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

Adam Tla/lka atlka at pg.gda.pl
Thu Jul 29 16:02:29 CEST 2004


Hi,
I attached a patch which is doing fs without unmapping window.
I tested it with metacity, icewm, fvwm2 and no manager at all
and it seems working.
Please test it.

Of course for gui version should be additional patch because
gui is doing same things in another fragment of code, 
so x11_common.c change is not enough.

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-29 15:53:17.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) */
@@ -870,12 +870,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 +1013,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 +1121,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 +1389,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 +1410,47 @@
             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);
-
-        XMoveResizeWindow(mDisplay, vo_window, x, y, w, h);
-    }
+    	vo_x11_setlayer(mDisplay, vo_window, vo_fs|vo_ontop);
+    if (vo_fs_type & vo_wm_FULLSCREEN) //  EWMH fs
+	    vo_x11_ewmh_fullscreen(vo_fs? 
+			    _NET_WM_STATE_ADD:
+			    _NET_WM_STATE_REMOVE);
+    else
+	    vo_x11_decoration(mDisplay, vo_window, vo_fs ? 0 : 1);
+    // 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