[MPlayer-dev-eng] [PATCH] x11 vo drivers override user settings for window placement

Mark Tiefenbruck mark at fluxbox.org
Sun Jun 24 21:03:24 CEST 2007


This bug (so far) only exists in the svn version of mplayer. Here's
what happens:

1. Kermit uses mplayer to play a video.
2. mplayer opens a window. At this point, the window manager or
session manager places the window where it thinks is best, taking into
account Kermit's preferences and the size hint already supplied by
mplayer.
3. mplayer moves the window to the center of the screen. The window
manager of course has the opportunity to override this, but it would
need a compelling reason.
4. Kermit complains to me, saying "hey, I really wanted that mplayer
window to be placed according to my settings."

First of all, since you're setting the size hint, the only reason to
move the window at all is in case there isn't a window manager
running. While that probably happens more often for a video player
than most applications, I'd still wager it's pretty rare. However, you
don't have to give up on that case to resolve this. You can just move
the window before mapping it. I've supplied a patch to do just that,
and it works. Oh, and it also makes the gl2 driver set the size hint
before mapping -- that's pretty important.

I'll be in #mplayerdev as _markt all day, in case you have any questions.

  Mark
-------------- next part --------------
Index: libvo/vo_xmga.c
===================================================================
--- libvo/vo_xmga.c	(revision 23613)
+++ libvo/vo_xmga.c	(working copy)
@@ -235,10 +235,10 @@
                 vo_x11_classhint(mDisplay, vo_window, "xmga");
                 vo_hidecursor(mDisplay, vo_window);
                 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
+                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
 
                 XStoreName(mDisplay, vo_window, mTitle);
                 XMapWindow(mDisplay, vo_window);
-                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
 
                 if (flags & VOFLAG_FULLSCREEN)
                     vo_x11_fullscreen();
Index: libvo/vo_xvidix.c
===================================================================
--- libvo/vo_xvidix.c	(revision 23613)
+++ libvo/vo_xvidix.c	(working copy)
@@ -347,10 +347,10 @@
                 vo_x11_classhint(mDisplay, vo_window, "xvidix");
                 vo_hidecursor(mDisplay, vo_window);
                 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
+                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
 
                 XStoreName(mDisplay, vo_window, title);
                 XMapWindow(mDisplay, vo_window);
-                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
 
                 if (flags & VOFLAG_FULLSCREEN)
                     vo_x11_fullscreen();
Index: libvo/vo_xvmc.c
===================================================================
--- libvo/vo_xvmc.c	(revision 23613)
+++ libvo/vo_xvmc.c	(working copy)
@@ -708,8 +708,8 @@
 		| ButtonPressMask | ButtonReleaseMask)) );
          XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
          XSetWMNormalHints( mDisplay,vo_window,&hint );
+	 vo_x11_nofs_sizepos(hint.x, hint.y, hint.width, hint.height);
 	 XMapWindow(mDisplay, vo_window);
-	 vo_x11_nofs_sizepos(hint.x, hint.y, hint.width, hint.height);
 	 if ( flags&VOFLAG_FULLSCREEN ) vo_x11_fullscreen();
 	 else {
 	    vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 );
Index: libvo/vo_xv.c
===================================================================
--- libvo/vo_xv.c	(revision 23613)
+++ libvo/vo_xv.c	(working copy)
@@ -328,8 +328,8 @@
             XSetStandardProperties(mDisplay, vo_window, hello, hello, None,
                                    NULL, 0, &hint);
             vo_x11_sizehint(hint.x, hint.y, hint.width, hint.height, 0);
+            vo_x11_nofs_sizepos(hint.x, hint.y, hint.width, hint.height);
             XMapWindow(mDisplay, vo_window);
-            vo_x11_nofs_sizepos(hint.x, hint.y, hint.width, hint.height);
             if (flags & VOFLAG_FULLSCREEN)
                 vo_x11_fullscreen();
         } else
Index: libvo/vo_gl.c
===================================================================
--- libvo/vo_gl.c	(revision 23613)
+++ libvo/vo_gl.c	(working copy)
@@ -508,6 +508,7 @@
     XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
     /* Set the size hints. */
     vo_x11_sizehint(hint.x, hint.y, hint.width, hint.height, 0);
+    vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
     /* Map window. */
     XMapWindow(mDisplay, vo_window);
 
@@ -523,10 +524,11 @@
     vo_x11_selectinput_witherr(mDisplay, vo_window,
         StructureNotifyMask | KeyPressMask | PointerMotionMask |
         ButtonPressMask | ButtonReleaseMask | ExposureMask);
+  } else {
+    vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
   }
   if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
 
-  vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
   if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
     vo_x11_fullscreen();
 #endif
Index: libvo/vo_x11.c
===================================================================
--- libvo/vo_x11.c	(revision 23613)
+++ libvo/vo_x11.c	(working copy)
@@ -451,6 +451,7 @@
                 vo_x11_classhint(mDisplay, vo_window, "x11");
                 vo_hidecursor(mDisplay, vo_window);
                 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
+                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
                 XSelectInput(mDisplay, vo_window, StructureNotifyMask);
                 XStoreName(mDisplay, vo_window, title);
                 XMapWindow(mDisplay, vo_window);
@@ -462,7 +463,6 @@
                 while (xev.type != MapNotify
                        || xev.xmap.event != vo_window);
 
-                vo_x11_nofs_sizepos(vo_dx, vo_dy, vo_dwidth, vo_dheight);
                 if (fullscreen)
                     vo_x11_fullscreen();
             } else
Index: libvo/vo_gl2.c
===================================================================
--- libvo/vo_gl2.c	(revision 23613)
+++ libvo/vo_gl2.c	(working copy)
@@ -702,6 +702,8 @@
 
     vo_x11_classhint( mDisplay,vo_window,"gl2" );
     vo_hidecursor(mDisplay,vo_window);
+    vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 );
+    vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
 
 	XSelectInput(mDisplay, vo_window, StructureNotifyMask);
 
@@ -711,7 +713,6 @@
 
 	/* Map window. */
 	XMapWindow(mDisplay, vo_window);
-	vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 );
         XClearWindow(mDisplay,vo_window);
 
 	/* Wait for map. */
@@ -727,8 +728,9 @@
         vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
 		 | ButtonPressMask | ButtonReleaseMask | ExposureMask
         );
+  } else {
+    vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
   }
-  vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
   if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
     vo_x11_fullscreen();
 


More information about the MPlayer-dev-eng mailing list