changeset 4017:21a75ab24703

Xinerama patch number two by attila.
author atmos4
date Sun, 06 Jan 2002 21:07:20 +0000
parents b47918337a66
children f94c539fa959
files cfg-mplayer.h libvo/vo_gl.c libvo/vo_gl2.c libvo/vo_x11.c libvo/vo_xmga.c libvo/x11_common.c
diffstat 6 files changed, 60 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Sun Jan 06 19:43:33 2002 +0000
+++ b/cfg-mplayer.h	Sun Jan 06 21:07:20 2002 +0000
@@ -73,6 +73,10 @@
 extern int use_old_pp;
 #endif
 
+#ifdef HAVE_XINERAMA
+extern int xinerama_screen;
+#endif
+
 /* from libvo/aspect.c */
 extern float monitor_aspect;
 
@@ -261,6 +265,10 @@
 	{"rootwin", &WinID, CONF_TYPE_FLAG, 0, -1, 0},
 #endif
 
+#ifdef HAVE_XINERAMA
+	{"xineramascreen", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32},
+#endif
+
 #define MAIN_CONF
 #include "cfg-common.h"
 #undef MAIN_CONF
--- a/libvo/vo_gl.c	Sun Jan 06 19:43:33 2002 +0000
+++ b/libvo/vo_gl.c	Sun Jan 06 21:07:20 2002 +0000
@@ -181,6 +181,9 @@
 	/* Map window. */
 
 	XMapWindow(mDisplay, mywindow);
+#ifdef HAVE_XINERAMA
+	vo_x11_xinerama_move(mDisplay,mywindow);
+#endif
 
 	/* Wait for map. */
 	do 
--- a/libvo/vo_gl2.c	Sun Jan 06 19:43:33 2002 +0000
+++ b/libvo/vo_gl2.c	Sun Jan 06 21:07:20 2002 +0000
@@ -691,6 +691,9 @@
 	/* Map window. */
 
 	XMapWindow(mDisplay, mywindow);
+#ifdef HAVE_XINERAMA
+	vo_x11_xinerama_move(mDisplay,mywindow);
+#endif
         XClearWindow(mDisplay,mywindow);
 
 	/* Wait for map. */
--- a/libvo/vo_x11.c	Sun Jan 06 19:43:33 2002 +0000
+++ b/libvo/vo_x11.c	Sun Jan 06 21:07:20 2002 +0000
@@ -298,6 +298,9 @@
     XSelectInput( mDisplay,mywindow,StructureNotifyMask );
     XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
     XMapWindow( mDisplay,mywindow );
+#ifdef HAVE_XINERAMA
+   vo_x11_xinerama_move(mDisplay,mywindow);
+#endif
     do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow );
     XSelectInput( mDisplay,mywindow,NoEventMask );
 
--- a/libvo/vo_xmga.c	Sun Jan 06 19:43:33 2002 +0000
+++ b/libvo/vo_xmga.c	Sun Jan 06 21:07:20 2002 +0000
@@ -45,6 +45,10 @@
 #include <X11/Xutil.h>
 #include <errno.h>
 
+#ifdef HAVE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+
 #include "x11_common.h"
 #include "sub.h"
 #include "aspect.h"
@@ -139,6 +143,31 @@
 
          mDrawColorKey();
 
+#ifdef HAVE_XINERAMA
+		 if(XineramaIsActive(mDisplay))
+		 {
+		 	XineramaScreenInfo *screens;
+		 	int num_screens;
+		 	int i;
+
+		 	screens = XineramaQueryScreens(mDisplay,&num_screens);
+
+		 	/* find the screen we are on */
+		 	i = 0;
+		 	while(!(screens[i].x_org <= drwcX && screens[i].y_org <= drwcY &&
+		 	       screens[i].x_org + screens[i].width >= drwcX &&
+		 	       screens[i].y_org + screens[i].height >= drwcY ))
+		 	{
+		 		i++;
+		 	}
+
+		 	/* set drwcX and drwcY to the right values */
+		 	drwcX = drwcX - screens[i].x_org;
+		 	drwcY = drwcY - screens[i].y_org;
+		 	XFree(screens);
+		 }
+
+#endif
          mga_vid_config.x_org=drwcX;
          mga_vid_config.y_org=drwcY;
          mga_vid_config.dest_width=drwWidth;
--- a/libvo/x11_common.c	Sun Jan 06 19:43:33 2002 +0000
+++ b/libvo/x11_common.c	Sun Jan 06 21:07:20 2002 +0000
@@ -48,6 +48,12 @@
 /* output window id */
 int WinID=-1;
 
+#ifdef HAVE_XINERAMA
+int xinerama_screen = 0;
+int xinerama_x = 0;
+int xinerama_y = 0;
+#endif
+
 void vo_hidecursor ( Display *disp , Window win )
 {
 	Cursor no_ptr;
@@ -149,13 +155,15 @@
   XineramaScreenInfo *screens;
   int num_screens;
 
-  mScreen = 0;
-
   screens = XineramaQueryScreens(mDisplay, &num_screens);
+  if(xinerama_screen >= num_screens) xinerama_screen = 0;
   if (! vo_screenwidth)
-    vo_screenwidth=screens[mScreen].width;
+    vo_screenwidth=screens[xinerama_screen].width;
   if (! vo_screenheight)
-    vo_screenheight=screens[mScreen].height;
+    vo_screenheight=screens[xinerama_screen].height;
+  xinerama_x = screens[xinerama_screen].x_org;
+  xinerama_y = screens[xinerama_screen].y_org;
+
   XFree(screens);
   }
  else
@@ -482,15 +490,10 @@
 #ifdef HAVE_XINERAMA
 void vo_x11_xinerama_move(Display *dsp, Window w)
 {
-	XineramaScreenInfo *screens;
-	int num_screens;
-
 	if(XineramaIsActive(dsp))
 	{
-		screens = XineramaQueryScreens(dsp,&num_screens);
-		/* printf("XXXX Xinerama screen: x: %hd y: %hd\n",screens[mScreen].x_org,screens[mScreen].y_org); */
-		XMoveWindow(dsp,w,screens[mScreen].x_org,screens[mScreen].y_org);
-		XFree(screens);
+		 /* printf("XXXX Xinerama screen: x: %hd y: %hd\n",xinerama_x,xinerama_y); */
+		XMoveWindow(dsp,w,xinerama_x,xinerama_y);
 	}
 }
 #endif