2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
* Xplugin rootless implementation screen functions
|
2008-11-02 08:26:08 -07:00
|
|
|
*
|
2012-06-10 07:21:05 -06:00
|
|
|
* Copyright (c) 2002-2012 Apple Computer, Inc. All Rights Reserved.
|
2006-11-26 11:13:41 -07:00
|
|
|
* Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name(s) of the above copyright
|
|
|
|
* holders shall not be used in advertising or otherwise to promote the sale,
|
|
|
|
* use or other dealings in this Software without prior written authorization.
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "sanitizedCarbon.h"
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
2007-11-24 10:55:21 -07:00
|
|
|
#endif
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
#include "quartzCommon.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "inputstr.h"
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "quartz.h"
|
2010-12-05 08:36:02 -07:00
|
|
|
#include "quartzRandR.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "xpr.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "xprEvent.h"
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "pseudoramiX.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "darwinEvents.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "rootless.h"
|
|
|
|
#include "dri.h"
|
|
|
|
#include "globals.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include <Xplugin.h>
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "applewmExt.h"
|
|
|
|
#include "micmap.h"
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#include "rootlessCommon.h"
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
#ifdef DAMAGE
|
2012-06-10 07:21:05 -06:00
|
|
|
#include "damage.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
/* 10.4's deferred update makes X slower.. have to live with the tearing
|
2012-06-10 07:21:05 -06:00
|
|
|
* for now.. */
|
2008-11-02 08:26:08 -07:00
|
|
|
#define XP_NO_DEFERRED_UPDATES 8
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
// Name of GLX bundle for native OpenGL
|
|
|
|
static const char *xprOpenGLBundle = "glxCGL.bundle";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* eventHandler
|
|
|
|
* Callback handler for Xplugin events.
|
|
|
|
*/
|
2012-06-10 07:21:05 -06:00
|
|
|
static void
|
|
|
|
eventHandler(unsigned int type, const void *arg,
|
|
|
|
unsigned int arg_size, void *data)
|
|
|
|
{
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
switch (type) {
|
2012-06-10 07:21:05 -06:00
|
|
|
case XP_EVENT_DISPLAY_CHANGED:
|
|
|
|
DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
|
|
|
|
DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XP_EVENT_WINDOW_STATE_CHANGED:
|
|
|
|
if (arg_size >= sizeof(xp_window_state_event)) {
|
|
|
|
const xp_window_state_event *ws_arg = arg;
|
|
|
|
|
|
|
|
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n",
|
|
|
|
ws_arg->id,
|
|
|
|
ws_arg->state);
|
|
|
|
DarwinSendDDXEvent(kXquartzWindowState, 2,
|
|
|
|
ws_arg->id, ws_arg->state);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XP_EVENT_WINDOW_MOVED:
|
|
|
|
DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
|
|
|
|
if (arg_size == sizeof(xp_window_id)) {
|
|
|
|
xp_window_id id = *(xp_window_id *)arg;
|
|
|
|
DarwinSendDDXEvent(kXquartzWindowMoved, 1, id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XP_EVENT_SURFACE_DESTROYED:
|
|
|
|
DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
|
|
|
|
|
|
|
|
case XP_EVENT_SURFACE_CHANGED:
|
|
|
|
DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
|
|
|
|
if (arg_size == sizeof(xp_surface_id)) {
|
|
|
|
int kind;
|
|
|
|
|
|
|
|
if (type == XP_EVENT_SURFACE_DESTROYED)
|
|
|
|
kind = AppleDRISurfaceNotifyDestroyed;
|
|
|
|
else
|
|
|
|
kind = AppleDRISurfaceNotifyChanged;
|
|
|
|
|
|
|
|
DRISurfaceNotify(*(xp_surface_id *)arg, kind);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
#ifdef XP_EVENT_SPACE_CHANGED
|
2012-06-10 07:21:05 -06:00
|
|
|
case XP_EVENT_SPACE_CHANGED:
|
|
|
|
DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n");
|
|
|
|
if (arg_size == sizeof(uint32_t)) {
|
|
|
|
uint32_t space_id = *(uint32_t *)arg;
|
|
|
|
DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
default:
|
|
|
|
ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-02 08:26:08 -07:00
|
|
|
* displayAtIndex
|
2006-11-26 11:13:41 -07:00
|
|
|
* Return the display ID for a particular display index.
|
|
|
|
*/
|
|
|
|
static CGDirectDisplayID
|
|
|
|
displayAtIndex(int index)
|
|
|
|
{
|
|
|
|
CGError err;
|
|
|
|
CGDisplayCount cnt;
|
2012-06-10 07:21:05 -06:00
|
|
|
CGDirectDisplayID dpy[index + 1];
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
err = CGGetActiveDisplayList(index + 1, dpy, &cnt);
|
|
|
|
if (err == kCGErrorSuccess && cnt == index + 1)
|
|
|
|
return dpy[index];
|
|
|
|
else
|
|
|
|
return kCGNullDirectDisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* displayScreenBounds
|
|
|
|
* Return the bounds of a particular display.
|
|
|
|
*/
|
|
|
|
static CGRect
|
|
|
|
displayScreenBounds(CGDirectDisplayID id)
|
|
|
|
{
|
|
|
|
CGRect frame;
|
|
|
|
|
|
|
|
frame = CGDisplayBounds(id);
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
DEBUG_LOG(" %dx%d @ (%d,%d).\n",
|
|
|
|
(int)frame.size.width, (int)frame.size.height,
|
|
|
|
(int)frame.origin.x, (int)frame.origin.y);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/* Remove menubar to help standard X11 window managers. */
|
2012-06-10 07:21:05 -06:00
|
|
|
if (XQuartzIsRootless &&
|
2009-09-06 13:44:18 -06:00
|
|
|
frame.origin.x == 0 && frame.origin.y == 0) {
|
2006-11-26 11:13:41 -07:00
|
|
|
frame.origin.y += aquaMenuBarHeight;
|
|
|
|
frame.size.height -= aquaMenuBarHeight;
|
|
|
|
}
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
DEBUG_LOG(" %dx%d @ (%d,%d).\n",
|
|
|
|
(int)frame.size.width, (int)frame.size.height,
|
|
|
|
(int)frame.origin.x, (int)frame.origin.y);
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprAddPseudoramiXScreens
|
|
|
|
* Add a single virtual screen encompassing all the physical screens
|
|
|
|
* with PseudoramiX.
|
|
|
|
*/
|
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height,
|
|
|
|
ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
CGDisplayCount i, displayCount;
|
|
|
|
CGDirectDisplayID *displayList = NULL;
|
|
|
|
CGRect unionRect = CGRectNull, frame;
|
|
|
|
|
|
|
|
// Find all the CoreGraphics displays
|
|
|
|
CGGetActiveDisplayList(0, NULL, &displayCount);
|
2010-07-27 13:02:24 -06:00
|
|
|
DEBUG_LOG("displayCount: %d\n", (int)displayCount);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!displayCount) {
|
|
|
|
ErrorF(
|
|
|
|
"CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n");
|
2010-07-27 13:02:24 -06:00
|
|
|
*x = *y = 0;
|
|
|
|
*width = 800;
|
|
|
|
*height = 600;
|
|
|
|
PseudoramiXAddScreen(*x, *y, *width, *height);
|
2011-11-05 07:32:40 -06:00
|
|
|
QuartzCopyDisplayIDs(pScreen, 0, NULL);
|
2010-07-27 13:02:24 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-02 10:08:38 -06:00
|
|
|
/* If the displays are captured, we are in a RandR game mode
|
|
|
|
* on the primary display, so we only want to include the first
|
|
|
|
* display. The others are covered by the shield window.
|
|
|
|
*/
|
|
|
|
if (CGDisplayIsCaptured(kCGDirectMainDisplay))
|
|
|
|
displayCount = 1;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!displayList)
|
2010-07-27 13:02:24 -06:00
|
|
|
FatalError("Unable to allocate memory for list of displays.\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
|
2010-12-05 08:36:02 -07:00
|
|
|
QuartzCopyDisplayIDs(pScreen, displayCount, displayList);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* Get the union of all screens */
|
2009-09-06 13:44:18 -06:00
|
|
|
for (i = 0; i < displayCount; i++) {
|
2006-11-26 11:13:41 -07:00
|
|
|
CGDirectDisplayID dpy = displayList[i];
|
|
|
|
frame = displayScreenBounds(dpy);
|
|
|
|
unionRect = CGRectUnion(unionRect, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use unionRect as the screen size for the X server. */
|
|
|
|
*x = unionRect.origin.x;
|
|
|
|
*y = unionRect.origin.y;
|
|
|
|
*width = unionRect.size.width;
|
|
|
|
*height = unionRect.size.height;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
DEBUG_LOG(" screen union origin: (%d,%d) size: (%d,%d).\n",
|
|
|
|
*x, *y, *width, *height);
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/* Tell PseudoramiX about the real screens. */
|
2012-06-10 07:21:05 -06:00
|
|
|
for (i = 0; i < displayCount; i++) {
|
2006-11-26 11:13:41 -07:00
|
|
|
CGDirectDisplayID dpy = displayList[i];
|
|
|
|
|
|
|
|
frame = displayScreenBounds(dpy);
|
|
|
|
frame.origin.x -= unionRect.origin.x;
|
|
|
|
frame.origin.y -= unionRect.origin.y;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n",
|
|
|
|
(int)frame.origin.x, (int)frame.origin.y);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
PseudoramiXAddScreen(frame.origin.x, frame.origin.y,
|
|
|
|
frame.size.width, frame.size.height);
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
free(displayList);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprDisplayInit
|
|
|
|
* Find number of CoreGraphics displays and initialize Xplugin.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
xprDisplayInit(void)
|
|
|
|
{
|
|
|
|
CGDisplayCount displayCount;
|
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
TRACE();
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
CGGetActiveDisplayList(0, NULL, &displayCount);
|
|
|
|
|
|
|
|
/* With PseudoramiX, the X server only sees one screen; only PseudoramiX
|
|
|
|
itself knows about all of the screens. */
|
|
|
|
|
|
|
|
if (noPseudoramiXExtension)
|
|
|
|
darwinScreensFound = displayCount;
|
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
darwinScreensFound = 1;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
if (xp_init(XP_BACKGROUND_EVENTS | XP_NO_DEFERRED_UPDATES) != Success)
|
2006-11-26 11:13:41 -07:00
|
|
|
FatalError("Could not initialize the Xplugin library.");
|
|
|
|
|
|
|
|
xp_select_events(XP_EVENT_DISPLAY_CHANGED
|
|
|
|
| XP_EVENT_WINDOW_STATE_CHANGED
|
|
|
|
| XP_EVENT_WINDOW_MOVED
|
2009-09-06 13:44:18 -06:00
|
|
|
#ifdef XP_EVENT_SPACE_CHANGED
|
|
|
|
| XP_EVENT_SPACE_CHANGED
|
|
|
|
#endif
|
2006-11-26 11:13:41 -07:00
|
|
|
| XP_EVENT_SURFACE_CHANGED
|
|
|
|
| XP_EVENT_SURFACE_DESTROYED,
|
|
|
|
eventHandler, NULL);
|
|
|
|
|
|
|
|
AppleDRIExtensionInit();
|
|
|
|
xprAppleWMInit();
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
XQuartzIsRootless = XQuartzRootlessDefault;
|
|
|
|
if (!XQuartzIsRootless)
|
2010-07-27 13:02:24 -06:00
|
|
|
RootlessHideAllWindows();
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprAddScreen
|
|
|
|
* Init the framebuffer and record pixmap parameters for the screen.
|
|
|
|
*/
|
|
|
|
static Bool
|
|
|
|
xprAddScreen(int index, ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
|
2008-11-02 08:26:08 -07:00
|
|
|
int depth = darwinDesiredDepth;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
|
|
|
DEBUG_LOG("index=%d depth=%d\n", index, depth);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
|
|
|
if (depth == -1) {
|
2011-04-02 10:08:38 -06:00
|
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
2012-06-10 07:21:05 -06:00
|
|
|
depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) *
|
|
|
|
CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
2011-04-02 10:08:38 -06:00
|
|
|
#else
|
|
|
|
CGDisplayModeRef modeRef;
|
|
|
|
CFStringRef encStrRef;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-04-02 10:08:38 -06:00
|
|
|
modeRef = CGDisplayCopyDisplayMode(kCGDirectMainDisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!modeRef)
|
2011-04-02 10:08:38 -06:00
|
|
|
goto have_depth;
|
|
|
|
|
|
|
|
encStrRef = CGDisplayModeCopyPixelEncoding(modeRef);
|
|
|
|
CFRelease(modeRef);
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!encStrRef)
|
2011-04-02 10:08:38 -06:00
|
|
|
goto have_depth;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
|
|
|
if (CFStringCompare(encStrRef, CFSTR(IO32BitDirectPixels),
|
|
|
|
kCFCompareCaseInsensitive) ==
|
|
|
|
kCFCompareEqualTo) {
|
2011-04-02 10:08:38 -06:00
|
|
|
depth = 24;
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else if (CFStringCompare(encStrRef, CFSTR(IO16BitDirectPixels),
|
|
|
|
kCFCompareCaseInsensitive) ==
|
|
|
|
kCFCompareEqualTo) {
|
2011-04-02 10:08:38 -06:00
|
|
|
depth = 15;
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else if (CFStringCompare(encStrRef, CFSTR(IO8BitIndexedPixels),
|
|
|
|
kCFCompareCaseInsensitive) ==
|
|
|
|
kCFCompareEqualTo) {
|
2011-04-02 10:08:38 -06:00
|
|
|
depth = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
CFRelease(encStrRef);
|
|
|
|
#endif
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
2011-04-02 10:08:38 -06:00
|
|
|
have_depth:
|
2011-11-05 07:32:40 -06:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (depth) {
|
|
|
|
case 8: // pseudo-working
|
|
|
|
dfb->visuals = PseudoColorMask;
|
|
|
|
dfb->preferredCVC = PseudoColor;
|
|
|
|
dfb->depth = 8;
|
|
|
|
dfb->bitsPerRGB = 8;
|
|
|
|
dfb->bitsPerPixel = 8;
|
|
|
|
dfb->redMask = 0;
|
|
|
|
dfb->greenMask = 0;
|
|
|
|
dfb->blueMask = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
|
|
|
dfb->visuals = TrueColorMask; //LARGE_VISUALS;
|
|
|
|
dfb->preferredCVC = TrueColor;
|
|
|
|
dfb->depth = 15;
|
|
|
|
dfb->bitsPerRGB = 5;
|
|
|
|
dfb->bitsPerPixel = 16;
|
|
|
|
dfb->redMask = RM_ARGB(0, 5, 5, 5);
|
|
|
|
dfb->greenMask = GM_ARGB(0, 5, 5, 5);
|
|
|
|
dfb->blueMask = BM_ARGB(0, 5, 5, 5);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// case 24:
|
|
|
|
default:
|
|
|
|
if (depth != 24)
|
|
|
|
ErrorF(
|
|
|
|
"Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n",
|
|
|
|
depth, darwinDesiredDepth);
|
|
|
|
dfb->visuals = TrueColorMask; //LARGE_VISUALS;
|
|
|
|
dfb->preferredCVC = TrueColor;
|
|
|
|
dfb->depth = 24;
|
|
|
|
dfb->bitsPerRGB = 8;
|
|
|
|
dfb->bitsPerPixel = 32;
|
|
|
|
dfb->redMask = RM_ARGB(0, 8, 8, 8);
|
|
|
|
dfb->greenMask = GM_ARGB(0, 8, 8, 8);
|
|
|
|
dfb->blueMask = BM_ARGB(0, 8, 8, 8);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (noPseudoramiXExtension) {
|
2006-11-26 11:13:41 -07:00
|
|
|
CGDirectDisplayID dpy;
|
|
|
|
CGRect frame;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
ErrorF("Warning: noPseudoramiXExtension!\n");
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
dpy = displayAtIndex(index);
|
2010-12-05 08:36:02 -07:00
|
|
|
QuartzCopyDisplayIDs(pScreen, 1, &dpy);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
frame = displayScreenBounds(dpy);
|
|
|
|
|
|
|
|
dfb->x = frame.origin.x;
|
|
|
|
dfb->y = frame.origin.y;
|
2012-06-10 07:21:05 -06:00
|
|
|
dfb->width = frame.size.width;
|
2006-11-26 11:13:41 -07:00
|
|
|
dfb->height = frame.size.height;
|
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
else {
|
|
|
|
xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height,
|
|
|
|
pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Passing zero width (pitch) makes miCreateScreenResources set the
|
|
|
|
screen pixmap to the framebuffer pointer, i.e. NULL. The generic
|
|
|
|
rootless code takes care of making this work. */
|
|
|
|
dfb->pitch = 0;
|
|
|
|
dfb->framebuffer = NULL;
|
|
|
|
|
|
|
|
DRIScreenInit(pScreen);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprSetupScreen
|
|
|
|
* Setup the screen for rootless access.
|
|
|
|
*/
|
|
|
|
static Bool
|
|
|
|
xprSetupScreen(int index, ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
#ifdef DAMAGE
|
|
|
|
// The Damage extension needs to wrap underneath the
|
|
|
|
// generic rootless layer, so do it now.
|
|
|
|
if (!DamageSetup(pScreen))
|
|
|
|
return FALSE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Initialize generic rootless code
|
|
|
|
if (!xprInit(pScreen))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return DRIFinishScreenInit(pScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprUpdateScreen
|
|
|
|
* Update screen after configuation change.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
xprUpdateScreen(ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
rootlessGlobalOffsetX = darwinMainScreenX;
|
|
|
|
rootlessGlobalOffsetY = darwinMainScreenY;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
AppleWMSetScreenOrigin(pScreen->root);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
RootlessRepositionWindows(pScreen);
|
|
|
|
RootlessUpdateScreenPixmap(pScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xprInitInput
|
|
|
|
* Finalize xpr specific setup.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
xprInitInput(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
rootlessGlobalOffsetX = darwinMainScreenX;
|
|
|
|
rootlessGlobalOffsetY = darwinMainScreenY;
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numScreens; i++)
|
2010-12-05 08:36:02 -07:00
|
|
|
AppleWMSetScreenOrigin(screenInfo.screens[i]->root);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Quartz display mode function list.
|
|
|
|
*/
|
|
|
|
static QuartzModeProcsRec xprModeProcs = {
|
|
|
|
xprDisplayInit,
|
|
|
|
xprAddScreen,
|
|
|
|
xprSetupScreen,
|
|
|
|
xprInitInput,
|
|
|
|
QuartzInitCursor,
|
|
|
|
QuartzSuspendXCursor,
|
|
|
|
QuartzResumeXCursor,
|
|
|
|
xprAddPseudoramiXScreens,
|
|
|
|
xprUpdateScreen,
|
|
|
|
xprIsX11Window,
|
|
|
|
xprHideWindows,
|
|
|
|
RootlessFrameForWindow,
|
|
|
|
TopLevelParent,
|
|
|
|
DRICreateSurface,
|
|
|
|
DRIDestroySurface
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* QuartzModeBundleInit
|
|
|
|
* Initialize the display mode bundle after loading.
|
|
|
|
*/
|
|
|
|
Bool
|
|
|
|
QuartzModeBundleInit(void)
|
|
|
|
{
|
|
|
|
quartzProcs = &xprModeProcs;
|
|
|
|
quartzOpenGLBundle = xprOpenGLBundle;
|
|
|
|
return TRUE;
|
|
|
|
}
|