[MPlayer-dev-eng] [PATCH] mplayer/metacity fs bug

Alexander Strasser eclipse7 at gmx.net
Sun May 30 21:54:25 CEST 2004


There is a bug in conjunction with metacity if one moves
the window and then wants to switch to fullscreen.

I attached a patch to fix it. The patch sends the
EWMH fullscreen state when switching to fs and when
switching back to win it removes it. It does it for
every wm detected to support EWMH, but that shouldn't
make problems.
There is already EWMH code in the X11 modules but I
didn't really grasp it and it seemed somehow broken.

I tested it with the help of Scognito on different
wm setups and it didn't break any other wm so far.

The error messages in the patch should get translated
if this patch gets accepted.


  beastd
-------------- next part --------------
Index: libvo/x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.171
diff -u -r1.171 x11_common.c
--- libvo/x11_common.c	1 May 2004 14:52:15 -0000	1.171
+++ libvo/x11_common.c	30 May 2004 15:02:50 -0000
@@ -115,6 +115,43 @@
 
 static int vo_x11_get_fs_type(int supported);
 
+/*
+ * Sends the EWMH fullscreen state event.
+ * 
+ * action: could be on of 0 -- remove state
+ *                        1 -- add state
+ *                        2 -- toggle
+ */
+void vo_x11_ewmh_fullscreen( int action )
+{
+  if ( vo_fs_type & vo_wm_FULLSCREEN )
+  {
+    XEvent xev;
+  
+    /* init X event structure for _NET_WM_FULLSCREEN client msg */
+    xev.xclient.type = ClientMessage;
+    xev.xclient.serial = 0;
+    xev.xclient.send_event = True;
+    xev.xclient.message_type = XInternAtom( mDisplay,
+                                            "_NET_WM_STATE", False );
+    xev.xclient.window = vo_window;
+    xev.xclient.format = 32;
+    xev.xclient.data.l[0] = action;
+    xev.xclient.data.l[1] = XInternAtom( mDisplay,
+                                         "_NET_WM_STATE_FULLSCREEN", False );
+    xev.xclient.data.l[2] = 0;
+    xev.xclient.data.l[3] = 0;
+    xev.xclient.data.l[4] = 0;    
+  
+    /* finally send that damn thing */
+    if ( !XSendEvent( mDisplay, DefaultRootWindow( mDisplay ), False,
+  	              SubstructureRedirectMask | SubstructureNotifyMask, &xev ) )
+    {
+      mp_msg( MSGT_VO,MSGL_ERR, "\nX11: Couldn't send EWMH fullscreen Event!\n" );
+    }
+  }
+}
+
 void vo_hidecursor ( Display *disp , Window win )
 {
 	Cursor no_ptr;
@@ -1060,11 +1097,15 @@
 
  if ( vo_fs ){
    // fs->win
+   vo_x11_ewmh_fullscreen( 0 ); // removes fullscreen state if wm supports EWMH
+   
    if(vo_dwidth != vo_screenwidth && vo_dheight != vo_screenheight) return;
    vo_fs=VO_FALSE;
    x=vo_old_x; y=vo_old_y; w=vo_old_width; h=vo_old_height;
  } else {
    // win->fs
+   vo_x11_ewmh_fullscreen( 1 ); // sends fullscreen state to be added if wm supports EWMH
+   
    if(vo_old_width && 
      (vo_dwidth==vo_screenwidth && vo_dwidth!=vo_old_width) &&
      (vo_dheight==vo_screenheight && vo_dheight!=vo_old_height) ) return;
Index: Gui/wm/ws.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/wm/ws.c,v
retrieving revision 1.72
diff -u -r1.72 ws.c
--- Gui/wm/ws.c	30 Nov 2003 16:36:04 -0000	1.72
+++ Gui/wm/ws.c	30 May 2004 15:02:52 -0000
@@ -763,6 +763,8 @@
 #ifdef ENABLE_DPMS
    wsScreenSaverOn( wsDisplay );
 #endif
+
+   vo_x11_ewmh_fullscreen( 0 ); // removes fullscreen state to be added if wm supports EWMH
   }
   else
    {
@@ -774,6 +776,8 @@
 #ifdef ENABLE_DPMS
     wsScreenSaverOff( wsDisplay );
 #endif
+    
+     vo_x11_ewmh_fullscreen( 1 ); // sends fullscreen state to be added if wm supports EWMH
    }
 
  vo_x11_decoration( wsDisplay,win->WindowID,decoration );


More information about the MPlayer-dev-eng mailing list