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.
This commit is contained in:
Torrey Lyons 2004-10-08 00:35:08 +00:00
parent d737bc3300
commit fa9847aeb9
8 changed files with 128 additions and 41 deletions

View File

@ -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);

View File

@ -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(

View File

@ -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

View File

@ -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")
@ -342,6 +343,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,

View File

@ -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):

View File

@ -57,6 +57,7 @@ winMWExtWMProcs = {
winMWExtWMDamageRects,
#endif
winMWExtWMRootlessSwitchWindow,
NULL,//winWMExtWMDoReorderWindow,
NULL,//winMWExtWMCopyBytes,
NULL,//winMWExtWMFillBytes,

View File

@ -266,6 +266,20 @@ typedef void (*RootlessDamageRectsProc)
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;

View File

@ -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. */