aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/quartz.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-09-30 09:49:59 +0000
committermarha <marha@users.sourceforge.net>2010-09-30 09:49:59 +0000
commitf952d0d771de6d9b8ecc3cbbe3624203723bbb25 (patch)
tree6dd2d11e017529c66f2489000136201829dc3b9d /xorg-server/hw/xquartz/quartz.c
parentf6ba83c963bf48dfa349ab8c54d1968c4c69f7b8 (diff)
downloadvcxsrv-f952d0d771de6d9b8ecc3cbbe3624203723bbb25.tar.gz
vcxsrv-f952d0d771de6d9b8ecc3cbbe3624203723bbb25.tar.bz2
vcxsrv-f952d0d771de6d9b8ecc3cbbe3624203723bbb25.zip
xserver libX11 xkeyboard-config git update 30/9/2010
Diffstat (limited to 'xorg-server/hw/xquartz/quartz.c')
-rw-r--r--xorg-server/hw/xquartz/quartz.c201
1 files changed, 82 insertions, 119 deletions
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
index 3aa234e09..7a92755c7 100644
--- a/xorg-server/hw/xquartz/quartz.c
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -35,6 +35,7 @@
#endif
#include "quartzCommon.h"
+#include "quartzRandR.h"
#include "inputstr.h"
#include "quartz.h"
#include "darwin.h"
@@ -46,7 +47,6 @@
#include "X11Application.h"
#include <X11/extensions/applewmconst.h>
-#include <X11/extensions/randr.h>
// X headers
#include "scrnintstr.h"
@@ -56,6 +56,8 @@
#include "mi.h"
// System headers
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -64,41 +66,20 @@
#include <rootlessCommon.h>
#include <Xplugin.h>
-#define FAKE_RANDR 1
-
-// Shared global variables for Quartz modes
-int quartzUseSysBeep = 0;
-int quartzServerVisible = FALSE;
DevPrivateKeyRec quartzScreenKeyRec;
int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
const char *quartzOpenGLBundle = NULL;
-int quartzFullscreenDisableHotkeys = TRUE;
-int quartzOptionSendsAlt = FALSE;
-
-#if defined(RANDR) && !defined(FAKE_RANDR)
-Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
- return FALSE;
-}
-
-Bool QuartzRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize) {
- return FALSE;
-}
-Bool QuartzRandRInit (ScreenPtr pScreen) {
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen)) return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = QuartzRandRGetInfo;
- pScrPriv->rrSetConfig = QuartzRandRSetConfig;
- return TRUE;
-}
-#endif
+Bool XQuartzFullscreenDisableHotkeys = TRUE;
+Bool XQuartzOptionSendsAlt = FALSE;
+Bool XQuartzEnableKeyEquivalents = TRUE;
+Bool XQuartzFullscreenVisible = FALSE;
+Bool XQuartzRootlessDefault = TRUE;
+Bool XQuartzIsRootless = TRUE;
+Bool XQuartzServerVisible = FALSE;
+Bool XQuartzFullscreenMenu = FALSE;
+Bool XQuartzUseSysBeep = FALSE;
/*
===========================================================================
@@ -143,6 +124,13 @@ Bool QuartzSetupScreen(
if (! quartzProcs->InitCursor(pScreen))
return FALSE;
+#if defined(RANDR)
+ if(!QuartzRandRInit(pScreen)) {
+ DEBUG_LOG("Failed to init RandR extension.\n");
+ return FALSE;
+ }
+#endif
+
return TRUE;
}
@@ -165,11 +153,6 @@ void QuartzInitOutput(
if (!dixRegisterPrivateKey(&quartzScreenKeyRec, PRIVATE_SCREEN, 0))
FatalError("Failed to alloc quartz screen private.\n");
-#if defined(RANDR) && !defined(FAKE_RANDR)
- if(!QuartzRandRInit(pScreen))
- FatalError("Failed to init RandR extension.\n");
-#endif
-
// Do display mode specific initialization
quartzProcs->DisplayInit();
}
@@ -191,50 +174,6 @@ void QuartzInitInput(
}
-#ifdef FAKE_RANDR
-
-static const int padlength[4] = {0, 3, 2, 1};
-
-static void
-RREditConnectionInfo (ScreenPtr pScreen)
-{
- xConnSetup *connSetup;
- char *vendor;
- xPixmapFormat *formats;
- xWindowRoot *root;
- xDepth *depth;
- xVisualType *visual;
- int screen = 0;
- int d;
-
- connSetup = (xConnSetup *) ConnectionInfo;
- vendor = (char *) connSetup + sizeof (xConnSetup);
- formats = (xPixmapFormat *) ((char *) vendor +
- connSetup->nbytesVendor +
- padlength[connSetup->nbytesVendor & 3]);
- root = (xWindowRoot *) ((char *) formats +
- sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
- while (screen != pScreen->myNum)
- {
- depth = (xDepth *) ((char *) root +
- sizeof (xWindowRoot));
- for (d = 0; d < root->nDepths; d++)
- {
- visual = (xVisualType *) ((char *) depth +
- sizeof (xDepth));
- depth = (xDepth *) ((char *) visual +
- depth->nVisuals * sizeof (xVisualType));
- }
- root = (xWindowRoot *) ((char *) depth);
- screen++;
- }
- root->pixWidth = pScreen->width;
- root->pixHeight = pScreen->height;
- root->mmWidth = pScreen->mmWidth;
- root->mmHeight = pScreen->mmHeight;
-}
-#endif
-
void QuartzUpdateScreens(void) {
ScreenPtr pScreen;
WindowPtr pRoot;
@@ -255,7 +194,7 @@ void QuartzUpdateScreens(void) {
pScreen = screenInfo.screens[0];
PseudoramiXResetScreens();
- quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height);
+ quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen);
pScreen->x = x;
pScreen->y = y;
@@ -305,71 +244,78 @@ void QuartzUpdateScreens(void) {
DeliverEvents(pRoot, &e, 1, NullWindow);
quartzProcs->UpdateScreen(pScreen);
-
-#ifdef FAKE_RANDR
- RREditConnectionInfo(pScreen);
-#endif
}
-void QuartzSetFullscreen(Bool state) {
+void QuartzShowFullscreen(int state) {
+ int i;
- DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
+ DEBUG_LOG("QuartzShowFullscreen: state=%d\n", state);
- if(quartzHasRoot == state)
+ if(XQuartzIsRootless) {
+ ErrorF("QuartzShowFullscreen called while in rootless mode.\n");
+ return;
+ }
+
+ if(XQuartzFullscreenVisible == state)
return;
- quartzHasRoot = state;
+ XQuartzFullscreenVisible = state;
xp_disable_update ();
- if (!quartzHasRoot && !quartzEnableRootless)
+ if (!XQuartzFullscreenVisible)
RootlessHideAllWindows();
- RootlessUpdateRooted(quartzHasRoot);
+ RootlessUpdateRooted(XQuartzFullscreenVisible);
- if (quartzHasRoot && !quartzEnableRootless)
+ if (XQuartzFullscreenVisible) {
RootlessShowAllWindows ();
-
- if (quartzHasRoot || quartzEnableRootless) {
- RootlessRepositionWindows(screenInfo.screens[0]);
+ for (i=0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ RootlessRepositionWindows(pScreen);
+ // JH: I don't think this is necessary, but keeping it here as a reminder
+ //RootlessUpdateScreenPixmap(pScreen);
+ }
}
/* Somehow the menubar manages to interfere with our event stream
* in fullscreen mode, even though it's not visible.
*/
- X11ApplicationShowHideMenubar(!quartzHasRoot);
+ X11ApplicationShowHideMenubar(!XQuartzFullscreenVisible);
xp_reenable_update ();
- if (quartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(quartzHasRoot);
+ if (XQuartzFullscreenDisableHotkeys)
+ xp_disable_hot_keys(XQuartzFullscreenVisible);
}
-void QuartzSetRootless(Bool state) {
- if(quartzEnableRootless == state)
+void QuartzSetRootless(Bool state) {
+ DEBUG_LOG("QuartzSetRootless state=%d\n", state);
+
+ if(XQuartzIsRootless == state)
return;
- quartzEnableRootless = state;
+ if(state)
+ QuartzShowFullscreen(FALSE);
+
+ XQuartzIsRootless = state;
xp_disable_update();
/* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
QuartzUpdateScreens();
- if(!quartzHasRoot) {
- if(!quartzEnableRootless) {
- RootlessHideAllWindows();
- } else {
- RootlessShowAllWindows();
- }
+ if(XQuartzIsRootless) {
+ RootlessShowAllWindows();
+ } else {
+ RootlessHideAllWindows();
}
- X11ApplicationShowHideMenubar(!quartzHasRoot);
+ X11ApplicationShowHideMenubar(TRUE);
xp_reenable_update();
- if (!quartzEnableRootless && quartzFullscreenDisableHotkeys)
- xp_disable_hot_keys(quartzHasRoot);
+ xp_disable_hot_keys(FALSE);
}
/*
@@ -381,18 +327,18 @@ void QuartzSetRootless(Bool state) {
void QuartzShow(void) {
int i;
- if (quartzServerVisible)
+ if (XQuartzServerVisible)
return;
- quartzServerVisible = TRUE;
+ XQuartzServerVisible = TRUE;
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
quartzProcs->ResumeScreen(screenInfo.screens[i]);
}
}
- if (!quartzEnableRootless)
- QuartzSetFullscreen(TRUE);
+ if (!XQuartzIsRootless)
+ QuartzShowFullscreen(TRUE);
}
@@ -406,16 +352,17 @@ void QuartzHide(void)
{
int i;
- if (quartzServerVisible) {
+ if (XQuartzServerVisible) {
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
quartzProcs->SuspendScreen(screenInfo.screens[i]);
}
}
}
-
- QuartzSetFullscreen(FALSE);
- quartzServerVisible = FALSE;
+
+ if(!XQuartzIsRootless)
+ QuartzShowFullscreen(FALSE);
+ XQuartzServerVisible = FALSE;
}
@@ -428,7 +375,7 @@ void QuartzSetRootClip(
{
int i;
- if (!quartzServerVisible)
+ if (!XQuartzServerVisible)
return;
for (i = 0; i < screenInfo.numScreens; i++) {
@@ -446,3 +393,19 @@ void QuartzSpaceChanged(uint32_t space_id) {
/* Do something special here, so we don't depend on quartz-wm for spaces to work... */
DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
}
+
+/*
+ * QuartzCopyDisplayIDs
+ * Associate an X11 screen with one or more CoreGraphics display IDs by copying
+ * the list into a private array. Free the previously copied array, if present.
+ */
+void QuartzCopyDisplayIDs(ScreenPtr pScreen,
+ int displayCount, CGDirectDisplayID *displayIDs) {
+ QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ int size = displayCount * sizeof(CGDirectDisplayID);
+
+ free(pQuartzScreen->displayIDs);
+ pQuartzScreen->displayIDs = malloc(size);
+ memcpy(pQuartzScreen->displayIDs, displayIDs, size);
+ pQuartzScreen->displayCount = displayCount;
+}