aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/xpr/xprScreen.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/hw/xquartz/xpr/xprScreen.c
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/hw/xquartz/xpr/xprScreen.c')
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c112
1 files changed, 61 insertions, 51 deletions
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
index e4e1fda7e..da262f654 100644
--- a/xorg-server/hw/xquartz/xpr/xprScreen.c
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -27,26 +27,27 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartz.h"
#include "xpr.h"
+#include "xprEvent.h"
#include "pseudoramiX.h"
#include "darwin.h"
+#include "darwinEvents.h"
#include "rootless.h"
-#include "safeAlpha/safeAlpha.h"
#include "dri.h"
#include "globals.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "applewmExt.h"
#include "micmap.h"
-// From xprFrame.c
-WindowPtr xprGetXWindow(xp_window_id wid);
-
#ifdef DAMAGE
# include "damage.h"
#endif
@@ -64,10 +65,11 @@ static const char *xprOpenGLBundle = "glxCGL.bundle";
*/
static void eventHandler(unsigned int type, const void *arg,
unsigned int arg_size, void *data) {
+
switch (type) {
case XP_EVENT_DISPLAY_CHANGED:
DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
- QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
+ DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
break;
case XP_EVENT_WINDOW_STATE_CHANGED:
@@ -75,7 +77,7 @@ static void eventHandler(unsigned int type, const void *arg,
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);
- QuartzMessageServerThread(kXDarwinWindowState, 2,
+ DarwinSendDDXEvent(kXquartzWindowState, 2,
ws_arg->id, ws_arg->state);
} else {
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
@@ -86,8 +88,7 @@ static void eventHandler(unsigned int type, const void *arg,
DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
if (arg_size == sizeof(xp_window_id)) {
xp_window_id id = * (xp_window_id *) arg;
- WindowPtr pWin = xprGetXWindow(id);
- QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
+ DarwinSendDDXEvent(kXquartzWindowMoved, 1, id);
}
break;
@@ -106,6 +107,15 @@ static void eventHandler(unsigned int type, const void *arg,
DRISurfaceNotify(*(xp_surface_id *) arg, kind);
}
break;
+#ifdef XP_EVENT_SPACE_CHANGED
+ 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;
+#endif
default:
ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
}
@@ -140,14 +150,21 @@ displayScreenBounds(CGDirectDisplayID id)
frame = CGDisplayBounds(id);
+ DEBUG_LOG(" %dx%d @ (%d,%d).\n",
+ (int)frame.size.width, (int)frame.size.height,
+ (int)frame.origin.x, (int)frame.origin.y);
+
/* Remove menubar to help standard X11 window managers. */
-
- if (frame.origin.x == 0 && frame.origin.y == 0)
- {
+ if (quartzEnableRootless &&
+ frame.origin.x == 0 && frame.origin.y == 0) {
frame.origin.y += aquaMenuBarHeight;
frame.size.height -= aquaMenuBarHeight;
}
+ DEBUG_LOG(" %dx%d @ (%d,%d).\n",
+ (int)frame.size.width, (int)frame.size.height,
+ (int)frame.origin.x, (int)frame.origin.y);
+
return frame;
}
@@ -169,8 +186,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
/* Get the union of all screens */
- for (i = 0; i < displayCount; i++)
- {
+ for (i = 0; i < displayCount; i++) {
CGDirectDisplayID dpy = displayList[i];
frame = displayScreenBounds(dpy);
unionRect = CGRectUnion(unionRect, frame);
@@ -182,22 +198,20 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
*width = unionRect.size.width;
*height = unionRect.size.height;
+ DEBUG_LOG(" screen union origin: (%d,%d) size: (%d,%d).\n",
+ *x, *y, *width, *height);
+
/* Tell PseudoramiX about the real screens. */
for (i = 0; i < displayCount; i++)
{
CGDirectDisplayID dpy = displayList[i];
frame = displayScreenBounds(dpy);
-
- /* ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i,
- (int)frame.size.width, (int)frame.size.height,
- (int)frame.origin.x, (int)frame.origin.y); */
-
frame.origin.x -= unionRect.origin.x;
frame.origin.y -= unionRect.origin.y;
- /* ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n",
- i, (int)frame.origin.x, (int)frame.origin.y); */
+ DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n",
+ (int)frame.origin.x, (int)frame.origin.y);
PseudoramiXAddScreen(frame.origin.x, frame.origin.y,
frame.size.width, frame.size.height);
@@ -215,7 +229,7 @@ xprDisplayInit(void)
{
CGDisplayCount displayCount;
- // ErrorF("Display mode: Rootless Quartz -- Xplugin implementation\n");
+ DEBUG_LOG("");
CGGetActiveDisplayList(0, NULL, &displayCount);
@@ -233,6 +247,9 @@ xprDisplayInit(void)
xp_select_events(XP_EVENT_DISPLAY_CHANGED
| XP_EVENT_WINDOW_STATE_CHANGED
| XP_EVENT_WINDOW_MOVED
+#ifdef XP_EVENT_SPACE_CHANGED
+ | XP_EVENT_SPACE_CHANGED
+#endif
| XP_EVENT_SURFACE_CHANGED
| XP_EVENT_SURFACE_DESTROYED,
eventHandler, NULL);
@@ -250,6 +267,8 @@ xprAddScreen(int index, ScreenPtr pScreen)
{
DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
int depth = darwinDesiredDepth;
+
+ DEBUG_LOG("index=%d depth=%d\n", index, depth);
if(depth == -1) {
depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
@@ -259,18 +278,17 @@ xprAddScreen(int index, ScreenPtr pScreen)
}
switch(depth) {
- case -8: // broken
- FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
- dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
- dfb->preferredCVC = GrayScale;
- dfb->depth = 8;
- dfb->bitsPerRGB = 8;
- dfb->bitsPerPixel = 8;
- dfb->redMask = 0;
- dfb->greenMask = 0;
- dfb->blueMask = 0;
- break;
- case 8: // broken
+// case -8: // broken
+// dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
+// dfb->preferredCVC = GrayScale;
+// dfb->depth = 8;
+// dfb->bitsPerRGB = 8;
+// dfb->bitsPerPixel = 8;
+// dfb->redMask = 0;
+// dfb->greenMask = 0;
+// dfb->blueMask = 0;
+// break;
+ case 8: // pseudo-working
dfb->visuals = PseudoColorMask;
dfb->preferredCVC = PseudoColor;
dfb->depth = 8;
@@ -290,7 +308,10 @@ xprAddScreen(int index, ScreenPtr pScreen)
dfb->greenMask = 0x03e0;
dfb->blueMask = 0x001f;
break;
- case 24:
+// case 24:
+ default:
+ if(depth != 24)
+ ErrorF("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d CGDisplaySamplesPerPixel=%d CGDisplayBitsPerSample=%d)\n", darwinDesiredDepth, depth, (int)CGDisplaySamplesPerPixel(kCGDirectMainDisplay), (int)CGDisplayBitsPerSample(kCGDirectMainDisplay));
dfb->visuals = LARGE_VISUALS;
dfb->preferredCVC = TrueColor;
dfb->depth = 24;
@@ -300,12 +321,12 @@ xprAddScreen(int index, ScreenPtr pScreen)
dfb->greenMask = 0x0000ff00;
dfb->blueMask = 0x000000ff;
break;
- default:
- FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
}
if (noPseudoramiXExtension)
{
+ ErrorF("Warning: noPseudoramiXExtension!\n");
+
CGDirectDisplayID dpy;
CGRect frame;
@@ -341,18 +362,11 @@ xprAddScreen(int index, ScreenPtr pScreen)
static Bool
xprSetupScreen(int index, ScreenPtr pScreen)
{
- // Add alpha protecting replacements for fb screen functions
-
-#ifdef RENDER
- {
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- ps->Composite = SafeAlphaComposite;
- }
-#endif /* RENDER */
-
// Initialize accelerated rootless drawing
// Note that this must be done before DamageSetup().
- RootlessAccelInit(pScreen);
+
+ // These are crashing ugly... better to be stable and not crash for now.
+ //RootlessAccelInit(pScreen);
#ifdef DAMAGE
// The Damage extension needs to wrap underneath the
@@ -409,12 +423,8 @@ static QuartzModeProcsRec xprModeProcs = {
xprSetupScreen,
xprInitInput,
QuartzInitCursor,
- NULL, // No need to update cursor
QuartzSuspendXCursor,
QuartzResumeXCursor,
- NULL, // No capture or release in rootless mode
- NULL,
- NULL, // Xplugin sends screen change events directly
xprAddPseudoramiXScreens,
xprUpdateScreen,
xprIsX11Window,