diff options
Diffstat (limited to 'hw/darwin/quartz/xpr/xprScreen.c')
-rw-r--r-- | hw/darwin/quartz/xpr/xprScreen.c | 97 |
1 files changed, 65 insertions, 32 deletions
diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c index 3adb62a63..5c77756fd 100644 --- a/hw/darwin/quartz/xpr/xprScreen.c +++ b/hw/darwin/quartz/xpr/xprScreen.c @@ -1,10 +1,10 @@ -/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.1.4.2.4.2 2004/03/04 17:47:30 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.4 2004/08/12 20:24:36 torrey Exp $ */ /* * Xplugin rootless implementation screen functions */ /* * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * 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"), @@ -28,7 +28,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.8 2003/11/12 20:21:52 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.11 2004/07/15 18:53:25 torrey Exp $ */ #include "quartzCommon.h" #include "quartz.h" @@ -42,6 +42,10 @@ #include "Xplugin.h" #include "applewmExt.h" +#ifdef DAMAGE +# include "damage.h" +#endif + // Name of GLX bundle for native OpenGL static const char *xprOpenGLBundle = "glxCGL.bundle"; @@ -57,41 +61,42 @@ eventHandler(unsigned int type, const void *arg, switch (type) { case XP_EVENT_DISPLAY_CHANGED: - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); - break; + QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + break; case XP_EVENT_WINDOW_STATE_CHANGED: - if (arg_size >= sizeof(xp_window_state_event)) + if (arg_size >= sizeof(xp_window_state_event)) { - const xp_window_state_event *ws_arg = arg; - QuartzMessageServerThread(kXDarwinWindowState, 2, + const xp_window_state_event *ws_arg = arg; + + QuartzMessageServerThread(kXDarwinWindowState, 2, ws_arg->id, ws_arg->state); - } - break; + } + break; case XP_EVENT_WINDOW_MOVED: - if (arg_size == sizeof(xp_window_id)) - { - xp_window_id id = * (xp_window_id *) arg; + if (arg_size == sizeof(xp_window_id)) + { + xp_window_id id = * (xp_window_id *) arg; - QuartzMessageServerThread(kXDarwinWindowMoved, 1, id); - } - break; + QuartzMessageServerThread(kXDarwinWindowMoved, 1, id); + } + break; case XP_EVENT_SURFACE_DESTROYED: case XP_EVENT_SURFACE_CHANGED: - 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; + 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; } } @@ -139,11 +144,12 @@ displayScreenBounds(CGDirectDisplayID id) /* - * addPseudoramiXScreens - * Add a physical screen with PseudoramiX. + * xprAddPseudoramiXScreens + * Add a single virtual screen encompassing all the physical screens + * with PseudoramiX. */ static void -addPseudoramiXScreens(int *x, int *y, int *width, int *height) +xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height) { CGDisplayCount i, displayCount; CGDirectDisplayID *displayList = NULL; @@ -286,7 +292,7 @@ xprAddScreen(int index, ScreenPtr pScreen) } else { - addPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); + xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); } /* Passing zero width (pitch) makes miCreateScreenResources set the @@ -319,6 +325,13 @@ xprSetupScreen(int index, ScreenPtr pScreen) } #endif /* RENDER */ +#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; @@ -328,6 +341,23 @@ xprSetupScreen(int index, ScreenPtr pScreen) /* + * xprUpdateScreen + * Update screen after configuation change. + */ +static void +xprUpdateScreen(ScreenPtr pScreen) +{ + rootlessGlobalOffsetX = darwinMainScreenX; + rootlessGlobalOffsetY = darwinMainScreenY; + + AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]); + + RootlessRepositionWindows(pScreen); + RootlessUpdateScreenPixmap(pScreen); +} + + +/* * xprInitInput * Finalize xpr specific setup. */ @@ -358,6 +388,9 @@ static QuartzModeProcsRec xprModeProcs = { QuartzResumeXCursor, NULL, // No capture or release in rootless mode NULL, + NULL, // Xplugin sends screen change events directly + xprAddPseudoramiXScreens, + xprUpdateScreen, xprIsX11Window, xprHideWindows, RootlessFrameForWindow, |