diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-01-09 20:47:14 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-01-09 20:47:14 +0000 |
commit | 52a7bad9a6b5240797ba9780e182a31caf3e79d4 (patch) | |
tree | 41c7ff8cc73c61efce83a7c721a0fa352a940e8a /Gui | |
parent | 8c30a49e223eebe3f20a522b66dc32e120024853 (diff) |
- sync with x11_common
- half rewrited font render engine (disabled by default)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8865 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r-- | Gui/mplayer/mw.c | 8 | ||||
-rw-r--r-- | Gui/mplayer/play.c | 2 | ||||
-rw-r--r-- | Gui/mplayer/sw.c | 9 | ||||
-rw-r--r-- | Gui/mplayer/widgets.c | 6 | ||||
-rw-r--r-- | Gui/skin/font.c | 145 | ||||
-rw-r--r-- | Gui/skin/font.h | 7 | ||||
-rw-r--r-- | Gui/wm/ws.c | 241 | ||||
-rw-r--r-- | Gui/wm/ws.h | 2 |
8 files changed, 177 insertions, 243 deletions
diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c index 040e51cf94..e0b6f13012 100644 --- a/Gui/mplayer/mw.c +++ b/Gui/mplayer/mw.c @@ -218,20 +218,20 @@ void mplMainDraw( void ) 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; } diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 66b96f11dd..92bcdd968a 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -238,7 +238,7 @@ 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 ( 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 ); diff --git a/Gui/mplayer/sw.c b/Gui/mplayer/sw.c index ac0f9b8901..21191b4fb2 100644 --- a/Gui/mplayer/sw.c +++ b/Gui/mplayer/sw.c @@ -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 @@ void mplSubDraw( void ) 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 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) 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; diff --git a/Gui/mplayer/widgets.c b/Gui/mplayer/widgets.c index e11b909b77..206c3f25f0 100644 --- a/Gui/mplayer/widgets.c +++ b/Gui/mplayer/widgets.c @@ -144,13 +144,15 @@ void gtkMessageBox( int type,gchar * str ) } 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 )); } diff --git a/Gui/skin/font.c b/Gui/skin/font.c index 65f196fe73..7ce0feba96 100644 --- a/Gui/skin/font.c +++ b/Gui/skin/font.c @@ -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 @@ int fntTextWidth( int id,char * str ) 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 @@ int fntTextHeight( int id,char * str ) return max; } -txSample * fntRender( int id,int px,int sx,char * fmt,... ) +typedef struct { - txSample * tmp = NULL; + 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; - char p[512]; + txSample * tmp = NULL; va_list ap; + char p[512]; 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 @@ txSample * fntRender( int id,int px,int sx,char * fmt,... ) 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 @@ txSample * fntRender( int id,int px,int sx,char * fmt,... ) free( tmp->Image ); tmp->Width=sx; tmp->ImageSize=tmp2.ImageSize; tmp->Image=tmp2.Image; } +#endif return tmp; } diff --git a/Gui/skin/font.h b/Gui/skin/font.h index 9258a353fd..6e86edf10f 100644 --- a/Gui/skin/font.h +++ b/Gui/skin/font.h @@ -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 fntTextHeight( int id,char * str ); 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 diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index 441bf861b1..cf04488c92 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -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 @@ int wsScreen; Window wsRootWin; XEvent wsEvent; int wsWindowDepth; -int wsWMType = wsWMUnknown; GC wsHGC; MotifWmHints wsMotifWmHints; Atom wsTextProperlyAtom = None; @@ -167,73 +167,6 @@ int wsErrorHandler( Display * dpy,XErrorEvent * Event ) 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 @@ wsXDNDInitialize(); 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 @@ wsXDNDInitialize(); 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 @@ buttonreleased: 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 @@ while(wsTrue){ #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 wsSetLayer( Display * wsDisplay, Window win, int layer ) 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 @@ void wsFullScreen( wsTWindow * win ) #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 @@ void wsResizeWindow( wsTWindow * win,int sx, int sy ) 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 wsIconify( wsTWindow win ) // ---------------------------------------------------------------------------------------------- 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 ); } // ---------------------------------------------------------------------------------------------- diff --git a/Gui/wm/ws.h b/Gui/wm/ws.h index 84195d6f76..bd0b6c802d 100644 --- a/Gui/wm/ws.h +++ b/Gui/wm/ws.h @@ -170,8 +170,6 @@ typedef struct extern int wsMaxX; extern int wsMaxY; -extern int wsWMType; - extern Display * wsDisplay; extern int wsScreen; extern Window wsRootWin; |