From 01b70afaac0990b41d1fb6fadbfd64df1486b669 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Sat, 3 Nov 2007 05:34:19 -0700 Subject: [PATCH] Darwin: Initial support for Spaces -- if you use Expose to drag an X11 window to another Space, it will work correctly (as opposed to just leaving a ghost window). We accomplish this by listening for the notification from Xplugin that our window has been moved, and then we ask X11 to move the window to the new location. (cherry picked from commit 2d50ea8013e7c1639d570e227b53b037fb567565) --- hw/darwin/quartz/quartz.c | 12 ++++++++++++ hw/darwin/quartz/xpr/xprScreen.c | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c index 3374baaf8..0bbbada1f 100644 --- a/hw/darwin/quartz/quartz.c +++ b/hw/darwin/quartz/quartz.c @@ -426,6 +426,18 @@ void DarwinModeProcessEvent( RootlessOrderAllWindows(); break; + case kXDarwinWindowState: + ErrorF("kXDarwinWindowState\n"); + break; + case kXDarwinWindowMoved: { + WindowPtr pWin = (WindowPtr)xe->u.clientMessage.u.l.longs0; + short x = xe->u.clientMessage.u.l.longs1, + y = xe->u.clientMessage.u.l.longs2; + ErrorF("kXDarwinWindowMoved(%p, %hd, %hd)\n", pWin, x, y); + RootlessMoveWindow(pWin, x, y, pWin->nextSib, VTMove); + } + break; + default: ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); } diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c index a625e62a4..674a268ad 100644 --- a/hw/darwin/quartz/xpr/xprScreen.c +++ b/hw/darwin/quartz/xpr/xprScreen.c @@ -87,7 +87,13 @@ eventHandler(unsigned int type, const void *arg, { xp_window_id id = * (xp_window_id *) arg; WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); + BoxRec box; + xp_error retval = xp_get_window_bounds(id, &box); + if (retval != Success) { + ErrorF("Unable to find new bounds for window\n"); + break; + } + QuartzMessageServerThread(kXDarwinWindowMoved, 3, pWin, box.x1, box.y1); } break;