From 8d3a4273784f383298d0f43d673eb8d97986379c Mon Sep 17 00:00:00 2001 From: pontscho Date: Sat, 1 Sep 2001 17:53:07 +0000 Subject: [PATCH] fix some bug. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1824 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/app.c | 30 +++++++++--------------------- Gui/events.c | 3 ++- Gui/events.h | 2 ++ Gui/mplayer/gtk/fs.h | 1 + Gui/mplayer/menu.h | 8 ++++++-- Gui/mplayer/mixer.c | 6 +++--- Gui/mplayer/mplayer.c | 2 -- Gui/mplayer/mw.h | 1 + Gui/mplayer/play.h | 1 + Gui/mplayer/sw.h | 20 ++++++++++++++++---- Gui/wm/ws.c | 12 ++++++++++-- Gui/wm/ws.h | 2 ++ 12 files changed, 53 insertions(+), 35 deletions(-) diff --git a/Gui/app.c b/Gui/app.c index 4c7ace937d..771e861e29 100644 --- a/Gui/app.c +++ b/Gui/app.c @@ -72,8 +72,9 @@ void appInitStruct( listItems * item ) appClearItem( &item->main ); appClearItem( &item->sub ); - item->sub.Bitmap.Width=256; item->sub.Bitmap.Height=256; - item->sub.width=256; item->sub.height=256; + item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384; + item->sub.width=384; item->sub.height=384; + item->sub.x=-1; item->sub.y=-1; appClearItem( &item->menuBase ); appClearItem( &item->menuSelected ); item->subR=0; @@ -104,27 +105,14 @@ void appInit( int argc,char* argv[], char *envp[], void* disp ) printf("SKIN dir 1: '%s'\n",skinDirInHome); printf("SKIN dir 2: '%s'\n",skinMPlayerDir); -// if ( ( appMPlayerDirInHome=(char *)calloc( 1,strlen( getenv( "HOME" ) ) + 9 ) ) != NULL ) -// { strcpy( appMPlayerDirInHome,getenv( "HOME" ) ); strcat( appMPlayerDirInHome,"/.mplayer" ); } -// if ( ( skinDirInHome=(char *)calloc( 1,strlen( appMPlayerDirInHome ) + 5 ) ) != NULL ) -// { strcpy( skinDirInHome,appMPlayerDirInHome ); strcat( skinDirInHome,"/Skin" ); } -// if ( ( appMPlayerDir=(char *)calloc( 1,strlen( PREFIX ) + 14 ) ) != NULL ) -// { strcpy( appMPlayerDir,PREFIX ); strcat( appMPlayerDir,"/share/mplayer" ); } -// if ( ( skinMPlayerDir=(char *)calloc( 1,strlen( appMPlayerDir ) + 5 ) ) != NULL ) -// { strcpy( skinMPlayerDir,appMPlayerDir ); strcat( skinMPlayerDir,"/Skin" ); } - initDebug(NULL); // write messages to stderr cfgDefaults(); // set skin to "default" cfgRead(); // empty function - NOP -// if ( !strcmp( cfgAppName,"movieplayer" ) ) -// { - appMPlayer.sub.x=-1; appMPlayer.sub.y=-1; appMPlayer.sub.width=512; appMPlayer.sub.height=256; - switch ( skinRead( cfgSkin ) ) - { - case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); - case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); - } - mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows -// } + switch ( skinRead( cfgSkin ) ) + { + case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); + case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); + } + mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows } diff --git a/Gui/events.c b/Gui/events.c index b6d4330668..ca514d9fd2 100644 --- a/Gui/events.c +++ b/Gui/events.c @@ -40,7 +40,8 @@ evName evNames[] = { evDoubleSize, "evDoubleSize" }, // 38 { evSetMoviePosition, "evSetMoviePosition" }, // 39 { evSetVolume, "evSetVolume" }, // 40 - { evSetBalance, "evSetBalance" } // 41 + { evSetBalance, "evSetBalance" }, // 41 + { evHelp, "evHelp" } }; const int evBoxs = sizeof( evNames ) / sizeof( evName ); diff --git a/Gui/events.h b/Gui/events.h index 893cb4ee5f..94e148ad1a 100644 --- a/Gui/events.h +++ b/Gui/events.h @@ -41,6 +41,8 @@ #define evSetVolume 36 #define evSetBalance 37 +#define evHelp 38 + #define evExit 1000 // --- General events --- diff --git a/Gui/mplayer/gtk/fs.h b/Gui/mplayer/gtk/fs.h index 52bdd0beb5..b4998629bd 100644 --- a/Gui/mplayer/gtk/fs.h +++ b/Gui/mplayer/gtk/fs.h @@ -257,6 +257,7 @@ void fs_Ok_released( GtkButton * button,gpointer user_data ) break; } strcpy( gtkShMem->fs.dir,fsSelectedDirectory ); +printf( "----gtk---> filname: %s\n",fsSelectedFile ); strcpy( gtkShMem->fs.filename,fsSelectedFile ); item=fsTopList_items; while( item ) diff --git a/Gui/mplayer/menu.h b/Gui/mplayer/menu.h index 81d776db6b..78e21acddf 100644 --- a/Gui/mplayer/menu.h +++ b/Gui/mplayer/menu.h @@ -55,11 +55,11 @@ void mplMenuMouseHandle( int X,int Y,int RX,int RY ) return; } - for( i=0;i %d %d,%d\n",i,x,y ); + printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height ); if ( wgIsRect( x,y, appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, diff --git a/Gui/mplayer/mixer.c b/Gui/mplayer/mixer.c index 2ea816977d..e8ad4a5f22 100644 --- a/Gui/mplayer/mixer.c +++ b/Gui/mplayer/mixer.c @@ -10,7 +10,7 @@ float mixerGetVolume( void ) { - mplShMem->Volume=mixer_getbothvolume(); +// mplShMem->Volume=(float)mixer_getbothvolume(); return mplShMem->Volume; } @@ -22,13 +22,13 @@ void mixerSetVolume( float v ) void mixerIncVolume( void ) { - mixer_incvolume(); +// mixer_incvolume(); mixerGetVolume(); } void mixerDecVolume( void ) { - mixer_decvolume(); +// mixer_decvolume(); mixerGetVolume(); } diff --git a/Gui/mplayer/mplayer.c b/Gui/mplayer/mplayer.c index 147e0e9cc2..31008e3650 100644 --- a/Gui/mplayer/mplayer.c +++ b/Gui/mplayer/mplayer.c @@ -52,8 +52,6 @@ void mplTimerHandler( int signum ) void mplInit( int argc,char* argv[], char *envp[], void* disp ) { -// parse_cfgfiles( argc,argv,envp ); - // allocates shmem to gtkShMem // fork() a process which runs gtkThreadProc() [gtkPID] gtkInit( argc,argv,envp ); diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 015f286f9c..04a5d3bfbc 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -91,6 +91,7 @@ calclengthmmmmss: case 'V': sprintf( tmp,"%3.1f",mplShMem->Volume ); strcat( trbuf,tmp ); break; case 'b': sprintf( tmp,"%3.2f%%",mplShMem->Balance ); strcat( trbuf,tmp ); break; case 'B': sprintf( tmp,"%3.1f",mplShMem->Balance ); strcat( trbuf,tmp ); break; + case 'd': sprintf( tmp,"%d",mplShMem->FrameDrop ); strcat( trbuf,tmp ); break; case 's': if ( mplShMem->Playing == 0 ) strcat( trbuf,"s" ); break; case 'l': if ( mplShMem->Playing == 1 ) strcat( trbuf,"p" ); break; case 'e': if ( mplShMem->Playing == 2 ) strcat( trbuf,"e" ); break; diff --git a/Gui/mplayer/play.h b/Gui/mplayer/play.h index 49cd966782..26477c9610 100644 --- a/Gui/mplayer/play.h +++ b/Gui/mplayer/play.h @@ -46,6 +46,7 @@ typedef struct int StreamType; int TimeSec; int LengthInSec; + int FrameDrop; char Filename[4096]; int FilenameChanged; diff --git a/Gui/mplayer/sw.h b/Gui/mplayer/sw.h index bd8f9e9caa..517dedf629 100644 --- a/Gui/mplayer/sw.h +++ b/Gui/mplayer/sw.h @@ -35,7 +35,6 @@ int VisibleMainWindow( void ) for (i=0; i < nchilds; i++) if ( childs[i]==me ) break; for ( ;i visible main vindov: %d ---\n",visible ); return visible; } @@ -45,6 +44,10 @@ int count = 0; void mplSubDraw( wsParamDisplay ) { +// mainisvisible1=VisibleMainWindow(); +// printf( "--------> main: %d ---\n",mainisvisible1 ); + + // if ( ( appMPlayer.subWindow.Visible == wsWindowNotVisible )|| // ( appMPlayer.subWindow.State != wsWindowExpose ) ) return; @@ -67,6 +70,7 @@ void mplSubDraw( wsParamDisplay ) XFlush( wsDisplay ); } appMPlayer.subWindow.State=0; +// mainis=0; } void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) @@ -89,9 +93,7 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) break; // --- case wsPLMouseButton: - oldmainisvisible=VisibleMainWindow(); - printf( "----> %d %d\n",mainisvisible1,mainisvisible2 ); - //=mainisvisible; +//mainis=0; sx=X; sy=Y; msButton=wsPLMouseButton; mplSubMoved=0; @@ -110,6 +112,15 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) } break; case wsRLMouseButton: +// if ( ( appMPlayer.subWindow.Focused == 0 && appMPlayer.subWindow.OFocused == 2 ) ) +// ( appMPlayer.mainWindow.Focused == 0 && appMPlayer.mainWindow.OFocused == 2 ) ) +// if ( ( !mplSubMoved )&&( !appMPlayer.mainWindow.Focused ) ) +printf( "-----> mainis: %d ---- \n",mainis ); +if ( !mainis ) +{ +wsMoveTopWindow( &appMPlayer.mainWindow ); +} +/* if ( ( !mplSubMoved )&& ( appMPlayer.subWindow.isFullScreen )&& ( !VisibleMainWindow() ) ) @@ -117,6 +128,7 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) wsMoveTopWindow( &appMPlayer.mainWindow ); // else wsMoveTopWindow( &appMPlayer.mainWindow ); } +*/ msButton=0; mplSubMoved=0; break; diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index bb5a73cfee..46ed229f20 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -439,6 +439,7 @@ void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,uns win->Visible=0; win->Focused=0; + win->OFocused=0; win->Mapped=0; win->Rolled=0; if ( D & wsShowWindow ) XMapWindow( wsDisplay,win->WindowID ); @@ -481,6 +482,7 @@ void wsDestroyWindow( wsTWindow * win ) win->KeyHandler=NULL; win->Visible=0; win->Focused=0; + win->OFocused=0; win->Mapped=0; win->Rolled=0; } @@ -528,10 +530,16 @@ Bool wsEvents( Display * display,XEvent * Event,XPointer arg ) case UnmapNotify: i=wsWindowUnmapped; wsWindowList[l]->Mapped=wsNone; goto expose; case FocusIn: if ( wsWindowList[l]->Focused == wsFocused ) break; - i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; + i=wsWindowFocusIn; + wsWindowList[l]->OFocused=wsWindowList[l]->Focused; + wsWindowList[l]->Focused=wsFocused; + goto expose; case FocusOut: if ( wsWindowList[l]->Focused == wsNone ) break; - i=wsWindowFocusOut; wsWindowList[l]->Focused=wsNone; goto expose; + i=wsWindowFocusOut; + wsWindowList[l]->OFocused=wsWindowList[l]->Focused; + wsWindowList[l]->Focused=wsNone; + goto expose; case VisibilityNotify: switch( Event->xvisibility.state ) { diff --git a/Gui/wm/ws.h b/Gui/wm/ws.h index f1d6fddc62..21bda65004 100644 --- a/Gui/wm/ws.h +++ b/Gui/wm/ws.h @@ -124,6 +124,8 @@ typedef struct int CapsLock; // --- Misc ------------------------------------------------------------------------------------- + int OFocused; + Atom AtomDeleteWindow; Atom AtomTakeFocus; Atom AtomRolle;