[Mplayer-cvslog] CVS: main/Gui/wm ws.c,1.67,1.68 ws.h,1.25,1.26
Zoltan Ponekker
pontscho at mplayerhq.hu
Mon May 26 10:45:46 CEST 2003
Update of /cvsroot/mplayer/main/Gui/wm
In directory mail:/var/tmp.root/cvs-serv25592/Gui/wm
Modified Files:
ws.c ws.h
Log Message:
From: Ben Low <ben at bdlow.net>
[PATCH] xineramascreen for gmplayer (the right way)
Index: ws.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/wm/ws.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- ws.c 23 May 2003 17:39:33 -0000 1.67
+++ ws.c 26 May 2003 08:45:43 -0000 1.68
@@ -33,11 +33,19 @@
#include <X11/extensions/shape.h>
#endif
+#ifdef HAVE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+
#include <sys/ipc.h>
#include <sys/shm.h>
#undef ENABLE_DPMS
+#ifdef HAVE_XINERAMA
+extern int xinerama_screen;
+#endif
+
typedef struct
{
unsigned long flags;
@@ -51,6 +59,8 @@
int wsMaxX = 0; // Screen width.
int wsMaxY = 0; // Screen height.
+int wsOrgX = 0; // Screen origin x.
+int wsOrgY = 0; // Screen origin y.
Display * wsDisplay;
int wsScreen;
@@ -227,8 +237,29 @@
wsScreen=DefaultScreen( wsDisplay );
wsRootWin=RootWindow( wsDisplay,wsScreen );
+#ifdef HAVE_XINERAMA
+ if(XineramaIsActive(wsDisplay))
+ {
+ XineramaScreenInfo *screens;
+ int num_screens;
+
+ screens = XineramaQueryScreens(wsDisplay, &num_screens);
+ if(xinerama_screen >= num_screens) xinerama_screen = 0;
+ wsOrgX = screens[xinerama_screen].x_org;
+ wsOrgY = screens[xinerama_screen].y_org;
+ wsMaxX=screens[xinerama_screen].width;
+ wsMaxY=screens[xinerama_screen].height;
+ mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] screens %d Max %d, %d Org %d,%d\n",
+ num_screens, wsMaxX, wsMaxY, wsOrgX, wsOrgY);
+ XFree(screens);
+ }
+ else
+#endif
+ {
+ wsOrgX = wsOrgY = 0;
wsMaxX=DisplayWidth( wsDisplay,wsScreen );
wsMaxY=DisplayHeight( wsDisplay,wsScreen );
+ }
wsGetDepthOnScreen();
#ifdef DEBUG
@@ -236,6 +267,9 @@
int minor,major,shp;
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Screen depth: %d\n",wsDepthOnScreen );
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] size: %dx%d\n",wsMaxX,wsMaxY );
+#ifdef HAVE_XINERAMA
+ mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] origin: +%d+%d\n",wsOrgX,wsOrgY );
+#endif
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] red mask: 0x%x\n",wsRedMask );
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] green mask: 0x%x\n",wsGreenMask );
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] blue mask: 0x%x\n",wsBlueMask );
@@ -318,14 +352,14 @@
// The window position and size.
switch ( X )
{
- case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ); break;
- case -2: win->X=wsMaxX - wX - 1; break;
+ case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ) + wsOrgX; break;
+ case -2: win->X=wsMaxX - wX - 1 + wsOrgX; break;
default: win->X=X; break;
}
switch ( Y )
{
- case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ); break;
- case -2: win->Y=wsMaxY - hY - 1; break;
+ case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ) + wsOrgY; break;
+ case -2: win->Y=wsMaxY - hY - 1 + wsOrgY; break;
default: win->Y=Y; break;
}
win->Width=wX;
@@ -740,7 +774,7 @@
{
win->OldX=win->X; win->OldY=win->Y;
win->OldWidth=win->Width; win->OldHeight=win->Height;
- win->X=0; win->Y=0;
+ win->X=wsOrgX; win->Y=wsOrgY;
win->Width=wsMaxX; win->Height=wsMaxY;
win->isFullScreen=True;
#ifdef ENABLE_DPMS
@@ -811,14 +845,14 @@
{
switch ( x )
{
- case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ); break;
- case -2: win->X=wsMaxX - win->Width; break;
+ case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ) + wsOrgX; break;
+ case -2: win->X=wsMaxX - win->Width + wsOrgX; break;
default: win->X=x; break;
}
switch ( y )
{
- case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ); break;
- case -2: win->Y=wsMaxY - win->Height; break;
+ case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ) + wsOrgY; break;
+ case -2: win->Y=wsMaxY - win->Height + wsOrgY; break;
default: win->Y=y; break;
}
}
Index: ws.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/wm/ws.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ws.h 15 Jan 2003 11:16:27 -0000 1.25
+++ ws.h 26 May 2003 08:45:43 -0000 1.26
@@ -169,6 +169,8 @@
extern int wsMaxX;
extern int wsMaxY;
+extern int wsOrgX;
+extern int wsOrgY;
extern Display * wsDisplay;
extern int wsScreen;
More information about the MPlayer-cvslog
mailing list