diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-04-01 12:10:12 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-04-01 12:10:12 +0100 |
commit | 2060456a465de71c52f9ef025cdf515847fae81e (patch) | |
tree | 6832e03e382e20a35232daf77b062ec91173d07f | |
parent | 475d248cef2c84e56458f9faa4d95157ed904f8b (diff) | |
parent | fca8dc060c98919bd8dfb2639b1096247737a284 (diff) |
Merge branch 'pseudoramix-multiwindow' into cygwin-patches-for-1.12
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | hw/xquartz/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 55 | ||||
-rw-r--r-- | hw/xwin/Makefile.am | 2 | ||||
-rw-r--r-- | hw/xwin/man/XWin.man | 3 | ||||
-rw-r--r-- | hw/xwin/winprocarg.c | 4 | ||||
-rw-r--r-- | hw/xwin/winscrinit.c | 21 | ||||
-rw-r--r-- | pseudoramiX/Makefile.am | 7 | ||||
-rw-r--r-- | pseudoramiX/pseudoramiX.c (renamed from hw/xquartz/pseudoramiX.c) | 70 | ||||
-rw-r--r-- | pseudoramiX/pseudoramiX.h (renamed from hw/xquartz/pseudoramiX.h) | 0 |
11 files changed, 133 insertions, 33 deletions
diff --git a/Makefile.am b/Makefile.am index cea140bea..a8d612ca6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,7 @@ SUBDIRS = \ Xext \ miext \ os \ + pseudoramiX \ randr \ render \ Xi \ @@ -77,6 +78,7 @@ DIST_SUBDIRS = \ Xext \ miext \ os \ + pseudoramiX \ randr \ render \ Xi \ diff --git a/configure.ac b/configure.ac index 6d4937809..64886099f 100644 --- a/configure.ac +++ b/configure.ac @@ -2153,6 +2153,7 @@ miext/shadow/Makefile miext/cw/Makefile miext/rootless/Makefile os/Makefile +pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index a7cc012d9..57928005c 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -28,7 +28,6 @@ libXquartz_la_SOURCES = \ darwinEvents.c \ darwinXinput.c \ keysym2ucs.c \ - pseudoramiX.c \ quartz.c \ quartzCocoa.m \ quartzKeyboard.c \ diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 6e5c366aa..a1d92b1b4 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -56,6 +56,8 @@ typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)( ); #endif #include "ddxhooks.h" +#include "winmonitors.h" +#include "pseudoramiX/pseudoramiX.h" /* * References to external symbols @@ -1044,6 +1046,59 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) } } + /* + Unless full xinerama has been explicitly enabled, register all native screens with pseduoramiX + */ + if (!noPanoramiXExtension) + noPseudoramiXExtension = TRUE; + + if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension) + { + int pass; + + PseudoramiXExtensionInit(argc, argv); + + /* Add primary monitor on pass 0, other monitors on pass 1, to ensure + the primary monitor is first in XINERAMA list */ + for (pass = 0; pass < 2; pass++) + { + int iMonitor; + + for (iMonitor = 1; ; iMonitor++) + { + struct GetMonitorInfoData data; + QueryMonitor(iMonitor, &data); + if (data.bMonitorSpecifiedExists) + { + MONITORINFO mi; + mi.cbSize = sizeof(MONITORINFO); + + if (GetMonitorInfo(data.monitorHandle, &mi)) + { + /* pass == 1 XOR primary monitor flags is set */ + if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY))) + { + /* + Note the screen origin in a normalized coordinate space where (0,0) is at the top left + of the native virtual desktop area + */ + data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN); + data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN); + + winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n", + iMonitor-1, data.monitorOffsetX, data.monitorOffsetY); + + PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY, + data.monitorWidth, data.monitorHeight); + } + } + } + else + break; + } + } + } + #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Generate a cookie used by internal clients for authorization */ diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am index 7e579f484..edcd1b5b8 100644 --- a/hw/xwin/Makefile.am +++ b/hw/xwin/Makefile.am @@ -150,6 +150,8 @@ XWin_SOURCES = $(SRCS) INCLUDES = -I$(top_srcdir)/miext/rootless +XWIN_LIBS += $(top_builddir)/pseudoramix/libPseudoramiX.la + XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) XWin_LDFLAGS = -mwindows -static diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index c71f6a154..cf5324131 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -76,6 +76,9 @@ preceeding \fB\-screen\fP parameter. .B \-[no]multimonitors or \-[no]multiplemonitors Create a screen 0 that covers all monitors [the primary monitor] on a system with multiple monitors. +Fake XINERAMA data is created describing the individual monitors, +(This is similar to the 'merged framebuffer' or 'pseudo-xinerama' mode provided by +some drivers for the xorg X server). This option is currently enabled by default in \fB\-multiwindow\fP mode. .TP 8 .B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] " diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 674aa03db..a9217ed70 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -99,13 +99,13 @@ winInitializeScreenDefaults(void) int dpiX = GetDeviceCaps(hdc, LOGPIXELSX); int dpiY = GetDeviceCaps(hdc, LOGPIXELSY); - winErrorFVerb(2, "winInitializeDefaultScreens - native DPI x %d y %d\n", dpiX, dpiY); + winErrorFVerb(2, "winInitializeScreenDefaults - native DPI x %d y %d\n", dpiX, dpiY); monitorResolution = dpiY; ReleaseDC(NULL, hdc); } else { - winErrorFVerb(1, "winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI); + winErrorFVerb(1, "winInitializeScreenDefaults - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI); monitorResolution = WIN_DEFAULT_DPI; } } diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index fa6838a78..77c6bf5a3 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -232,15 +232,18 @@ winScreenInit (int index, else winErrorFVerb(2, "winScreenInit - Using software cursor\n"); - /* - Note the screen origin in a normalized coordinate space where (0,0) is at the top left - of the native virtual desktop area - */ - pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); - pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); - - ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", - index, pScreen->x, pScreen->y); + if (!noPanoramiXExtension) + { + /* + Note the screen origin in a normalized coordinate space where (0,0) is at the top left + of the native virtual desktop area + */ + pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); + pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); + + ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", + index, pScreen->x, pScreen->y); + } #if CYGDEBUG || YES winDebug ("winScreenInit - returning\n"); diff --git a/pseudoramiX/Makefile.am b/pseudoramiX/Makefile.am new file mode 100644 index 000000000..4dfceb765 --- /dev/null +++ b/pseudoramiX/Makefile.am @@ -0,0 +1,7 @@ +# Fake Xinerama extension + +AM_CFLAGS = $(DIX_CFLAGS) + +noinst_LTLIBRARIES = libPseudoramix.la + +libPseudoramix_la_SOURCES = pseudoramiX.c pseudoramiX.h diff --git a/hw/xquartz/pseudoramiX.c b/pseudoramiX/pseudoramiX.c index 5a5b9c2e7..177af9fbd 100644 --- a/hw/xquartz/pseudoramiX.c +++ b/pseudoramiX/pseudoramiX.c @@ -37,7 +37,6 @@ Equipment Corporation. #include <dix-config.h> #endif -#include "darwin.h" #include "pseudoramiX.h" #include "extnsionst.h" #include "dixstruct.h" @@ -45,6 +44,9 @@ Equipment Corporation. #include <X11/extensions/panoramiXproto.h> #include "globals.h" +#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__) +#define DEBUG_LOG PseudoramiXDebug + Bool noPseudoramiXExtension = FALSE; extern int ProcPanoramiXQueryVersion (ClientPtr client); @@ -80,6 +82,23 @@ static int pseudoramiXScreensAllocated = 0; static int pseudoramiXNumScreens = 0; static unsigned long pseudoramiXGeneration = 0; +static void +PseudoramiXTrace(const char *format, ...) +{ + va_list ap; + va_start (ap, format); + LogVMessageVerb(X_NONE, 10, format, ap); + va_end (ap); +} + +static void +PseudoramiXDebug(const char *format, ...) +{ + va_list ap; + va_start (ap, format); + LogVMessageVerb(X_NONE, 3, format, ap); + va_end (ap); +} // Add a PseudoramiX screen. // The rest of the X server will know nothing about this screen. @@ -118,7 +137,7 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) if (noPseudoramiXExtension) return; - TRACE(); + TRACE; /* Even with only one screen we need to enable PseudoramiX to allow dynamic screen configuration changes. */ @@ -154,7 +173,7 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) void PseudoramiXResetScreens(void) { - TRACE(); + TRACE; pseudoramiXNumScreens = 0; } @@ -162,7 +181,7 @@ void PseudoramiXResetScreens(void) static void PseudoramiXResetProc(ExtensionEntry *extEntry) { - TRACE(); + TRACE; PseudoramiXResetScreens(); } @@ -171,7 +190,7 @@ static void PseudoramiXResetProc(ExtensionEntry *extEntry) // was PanoramiX static int ProcPseudoramiXQueryVersion(ClientPtr client) { - TRACE(); + TRACE; return ProcPanoramiXQueryVersion(client); } @@ -185,7 +204,7 @@ static int ProcPseudoramiXGetState(ClientPtr client) xPanoramiXGetStateReply rep; register int rc; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); @@ -196,10 +215,11 @@ static int ProcPseudoramiXGetState(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; rep.state = !noPseudoramiXExtension; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.state); + swapl(&rep.window); } WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep); return Success; @@ -214,7 +234,7 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client) xPanoramiXGetScreenCountReply rep; register int rc; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); @@ -225,10 +245,11 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; rep.ScreenCount = pseudoramiXNumScreens; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.ScreenCount); + swapl(&rep.window); } WriteToClient (client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep); return Success; @@ -243,8 +264,11 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) xPanoramiXGetScreenSizeReply rep; register int n, rc; - TRACE(); + TRACE; + if (stuff->screen >= PanoramiXNumScreens) + return BadMatch; + REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) @@ -258,11 +282,15 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) // was screenInfo.screens[stuff->screen]->width; rep.height = pseudoramiXScreens[stuff->screen].h; // was screenInfo.screens[stuff->screen]->height; + rep.window = stuff->window; + rep.screen = stuff->screen; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.width); - swaps(&rep.height); + swapl(&rep.width); + swapl(&rep.height); + swapl(&rep.window); + swapl(&rep.screen); } WriteToClient (client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep); return Success; @@ -275,7 +303,7 @@ static int ProcPseudoramiXIsActive(ClientPtr client) /* REQUEST(xXineramaIsActiveReq); */ xXineramaIsActiveReply rep; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -341,7 +369,7 @@ static int ProcPseudoramiXQueryScreens(ClientPtr client) // was PanoramiX static int ProcPseudoramiXDispatch (ClientPtr client) { REQUEST(xReq); - TRACE(); + TRACE; switch (stuff->data) { case X_PanoramiXQueryVersion: @@ -367,7 +395,7 @@ SProcPseudoramiXQueryVersion (ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); @@ -379,7 +407,7 @@ SProcPseudoramiXGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); @@ -391,7 +419,7 @@ SProcPseudoramiXGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); @@ -403,7 +431,7 @@ SProcPseudoramiXGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); @@ -416,7 +444,7 @@ SProcPseudoramiXIsActive(ClientPtr client) { REQUEST(xXineramaIsActiveReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -429,7 +457,7 @@ SProcPseudoramiXQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); @@ -441,7 +469,7 @@ static int SProcPseudoramiXDispatch (ClientPtr client) { REQUEST(xReq); - TRACE(); + TRACE; switch (stuff->data) { diff --git a/hw/xquartz/pseudoramiX.h b/pseudoramiX/pseudoramiX.h index df5010d1d..df5010d1d 100644 --- a/hw/xquartz/pseudoramiX.h +++ b/pseudoramiX/pseudoramiX.h |