[Mplayer-cvslog] CVS: main/Gui/mplayer menu.h,1.8,1.9 mplayer.c,1.20,1.21 mplayer.h,1.4,1.5 mw.h,1.42,1.43 play.c,1.46,1.47 play.h,1.19,1.20 sw.h,1.26,1.27 widgets.c,1.16,1.17 widgets.h,1.11,1.12 psignal.c,1.24,NONE psignal.h,1.7,NONE

Zoltan Ponekker pontscho at mplayer.dev.hu
Sat Feb 23 16:12:56 CET 2002


Update of /cvsroot/mplayer/main/Gui/mplayer
In directory mplayer:/var/tmp.root/cvs-serv25081/Gui/mplayer

Modified Files:
	menu.h mplayer.c mplayer.h mw.h play.c play.h sw.h widgets.c 
	widgets.h 
Removed Files:
	psignal.c psignal.h 
Log Message:
new gui interface, and gtk moved into mplayer process. fork ... bleh :)

Index: menu.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/menu.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- menu.h	1 Feb 2002 16:34:15 -0000	1.8
+++ menu.h	23 Feb 2002 15:12:53 -0000	1.9
@@ -100,14 +100,14 @@
 
  if ( ( x < 0 ) || ( y < 0 ) ) return;
 
-// printf( "---------> %d %d,%d\n",i,x,y ); 
+// printf( "---------> %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,
         appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) )
    {
-    mplMsgHandle( appMPlayer.MenuItems[i].msg,0 );
+    mplEventHandling( appMPlayer.MenuItems[i].msg,0 );
    }
 }
 
@@ -122,7 +122,7 @@
  if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
   {
    #ifdef DEBUG
-    dbprintf( 1,MSGTR_NEMFMR );
+    mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] %s",MSGTR_NEMFMR );
    #endif
    gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR );
    return;
@@ -133,7 +133,7 @@
  wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" );
 
  #ifdef DEBUG
-  dbprintf( 1,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
+  mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
  #endif
 
  appMPlayer.menuWindow.ReDraw=mplMenuDraw;

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mplayer.c	21 Feb 2002 21:20:52 -0000	1.20
+++ mplayer.c	23 Feb 2002 15:12:53 -0000	1.21
@@ -7,29 +7,28 @@
 #include "./mplayer.h"
 #include "../events.h"
 #include "../app.h"
+#include "../interface.h"
 #include "../skin/skin.h"
 #include "../skin/font.h"
 #include "../wm/ws.h"
 #include "../wm/wskeys.h"
 #include "../wm/widget.h"
 #include "../bitmap/bitmap.h"
-#include "../timer.h"
-#include "../error.h"
 
 #include "../../config.h"
 #include "../../help_mp.h"
 #include "../../libvo/x11_common.h"
 #include "../../libmpdemux/stream.h"
+#include "../../mp_msg.h"
 
 #define mplMouseTimerConst  10
 #define mplRedrawTimerConst 5
 
 int mplMouseTimer  = mplMouseTimerConst;
 int mplRedrawTimer = mplRedrawTimerConst;
-int mplGeneralTimer = -1;
 int mplTimer = 0;
 
-void mplMsgHandle( int msg,float param );
+void mplEventHandling( int msg,float param );
 
 #include "widgets.h"
 #include "play.h"
@@ -38,31 +37,24 @@
 #include "sw.h"
 #include "widgets.h"
 
-void mplTimerHandler( int signum )
+void mplTimerHandler( void )
 {
  mplTimer++;
  mplMouseTimer--;
  mplRedrawTimer--;
- mplGeneralTimer--;
- if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 );
- if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 );
- if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 );
+ if ( mplMouseTimer == 0 ) mplEventHandling( evHideMouseCursor,0 );
+ if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 );
 }
 
 void mplInit( int argc,char* argv[], char *envp[], void* disp )
 {
  int i;
 
- // allocates shmem to mplShMem
  // init fields of this struct to default values
  mplMPlayerInit( argc,argv,envp );
 
- // allocates shmem to gtkShMem
  // fork() a process which runs gtkThreadProc()  [gtkPID]
  gtkInit( argc,argv,envp );
- strcpy( gtkShMem->sb.name,skinName ); 
-
- message=mplErrorHandler;  // error messagebox drawing function
 
  // opens X display, checks for extensions (XShape, DGA etc)
  wsXInit(disp);
@@ -81,7 +73,7 @@
  wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
 
  vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
- 
+
  i=wsHideFrame|wsMaxSize|wsHideWindow;
  if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
  wsCreateWindow( &appMPlayer.mainWindow,
@@ -89,13 +81,13 @@
   wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
 
  wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
- 
+
  mplMenuInit();
 
  #ifdef DEBUG
-  dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen );
-  dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
-  dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
+  mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen );
+  mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
+  mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
  #endif
 
  appMPlayer.mainWindow.ReDraw=mplMainDraw;
@@ -114,24 +106,13 @@
  wsPostRedisplay( &appMPlayer.mainWindow );
  wsPostRedisplay( &appMPlayer.subWindow );
 
- btnModify( evSetVolume,mplShMem->Volume );
- btnModify( evSetBalance,mplShMem->Balance );
- btnModify( evSetMoviePosition,mplShMem->Position );
+ btnModify( evSetVolume,guiIntfStruct.Volume );
+ btnModify( evSetBalance,guiIntfStruct.Balance );
+ btnModify( evSetMoviePosition,guiIntfStruct.Position );
 
- mplShMem->Playing=0;
+ guiIntfStruct.Playing=0;
 
  wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
  wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
-}
-
-void mplDone(){
-
- dbprintf( 1,"[mplayer] exit.\n" );
-
- mplStop();
-// timerDone();
- gtkDone();  // kills the gtkThreadProc() process
- wsXDone();
-
 }
 

Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mplayer.h	16 Nov 2001 23:17:52 -0000	1.4
+++ mplayer.h	23 Feb 2002 15:12:53 -0000	1.5
@@ -4,16 +4,16 @@
 
 extern int             mplSubRender;
 extern int             mplMainRender;
-extern int             mplGeneralTimer;
 
 extern unsigned char * mplDrawBuffer;
 extern unsigned char * mplMenuDrawBuffer;
 extern int             mainVisible;
 
 extern int             mplMainAutoPlay;
-extern int	       mplMiddleMenu;
+extern int             mplMiddleMenu;
 
 extern void mplInit( int argc,char* argv[], char *envp[], void* disp );
-extern void mplMsgHandle( int msg,float param );
+extern void mplEventHandling( int msg,float param );
+extern void mplTimerHandler( void );
 
 #endif

Index: mw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mw.h	1 Feb 2002 16:34:15 -0000	1.42
+++ mw.h	23 Feb 2002 15:12:53 -0000	1.43
@@ -7,7 +7,7 @@
 int             mplMainRender = 1;
 
 int             mplMainAutoPlay = 0;
-int		mplMiddleMenu = 0;
+int             mplMiddleMenu = 0;
 
 int             mainVisible = 1;
 
@@ -18,19 +18,19 @@
 inline void TranslateFilename( int c,char * tmp )
 {
  int i;
- switch ( mplShMem->StreamType )
+ switch ( guiIntfStruct.StreamType )
   {
    case STREAMTYPE_FILE:
-          if ( gtkShMem->fs.filename[0] )
+          if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
            {
-            strcpy( tmp,gtkShMem->fs.filename );
+            strcpy( tmp,guiIntfStruct.Filename );
             if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
             if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
            } else strcpy( tmp,"no file loaded" );
           break;
-#ifdef USE_DVDREAD		     
+#ifdef USE_DVDREAD
    case STREAMTYPE_DVD:
-          if ( mplShMem->DVD.current_chapter ) sprintf( tmp,"chapter %d",mplShMem->DVD.current_chapter );
+          if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,"chapter %d",guiIntfStruct.DVD.current_chapter );
             else strcat( tmp,"no chapter" );
           break;
 #endif
@@ -38,7 +38,7 @@
   }
  if ( c )
   {
-   for ( i=0;i < strlen( tmp );i++ )
+   for ( i=0;i < (int)strlen( tmp );i++ )
     {
      int t=0;
      if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
@@ -51,46 +51,46 @@
 char * Translate( char * str )
 {
  static char   trbuf[512];
-        char   tmp[128];
+        char   tmp[512];
         int    i,c;
         int    t;
  memset( trbuf,0,512 );
  memset( tmp,0,128 );
- for ( c=0,i=0;i < strlen( str );i++ )
+ for ( c=0,i=0;i < (int)strlen( str );i++ )
   {
    if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
     else
     {
      switch ( str[++i] )
       {
-       case 't': sprintf( tmp,"%02d",mplShMem->Track ); strcat( trbuf,tmp ); break;
+       case 't': sprintf( tmp,"%02d",guiIntfStruct.Track ); strcat( trbuf,tmp ); break;
        case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break;
        case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break;
        case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break;
-       case '6': t=mplShMem->LengthInSec; goto calclengthhhmmss;
-       case '1': t=mplShMem->TimeSec;
+       case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
+       case '1': t=guiIntfStruct.TimeSec;
 calclengthhhmmss:
             sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp );
             break;
-       case '7': t=mplShMem->LengthInSec; goto calclengthmmmmss;
-       case '2': t=mplShMem->TimeSec;
+       case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
+       case '2': t=guiIntfStruct.TimeSec;
 calclengthmmmmss:
             sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp );
             break;
-       case '3': sprintf( tmp,"%02d",mplShMem->TimeSec / 3600 ); strcat( trbuf,tmp ); break;
-       case '4': sprintf( tmp,"%02d",( ( mplShMem->TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break;
-       case '5': sprintf( tmp,"%02d",mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break;
-       case '8': sprintf( tmp,"%01d:%02d:%02d",mplShMem->TimeSec / 3600,( mplShMem->TimeSec / 60 ) % 60,mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break;
-       case 'v': sprintf( tmp,"%3.2f%%",mplShMem->Volume ); strcat( trbuf,tmp ); break;
-       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;
+       case '3': sprintf( tmp,"%02d",guiIntfStruct.TimeSec / 3600 ); strcat( trbuf,tmp ); break;
+       case '4': sprintf( tmp,"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break;
+       case '5': sprintf( tmp,"%02d",guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
+       case '8': sprintf( tmp,"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
+       case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
+       case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
+       case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
+       case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
+       case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break;
+       case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break;
+       case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
+       case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break;
        case 'a':
-            switch ( mplShMem->AudioType )
+            switch ( guiIntfStruct.AudioType )
              {
               case 0: strcat( trbuf,"n" ); break;
               case 1: strcat( trbuf,"m" ); break;
@@ -98,12 +98,12 @@
              }
             break;
        case 'T':
-           switch ( mplShMem->StreamType )
+           switch ( guiIntfStruct.StreamType )
             {
              case STREAMTYPE_FILE:   strcat( trbuf,"f" ); break;
              case STREAMTYPE_VCD:    strcat( trbuf,"v" ); break;
              case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break;
-#ifdef USE_DVDREAD		     
+#ifdef USE_DVDREAD
              case STREAMTYPE_DVD:    strcat( trbuf,"d" ); break;
 #endif
              default:                strcat( trbuf," " ); break;
@@ -131,8 +131,8 @@
  buf=(unsigned long *)mplDrawBuffer;
  drw=(unsigned long *)bf->Image;
 
- for ( iy=y;iy < y+bf->Height / max;iy++ )
-  for ( ix=x;ix < x+bf->Width;ix++ )
+ for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
+  for ( ix=x;ix < (int)(x+bf->Width);ix++ )
    {
     tmp=drw[i++];
     if ( tmp != 0x00ff00ff )
@@ -150,8 +150,8 @@
       !mainVisible ) return;
 //      !appMPlayer.mainWindow.Mapped ) return;
 
- btnModify( evSetMoviePosition,mplShMem->Position );
- btnModify( evSetVolume,mplShMem->Volume );
+ btnModify( evSetMoviePosition,guiIntfStruct.Position );
+ btnModify( evSetVolume,guiIntfStruct.Volume );
 
  if ( mplMainRender )
   {
@@ -176,7 +176,7 @@
             goto drawrenderedtext;
        case itDLabel:
             image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) );
-//            image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) );
+////            image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) );
 drawrenderedtext:
             PutImage( image,item->x,item->y,1,0 );
             if ( image )
@@ -200,7 +200,7 @@
 extern int audio_id;
 extern int dvdsub_id;
 
-void mplMsgHandle( int msg,float param )
+void mplEventHandling( int msg,float param )
 {
  int j;
 
@@ -218,69 +218,64 @@
         dvd_chapter=1;
         dvd_angle=1;
 play_dvd_2:
-        mplShMem->StreamType=STREAMTYPE_DVD;
+        guiIntfStruct.StreamType=STREAMTYPE_DVD;
 #endif
    case evPlay:
    case evPlaySwitchToPause:
 //        btnModify( evPlaySwitchToPause,btnDisabled );
 //        btnModify( evPauseSwitchToPlay,btnReleased );
-        if ( ( msg == evPlaySwitchToPause )&( mplShMem->Playing == 1 ) ) goto NoPause;
+        mplMainAutoPlay=0;
+        if ( ( msg == evPlaySwitchToPause )&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
         mplMainRender=1;
 
-        switch ( mplShMem->StreamType )
+        switch ( guiIntfStruct.StreamType )
          {
-          case STREAMTYPE_STREAM: 
+          case STREAMTYPE_STREAM:
           case STREAMTYPE_VCD:
-          case STREAMTYPE_FILE:   
-	       dvd_title=0;
-	       break;
+          case STREAMTYPE_FILE:
+               dvd_title=0;
+               break;
 #ifdef USE_DVDREAD
-          case STREAMTYPE_DVD:    
-	       strcpy( mplShMem->Filename,"/dev/dvd" );
-	       break;
+          case STREAMTYPE_DVD:
+               guiSetFilename( guiIntfStruct.Filename,"/dev/dvd" );
+               break;
 #endif
          }
         mplPlay();
-	mplState();
+        mplState();
         break;
-   case evSetDVDSubtitle:
 #ifdef USE_DVDREAD
+   case evSetDVDSubtitle:
         dvdsub_id=(int)param;
-	dvd_title=mplShMem->DVD.current_title;
-	dvd_angle=mplShMem->DVD.current_angle;
-        dvd_chapter=mplShMem->DVD.current_chapter;
-        mplShMem->DVDChanged=1;
-	goto play_dvd_2;
-#endif
+        dvd_title=guiIntfStruct.DVD.current_title;
+        dvd_angle=guiIntfStruct.DVD.current_angle;
+        dvd_chapter=guiIntfStruct.DVD.current_chapter;
+        guiIntfStruct.DVDChanged=1;
+        goto play_dvd_2;
         break;
    case evSetDVDAudio:
-#ifdef USE_DVDREAD
         audio_id=(int)param;
-	dvd_title=mplShMem->DVD.current_title;
-	dvd_angle=mplShMem->DVD.current_angle;
-        dvd_chapter=mplShMem->DVD.current_chapter;
-        mplShMem->DVDChanged=1;
-	goto play_dvd_2;
-#endif
+        dvd_title=guiIntfStruct.DVD.current_title;
+        dvd_angle=guiIntfStruct.DVD.current_angle;
+        dvd_chapter=guiIntfStruct.DVD.current_chapter;
+        guiIntfStruct.DVDChanged=1;
+        goto play_dvd_2;
         break;
    case evSetDVDChapter:
-#ifdef USE_DVDREAD
-	dvd_title=mplShMem->DVD.current_title;
-	dvd_angle=mplShMem->DVD.current_angle;
+        dvd_title=guiIntfStruct.DVD.current_title;
+        dvd_angle=guiIntfStruct.DVD.current_angle;
         dvd_chapter=(int)param;
-        mplShMem->DVDChanged=1;
-	goto play_dvd_2;
-#endif
+        guiIntfStruct.DVDChanged=1;
+        goto play_dvd_2;
         break;
    case evSetDVDTitle:
-#ifdef USE_DVDREAD
         dvd_title=(int)param;
-	dvd_chapter=1;
-	dvd_angle=1;
-        mplShMem->DVDChanged=1;
-	goto play_dvd_2;
-#endif
+        dvd_chapter=1;
+        dvd_angle=1;
+        guiIntfStruct.DVDChanged=1;
+        goto play_dvd_2;
         break;
+#endif
 
    case evPause:
    case evPauseSwitchToPlay:
@@ -292,42 +287,38 @@
         break;
 
    case evStop:
-        IZE("evStop");
 //        btnModify( evPlaySwitchToPause,btnReleased );
 //        btnModify( evPauseSwitchToPlay,btnDisabled );
         mplMainRender=1;
         mplStop();
-	mplState();
+        mplState();
         break;
 
    case evLoadPlay:
         mplMainAutoPlay=1;
    case evLoad:
         mplMainRender=1;
-        gtkSendMessage( evLoad );
+        gtkShow( evLoad,NULL );
         break;
    case evLoadSubtitle:
         mplMainRender=1;
-        gtkSendMessage( evLoadSubtitle );
+        gtkShow( evLoadSubtitle,NULL );
         break;
    case evPrev:
-        IZE("evPrev");
         mplMainRender=1;
-        #ifdef DEBUG
-         dbprintf( 1,"[mw.h] previous stream ...\n" );
-        #endif
+        mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[mw.h] previous stream ...\n" );
         break;
    case evNext:
-        IZE("evNext");
         mplMainRender=1;
-        #ifdef DEBUG
-         dbprintf( 1,"[mw.h] next stream ...\n" );
-        #endif
+        mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[mw.h] next stream ...\n" );
         break;
 
    case evPlayList:
         IZE("evPlayList");
         mplMainRender=1;
+        gtkShow( evPlayList,NULL );
+#warning disabled old gtk code
+#if 0
         if ( gtkVisiblePlayList )
          {
           btnModify( evPlayList,btnReleased );
@@ -341,11 +332,12 @@
            btnModify( evPlayList,btnPressed );
            gtkVisiblePlayList=1;
           }
+#endif
         break;
 
-   case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break;
-   case evAbout:       gtkSendMessage( evAbout ); break;
-   case evPreferences: gtkSendMessage( evPreferences ); break;
+   case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
+   case evAbout:       gtkShow( evAbout,NULL ); break;
+   case evPreferences: gtkShow( evPreferences,NULL ); break;
 
    case evForward1min:      mplRelSeek( 60 );  break;
    case evBackward1min:     mplRelSeek( -60 ); break;
@@ -355,9 +347,9 @@
 
    case evIncVolume:  vo_x11_putkey( wsGrayMul ); break;
    case evDecVolume:  vo_x11_putkey( wsGrayDiv ); break;
-   case evMute:       mplShMem->Mute=1; break;
+   case evMute:       guiIntfStruct.Mute=1; break;
    case evSetVolume:
-   case evSetBalance: mplShMem->VolumeChanged=1; break;
+   case evSetBalance: guiIntfStruct.VolumeChanged=1; break;
 
 
    case evIconify:
@@ -368,25 +360,25 @@
          }
         break;
    case evNormalSize:
-        if ( mplShMem->Playing )
+        if ( guiIntfStruct.Playing )
          {
           appMPlayer.subWindow.isFullScreen=True;
-          appMPlayer.subWindow.OldX=( wsMaxX - moviewidth ) / 2;
-          appMPlayer.subWindow.OldY=( wsMaxY - movieheight ) / 2;
-          appMPlayer.subWindow.OldWidth=moviewidth; appMPlayer.subWindow.OldHeight=movieheight;
+          appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth ) / 2;
+          appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight ) / 2;
+          appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
           wsFullScreen( &appMPlayer.subWindow );
-          mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight );
+          mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,guiIntfStruct.MovieWidth,guiIntfStruct.MovieHeight );
          }
         break;
    case evDoubleSize:
-        if ( mplShMem->Playing )
+        if ( guiIntfStruct.Playing )
          {
           appMPlayer.subWindow.isFullScreen=True;
-          appMPlayer.subWindow.OldX=( wsMaxX - moviewidth * 2 ) / 2;
-          appMPlayer.subWindow.OldY=( wsMaxY - movieheight * 2 ) / 2;
-          appMPlayer.subWindow.OldWidth=moviewidth * 2; appMPlayer.subWindow.OldHeight=movieheight * 2;
+          appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth * 2 ) / 2;
+          appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight * 2 ) / 2;
+          appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth * 2; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight * 2;
           wsFullScreen( &appMPlayer.subWindow );
-          mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight );
+          mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,guiIntfStruct.MovieWidth,guiIntfStruct.MovieHeight );
          }
         break;
    case evFullScreen:
@@ -410,30 +402,15 @@
    case evRedraw:
         mplMainRender=1;
         wsPostRedisplay( &appMPlayer.mainWindow );
-//        if ( !mplShMem->Playing )
-//      wsPostRedisplay( &appMPlayer.subWindow );
         XFlush( wsDisplay );
         mplRedrawTimer=mplRedrawTimerConst;
         break;
-   case evGeneralTimer:
-        if ( mplMainAutoPlay )
-         {
-          mplMainRender=1;
-          mplMainAutoPlay=0;
-          mplPlay();
-         }
-	if ( mplMiddleMenu )
-	 {
-	  mplMiddleMenu=0;
-	  mplMsgHandle( gtkShMem->popupmenu,gtkShMem->popupmenuparam );
-	 }
-        break;
 // --- system events
    case evNone:
-        dbprintf( 1,"[mw] event none received.\n" );
+        mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" );
         break;
    default:
-        dbprintf( 1,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
+        mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
         break;
   }
 }
@@ -503,24 +480,21 @@
                  switch ( item->msg )
                   {
                    case evSetVolume:
-                        mplShMem->VolumeChanged=1;
-                        mplShMem->Volume=item->value;
+                        guiIntfStruct.VolumeChanged=1;
+                        guiIntfStruct.Volume=item->value;
                         break;
                   }
                  value=item->value;
                  break;
            }
-          mplMsgHandle( item->msg,value );
+          mplEventHandling( item->msg,value );
           mplMainRender=1;
           itemtype=0;
           break;
-	  
+
    case wsPMMouseButton:
-#ifdef USE_DVDREAD
-	memcpy( &gtkShMem->DVD,&mplShMem->DVD,sizeof( mplDVDStruct ) );
-#endif
-        gtkSendMessage( evShowPopUpMenu );
-	break;	  
+        gtkShow( evShowPopUpMenu,NULL );
+        break;
 
 // --- rolled mouse ... de szar :)))
    case wsP5MouseButton: value=-2.5f; goto rollerhandled;
@@ -535,11 +509,11 @@
             switch ( item->msg )
              {
               case evSetVolume:
-                   mplShMem->VolumeChanged=1;
-                   mplShMem->Volume=item->value;
+                   guiIntfStruct.VolumeChanged=1;
+                   guiIntfStruct.Volume=item->value;
                    break;
              }
-            mplMsgHandle( item->msg,item->value );
+            mplEventHandling( item->msg,item->value );
             mplMainRender=1;
            }
           break;
@@ -567,11 +541,11 @@
                  switch ( item->msg )
                   {
                    case evSetVolume:
-                        mplShMem->VolumeChanged=1;
-                        mplShMem->Volume=item->value;
+                        guiIntfStruct.VolumeChanged=1;
+                        guiIntfStruct.Volume=item->value;
                         break;
                   }
-                 mplMsgHandle( item->msg,item->value );
+                 mplEventHandling( item->msg,item->value );
                  mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
                  break;
            }
@@ -615,7 +589,7 @@
    case wsS:         msg=evStop; break;
    case wsp:
    case wsP:         msg=evPlayList; break;
-   
+
    case wsXF86LowerVolume:  msg=evDecVolume; break;
    case wsXF86RaiseVolume:  msg=evIncVolume; break;
    case wsXF86Mute:         msg=evMute; break;
@@ -629,7 +603,7 @@
   }
  if ( msg != evNone )
   {
-   mplMsgHandle( msg,0 );
+   mplEventHandling( msg,0 );
 //   mplMainRender=1;
 //   wsPostRedisplay( &appMPlayer.mainWindow );
   }

Index: play.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- play.c	21 Feb 2002 22:48:47 -0000	1.46
+++ play.c	23 Feb 2002 15:12:53 -0000	1.47
@@ -5,30 +5,23 @@
 #include <unistd.h>
 #include <signal.h>
 
-int    mplParent = 1;
-
-int    moviex,moviey,moviewidth,movieheight;
+#include "../wm/ws.h"
+#include "../../config.h"
+#include "../../help_mp.h"
+#include "../../libvo/x11_common.h"
 
 #include "../app.h"
 
-#include "../wm/ws.h"
 #include "../wm/wskeys.h"
 #include "../wm/widget.h"
-
-#include "../../config.h"
-#include "../../help_mp.h"
-#include "../../libvo/x11_common.h"
+#include "../interface.h"
 
 #include "widgets.h"
 #include "./mplayer.h"
-#include "psignal.h"
 #include "play.h"
 
 #include "../skin/skin.h"
-#include "../error.h"
-
-mplCommStruct * mplShMem;
-char          * Filename = NULL;
+#include "../skin/font.h"
 
 extern float rel_seek_secs;
 extern int abs_seek_pos;
@@ -53,7 +46,7 @@
     wsWindowDecoration( &appMPlayer.subWindow,0 );
     appMPlayer.subWindow.isFullScreen=1;
    }
- if ( mplShMem->Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
+ if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
   else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
  wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
  mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height );
@@ -63,11 +56,11 @@
 
 void mplStop()
 {
- mplShMem->Playing=0;
- mplShMem->TimeSec=0;
- mplShMem->Position=0;
- mplShMem->AudioType=0;
-// if ( !mplShMem->Playing ) return;
+ guiIntfStruct.Playing=0;
+ guiIntfStruct.TimeSec=0;
+ guiIntfStruct.Position=0;
+ guiIntfStruct.AudioType=0;
+// if ( !guiIntfStruct.Playing ) return;
  if ( !appMPlayer.subWindow.isFullScreen )
   {
    wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
@@ -81,30 +74,31 @@
 
 void mplPlay( void )
 {
- if ( ( mplShMem->Filename[0] == 0 )||
-      ( mplShMem->Playing == 1 ) ) return;
- if ( mplShMem->Playing == 2 ) { mplPause(); return; }
- mplShMem->Playing=1;
+ if ( ( !guiIntfStruct.Filename )||
+      ( guiIntfStruct.Filename[0] == 0 )||
+      ( guiIntfStruct.Playing == 1 ) ) return;
+ if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
+ guiIntfStruct.Playing=1;
  mplSubRender=0;
  wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
- wsClearWindow( appMPlayer.subWindow ); 
+ wsClearWindow( appMPlayer.subWindow );
  wsPostRedisplay( &appMPlayer.subWindow );
 }
 
 void mplPause( void )
 {
- switch( mplShMem->Playing )
+ switch( guiIntfStruct.Playing )
   {
    case 1: // playing
-        mplShMem->Playing=2;
-//	btnModify( evPlaySwitchToPause,btnReleased );
-//	btnModify( evPauseSwitchToPlay,btnDisabled );
-	break;
+        guiIntfStruct.Playing=2;
+//      btnModify( evPlaySwitchToPause,btnReleased );
+//      btnModify( evPauseSwitchToPlay,btnDisabled );
+        break;
    case 2: // paused
-	mplShMem->Playing=1;
-//	btnModify( evPlaySwitchToPause,btnDisabled );
-//	btnModify( evPauseSwitchToPlay,btnReleased );
-	break;
+        guiIntfStruct.Playing=1;
+//      btnModify( evPlaySwitchToPause,btnDisabled );
+//      btnModify( evPauseSwitchToPlay,btnReleased );
+        break;
   }
  mplState();
  mplSubRender=0;
@@ -112,12 +106,12 @@
 
 void mplState( void )
 {
- if ( ( mplShMem->Playing == 0 )||( mplShMem->Playing == 2 ) )
+ if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
   {
    btnModify( evPlaySwitchToPause,btnReleased );
    btnModify( evPauseSwitchToPlay,btnDisabled );
   }
-  else 
+  else
    {
     btnModify( evPlaySwitchToPause,btnDisabled );
     btnModify( evPauseSwitchToPlay,btnReleased );
@@ -130,19 +124,13 @@
 
 void mplMPlayerInit( int argc,char* argv[], char *envp[] )
 {
- struct sigaction sa;
-
- mplShMem=calloc( 1,sizeof( mplCommStruct ) );
- mplShMem->Balance=50.0f;
- mplShMem->StreamType=-1;
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = mplMainSigHandler;
- sigaction( SIGTYPE,&sa,NULL );
+ guiIntfStruct.Balance=50.0f;
+ guiIntfStruct.StreamType=-1;
 }
 
 float mplGetPosition( void )
 { // return 0.0 ... 100.0
- return mplShMem->Position;
+ return guiIntfStruct.Position;
 }
 
 void mplRelSeek( float s )
@@ -157,27 +145,22 @@
 
 listItems tmpList;
 
-void ChangeSkin( void )
+void ChangeSkin( char * name )
 {
  int ret;
- if ( !strcmp( skinName,gtkShMem->sb.name ) ) return;
-#ifdef DEBUG
- dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name );
-#endif
-
+// if ( !strcmp( skinName,name ) ) return;
  mainVisible=0;
 
  appInitStruct( &tmpList );
  skinAppMPlayer=&tmpList;
  fntFreeFont();
- ret=skinRead( gtkShMem->sb.name );
+ ret=skinRead( name );
 
  appInitStruct( &tmpList );
  skinAppMPlayer=&appMPlayer;
  appInitStruct( &appMPlayer );
- if ( !ret ) strcpy( skinName,gtkShMem->sb.name );
- skinRead( skinName );
- if ( ret )
+ if ( ret ) name=skinName;
+ if ( skinRead( name ) )
   {
    mainVisible=1;
    return;
@@ -187,21 +170,21 @@
   {
    if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
    if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
-    { message( False,MSGTR_NEMDB ); return; }
+    { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
    wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
    wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
   }
 
  if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
- if ( ( !appMPlayer.subWindow.isFullScreen )&&( !mplShMem->Playing ) )
+ if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
   {
    wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
    wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
-  } 
+  }
  if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
- if ( !mplShMem->Playing ) 
+ if ( !guiIntfStruct.Playing )
   {
-   mplSubRender=1; 
+   mplSubRender=1;
    wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
    wsClearWindow( appMPlayer.subWindow );
    wsPostRedisplay( &appMPlayer.subWindow );
@@ -209,7 +192,7 @@
 
  if ( mplDrawBuffer ) free( mplDrawBuffer );
  if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
-  { message( False,MSGTR_NEMDB ); return; }
+  { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
  wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
  wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
  wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y );
@@ -218,10 +201,10 @@
  wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
  mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
  wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
-   
- btnModify( evSetVolume,mplShMem->Volume );
- btnModify( evSetBalance,mplShMem->Balance );
- btnModify( evSetMoviePosition,mplShMem->Position );
+
+ btnModify( evSetVolume,guiIntfStruct.Volume );
+ btnModify( evSetBalance,guiIntfStruct.Balance );
+ btnModify( evSetMoviePosition,guiIntfStruct.Position );
  btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
 }
 
@@ -231,10 +214,12 @@
   {
    wsResizeWindow( &appMPlayer.subWindow,width,height );
    wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
-  } 
+  }
 }
 
 void mplSetFileName( char * fname )
 {
- if ( ( fname )&&( gtkShMem ) ) strcpy( gtkShMem->fs.filename,fname );
+ if ( !fname ) return;
+ if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename );
+ guiIntfStruct.Filename=strdup( fname );
 }

Index: play.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- play.h	1 Feb 2002 16:34:15 -0000	1.19
+++ play.h	23 Feb 2002 15:12:53 -0000	1.20
@@ -4,99 +4,8 @@
 
 #include "../../config.h"
 
-#include "./psignal.h"
 #include "./mplayer.h"
 
-#ifdef USE_DVDREAD
- #include "../../libmpdemux/stream.h"
-#endif
-
-typedef struct
-{
- int x;
- int y;
- int width;
- int height;
-} mplResizeStruct;
-
-typedef struct
-{
- int  signal;
- char module[512];
-} mplUnknowErrorStruct;
-
-typedef struct
-{
- int  seek;
- int  format;
- int  width;
- int  height;
- char codecdll[128];
-} mplVideoStruct;
-
-#ifdef USE_DVDREAD
-typedef struct
-{
- int titles;
- int chapters;
- int angles;
- int current_chapter;
- int current_title;
- int current_angle;
- int nr_of_audio_channels;
- stream_language_t audio_streams[32];
- int nr_of_subtitles;
- stream_language_t subtitles[32]; 
-} mplDVDStruct;
-#endif
-
-typedef struct
-{
- int message;
-   mplResizeStruct      resize;
-   mplVideoStruct       videodata;
-   mplUnknowErrorStruct error;
-#ifdef USE_DVDREAD
-   mplDVDStruct         DVD;
-   int                  DVDChanged;
-#endif
-
-   int    Playing;
-   float  Position;
-
-   float  Volume;
-   int    VolumeChanged;
-   float  Balance;
-   int    Mute;
-   
-   int    Track;
-   int    AudioType;
-   int    StreamType;
-   int    TimeSec;
-   int    LengthInSec;
-   int    FrameDrop;
-   
-   char   Filename[4096];
-   int    FilenameChanged;
-   
-   char   Subtitlename[4096];
-   int    SubtitleChanged;
-   
-   int    SkinChange;
-} mplCommStruct;
-
-extern mplCommStruct * mplShMem;
-extern char * Filename;
-
-extern int   mplParent;
-
-extern int   moviex;
-extern int   moviey;
-extern int   moviewidth;
-extern int   movieheight;
-
-extern mplCommStruct * mplShMem;
-
 extern void mplMPlayerInit( int argc,char* argv[], char *envp[] );
 
 extern void mplStop();
@@ -118,7 +27,7 @@
 extern void mplSigHandler( int s );
 extern void mplPlayerThread( void );
 
-extern void ChangeSkin( void );
+extern void ChangeSkin( char * name );
 extern void EventHandling( void );
 
 extern void mplSetFileName( char * fname );

Index: sw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/sw.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- sw.h	21 Feb 2002 21:20:52 -0000	1.26
+++ sw.h	23 Feb 2002 15:12:53 -0000	1.27
@@ -11,7 +11,7 @@
  if ( !appMPlayer.subWindow.Mapped ||
       appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
 
- if ( mplShMem->Playing ) mplSubRender=0;
+ if ( guiIntfStruct.Playing ) mplSubRender=0;
 
  if ( mplSubRender )
   {
@@ -28,18 +28,15 @@
 
  mplMouseTimer=mplMouseTimerConst;
  wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor );
- 
+
 
  switch( Button )
   {
    case wsPMMouseButton:
-#ifdef USE_DVDREAD
-	  memcpy( &gtkShMem->DVD,&mplShMem->DVD,sizeof( mplDVDStruct ) );
-#endif
-          gtkSendMessage( evShowPopUpMenu );
+          gtkShow( evShowPopUpMenu,NULL );
           break;
    case wsPRMouseButton:
-	  if ( gtkShMem->visiblepopupmenu ) gtkSendMessage( evHidePopUpMenu );
+          gtkShow( evHidePopUpMenu,NULL );
           mplShowMenu( RX,RY );
           msButton=wsPRMouseButton;
           break;
@@ -50,13 +47,13 @@
 // ---
    case wsPLMouseButton:
           if ( appMPlayer.subWindow.isFullScreen )
-	   {
+           {
             if( ++SubVisible%2 ) wsMoveTopWindow( &appMPlayer.mainWindow );
              else wsMoveTopWindow( &appMPlayer.subWindow );
             mplSubMoved=1;
-	    break;
-	   }
-	  if ( gtkShMem->visiblepopupmenu ) gtkSendMessage( evHidePopUpMenu );
+            break;
+           }
+          gtkShow( evHidePopUpMenu,NULL );
           sx=X; sy=Y;
           msButton=wsPLMouseButton;
           mplSubMoved=0;

Index: widgets.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/widgets.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- widgets.c	15 Jan 2002 17:03:19 -0000	1.16
+++ widgets.c	23 Feb 2002 15:12:53 -0000	1.17
@@ -17,12 +17,14 @@
 #include "widgets.h"
 
 #include "./mplayer.h"
-#include "psignal.h"
 #include "../events.h"
 
+#include "gtk/menu.h"
+#include "play.h"
+#include "gtk/fs.h"
+
 #include "../../config.h"
 #include "../../help_mp.h"
-#include "../error.h"
 
 GtkWidget     * SkinBrowser;
 GtkWidget     * PlayList;
@@ -36,14 +38,8 @@
 GtkWidget     * WarningPixmap;
 GtkWidget     * ErrorPixmap;
 
-int             gtkVisibleSkinBrowser = 0;
-int             gtkVisiblePlayList = 0;
-int             gtkVisibleFileSelect = 0;
-int             gtkVisibleMessageBox = 0;
-int             gtkVisibleAboutBox = 0;
-int             gtkVisibleOptions = 0;
-
-gtkCommStruct * gtkShMem;
+int gtkPopupMenu = 0;
+int gtkPopupMenuParam = 0;
 
 #include "gtk/sb.h"
 #include "gtk/pl.h"
@@ -64,65 +60,18 @@
 // PopUpMenu=create_PopUpMenu();
 }
 
-// --- forked function
-
-extern char *mDisplayName;
+// --- init & close gtk
 
-static void gtkThreadProc( int argc,char * argv[] )
+void gtkInit( int argc,char* argv[], char *envp[] )
 {
- struct sigaction sa;
-
- #ifdef HAVE_RTC
-  setuid( getuid() ); // strongly test, please check this.
- #endif
-
  gtk_set_locale();
- {
-  char tmp[128];
-  sprintf( tmp,"--display=%s",mDisplayName );
-  argv[argc++]=strdup( tmp );
-  gtk_init( &argc,&argv );
- }
+ gtk_init( &argc,&argv );
  gdk_set_use_xshm( TRUE );
- printf( "[gtk] display: %s\n",gdk_get_display() );
-
  widgetsCreate();
-
- gtkPID=getppid();
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = gtkSigHandler;
- sigaction( SIGTYPE, &sa, NULL );
-
- gtkIsOk=True;
- gtkSendMessage( evGtkIsOk );
-
- gtk_main();
- printf( "[gtk] exit.\n" );
- exit( 0 );
 }
 
-// --- init & close gtk
-
-void gtkInit( int argc,char* argv[], char *envp[] )
+void gtkDone( void )
 {
- gtkShMem=shmem_alloc( sizeof( gtkCommStruct ) );
- if ( ( gtkPID = fork() ) == 0 ) gtkThreadProc( argc,argv );
-}
-
-void gtkDone( void ){
- gtkSendMessage(evExit);
- usleep(50000); // 50ms should be enough!
- printf("gtk killed...\n");
- kill( gtkPID,SIGKILL );
-}
-
-void gtkMessageBox( int type,gchar * str )
-{
- if ( !gtkIsOk ) return;
- gtkShMem->mb.type=type;
- strcpy( gtkShMem->mb.str,str );
- gtkSendMessage( evMessageBox );
 }
 
 void gtkClearList( GtkWidget * list )
@@ -146,3 +95,82 @@
  if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 );
 }
 
+void gtkEventHandling( void )
+{
+ int i;
+ for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 );
+}
+
+// --- funcs
+
+void gtkMessageBox( int type,gchar * str )
+{
+ gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str );
+ gtk_widget_hide( MessageBox );
+ switch( type)
+  {
+    case GTK_MB_FATAL:
+         gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError );
+         gtk_widget_hide( WarningPixmap );
+         gtk_widget_show( ErrorPixmap );
+         break;
+    case GTK_MB_ERROR:
+         gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error );
+         gtk_widget_hide( WarningPixmap );
+         gtk_widget_show( ErrorPixmap );
+         break;
+    case GTK_MB_WARNING:
+         gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning );
+         gtk_widget_show( WarningPixmap );
+         gtk_widget_hide( ErrorPixmap );
+         break;
+  }
+ gtk_widget_show( MessageBox );
+}
+
+void gtkShow( int type,char * param )
+{
+ switch( type )
+  {
+   case evSkinBrowser:
+        gtk_widget_hide( SkinBrowser );
+        gtkClearList( SkinList );
+        if ( gtkFillSkinList( sbMPlayerPrefixDir )&&gtkFillSkinList( sbMPlayerDirInHome ) )
+         {
+          gtkSetDefaultToCList( SkinList,param );
+          gtk_widget_show( SkinBrowser );
+         }
+        break;
+   case evPreferences:
+        gtk_widget_hide( Options );
+        gtk_widget_show( Options );
+        break;
+   case evPlayList:
+        gtk_widget_hide( PlayList );
+        gtk_widget_show( PlayList );
+        break;
+   case evLoad:
+        ShowFileSelect( fsVideoSelector );
+        break;
+   case evFirstLoad:
+        ShowFileSelect( fsVideoSelector );
+        break;
+   case evLoadSubtitle:
+        ShowFileSelect( fsSubtitleSelector );
+        break;
+   case evAbout:
+        gtk_widget_hide( AboutBox );
+        gtk_widget_show( AboutBox );
+        break;
+   case evShowPopUpMenu:
+        gtkPopupMenu=evNone;
+        gtkPopupMenuParam=0;
+        gtk_widget_hide_on_delete( PopUpMenu );
+        PopUpMenu=create_PopUpMenu();
+        gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
+        break;
+   case evHidePopUpMenu:
+        gtk_widget_hide_on_delete( PopUpMenu );
+        break;
+  }
+}

Index: widgets.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/widgets.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- widgets.h	15 Dec 2001 15:36:06 -0000	1.11
+++ widgets.h	23 Feb 2002 15:12:53 -0000	1.12
@@ -2,12 +2,16 @@
 #ifndef __MY_WIDGET
 #define __MY_WIDGET
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
 #include "../../config.h"
 #include "../../linux/shmem.h"
 #include "play.h"
+#include "mplayer.h"
+#include "../interface.h"
 
 #define GTK_MB_SIMPLE 0
 #define GTK_MB_MODAL 1
@@ -15,59 +19,6 @@
 #define GTK_MB_ERROR 4
 #define GTK_MB_WARNING 8
 
-typedef struct
-{
- char dir[ 2048 ];
- char filename[ 2048 ];
- char subtitlename[ 4096 ];
- char otherfilename[ 4096 ];
-} gtkFileSelectorStruct;
-
-typedef struct
-{
- int  sx;
- int  sy;
- int  tsx;
- int  tsy;
- int  type;
- char str[512];
-} gtkMessageBoxStruct;
-
-typedef struct
-{
- char name[128];
-} gtkSkinStruct;
-
-typedef struct
-{
- int window;
-} gtkVisibleStruct;
-
-typedef struct
-{
- int i;
-} gtkOptionsStruct;
-
-typedef struct
-{
- int                   message;
- gtkFileSelectorStruct fs;
- gtkMessageBoxStruct   mb;
- gtkSkinStruct         sb;
- gtkVisibleStruct      vs;
- gtkOptionsStruct      op;
-
-#ifdef USE_DVDREAD 
- mplDVDStruct          DVD;
-#endif
- 
- int		       popupmenu;
- int		       popupmenuparam;
- int		       visiblepopupmenu;
-} gtkCommStruct;
-
-extern gtkCommStruct * gtkShMem;
-
 extern GtkWidget     * SkinBrowser;
 extern GtkWidget     * PlayList;
 extern GtkWidget     * FileSelect;
@@ -83,12 +34,8 @@
 extern GtkWidget     * SkinList;
 extern GtkWidget     * gtkMessageBoxText;
 
-extern int             gtkVisibleSkinBrowser;
-extern int             gtkVisiblePlayList;
-extern int             gtkVisibleFileSelect;
-extern int             gtkVisibleMessageBox;
-extern int             gtkVisibleAboutBox;
-extern int             gtkVisibleOptions;
+extern int             gtkPopupMenu;
+extern int             gtkPopupMenuParam;
 
 extern char          * sbMPlayerDirInHome;
 extern char          * sbMPlayerPrefixDir;
@@ -97,10 +44,15 @@
 
 extern void gtkInit( int argc,char* argv[], char *envp[] );
 extern void gtkDone( void );
-extern void gtkMessageBox( int type,gchar * str );
+
 extern int  gtkFillSkinList( gchar * dir );
 extern void gtkClearList( GtkWidget * list );
 extern void gtkSetDefaultToCList( GtkWidget * list,char * item );
 extern int  gtkFindCList( GtkWidget * list,char * item );
+
+extern void gtkEventHandling( void );
+
+extern void gtkShow( int type,char * param );
+extern void gtkMessageBox( int type,gchar * str );
 
 #endif

--- psignal.c DELETED ---

--- psignal.h DELETED ---




More information about the MPlayer-cvslog mailing list