[MPlayer-dev-eng] [PATCH] 2-Win Fullscreen new method + fixes for virtual desktop + application changing

Adam Tla/lka atlka at pg.gda.pl
Fri Jul 30 14:08:20 CEST 2004


Hello,

I tested apps switching a bit and this is my conclusion:
we shouldn't set window layer because we can't see other
windows at all while trying to switch apps.
Moreover some WM (icewm for example) are not detected as EWMH 
fs WM so vo_x11_ewmh_fullscreen function is not used,
and some indicate that this is supported but this is not true
(old fvwm2).

So my last patch in x11_common.c is to call vo_x11_ewmh_fullscreen
always (if WM doesn't supports this just nothing happends)
and not to change window layer at all - this should be maintained by WM
and fs state is a hint for WM  that mplayer window is above all other
windows if active.

So please test it now ;-).
Regards
-- 
Adam Tla/lka      mailto:atlka at pg.gda.pl    ^v^ ^v^ ^v^
System  & Network Administration Group           ~~~~~~
Computer Center,  Gdansk University of Technology, Poland
PGP public key:   finger atlka at sunrise.pg.gda.pl
-------------- next part --------------
--- main/libvo/x11_common.c	2004-07-13 12:37:48.000000000 +0200
+++ main_new/libvo/x11_common.c	2004-07-30 14:01:37.000000000 +0200
@@ -79,7 +79,7 @@
 int vo_mouse_autohide = 0;
 int vo_wm_type = 0;
 int vo_fs_type = 0; // needs to be accessible for GUI X11 code
-static int vo_fs_flip = 0;
+static int vo_fs_flip = 1;
 char **vo_fstype_list;
 
 /* if equal to 1 means that WM is a metacity (broken as hell) */
@@ -126,13 +126,10 @@
  */
 void vo_x11_ewmh_fullscreen(int action)
 {
+        XEvent xev;
     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;
@@ -156,7 +153,6 @@
         {
             mp_msg(MSGT_VO, MSGL_ERR, MSGTR_EwmhFullscreenStateFailed);
         }
-    }
 }
 
 void vo_hidecursor(Display * disp, Window win)
@@ -870,12 +866,6 @@
     if (!WinID)
         return;
 
-    if (vo_fsmode & 8)
-    {
-        XSetTransientForHint(vo_Display, w,
-                             RootWindow(vo_Display, mScreen));
-    }
-
     vo_MotifHints = XInternAtom(vo_Display, "_MOTIF_WM_HINTS", 0);
     if (vo_MotifHints != None)
     {
@@ -1019,6 +1009,11 @@
         switch (Event.type)
         {
             case Expose:
+		if (vo_fs_flip) {
+			vo_hint.win_gravity = old_gravity;
+			XSetWMNormalHints(mDisplay, vo_window, &vo_hint);
+	                vo_fs_flip = 0;
+		}
                 ret |= VO_EVENT_EXPOSE;
                 break;
             case ConfigureNotify:
@@ -1122,11 +1117,6 @@
                     XFree(name);
                 }
                 break;
-            case MapNotify:
-                vo_hint.win_gravity = old_gravity;
-                XSetWMNormalHints(mDisplay, vo_window, &vo_hint);
-                vo_fs_flip = 0;
-                break;
         }
     }
     return ret;
@@ -1395,34 +1385,15 @@
 
 void vo_x11_fullscreen(void)
 {
+    long dummy;
     int x, y, w, h;
 
-    if (WinID >= 0 || vo_fs_flip)
+    if (WinID == 0 || vo_fs_flip)
         return;
 
-    if (vo_fs)
-    {
-        // fs->win
-        if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
-        {
-            if (vo_dwidth != vo_screenwidth && vo_dheight != vo_screenheight)
-                return;
-            x = vo_old_x;
-            y = vo_old_y;
-            w = vo_old_width;
-            h = vo_old_height;
-	}
-
-        vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE);   // removes fullscreen state if wm supports EWMH
-        vo_fs = VO_FALSE;
-    } else
+    if ((vo_fs = !vo_fs))
     {
         // win->fs
-        vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD);      // sends fullscreen state to be added if wm supports EWMH
-
-        vo_fs = VO_TRUE;
-        if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
-        {
             if (vo_old_width &&
                 (vo_dwidth == vo_screenwidth && vo_dwidth != vo_old_width) &&
                 (vo_dheight == vo_screenheight && vo_dheight != vo_old_height))
@@ -1435,49 +1406,40 @@
             y = 0;
             w = vo_screenwidth;
             h = vo_screenheight;
-        }
-    }
+    } else
     {
-        long dummy;
+        // fs->win
+            if (vo_dwidth != vo_screenwidth && vo_dheight != vo_screenheight)
+                return;
+            x = vo_old_x;
+            y = vo_old_y;
+            w = vo_old_width;
+            h = vo_old_height;
+    }
+	
+  
 
         XGetWMNormalHints(mDisplay, vo_window, &vo_hint, &dummy);
         if (!(vo_hint.flags & PWinGravity))
             old_gravity = NorthWestGravity;
         else
             old_gravity = vo_hint.win_gravity;
-    }
-    if (vo_wm_type == 0 && !(vo_fsmode & 16))
-    {
-        XUnmapWindow(mDisplay, vo_window);      // required for MWM
-        XWithdrawWindow(mDisplay, vo_window, mScreen);
-        vo_fs_flip = 1;
-    }
-
-    if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
-    {
-        vo_x11_decoration(mDisplay, vo_window, (vo_fs) ? 0 : 1);
         vo_x11_sizehint(x, y, w, h, 0);
-        vo_x11_setlayer(mDisplay, vo_window, vo_fs);
-
-        if ((!(vo_fs)) & vo_ontop)
-            vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
-
+        vo_x11_ewmh_fullscreen(vo_fs ? _NET_WM_STATE_ADD: _NET_WM_STATE_REMOVE);
+        // moveresize because old fvwm2 is not doing that 
         XMoveResizeWindow(mDisplay, vo_window, x, y, w, h);
-    }
+        vo_fs_flip = 1;
 #ifdef HAVE_XINERAMA
     vo_x11_xinerama_move(mDisplay, vo_window);
 #endif
 
-    XMapRaised(mDisplay, vo_window);
     XRaiseWindow(mDisplay, vo_window);
     XFlush(mDisplay);
 }
 
 void vo_x11_ontop(void)
 {
-    vo_ontop = (!(vo_ontop));
-
-    vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+    vo_x11_setlayer(mDisplay, vo_window, (vo_ontop = !(vo_ontop)));
 }
 
 /*


More information about the MPlayer-dev-eng mailing list