diff options
author | Torrey Lyons <torrey@mrcla.com> | 2004-10-08 00:35:08 +0000 |
---|---|---|
committer | Torrey Lyons <torrey@mrcla.com> | 2004-10-08 00:35:08 +0000 |
commit | fa9847aeb9094aafc3798aee1fc8379e77a18d6a (patch) | |
tree | c0272daf2dc76defdf3879e96528af88f7d0e9e1 | |
parent | d737bc3300cf1847bcea08ca781f37ee3ee62692 (diff) |
Allow rootless implementations to override frame reordering. This is used
on Mac OS X when genie-restoring from the Dock to ensure that the
animation completes before drawing the frame.
-rw-r--r-- | hw/darwin/quartz/applewm.c | 71 | ||||
-rw-r--r-- | hw/darwin/quartz/applewmExt.h | 14 | ||||
-rw-r--r-- | hw/darwin/quartz/cr/crFrame.m | 16 | ||||
-rw-r--r-- | hw/darwin/quartz/xpr/xprFrame.c | 33 | ||||
-rw-r--r-- | hw/xwin/ChangeLog | 6 | ||||
-rw-r--r-- | hw/xwin/winscrinit.c | 1 | ||||
-rw-r--r-- | miext/rootless/rootless.h | 15 | ||||
-rw-r--r-- | miext/rootless/rootlessWindow.c | 13 |
8 files changed, 128 insertions, 41 deletions
diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index 9b62915c8..040b57680 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -40,24 +40,26 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "windowstr.h" #include "servermd.h" #include "swaprep.h" +#include "propertyst.h" #include "Xatom.h" #include "darwin.h" #define _APPLEWM_SERVER_ #include "applewmstr.h" #include "applewmExt.h" -#define DEFINE_ATOM_HELPER(func,atom_name) \ -static Atom func (void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ - } \ - return atom; \ +#define DEFINE_ATOM_HELPER(func,atom_name) \ +static Atom func (void) { \ + static int generation; \ + static Atom atom; \ + if (generation != serverGeneration) { \ + generation = serverGeneration; \ + atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ + } \ + return atom; \ } DEFINE_ATOM_HELPER(xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN") +DEFINE_ATOM_HELPER (xa_apple_no_order_in, "_APPLE_NO_ORDER_IN") static AppleWMProcsPtr appleWMProcs; @@ -84,8 +86,8 @@ static void SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to); typedef struct _WMEvent *WMEventPtr; typedef struct _WMEvent { WMEventPtr next; - ClientPtr client; - XID clientResource; + ClientPtr client; + XID clientResource; unsigned int mask; } WMEventRec; @@ -152,6 +154,29 @@ AppleWMSetScreenOrigin( 32, PropModeReplace, 2, data, TRUE); } +/* Window managers can set the _APPLE_NO_ORDER_IN property on windows + that are being genie-restored from the Dock. We want them to + be mapped but remain ordered-out until the animation + completes (when the Dock will order them in). */ +Bool +AppleWMDoReorderWindow( + WindowPtr pWin +) +{ + Atom atom; + PropertyPtr prop; + + atom = xa_apple_no_order_in(); + for (prop = wUserProps(pWin); prop != NULL; prop = prop->next) + { + if (prop->propertyName == atom && prop->type == atom) + return FALSE; + } + + return TRUE; +} + + static int ProcAppleWMQueryVersion( register ClientPtr client @@ -191,8 +216,8 @@ updateEventMask (WMEventPtr *pHead) /*ARGSUSED*/ static int WMFreeClient (data, id) - pointer data; - XID id; + pointer data; + XID id; { WMEventPtr pEvent; WMEventPtr *pHead, pCur, pPrev; @@ -218,8 +243,8 @@ WMFreeClient (data, id) /*ARGSUSED*/ static int WMFreeEvents (data, id) - pointer data; - XID id; + pointer data; + XID id; { WMEventPtr *pHead, pCur, pNext; @@ -236,11 +261,11 @@ WMFreeEvents (data, id) static int ProcAppleWMSelectInput (client) - register ClientPtr client; + register ClientPtr client; { REQUEST(xAppleWMSelectInputReq); - WMEventPtr pEvent, pNewEvent, *pHead; - XID clientResource; + WMEventPtr pEvent, pNewEvent, *pHead; + XID clientResource; REQUEST_SIZE_MATCH (xAppleWMSelectInputReq); pHead = (WMEventPtr *)SecurityLookupIDByType(client, @@ -329,8 +354,8 @@ AppleWMSendEvent (type, mask, which, arg) int type, which, arg; unsigned int mask; { - WMEventPtr *pHead, pEvent; - ClientPtr client; + WMEventPtr *pHead, pEvent; + ClientPtr client; xAppleWMNotifyEvent se; pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); @@ -610,7 +635,7 @@ ProcAppleWMFrameDraw( static int ProcAppleWMDispatch ( - register ClientPtr client + register ClientPtr client ) { REQUEST(xReq); @@ -666,7 +691,7 @@ SNotifyEvent(from, to) static int SProcAppleWMQueryVersion( - register ClientPtr client + register ClientPtr client ) { register int n; @@ -677,7 +702,7 @@ SProcAppleWMQueryVersion( static int SProcAppleWMDispatch ( - register ClientPtr client + register ClientPtr client ) { REQUEST(xReq); diff --git a/hw/darwin/quartz/applewmExt.h b/hw/darwin/quartz/applewmExt.h index 63e2bea9f..92d3c5c03 100644 --- a/hw/darwin/quartz/applewmExt.h +++ b/hw/darwin/quartz/applewmExt.h @@ -4,7 +4,7 @@ /************************************************************************** Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. -Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. +Copyright (c) 2003-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 @@ -69,11 +69,15 @@ void AppleWMSetScreenOrigin( WindowPtr pWin ); +Bool AppleWMDoReorderWindow( + WindowPtr pWin +); + void AppleWMSendEvent( - int /* type */, - unsigned int /* mask */, - int /* which */, - int /* arg */ + int /* type */, + unsigned int /* mask */, + int /* which */, + int /* arg */ ); unsigned int AppleWMSelectedEvents( diff --git a/hw/darwin/quartz/cr/crFrame.m b/hw/darwin/quartz/cr/crFrame.m index 2fade0c80..79d55a4d1 100644 --- a/hw/darwin/quartz/cr/crFrame.m +++ b/hw/darwin/quartz/cr/crFrame.m @@ -27,7 +27,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. */ -/* $XdotOrg$ */ +/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.2 2004/04/23 19:15:51 eich Exp $ */ /* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */ #include "quartzCommon.h" @@ -36,6 +36,7 @@ #undef BOOL #define BOOL xBOOL #include "rootless.h" +#include "applewmExt.h" #include "windowstr.h" #undef BOOL @@ -389,6 +390,17 @@ CRDamageRects(RootlessFrameID wid, int count, const BoxRec *rects, } +/* + * Called to check if the frame should be reordered when it is restacked. + */ +Bool CRDoReorderWindow(RootlessWindowPtr pFrame) +{ + WindowPtr pWin = pFrame->win; + + return AppleWMDoReorderWindow(pWin); +} + + static RootlessFrameProcsRec CRRootlessProcs = { CRCreateFrame, CRDestroyFrame, @@ -402,6 +414,8 @@ static RootlessFrameProcsRec CRRootlessProcs = { CRUpdateRegion, CRDamageRects, NULL, + CRDoReorderWindow, + NULL, NULL, NULL, NULL diff --git a/hw/darwin/quartz/xpr/xprFrame.c b/hw/darwin/quartz/xpr/xprFrame.c index 15a52a52c..98df1d3f3 100644 --- a/hw/darwin/quartz/xpr/xprFrame.c +++ b/hw/darwin/quartz/xpr/xprFrame.c @@ -27,7 +27,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. */ -/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.5 2003/11/27 01:59:53 torrey Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.2 2004/04/23 19:16:52 eich Exp $ */ /* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.4 2003/11/12 20:21:52 torrey Exp $ */ #include "xpr.h" @@ -35,6 +35,7 @@ #include "Xplugin.h" #include "x-hash.h" #include "x-list.h" +#include "applewmExt.h" #include "propertyst.h" #include "dix.h" @@ -43,15 +44,15 @@ #include <pthread.h> -#define DEFINE_ATOM_HELPER(func,atom_name) \ -static Atom func (void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ - } \ - return atom; \ +#define DEFINE_ATOM_HELPER(func,atom_name) \ +static Atom func (void) { \ + static int generation; \ + static Atom atom; \ + if (generation != serverGeneration) { \ + generation = serverGeneration; \ + atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ + } \ + return atom; \ } DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID") @@ -343,6 +344,17 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) /* + * Called to check if the frame should be reordered when it is restacked. + */ +Bool xprDoReorderWindow(RootlessWindowPtr pFrame) +{ + WindowPtr pWin = pFrame->win; + + return AppleWMDoReorderWindow(pWin); +} + + +/* * Copy area in frame to another part of frame. * Used to accelerate scrolling. */ @@ -368,6 +380,7 @@ static RootlessFrameProcsRec xprRootlessProcs = { xprUpdateRegion, xprDamageRects, xprSwitchWindow, + xprDoReorderWindow, xp_copy_bytes, xp_fill_bytes, xp_composite_pixels, diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index ef0a00dec..f646de4da 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,9 @@ +2004-10-07 Torrey Lyons <torrey at freedesktop dot org> + + * winscrinit.c: + Add compatibility with the generic rootless layer's new + DoReorderWindow function. + 2004-09-17 Torrey Lyons <torrey at freedesktop dot org> * winscrinit.c: (winFinishScreenInitFB): diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index f4c2b5579..c0840da47 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -57,6 +57,7 @@ winMWExtWMProcs = { winMWExtWMDamageRects, #endif winMWExtWMRootlessSwitchWindow, + NULL,//winWMExtWMDoReorderWindow, NULL,//winMWExtWMCopyBytes, NULL,//winMWExtWMFillBytes, diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h index d87b08da1..7612f00fa 100644 --- a/miext/rootless/rootless.h +++ b/miext/rootless/rootless.h @@ -267,6 +267,20 @@ typedef void (*RootlessSwitchWindowProc) (RootlessWindowPtr pFrame, WindowPtr oldWin); /* + * Check if window should be reordered. (Optional) + * The underlying window system may animate windows being ordered in. + * We want them to be mapped but remain ordered out until the animation + * completes. If defined this function will be called to check if a + * framed window should be reordered now. If this function returns + * FALSE, the window will still be mapped from the X11 perspective, but + * the RestackFrame function will not be called for its frame. + * + * pFrame Frame to reorder + */ +typedef Bool (*RootlessDoReorderWindowProc) + (RootlessWindowPtr pFrame); + +/* * Copy bytes. (Optional) * Source and destinate may overlap and the right thing should happen. * @@ -354,6 +368,7 @@ typedef struct _RootlessFrameProcs { /* Optional frame functions */ RootlessSwitchWindowProc SwitchWindow; + RootlessDoReorderWindowProc DoReorderWindow; /* Optional acceleration functions */ RootlessCopyBytesProc CopyBytes; diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index e8071bf02..334ac3f5e 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.2 2004/04/23 19:54:27 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/miext/rootless/rootlessWindow.c,v 1.3 2004/07/30 19:12:17 torrey Exp $ */ /* * Rootless window management */ @@ -481,7 +481,7 @@ RootlessUnrealizeWindow(WindowPtr pWin) /* * RootlessReorderWindow - * Reorder the window associated with the given frame so that it's + * Reorder the frame associated with the given window so that it's * physically above the window below it in the X stacking order. */ void @@ -495,6 +495,15 @@ RootlessReorderWindow(WindowPtr pWin) RootlessFrameID newPrevID; ScreenPtr pScreen = pWin->drawable.pScreen; + /* Check if the implementation wants the frame to not be reordered + even though the X11 window is restacked. This can be useful if + frames are ordered-in with animation so that the reordering is not + done until the animation is complete. */ + if (SCREENREC(pScreen)->imp->DoReorderWindow) { + if (!SCREENREC(pScreen)->imp->DoReorderWindow(winRec)) + return; + } + RootlessStopDrawing(pWin, FALSE); /* Find the next window above this one that has a mapped frame. */ |