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