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>
(cherry picked from commit 52456c602c)
This commit is contained in:
Jeremy Huddleston 2010-01-30 14:49:02 -08:00 committed by Jeremy Huddleston
parent 734a6b9c21
commit 1c126ba531
1 changed files with 13 additions and 0 deletions

View File

@ -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 */