[MPlayer-dev-eng] Patch for multi-screen xinerama setup.

daniel carter hedonist at win.co.nz
Fri Dec 14 14:56:26 CET 2001


dan carter wrote:

> i think it would be better
> to define two more general variables vo_screenx and vo_screeny in
> video_out.h
>

OK, here's a new patch that does it this alternative way.  I patched all the
drivers i could find that used X to set their position (x11, xv, xmga, gl,
gl2, 3dfx)

You guys interested in this?

The only alternative way i can see is to do all the screen size calculations
after the window manager has placed the window on the screen, adding a bunch
of logic to find which screen the xy of the window lies in... messy i think,
and when you are doing it full screen you would have a chicken and egg
problem.

The commandline parameter approach is also nice for window managers that are
not xinerama aware.
-------------- next part --------------
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.111
diff -u -r1.111 cfg-mplayer.h
--- cfg-mplayer.h	4 Dec 2001 21:04:17 -0000	1.111
+++ cfg-mplayer.h	14 Dec 2001 13:59:36 -0000
@@ -41,6 +41,10 @@
 extern int vo_dbpp;
 #endif

+#ifdef HAVE_XINERAMA
+extern int vo_xineramascreen;
+#endif
+
 #ifdef USE_SUB
 extern int sub_unicode;
 extern int sub_utf8;
@@ -222,6 +226,11 @@
 	{"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15},
 	{"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1},
 	{"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0},
+#endif
+
+#ifdef HAVE_XINERAMA
+//	need to find max possible number of screen for range but unlikey to be more than 100
+	{"xineramascreen", &vo_xineramascreen, CONF_TYPE_INT, CONF_RANGE, 0, 100},
 #endif

 #ifdef HAVE_AA
Index: libvo/video_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.c,v
retrieving revision 1.30
diff -u -r1.30 video_out.c
--- libvo/video_out.c	3 Dec 2001 01:09:36 -0000	1.30
+++ libvo/video_out.c	14 Dec 2001 13:59:38 -0000
@@ -35,6 +35,8 @@
 int vo_depthonscreen=0;
 int vo_screenwidth=0;
 int vo_screenheight=0;
+int vo_screenx=0;
+int vo_screeny=0;

 // requested resolution/bpp:  (-x -y -bpp options)
 int vo_dwidth=0;
Index: libvo/video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.13
diff -u -r1.13 video_out.h
--- libvo/video_out.h	29 Nov 2001 17:31:58 -0000	1.13
+++ libvo/video_out.h	14 Dec 2001 13:59:38 -0000
@@ -105,6 +105,8 @@
 extern int vo_depthonscreen;
 extern int vo_screenwidth;
 extern int vo_screenheight;
+extern int vo_screenx;
+extern int vo_screeny;

 // requested resolution/bpp:  (-x -y -bpp options)
 extern int vo_dwidth;
Index: libvo/vo_3dfx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_3dfx.c,v
retrieving revision 1.8
diff -u -r1.8 vo_3dfx.c
--- libvo/vo_3dfx.c	27 Sep 2001 12:22:27 -0000	1.8
+++ libvo/vo_3dfx.c	14 Dec 2001 13:59:39 -0000
@@ -157,8 +157,8 @@

 	screen = DefaultScreen(display);

-	hint.x = 0;
-	hint.y = 10;
+	hint.x = vo_screenx;
+	hint.y = vo_screeny + 10;
 	hint.width = dispwidth;
 	hint.height = dispheight;
 	hint.flags = PPosition | PSize;
Index: libvo/vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.15
diff -u -r1.15 vo_gl.c
--- libvo/vo_gl.c	6 Nov 2001 11:21:08 -0000	1.15
+++ libvo/vo_gl.c	14 Dec 2001 13:59:40 -0000
@@ -129,8 +129,8 @@
           aspect(&d_width,&d_height,A_ZOOM);
         }
 #endif
-	hint.x = 0;
-	hint.y = 0;
+	hint.x = vo_screenx;
+	hint.y = vo_screeny;
 	hint.width = d_width;
 	hint.height = d_height;
 	hint.flags = PPosition | PSize;
Index: libvo/vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.8
diff -u -r1.8 vo_gl2.c
--- libvo/vo_gl2.c	6 Nov 2001 11:21:08 -0000	1.8
+++ libvo/vo_gl2.c	14 Dec 2001 13:59:41 -0000
@@ -637,14 +637,14 @@
         {
 	        isFullscreen = GL_TRUE;
                 aspect(&d_width,&d_height,A_ZOOM);
-		hint.x = 0;
-		hint.y = 0;
+		hint.x = vo_screenx;
+		hint.y = vo_screeny;
 		hint.width = vo_screenwidth;
 		hint.height = vo_screenheight;
 		hint.flags = PPosition | PSize;
         } else {
-		hint.x = 0;
-		hint.y = 0;
+		hint.x = vo_screenx;
+		hint.y = vo_screeny;
 		hint.width = d_width;
 		hint.height = d_height;
 		hint.flags = PPosition | PSize;
Index: libvo/vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.43
diff -u -r1.43 vo_x11.c
--- libvo/vo_x11.c	11 Dec 2001 15:34:21 -0000	1.43
+++ libvo/vo_x11.c	14 Dec 2001 13:59:44 -0000
@@ -191,11 +191,11 @@
    {
     if( !vo_init() ) return 0; // Can't open X11

-    hint.x=0;
-    hint.y=0;
+    hint.x=vo_screenx;
+    hint.y=vo_screeny;
     hint.width=image_width;
     hint.height=image_height;
-
+

 #ifdef HAVE_XF86VM
     if (vm) {
Index: libvo/vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.34
diff -u -r1.34 vo_xmga.c
--- libvo/vo_xmga.c	18 Oct 2001 02:42:20 -0000	1.34
+++ libvo/vo_xmga.c	14 Dec 2001 13:59:45 -0000
@@ -236,7 +236,7 @@

  mvWidth=width; mvHeight=height;

- wndX=0; wndY=0;
+ wndX=vo_screenx; wndY=vo_screeny;
  wndWidth=d_width; wndHeight=d_height;
  #ifdef HAVE_NEW_GUI
 //  mdwidth=d_width; mdheight=d_height;
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.37
diff -u -r1.37 vo_xv.c
--- libvo/vo_xv.c	18 Oct 2001 02:42:20 -0000	1.37
+++ libvo/vo_xv.c	14 Dec 2001 13:59:46 -0000
@@ -155,8 +155,9 @@
  if ( vo_window == None )
   {
 #endif
-   hint.x = 0;
-   hint.y = 0;
+
+   hint.x = vo_screenx;
+   hint.y = vo_screeny;
    hint.width = d_width;
    hint.height = d_height;
    aspect(&d_width,&d_height,A_NOZOOM);
Index: libvo/x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.36
diff -u -r1.36 x11_common.c
--- libvo/x11_common.c	11 Dec 2001 16:45:25 -0000	1.36
+++ libvo/x11_common.c	14 Dec 2001 13:59:46 -0000
@@ -45,6 +45,10 @@
 int mScreen;
 int mLocalDisplay;

+#ifdef HAVE_XINERAMA
+int vo_xineramascreen = 1;
+#endif
+

 void vo_hidecursor ( Display *disp , Window win )
 {
@@ -144,15 +148,19 @@
   {
   XineramaScreenInfo *screens;
   int num_screens;
-  int disp_screen = mScreen;

   screens = XineramaQueryScreens(mDisplay, &num_screens);
-  if (disp_screen > num_screens)
-    disp_screen = 0;
+  if( vo_xineramascreen > num_screens )
+    {
+     printf( "vo: requested xinerama screen %d, only %d screens available, using first screen\n",vo_xineramascreen,num_screens);
+     vo_xineramascreen = 1;
+    }
+  vo_screenx = screens[vo_xineramascreen-1].x_org;
+  vo_screeny = screens[vo_xineramascreen-1].y_org;
   if (! vo_screenwidth)
-    vo_screenwidth=screens[disp_screen].width;
+    vo_screenwidth=screens[vo_xineramascreen-1].width;
   if (! vo_screenheight)
-    vo_screenheight=screens[disp_screen].height;
+    vo_screenheight=screens[vo_xineramascreen-1].height;
   }
  else
 #endif
Index: libvo/x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.11
diff -u -r1.11 x11_common.h
--- libvo/x11_common.h	24 Oct 2001 17:04:08 -0000	1.11
+++ libvo/x11_common.h	14 Dec 2001 13:59:46 -0000
@@ -4,6 +4,8 @@
 extern int vo_depthonscreen;
 extern int vo_screenwidth;
 extern int vo_screenheight;
+extern int vo_screenx;
+extern int vo_screeny;
 extern int vo_dwidth;
 extern int vo_dheight;

@@ -32,6 +34,10 @@
 #endif
 #ifdef HAVE_GUI
  extern Display * vo_display;
+#endif
+
+#ifdef HAVE_XINERAMA
+ extern int vo_xineramascreen;
 #endif

 void saver_off( Display * );


More information about the MPlayer-dev-eng mailing list