Mercurial > mplayer.hg
changeset 8864:b8c271750450
- sync with x11_common
- half rewrited font render engine (disabled by default)
author | pontscho |
---|---|
date | Thu, 09 Jan 2003 20:47:14 +0000 |
parents | 46440d3621a8 |
children | 561cd856fb18 |
files | Gui/mplayer/mw.c Gui/mplayer/play.c Gui/mplayer/sw.c Gui/mplayer/widgets.c Gui/skin/font.c Gui/skin/font.h Gui/wm/ws.c Gui/wm/ws.h libvo/x11_common.c libvo/x11_common.h |
diffstat | 10 files changed, 201 insertions(+), 255 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/mplayer/mw.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/mplayer/mw.c Thu Jan 09 20:47:14 2003 +0000 @@ -218,20 +218,20 @@ PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); break; case itSLabel: - image=fntRender( item->fontid,0,item->width,"%s",item->label ); + image=fntRender( item,0,"%s",item->label ); goto drawrenderedtext; case itDLabel: { char * t = Translate( item->label ); int l = fntTextWidth( item->fontid,t ); - image=fntRender( item->fontid,(GetTimerMS() / 20)%(l?l:item->width),item->width,"%s",t ); + image=fntRender( item,(GetTimerMS() / 20)%(l?l:item->width),"%s",t ); } drawrenderedtext: if ( image ) { PutImage( image,item->x,item->y,1,0 ); - if ( image->Image ) free( image->Image ); - free( image ); +// if ( image->Image ) free( image->Image ); +// free( image ); } break; }
--- a/Gui/mplayer/play.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/mplayer/play.c Thu Jan 09 20:47:14 2003 +0000 @@ -238,7 +238,7 @@ if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } - if ( wsWMType == wsWMUnknown ) wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); + 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 );
--- a/Gui/mplayer/sw.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/mplayer/sw.c Thu Jan 09 20:47:14 2003 +0000 @@ -1,6 +1,11 @@ // sub window +#include <inttypes.h> + +#include "../../config.h" +#include "../../libvo/x11_common.h" + #include "../app.h" #include "../interface.h" #include "../../help_mp.h" @@ -18,7 +23,7 @@ if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++; - if ( appMPlayer.subWindow.State == wsWindowFocusOut && wsWMType != wsWMKDE && wsWMType != wsWMIceWM ) SubVisible--; + if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--; if ( !appMPlayer.subWindow.Mapped || appMPlayer.subWindow.Visible == wsWindowNotVisible ) return; @@ -74,7 +79,7 @@ if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) ) { if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID ); - else if ( wsWMType != wsWMNetWM && wsWMType != wsWMKDE ) wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID ); + else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID ); } msButton=0; mplSubMoved=0;
--- a/Gui/mplayer/widgets.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/mplayer/widgets.c Thu Jan 09 20:47:14 2003 +0000 @@ -144,13 +144,15 @@ } gtk_widget_show( MessageBox ); gtkSetLayer( MessageBox ); - gtkActive( MessageBox ); if ( type == GTK_MB_FATAL ) while ( MessageBox ) gtk_main_iteration_do( 0 ); } void gtkSetLayer( GtkWidget * wdg ) -{ wsSetLayer( gdk_display,GDK_WINDOW_XWINDOW( wdg->window ),appMPlayer.subWindow.isFullScreen ); } +{ + wsSetLayer( gdk_display,GDK_WINDOW_XWINDOW( wdg->window ),appMPlayer.subWindow.isFullScreen ); + gtkActive( wdg ); +} void gtkActive( GtkWidget * wdg ) { wsMoveTopWindow( gdk_display,GDK_WINDOW_XWINDOW( wdg->window )); }
--- a/Gui/skin/font.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/skin/font.c Thu Jan 09 20:47:14 2003 +0000 @@ -5,6 +5,7 @@ #include <string.h> #include <inttypes.h> +#include "../app.h" #include "skin.h" #include "font.h" #include "cut.h" @@ -118,7 +119,7 @@ if ( ( !Fonts[id] )||( !str[0] ) ) return 0; - for ( i=0;i < (unsigned int)strlen( str );i++ ) + for ( i=0;i < (int)strlen( str );i++ ) { unsigned char c = (unsigned char)str[i]; if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' '; @@ -144,16 +145,134 @@ return max; } -txSample * fntRender( int id,int px,int sx,char * fmt,... ) +typedef struct +{ + int pos; + char c; +} iChar; + +txSample * fntRender( wItem * item,int px,char * fmt,... ) { +#if 0 + txSample * tmp = NULL; + va_list ap; + char p[512]; + iChar pos[512]; + int i, dx = 0, s, tw; + uint32_t * ibuf; + uint32_t * obuf; + + va_start( ap,fmt ); + vsnprintf( p,512,fmt,ap ); + va_end( ap ); + + if ( ( !item )|| + ( !Fonts[item->fontid] )|| + ( !p[0] )|| + ( !fntTextWidth( item->fontid,p ) ) ) return NULL; + + tw=fntTextWidth( item->fontid,p ); + + if ( item->Bitmap.Image == NULL ) + { + item->Bitmap.Height=item->height=fntTextHeight( item->fontid,p ); + item->Bitmap.Width=item->width; + item->Bitmap.ImageSize=item->height * item->width * 4; + item->Bitmap.BPP=32; + item->Bitmap.Image=malloc( item->Bitmap.ImageSize ); + } + + obuf=(uint32_t *)item->Bitmap.Image; + ibuf=(uint32_t *)Fonts[item->fontid]->Bitmap.Image; + + for ( i=0;i < item->Bitmap.ImageSize / 4;i++ ) obuf[i]=0xff00ff; + + if ( tw < item->width ) + { + switch ( item->align ) + { + default: + case fntAlignLeft: dx=0; break; + case fntAlignCenter: dx=( item->width - fntTextWidth( item->fontid,p ) ) / 2; break; + case fntAlignRight: dx=item->width - fntTextWidth( item->fontid,p ); break; + } + + } else dx+=px; +/* + for ( i=0;i < (int)strlen( p );i++ ) + { + int c = (int)p[i]; + int fw = Fonts[item->fontid]->Fnt[c].sx; + int fh = Fonts[item->fontid]->Fnt[c].sy; + int fx = Fonts[item->fontid]->Fnt[c].x; + int fy = Fonts[item->fontid]->Fnt[c].y; + + if ( fw != -1 ) + { + // font rendernig + int x,y; + for ( y=0;y < fh;y++ ) + { + if ( dx >= 0 ) + for ( x=0; x < fw;x++ ) + { + if ( dx + x >= item->width ) goto fnt_exit; + obuf[y * item->width + x + dx]=ibuf[ ( fy + y ) * Fonts[item->fontid]->Bitmap.Width + fx + x ]; + } + } + dx+=fw; + } else dx+=4; + } + +fnt_exit: +*/ + +if ( !strncmp( p,"lofasz",6 ) ) +{ + int i,j, c = 0; + char t[512]; + memset( t,0,512 ); +// printf( "!!!! " ); + for ( i=0; i < (int)strlen( p );i++ ) + { + int c = (int)p[i]; + int fw = Fonts[item->fontid]->Fnt[c].sx; + pos[i].pos=dx; + pos[i].c=p[i]; + if ( pos[i].pos > item->width ) pos[i].pos-=item->width; +// printf( "%d; ",pos[i] ); + dx+=fw; + } + for ( i=0;i < (int)strlen( p );i++ ) + for ( j=strlen( p );j > i;j-- ) + if ( pos[j].pos < pos[i].pos ) + { + iChar tmp; + memcpy( &tmp,&pos[i],sizeof( iChar ) ); + memcpy( &pos[i],&pos[j],sizeof( iChar ) ); + memcpy( &pos[j],&tmp,sizeof( iChar ) ); + } +// + for ( i=0;i < (int)strlen( p );i++ ) + t[c++]=pos[i].c; +// if ( pos[i].pos > 0 && pos[i].pos < item->width ) t[c++]=pos[i].c; + printf( "!!! %s\n",t ); +} + + return &item->Bitmap; + +#else + txSample tmp2; txSample * tmp = NULL; - txSample tmp2; + va_list ap; char p[512]; - va_list ap; uint32_t * ibuf; uint32_t * obuf; int i,x,y; - int oy = 0, ox = 0, dx = 0; + int oy = 0, ox = 0, dx = 0, s = 0; + int id=item->fontid; + int sx=item->width; + int a=item->align; va_start( ap,fmt ); vsnprintf( p,512,fmt,ap ); @@ -169,15 +288,24 @@ tmp->BPP=32; tmp->ImageSize=tmp->Width * tmp->Height * 4; if ( ( tmp->Image=malloc( tmp->ImageSize ) ) == NULL ) return NULL; + obuf=(uint32_t *)tmp->Image; ibuf=(uint32_t *)Fonts[id]->Bitmap.Image; + for ( i=0;i < (int)strlen( p );i++ ) { unsigned int c = (unsigned char)p[i]; + int cx,cy; + if ( Fonts[id]->Fnt[c].sx == -1 ) c=32; - for ( oy=0,y=Fonts[id]->Fnt[c].y;y < Fonts[id]->Fnt[c].y + Fonts[id]->Fnt[c].sy; y++,oy++ ) - for ( ox=0,x=Fonts[id]->Fnt[c].x;x < Fonts[id]->Fnt[c].x + Fonts[id]->Fnt[c].sx; x++,ox++ ) - obuf[ oy * tmp->Width + dx + ox ]=ibuf[ y * Fonts[id]->Bitmap.Width + x ]; + + cx=Fonts[id]->Fnt[c].x; + cy=Fonts[id]->Fnt[c].y; + + for ( oy=0,y=cy;y < cy + Fonts[id]->Fnt[c].sy; y++,oy++ ) + for ( ox=0,x=cx;x < cx + Fonts[id]->Fnt[c].sx; x++,ox++ ) + obuf[ oy * tmp->Width + dx + ox ]=ibuf[ y * Fonts[id]->Bitmap.Width + x ]; + dx+=Fonts[id]->Fnt[c].sx; } @@ -203,6 +331,7 @@ free( tmp->Image ); tmp->Width=sx; tmp->ImageSize=tmp2.ImageSize; tmp->Image=tmp2.Image; } +#endif return tmp; }
--- a/Gui/skin/font.h Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/skin/font.h Thu Jan 09 20:47:14 2003 +0000 @@ -3,6 +3,11 @@ #define _FONT_H #include "../bitmap.h" +#include "../app.h" + +#define fntAlignLeft 0 +#define fntAlignCenter 1 +#define fntAlignRight 2 typedef struct { @@ -27,7 +32,7 @@ extern int fntTextWidth( int id,char * str ); extern int fntRead( char * path,char * fname ); -extern txSample * fntRender( int id,int px,int sx,char * fmt,... ); +extern txSample * fntRender( wItem * item,int px,char * fmt,... ); #endif
--- a/Gui/wm/ws.c Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/wm/ws.c Thu Jan 09 20:47:14 2003 +0000 @@ -19,6 +19,7 @@ #include <inttypes.h> #include "../../config.h" +#include "../../libvo/x11_common.h" #include "ws.h" #include "wsxdnd.h" #include "../../postproc/rgb2rgb.h" @@ -33,7 +34,7 @@ #include <sys/ipc.h> #include <sys/shm.h> -#define ENABLE_DPMS 0 +#undef ENABLE_DPMS typedef struct { @@ -54,7 +55,6 @@ Window wsRootWin; XEvent wsEvent; int wsWindowDepth; -int wsWMType = wsWMUnknown; GC wsHGC; MotifWmHints wsMotifWmHints; Atom wsTextProperlyAtom = None; @@ -167,73 +167,6 @@ exit( 0 ); } -int wsWindowManagerType( void ) -{ - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char * args = NULL; - - Window win; - XEvent xev; - int c = 0; - int wm = wsWMUnknown; - -// --- gnome -/* - type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); - if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) - { - mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is Gnome\n" ); - XFree( args ); - return wsWMGnome; - } -*/ -// --- net wm - type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); - if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) - { - mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is NetWM\n" ); - XFree( args ); - return wsWMNetWM; - } - -// --- other wm - mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Create window for WM detect ...\n" ); - win=XCreateSimpleWindow( wsDisplay,wsRootWin,wsMaxX,wsMaxY,1,1,0,0,0 ); - XSelectInput( wsDisplay,win,PropertyChangeMask | StructureNotifyMask ); - XMapWindow( wsDisplay,win ); - XMoveWindow( wsDisplay,win,wsMaxX,wsMaxY ); - do - { - XCheckWindowEvent( wsDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); - - if ( xev.type == PropertyNotify ) - { - char * name = XGetAtomName( wsDisplay,xev.xproperty.atom ); - if ( !name ) break; - - if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) - { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); wm=wsWMIceWM; break; } - if ( !strncmp( name,"_KDE_",5 ) ) - { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); wm=wsWMKDE; break; } - if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) - { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); wm=wsWMWMaker; break; } -// fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); - XFree( name ); - } - } while( c++ < 25 ); - XUnmapWindow( wsDisplay,win ); - XDestroyWindow( wsDisplay,win ); -#ifdef MP_DEBUG - if ( wm == wsWMUnknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Unknown wm type...\n" ); -#endif - return wsWMUnknown; -} - -extern int vo_wm_type; -extern int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return); - void wsXInit( void* mDisplay ) { int eventbase; @@ -265,6 +198,7 @@ mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE"); if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Remote display, disabling XMITSHM\n"); } + if ( !XShmQueryExtension( wsDisplay ) ) { mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported X shared memory extension.\n" ); @@ -287,9 +221,6 @@ wsMaxX=DisplayWidth( wsDisplay,wsScreen ); wsMaxY=DisplayHeight( wsDisplay,wsScreen ); - if ( vo_wm_type != -1 ) wsWMType=vo_wm_type; - else wsWMType=wsWindowManagerType(); - wsGetDepthOnScreen(); #ifdef DEBUG { @@ -684,33 +615,6 @@ wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root ); break; - case PropertyNotify: - { - char * name = XGetAtomName( wsDisplay,Event->xproperty.atom ); - - if ( !name ) break; - if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) - { - wsWMType=wsWMIceWM; -// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); - } - if ( !strncmp( name,"_KDE_",5 ) ) - { -// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); - wsWMType=wsWMKDE; - } - if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) - { -// mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); - wsWMType=wsWMWMaker; - } - -// fprintf(stderr,"[ws] PropertyNotify %s ( 0x%x )\n",name,Event->xproperty.atom ); - - XFree( name ); - } - break; - case SelectionNotify: /* Handle DandD */ wsXDNDProcessSelection(wsWindowList[l],Event); @@ -775,75 +679,7 @@ #define WIN_LAYER_ONTOP 10 void wsSetLayer( Display * wsDisplay, Window win, int layer ) -{ - Atom type; - int format; - unsigned long nitems, bytesafter; - Atom * args = NULL; - - if ( wsWMType == wsWMIceWM ) - { - switch ( layer ) - { - case -1: layer=2; break; // WinLayerBelow - case 0: layer=4; break; // WinLayerNormal - case 1: layer=8; break; // WinLayerOnTop - } - XChangeProperty( wsDisplay,win, - XInternAtom( wsDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 ); - return; - } - - type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); - if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char **)&args ) && nitems > 0 ) - { - XClientMessageEvent xev; - - memset( &xev,0,sizeof( xev ) ); - xev.type=ClientMessage; - xev.window=win; - xev.message_type=XInternAtom( wsDisplay,"_WIN_LAYER",False ); - xev.format=32; - switch ( layer ) - { - case -1: xev.data.l[0] = WIN_LAYER_ONBOTTOM; break; - case 0: xev.data.l[0] = WIN_LAYER_NORMAL; break; - case 1: xev.data.l[0] = WIN_LAYER_ONTOP; break; - } - XSendEvent( wsDisplay,wsRootWin,False,SubstructureNotifyMask,(XEvent*)&xev ); - if ( layer ) XRaiseWindow( wsDisplay,win ); - - XFree( args ); - return; - } - - type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); - if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,(unsigned char **)&args ) && nitems > 0 ) - { - int i; - XEvent e; - - e.xclient.type=ClientMessage; - e.xclient.message_type=XInternAtom( wsDisplay,"_NET_WM_STATE",False ); - e.xclient.display=wsDisplay; - e.xclient.window=win; - e.xclient.format=32; - e.xclient.data.l[0]=layer; - - e.xclient.data.l[1]=XInternAtom( wsDisplay,"_NET_WM_STATE_STAYS_ON_TOP",False ); - type=XInternAtom( wsDisplay,"_NET_WM_STATE_FULLSCREEN",False ); - for ( i=0;(unsigned long)i < nitems;i++ ) - if ( args[i] == type ) { e.xclient.data.l[1]=XInternAtom( wsDisplay,"_NET_WM_STATE_FULLSCREEN",False ); break; } - - e.xclient.data.l[2]=0l; - e.xclient.data.l[3]=0l; - e.xclient.data.l[4]=0l; - XSendEvent( wsDisplay,wsRootWin,False,SubstructureRedirectMask,&e ); - - XFree( args ); - return; - } -} +{ vo_x11_setlayer( wsDisplay,win,layer ); } // ---------------------------------------------------------------------------------------------- // Switch to fullscreen. @@ -851,17 +687,6 @@ void wsFullScreen( wsTWindow * win ) { int decoration = 0; - - switch ( wsWMType ) - { - case wsWMUnknown: -// XUnmapWindow( wsDisplay,win->WindowID ); - XWithdrawWindow( wsDisplay,win->WindowID,wsScreen ); - break; - case wsWMIceWM: - if ( !win->isFullScreen ) XUnmapWindow( wsDisplay,win->WindowID ); - break; - } if ( win->isFullScreen ) { @@ -887,31 +712,21 @@ #endif } - win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; - win->SizeHint.x=win->X; win->SizeHint.y=win->Y; - win->SizeHint.width=win->Width; win->SizeHint.height=win->Height; -// win->SizeHint.base_width=win->Width; win->SizeHint.base_height=win->Height; - - win->SizeHint.win_gravity=StaticGravity; - if ( win->Property & wsMaxSize ) + if ( net_wm_support != SUPPORT_FULLSCREEN || metacity_hack == 1 ) { - win->SizeHint.flags|=PMaxSize; - win->SizeHint.max_width=win->Width; - win->SizeHint.max_height=win->Height; + vo_x11_decoration( wsDisplay,win->WindowID,decoration ); + vo_x11_sizehint( win->X,win->Y,win->Width,win->Height,0 ); } - if ( win->Property & wsMinSize ) + vo_x11_setlayer( wsDisplay,win->WindowID,win->isFullScreen ); + if ( net_wm_support != SUPPORT_FULLSCREEN || metacity_hack == 1 ) { - win->SizeHint.flags|=PMinSize; - win->SizeHint.min_width=win->Width; - win->SizeHint.min_height=win->Height; + if ( vo_wm_type == vo_wm_Unknown && !(vo_fsmode&16) ) + XWithdrawWindow( wsDisplay,win->WindowID,wsScreen ); + XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height ); } - XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); - - wsSetLayer( wsDisplay,win->WindowID,win->isFullScreen ); - XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height ); - wsWindowDecoration( win,decoration ); XMapRaised( wsDisplay,win->WindowID ); XRaiseWindow( wsDisplay,win->WindowID ); + XFlush( wsDisplay ); } // ---------------------------------------------------------------------------------------------- @@ -1019,7 +834,7 @@ win->SizeHint.win_gravity=StaticGravity; win->SizeHint.base_width=sx; win->SizeHint.base_height=sy; - if ( wsWMType == wsWMUnknown ) XUnmapWindow( wsDisplay,win->WindowID ); + if ( vo_wm_type == vo_wm_Unknown ) XUnmapWindow( wsDisplay,win->WindowID ); XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); XResizeWindow( wsDisplay,win->WindowID,sx,sy ); @@ -1038,30 +853,10 @@ // ---------------------------------------------------------------------------------------------- void wsMoveTopWindow( Display * wsDisplay,Window win ) { - switch ( wsWMType ) - { - case wsWMIceWM: - XUnmapWindow( wsDisplay,win ); - XMapWindow( wsDisplay,win ); - break; - case wsWMNetWM: - case wsWMKDE: - { - XEvent e; - e.xclient.type=ClientMessage; - e.xclient.message_type=XInternAtom( wsDisplay,"_NET_ACTIVE_WINDOW",False ); - e.xclient.display=wsDisplay; - e.xclient.window=win; - e.xclient.format=32; - e.xclient.data.l[0]=0; - XSendEvent( wsDisplay,RootWindow( wsDisplay,DefaultScreen( wsDisplay ) ),False,SubstructureRedirectMask,&e ); - break; - } - default: - XMapRaised( wsDisplay,win ); - XRaiseWindow( wsDisplay,win ); - break; - } +// XUnmapWindow( wsDisplay,win ); +// XMapWindow( wsDisplay,win ); + XMapRaised( wsDisplay,win ); + XRaiseWindow( wsDisplay,win ); } // ----------------------------------------------------------------------------------------------
--- a/Gui/wm/ws.h Thu Jan 09 20:42:01 2003 +0000 +++ b/Gui/wm/ws.h Thu Jan 09 20:47:14 2003 +0000 @@ -170,8 +170,6 @@ extern int wsMaxX; extern int wsMaxY; -extern int wsWMType; - extern Display * wsDisplay; extern int wsScreen; extern Window wsRootWin;
--- a/libvo/x11_common.c Thu Jan 09 20:42:01 2003 +0000 +++ b/libvo/x11_common.c Thu Jan 09 20:47:14 2003 +0000 @@ -41,10 +41,6 @@ #include "../mplayer.h" #endif -#define vo_wm_Unknown 0 -#define vo_wm_NetWM 1 -#define vo_wm_Layered 2 - #define WIN_LAYER_ONBOTTOM 2 #define WIN_LAYER_NORMAL 4 #define WIN_LAYER_ONTOP 6 @@ -72,10 +68,6 @@ /* if equal to 1 means that WM is a metacity (broken as hell) */ int metacity_hack = 0; -#define SUPPORT_NONE 0 -#define SUPPORT_FULLSCREEN 1 -#define SUPPORT_ABOVE 2 -#define SUPPORT_STAYS_ON_TOP 4 int net_wm_support = 0; Atom XA_NET_SUPPORTED; @@ -701,10 +693,13 @@ XSetWMNormalHints( mDisplay,vo_window,&vo_hint ); } -void vo_x11_setlayer( int layer ) +void vo_x11_setlayer( Display * mDisplay,Window vo_window,int layer ) { if ( WinID >= 0 ) return; - + + // window manager could be changed during play + vo_wm_type=vo_wm_detect(); + switch ( vo_wm_type ) { case vo_wm_Layered: { @@ -718,6 +713,7 @@ xev.data.l[0] = layer?ice_layer:WIN_LAYER_NORMAL; // if not fullscreen, stay on layer "Normal" xev.data.l[1] = CurrentTime; mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] Layered style stay on top ( layer %d ).\n",xev.data.l[0] ); + printf( "[x11] Layered style stay on top ( layer %d ).\n",xev.data.l[0] ); XSendEvent(mDisplay, mRootWin, False, SubstructureNotifyMask, (XEvent *) &xev); break; } @@ -751,6 +747,7 @@ } state = XGetAtomName (mDisplay, xev.data.l[1]); mp_dbg( MSGT_VO,MSGL_STATUS,"[x11] NET style stay on top ( layer %d ). Using state %s.\n",layer,state ); + printf( "[x11] NET style stay on top ( layer %d ). Using state %s.\n",layer,state ); XFree (state); } } @@ -784,7 +781,7 @@ vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 ); vo_x11_sizehint( x,y,w,h,0 ); } - vo_x11_setlayer( vo_fs ); + vo_x11_setlayer( mDisplay,vo_window,vo_fs ); if (net_wm_support!=SUPPORT_FULLSCREEN || metacity_hack==1) { if(vo_wm_type==vo_wm_Unknown && !(vo_fsmode&16))
--- a/libvo/x11_common.h Thu Jan 09 20:42:01 2003 +0000 +++ b/libvo/x11_common.h Thu Jan 09 20:47:14 2003 +0000 @@ -7,6 +7,19 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#define vo_wm_Unknown 0 +#define vo_wm_NetWM 1 +#define vo_wm_Layered 2 + +#define SUPPORT_NONE 0 +#define SUPPORT_FULLSCREEN 1 +#define SUPPORT_ABOVE 2 +#define SUPPORT_STAYS_ON_TOP 4 + +extern int net_wm_support; +extern int metacity_hack; +extern int vo_fsmode; + extern int vo_depthonscreen; extern int vo_screenwidth; extern int vo_screenheight; @@ -35,6 +48,7 @@ extern int vo_x11_check_events(Display *mydisplay); extern void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask); extern void vo_x11_fullscreen( void ); +extern void vo_x11_setlayer( Display * mDisplay,Window vo_window,int layer ); extern void vo_x11_uninit(); extern Colormap vo_x11_create_colormap(XVisualInfo *vinfo); extern uint32_t vo_x11_set_equalizer(char *name, int value); @@ -63,6 +77,7 @@ void vo_vm_close(Display*); #endif +int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return); + #endif -int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);