summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-01-30 14:49:02 -0800
committerJeremy Huddleston <jeremyhu@apple.com>2010-01-30 14:49:02 -0800
commit52456c602c3cdd7d5eac677889a18fad37dfb7ae (patch)
tree61f934cea5d2ab15b0585582c04e0077bec1db29
parent15f4bb6dc64313ff100aa5444a94c60922a498df (diff)
XQuartz: Attatch a stub display when CoreGraphics reports no displays.
This is half of the required changes to address the "stuck mouse pointer" bug that occurs when X11 launches while the displays are asleep. The remainder of the fix is part of libXplugin which needs to be updated to send XP_EVENT_DISPLAY_CHANGED when the display wakes up. If you don't have a recent enough libXplugin (expected in 2.5.0_beta2 or later), you can cause this event to be sent by changing your display resolution (or you could just start X11.app with your screens awake). Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/xpr/xprScreen.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 22a727e67..735b2ba67 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -184,7 +184,20 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
// Find all the CoreGraphics displays
CGGetActiveDisplayList(0, NULL, &displayCount);
+ DEBUG_LOG("displayCount: %d\n", (int)displayCount);
+
+ if(!displayCount) {
+ ErrorF("CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n");
+ *x = *y = 0;
+ *width = 800;
+ *height = 600;
+ PseudoramiXAddScreen(*x, *y, *width, *height);
+ return;
+ }
+
displayList = xalloc(displayCount * sizeof(CGDirectDisplayID));
+ if(!displayList)
+ FatalError("Unable to allocate memory for list of displays.\n");
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
/* Get the union of all screens */