summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-13 23:38:49 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-13 23:38:49 +0000
commit5b16ccc998296b12092403bc6abad2c60abcbf65 (patch)
tree85a42b78ab8e0cd828287979b40c1fd02cd9243a /Gui
parentd462b79a484d1477000aa0af2f30d1dcafe77f97 (diff)
downloadmpv-5b16ccc998296b12092403bc6abad2c60abcbf65.tar.bz2
mpv-5b16ccc998296b12092403bc6abad2c60abcbf65.tar.xz
correct skin changing
(fix one critical bug) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8950 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/app.c2
-rw-r--r--Gui/app.h7
-rw-r--r--Gui/interface.c2
-rw-r--r--Gui/mplayer/menu.c10
-rw-r--r--Gui/mplayer/play.c29
-rw-r--r--Gui/wm/ws.c18
6 files changed, 55 insertions, 13 deletions
diff --git a/Gui/app.c b/Gui/app.c
index bb17908de4..d6e7303dca 100644
--- a/Gui/app.c
+++ b/Gui/app.c
@@ -138,6 +138,8 @@ void appInitStruct( listItems * item )
item->subR=0;
item->subG=0;
item->subB=0;
+ item->barIsPresent=0;
+ item->menuIsPresent=0;
}
int appFindKey( unsigned char * name )
diff --git a/Gui/app.h b/Gui/app.h
index 1055bbfb56..5441630c11 100644
--- a/Gui/app.h
+++ b/Gui/app.h
@@ -145,7 +145,11 @@ typedef struct
wItem sub;
wsTWindow subWindow;
int subR,subG,subB;
- int subPixel;
+
+ wItem bar;
+ wsTWindow barWindow;
+ int barR,barG,barB;
+ int barIsPresent;
wItem eq;
wsTWindow eqWindow;
@@ -153,6 +157,7 @@ typedef struct
wItem menuBase;
wItem menuSelected;
wsTWindow menuWindow;
+ int menuIsPresent;
// ---
int NumberOfItems;
diff --git a/Gui/interface.c b/Gui/interface.c
index b5adb07b44..c2f53978f6 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -210,7 +210,7 @@ void guiInit( void )
i=wsShowFrame|wsMaxSize|wsHideWindow;
wsCreateWindow( &appMPlayer.mainWindow,
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
+ wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" );
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
wsXDNDMakeAwareness(&appMPlayer.mainWindow);
diff --git a/Gui/mplayer/menu.c b/Gui/mplayer/menu.c
index 31cf947963..f0d72176bf 100644
--- a/Gui/mplayer/menu.c
+++ b/Gui/mplayer/menu.c
@@ -15,6 +15,7 @@ int mplMenuRender = 1;
int mplMenuItem = -1;
int mplOldMenuItem = -1;
int mplMenuX,mplMenuY;
+static int mplMenuIsInitialized = 0;
void mplHideMenu( int mx,int my,int w );
@@ -24,7 +25,7 @@ void mplMenuDraw( void )
uint32_t * drw = NULL;
int x,y,tmp;
- if ( !appMPlayer.menuBase.Bitmap.Image ) return;
+ if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return;
if ( mplMenuRender || mplMenuItem != mplOldMenuItem )
@@ -78,7 +79,7 @@ void mplShowMenu( int mx,int my )
{
int x,y;
- if ( !appMPlayer.menuBase.Bitmap.Image ) return;
+ if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
x=mx;
if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1;
@@ -101,7 +102,7 @@ void mplHideMenu( int mx,int my,int w )
{
int x,y,i=mplMenuItem;
- if ( !appMPlayer.menuBase.Bitmap.Image ) return;
+ if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
x=mx-mplMenuX;
y=my-mplMenuY;
@@ -126,7 +127,7 @@ void mplHideMenu( int mx,int my,int w )
void mplMenuInit( void )
{
- if ( !appMPlayer.menuBase.Bitmap.Image ) return;
+ if ( mplMenuIsInitialized || !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
appMPlayer.menuBase.x=0;
appMPlayer.menuBase.y=0;
@@ -150,6 +151,7 @@ void mplMenuInit( void )
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
#endif
+ mplMenuIsInitialized=1;
appMPlayer.menuWindow.ReDraw=mplMenuDraw;
// appMPlayer.menuWindow.MouseHandler=mplMenuMouseHandle;
// appMPlayer.menuWindow.KeyHandler=mplMainKeyHandle;
diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c
index 92bcdd968a..5058fb19fe 100644
--- a/Gui/mplayer/play.c
+++ b/Gui/mplayer/play.c
@@ -191,6 +191,7 @@ listItems tmpList;
void ChangeSkin( char * name )
{
int ret;
+ int prev = appMPlayer.menuIsPresent;
mainVisible=0;
@@ -208,7 +209,8 @@ void ChangeSkin( char * name )
mainVisible=1;
return;
}
- if ( appMPlayer.menuBase.Bitmap.Image )
+
+ if ( prev && appMPlayer.menuIsPresent )
{
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
@@ -217,7 +219,7 @@ void ChangeSkin( char * name )
wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
- }
+ } else { mplMenuInit(); }
if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
@@ -238,7 +240,9 @@ void ChangeSkin( char * name )
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
- if ( vo_wm_type == vo_wm_Unknown ) wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
+#if 0
+// if ( vo_wm_type == vo_wm_Unknown )
+ wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y );
wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
@@ -246,7 +250,26 @@ void ChangeSkin( char * name )
wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
+#else
+ wsDestroyWindow( &appMPlayer.mainWindow );
+ wsCreateWindow( &appMPlayer.mainWindow,
+ appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
+ wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" );
+ wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height );
+ wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
+ wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
+
+ appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
+ appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
+ appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
+ appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
+
+ wsXDNDMakeAwareness( &appMPlayer.mainWindow );
+ if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
+ wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
+ mainVisible=1;
+#endif
btnModify( evSetVolume,guiIntfStruct.Volume );
btnModify( evSetBalance,guiIntfStruct.Balance );
btnModify( evSetMoviePosition,guiIntfStruct.Position );
diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c
index d5d4e4821b..979720e4dc 100644
--- a/Gui/wm/ws.c
+++ b/Gui/wm/ws.c
@@ -68,8 +68,8 @@ int wsOutMask = 0;
int wsTrue = True;
-wsTWindow * wsWindowList[5] = { NULL,NULL,NULL,NULL,NULL };
-int wsWLCount = 0;
+#define wsWLCount 5
+wsTWindow * wsWindowList[wsWLCount] = { NULL,NULL,NULL,NULL,NULL };
unsigned long wsKeyTable[512];
@@ -446,7 +446,14 @@ void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,uns
wsCreateImage( win,win->Width,win->Height );
// --- End of creating --------------------------------------------------------------------------
- wsWindowList[wsWLCount++]=win;
+ {
+ int i;
+ for ( i=0;i < wsWLCount;i++ )
+ if ( wsWindowList[i] == NULL ) break;
+ if ( i == wsWLCount )
+ { printf( "!!! tul sok nyitott ablak van.\n" ); exit( 1 ); }
+ wsWindowList[i]=win;
+ }
XFlush( wsDisplay );
XSync( wsDisplay,False );
@@ -469,9 +476,11 @@ void wsDestroyWindow( wsTWindow * win )
XFreeCursor( wsDisplay,win->wsCursor );
win->wsCursor=None;
}
+ XFreeGC( wsDisplay,win->wGC );
XUnmapWindow( wsDisplay,win->WindowID );
wsDestroyImage( win );
XDestroyWindow( wsDisplay,win->WindowID );
+#if 0
win->ReDraw=NULL;
win->ReSize=NULL;
win->Idle=NULL;
@@ -481,6 +490,7 @@ void wsDestroyWindow( wsTWindow * win )
win->Focused=0;
win->Mapped=0;
win->Rolled=0;
+#endif
}
// ----------------------------------------------------------------------------------------------
@@ -490,7 +500,7 @@ void wsDestroyWindow( wsTWindow * win )
inline int wsSearch( Window win )
{
int i;
- for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i]->WindowID == win ) return i;
+ for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i] && wsWindowList[i]->WindowID == win ) return i;
return -1;
}