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

Alexander Strasser eclipse7 at gmx.net
Mon May 31 15:50:36 CEST 2004


Made some enchancements and attached the modified patch.
It also contains the german translation of the err msg.
                                                                                                                            
  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	31 May 2004 10:42:46 -0000
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "video_out.h"
 #include "aspect.h"
@@ -115,6 +116,48 @@
 
 static int vo_x11_get_fs_type(int supported);
 
+
+/*
+ * Sends the EWMH fullscreen state event.
+ * 
+ * action: could be on of _NET_WM_STATE_REMOVE -- remove state
+ *                        _NET_WM_STATE_ADD    -- add state
+ *                        _NET_WM_STATE_TOGGLE -- toggle
+ */
+void vo_x11_ewmh_fullscreen( int action )
+{
+  assert( action == _NET_WM_STATE_REMOVE ||
+          action == _NET_WM_STATE_ADD ||
+          action == _NET_WM_STATE_TOGGLE    );
+  
+  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, MSGTR_EwmhFullscreenStateFailed );
+    }
+  }
+}
+
 void vo_hidecursor ( Display *disp , Window win )
 {
 	Cursor no_ptr;
@@ -1060,11 +1103,15 @@
 
  if ( vo_fs ){
    // fs->win
+   vo_x11_ewmh_fullscreen( _NET_WM_STATE_REMOVE ); // 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( _NET_WM_STATE_ADD ); // 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: libvo/x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.34
diff -u -r1.34 x11_common.h
--- libvo/x11_common.h	30 Nov 2003 16:36:10 -0000	1.34
+++ libvo/x11_common.h	31 May 2004 10:42:46 -0000
@@ -14,6 +14,11 @@
 #define vo_wm_BELOW 16
 #define vo_wm_NETWM (vo_wm_FULLSCREEN | vo_wm_STAYS_ON_TOP | vo_wm_ABOVE | vo_wm_BELOW)
 
+/*** EWMH state actions ***/
+#define _NET_WM_STATE_REMOVE        0    /* remove/unset property */
+#define _NET_WM_STATE_ADD           1    /* add/set property */
+#define _NET_WM_STATE_TOGGLE        2    /* toggle property  */
+
 extern int metacity_hack;
 extern int vo_fsmode;
 
@@ -62,6 +67,7 @@
 	int img_width, int img_height, int use_fs);
 extern void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
 extern void vo_x11_ontop();
+extern void vo_x11_ewmh_fullscreen( int action );
 
 #endif
 
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	31 May 2004 10:42:48 -0000
@@ -763,6 +763,8 @@
 #ifdef ENABLE_DPMS
    wsScreenSaverOn( wsDisplay );
 #endif
+
+   vo_x11_ewmh_fullscreen( _NET_WM_STATE_REMOVE ); // removes fullscreen state if wm supports EWMH
   }
   else
    {
@@ -774,6 +776,8 @@
 #ifdef ENABLE_DPMS
     wsScreenSaverOff( wsDisplay );
 #endif
+    
+     vo_x11_ewmh_fullscreen( _NET_WM_STATE_ADD ); // adds fullscreen state if wm supports EWMH
    }
 
  vo_x11_decoration( wsDisplay,win->WindowID,decoration );
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.116
diff -u -r1.116 help_mp-en.h
--- help/help_mp-en.h	27 Apr 2004 16:28:06 -0000	1.116
+++ help/help_mp-en.h	31 May 2004 10:42:50 -0000
@@ -360,6 +360,9 @@
 #define MSGTR_MovieAspectIsSet "Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n"
 #define MSGTR_MovieAspectUndefined "Movie-Aspect is undefined - no prescaling applied.\n"
 
+// x11_common.c
+#define MSGTR_EwmhFullscreenStateFailed "\nX11: Couldn't send EWMH fullscreen Event!\n"
+
 // ====================== GUI messages/buttons ========================
 
 #ifdef HAVE_NEW_GUI
Index: help/help_mp-de.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-de.h,v
retrieving revision 1.77
diff -u -r1.77 help_mp-de.h
--- help/help_mp-de.h	30 May 2004 18:41:31 -0000	1.77
+++ help/help_mp-de.h	31 May 2004 10:42:52 -0000
@@ -363,6 +363,9 @@
 #define MSGTR_MovieAspectIsSet "Seitenverh?ltnis ist %.2f:1 - Skaliere zur korrekten Videogr??e.\n"
 #define MSGTR_MovieAspectUndefined "Seitenverh?ltnis ist undefiniert - skaliere nicht.\n"
 
+// x11_common.c
+#define MSGTR_EwmhFullscreenStateFailed "\nX11: Konnte EWMH-Fullscreen-Event nicht senden!\n"
+
 // ====================== GUI messages/buttons ========================
 
 #ifdef HAVE_NEW_GUI


More information about the MPlayer-dev-eng mailing list