aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xext/panoramiX.c10
-rw-r--r--xorg-server/Xext/panoramiXsrv.h12
-rw-r--r--xorg-server/Xext/xvdix.h12
-rw-r--r--xorg-server/Xext/xvmain.c14
-rw-r--r--xorg-server/Xext/xvmc.c6
-rw-r--r--xorg-server/Xi/exglobals.h2
-rw-r--r--xorg-server/Xi/extinit.c2618
-rw-r--r--xorg-server/dix/Makefile.am1
-rw-r--r--xorg-server/dix/deprecated.c165
-rw-r--r--xorg-server/exa/exa.h1686
-rw-r--r--xorg-server/exa/exa_classic.c4
-rw-r--r--xorg-server/exa/exa_driver.c452
-rw-r--r--xorg-server/exa/exa_migration_mixed.c4
-rw-r--r--xorg-server/exa/exa_mixed.c4
-rw-r--r--xorg-server/exa/exa_priv.h6
-rw-r--r--xorg-server/fb/fb.h4
-rw-r--r--xorg-server/fb/fb24_32.c2
-rw-r--r--xorg-server/fb/fbpixmap.c10
-rw-r--r--xorg-server/glx/glapi.c122
-rw-r--r--xorg-server/glx/glthread.c84
-rw-r--r--xorg-server/glx/glthread.h111
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.c5
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h2
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c10
-rw-r--r--xorg-server/hw/xnest/Pixmap.c5
-rw-r--r--xorg-server/hw/xnest/XNPixmap.h2
-rw-r--r--xorg-server/hw/xwin/win.h2930
-rw-r--r--xorg-server/hw/xwin/winpixmap.c7
-rw-r--r--xorg-server/include/dix.h31
-rw-r--r--xorg-server/include/misc.h2
-rw-r--r--xorg-server/include/pixmapstr.h167
-rw-r--r--xorg-server/include/resource.h29
-rw-r--r--xorg-server/include/scrnintstr.h2
-rw-r--r--xorg-server/render/render.c2
38 files changed, 4066 insertions, 4469 deletions
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index 489224221..309c09cda 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -83,11 +83,11 @@ static DepthPtr PanoramiXDepths;
static int PanoramiXNumVisuals;
static VisualPtr PanoramiXVisuals;
-unsigned long XRC_DRAWABLE;
-unsigned long XRT_WINDOW;
-unsigned long XRT_PIXMAP;
-unsigned long XRT_GC;
-unsigned long XRT_COLORMAP;
+RESTYPE XRC_DRAWABLE;
+RESTYPE XRT_WINDOW;
+RESTYPE XRT_PIXMAP;
+RESTYPE XRT_GC;
+RESTYPE XRT_COLORMAP;
static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
diff --git a/xorg-server/Xext/panoramiXsrv.h b/xorg-server/Xext/panoramiXsrv.h
index d177df28d..21f1b4cb8 100644
--- a/xorg-server/Xext/panoramiXsrv.h
+++ b/xorg-server/Xext/panoramiXsrv.h
@@ -21,12 +21,12 @@ extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
extern _X_EXPORT void XineramaReinitData(ScreenPtr);
-extern _X_EXPORT unsigned long XRC_DRAWABLE;
-extern _X_EXPORT unsigned long XRT_WINDOW;
-extern _X_EXPORT unsigned long XRT_PIXMAP;
-extern _X_EXPORT unsigned long XRT_GC;
-extern _X_EXPORT unsigned long XRT_COLORMAP;
-extern _X_EXPORT unsigned long XRT_PICTURE;
+extern _X_EXPORT RESTYPE XRC_DRAWABLE;
+extern _X_EXPORT RESTYPE XRT_WINDOW;
+extern _X_EXPORT RESTYPE XRT_PIXMAP;
+extern _X_EXPORT RESTYPE XRT_GC;
+extern _X_EXPORT RESTYPE XRT_COLORMAP;
+extern _X_EXPORT RESTYPE XRT_PICTURE;
/*
* Drivers are allowed to wrap this function. Each wrapper can decide that the
diff --git a/xorg-server/Xext/xvdix.h b/xorg-server/Xext/xvdix.h
index 5104a4def..58069f040 100644
--- a/xorg-server/Xext/xvdix.h
+++ b/xorg-server/Xext/xvdix.h
@@ -64,12 +64,12 @@ extern _X_EXPORT int XvReqCode;
extern _X_EXPORT int XvEventBase;
extern _X_EXPORT int XvErrorBase;
-extern _X_EXPORT unsigned long XvRTPort;
-extern _X_EXPORT unsigned long XvRTEncoding;
-extern _X_EXPORT unsigned long XvRTGrab;
-extern _X_EXPORT unsigned long XvRTVideoNotify;
-extern _X_EXPORT unsigned long XvRTVideoNotifyList;
-extern _X_EXPORT unsigned long XvRTPortNotify;
+extern _X_EXPORT RESTYPE XvRTPort;
+extern _X_EXPORT RESTYPE XvRTEncoding;
+extern _X_EXPORT RESTYPE XvRTGrab;
+extern _X_EXPORT RESTYPE XvRTVideoNotify;
+extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
+extern _X_EXPORT RESTYPE XvRTPortNotify;
#endif
typedef struct {
diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c
index 7cd900117..bbd2b3c6c 100644
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
@@ -115,14 +115,12 @@ int XvReqCode;
int XvEventBase;
int XvErrorBase;
-unsigned long XvRTPort;
-unsigned long XvRTEncoding;
-unsigned long XvRTGrab;
-unsigned long XvRTVideoNotify;
-unsigned long XvRTVideoNotifyList;
-unsigned long XvRTPortNotify;
-
-
+RESTYPE XvRTPort;
+RESTYPE XvRTEncoding;
+RESTYPE XvRTGrab;
+RESTYPE XvRTVideoNotify;
+RESTYPE XvRTVideoNotifyList;
+RESTYPE XvRTPortNotify;
/* EXTERNAL */
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 9b9dd0bc2..0a0e9415e 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -42,9 +42,9 @@ unsigned long XvMCGeneration = 0;
int XvMCReqCode;
int XvMCEventBase;
-unsigned long XvMCRTContext;
-unsigned long XvMCRTSurface;
-unsigned long XvMCRTSubpicture;
+static RESTYPE XvMCRTContext;
+static RESTYPE XvMCRTSurface;
+static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
diff --git a/xorg-server/Xi/exglobals.h b/xorg-server/Xi/exglobals.h
index 4f09e6ca3..cba7efed7 100644
--- a/xorg-server/Xi/exglobals.h
+++ b/xorg-server/Xi/exglobals.h
@@ -76,7 +76,7 @@ extern int ChangeDeviceNotify;
extern int DevicePresenceNotify;
extern int DevicePropertyNotify;
-extern int RT_INPUTCLIENT;
+extern RESTYPE RT_INPUTCLIENT;
extern DevPrivateKeyRec XIClientPrivateKeyRec;
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 82df7eb02..63f7fca8b 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -1,1309 +1,1309 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-********************************************************/
-
-/********************************************************************
- *
- * Dispatch routines and initialization routines for the X input extension.
- *
- */
-
-#define NUMTYPES 15
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h"
-#include "gcstruct.h" /* pointer for extnsionst.h */
-#include "extnsionst.h" /* extension entry */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include <X11/extensions/XI2proto.h>
-#include <X11/extensions/geproto.h>
-#include "geext.h" /* extension interfaces for ge */
-
-#include "dixevents.h"
-#include "exevents.h"
-#include "extinit.h"
-#include "exglobals.h"
-#include "swaprep.h"
-#include "privates.h"
-#include "protocol-versions.h"
-
-/* modules local to Xi */
-#include "allowev.h"
-#include "chgdctl.h"
-#include "chgfctl.h"
-#include "chgkbd.h"
-#include "chgprop.h"
-#include "chgptr.h"
-#include "closedev.h"
-#include "devbell.h"
-#include "getbmap.h"
-#include "getbmap.h"
-#include "getdctl.h"
-#include "getfctl.h"
-#include "getfocus.h"
-#include "getkmap.h"
-#include "getmmap.h"
-#include "getprop.h"
-#include "getselev.h"
-#include "getvers.h"
-#include "getvers.h"
-#include "grabdev.h"
-#include "grabdevb.h"
-#include "grabdevk.h"
-#include "gtmotion.h"
-#include "listdev.h"
-#include "opendev.h"
-#include "queryst.h"
-#include "selectev.h"
-#include "sendexev.h"
-#include "chgkmap.h"
-#include "setbmap.h"
-#include "setdval.h"
-#include "setfocus.h"
-#include "setmmap.h"
-#include "setmode.h"
-#include "ungrdev.h"
-#include "ungrdevb.h"
-#include "ungrdevk.h"
-#include "xiallowev.h"
-#include "xiselectev.h"
-#include "xigrabdev.h"
-#include "xipassivegrab.h"
-#include "xisetdevfocus.h"
-#include "xiproperty.h"
-#include "xichangecursor.h"
-#include "xichangehierarchy.h"
-#include "xigetclientpointer.h"
-#include "xiquerydevice.h"
-#include "xiquerypointer.h"
-#include "xiqueryversion.h"
-#include "xisetclientpointer.h"
-#include "xiwarppointer.h"
-
-
-/* Masks for XI events have to be aligned with core event (partially anyway).
- * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
- * breaks down. The device needs the dev->button->motionMask. If DBMM is
- * the same as BMM, we can ensure that both core and device events can be
- * delivered, without the need for extra structures in the DeviceIntRec. */
-const Mask DeviceKeyPressMask = KeyPressMask;
-const Mask DeviceKeyReleaseMask = KeyReleaseMask;
-const Mask DeviceButtonPressMask = ButtonPressMask;
-const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
-const Mask DeviceProximityMask = (1L << 4);
-const Mask DeviceStateNotifyMask = (1L << 5);
-const Mask DevicePointerMotionMask = PointerMotionMask;
-const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
-const Mask DeviceButton1MotionMask = Button1MotionMask;
-const Mask DeviceButton2MotionMask = Button2MotionMask;
-const Mask DeviceButton3MotionMask = Button3MotionMask;
-const Mask DeviceButton4MotionMask = Button4MotionMask;
-const Mask DeviceButton5MotionMask = Button5MotionMask;
-const Mask DeviceButtonMotionMask = ButtonMotionMask;
-const Mask DeviceFocusChangeMask = (1L << 14);
-const Mask DeviceMappingNotifyMask = (1L << 15);
-const Mask ChangeDeviceNotifyMask = (1L << 16);
-const Mask DeviceButtonGrabMask = (1L << 17);
-const Mask DeviceOwnerGrabButtonMask = (1L << 17);
-const Mask DevicePresenceNotifyMask = (1L << 18);
-const Mask DeviceEnterWindowMask = (1L << 18);
-const Mask DeviceLeaveWindowMask = (1L << 19);
-const Mask DevicePropertyNotifyMask = (1L << 20);
-const Mask XIAllMasks = (1L << 21) - 1;
-
-int ExtEventIndex;
-Mask ExtExclusiveMasks[EMASKSIZE];
-
-static struct dev_type
-{
- Atom type;
- char *name;
-} dev_type[] = {
- {
- 0, XI_KEYBOARD}, {
- 0, XI_MOUSE}, {
- 0, XI_TABLET}, {
- 0, XI_TOUCHSCREEN}, {
- 0, XI_TOUCHPAD}, {
- 0, XI_BARCODE}, {
- 0, XI_BUTTONBOX}, {
- 0, XI_KNOB_BOX}, {
- 0, XI_ONE_KNOB}, {
- 0, XI_NINE_KNOB}, {
- 0, XI_TRACKBALL}, {
- 0, XI_QUADRATURE}, {
- 0, XI_ID_MODULE}, {
- 0, XI_SPACEBALL}, {
- 0, XI_DATAGLOVE}, {
- 0, XI_EYETRACKER}, {
- 0, XI_CURSORKEYS}, {
-0, XI_FOOTMOUSE}};
-
-CARD8 event_base[numInputClasses];
-XExtEventInfo EventInfo[32];
-
-static DeviceIntRec xi_all_devices;
-static DeviceIntRec xi_all_master_devices;
-
-/**
- * Dispatch vector. Functions defined in here will be called when the matching
- * request arrives.
- */
-static int (*ProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- ProcXGetExtensionVersion, /* 1 */
- ProcXListInputDevices, /* 2 */
- ProcXOpenDevice, /* 3 */
- ProcXCloseDevice, /* 4 */
- ProcXSetDeviceMode, /* 5 */
- ProcXSelectExtensionEvent, /* 6 */
- ProcXGetSelectedExtensionEvents, /* 7 */
- ProcXChangeDeviceDontPropagateList, /* 8 */
- ProcXGetDeviceDontPropagateList, /* 9 */
- ProcXGetDeviceMotionEvents, /* 10 */
- ProcXChangeKeyboardDevice, /* 11 */
- ProcXChangePointerDevice, /* 12 */
- ProcXGrabDevice, /* 13 */
- ProcXUngrabDevice, /* 14 */
- ProcXGrabDeviceKey, /* 15 */
- ProcXUngrabDeviceKey, /* 16 */
- ProcXGrabDeviceButton, /* 17 */
- ProcXUngrabDeviceButton, /* 18 */
- ProcXAllowDeviceEvents, /* 19 */
- ProcXGetDeviceFocus, /* 20 */
- ProcXSetDeviceFocus, /* 21 */
- ProcXGetFeedbackControl, /* 22 */
- ProcXChangeFeedbackControl, /* 23 */
- ProcXGetDeviceKeyMapping, /* 24 */
- ProcXChangeDeviceKeyMapping, /* 25 */
- ProcXGetDeviceModifierMapping, /* 26 */
- ProcXSetDeviceModifierMapping, /* 27 */
- ProcXGetDeviceButtonMapping, /* 28 */
- ProcXSetDeviceButtonMapping, /* 29 */
- ProcXQueryDeviceState, /* 30 */
- ProcXSendExtensionEvent, /* 31 */
- ProcXDeviceBell, /* 32 */
- ProcXSetDeviceValuators, /* 33 */
- ProcXGetDeviceControl, /* 34 */
- ProcXChangeDeviceControl, /* 35 */
- /* XI 1.5 */
- ProcXListDeviceProperties, /* 36 */
- ProcXChangeDeviceProperty, /* 37 */
- ProcXDeleteDeviceProperty, /* 38 */
- ProcXGetDeviceProperty, /* 39 */
- /* XI 2 */
- ProcXIQueryPointer, /* 40 */
- ProcXIWarpPointer, /* 41 */
- ProcXIChangeCursor, /* 42 */
- ProcXIChangeHierarchy, /* 43 */
- ProcXISetClientPointer, /* 44 */
- ProcXIGetClientPointer, /* 45 */
- ProcXISelectEvents, /* 46 */
- ProcXIQueryVersion, /* 47 */
- ProcXIQueryDevice, /* 48 */
- ProcXISetFocus, /* 49 */
- ProcXIGetFocus, /* 50 */
- ProcXIGrabDevice, /* 51 */
- ProcXIUngrabDevice, /* 52 */
- ProcXIAllowEvents, /* 53 */
- ProcXIPassiveGrabDevice, /* 54 */
- ProcXIPassiveUngrabDevice, /* 55 */
- ProcXIListProperties, /* 56 */
- ProcXIChangeProperty, /* 57 */
- ProcXIDeleteProperty, /* 58 */
- ProcXIGetProperty, /* 59 */
- ProcXIGetSelectedEvents /* 60 */
-};
-
-/* For swapped clients */
-static int (*SProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- SProcXGetExtensionVersion, /* 1 */
- SProcXListInputDevices, /* 2 */
- SProcXOpenDevice, /* 3 */
- SProcXCloseDevice, /* 4 */
- SProcXSetDeviceMode, /* 5 */
- SProcXSelectExtensionEvent, /* 6 */
- SProcXGetSelectedExtensionEvents, /* 7 */
- SProcXChangeDeviceDontPropagateList, /* 8 */
- SProcXGetDeviceDontPropagateList, /* 9 */
- SProcXGetDeviceMotionEvents, /* 10 */
- SProcXChangeKeyboardDevice, /* 11 */
- SProcXChangePointerDevice, /* 12 */
- SProcXGrabDevice, /* 13 */
- SProcXUngrabDevice, /* 14 */
- SProcXGrabDeviceKey, /* 15 */
- SProcXUngrabDeviceKey, /* 16 */
- SProcXGrabDeviceButton, /* 17 */
- SProcXUngrabDeviceButton, /* 18 */
- SProcXAllowDeviceEvents, /* 19 */
- SProcXGetDeviceFocus, /* 20 */
- SProcXSetDeviceFocus, /* 21 */
- SProcXGetFeedbackControl, /* 22 */
- SProcXChangeFeedbackControl, /* 23 */
- SProcXGetDeviceKeyMapping, /* 24 */
- SProcXChangeDeviceKeyMapping, /* 25 */
- SProcXGetDeviceModifierMapping, /* 26 */
- SProcXSetDeviceModifierMapping, /* 27 */
- SProcXGetDeviceButtonMapping, /* 28 */
- SProcXSetDeviceButtonMapping, /* 29 */
- SProcXQueryDeviceState, /* 30 */
- SProcXSendExtensionEvent, /* 31 */
- SProcXDeviceBell, /* 32 */
- SProcXSetDeviceValuators, /* 33 */
- SProcXGetDeviceControl, /* 34 */
- SProcXChangeDeviceControl, /* 35 */
- SProcXListDeviceProperties, /* 36 */
- SProcXChangeDeviceProperty, /* 37 */
- SProcXDeleteDeviceProperty, /* 38 */
- SProcXGetDeviceProperty, /* 39 */
- SProcXIQueryPointer, /* 40 */
- SProcXIWarpPointer, /* 41 */
- SProcXIChangeCursor, /* 42 */
- SProcXIChangeHierarchy, /* 43 */
- SProcXISetClientPointer, /* 44 */
- SProcXIGetClientPointer, /* 45 */
- SProcXISelectEvents, /* 46 */
- SProcXIQueryVersion, /* 47 */
- SProcXIQueryDevice, /* 48 */
- SProcXISetFocus, /* 49 */
- SProcXIGetFocus, /* 50 */
- SProcXIGrabDevice, /* 51 */
- SProcXIUngrabDevice, /* 52 */
- SProcXIAllowEvents, /* 53 */
- SProcXIPassiveGrabDevice, /* 54 */
- SProcXIPassiveUngrabDevice, /* 55 */
- SProcXIListProperties, /* 56 */
- SProcXIChangeProperty, /* 57 */
- SProcXIDeleteProperty, /* 58 */
- SProcXIGetProperty, /* 59 */
- SProcXIGetSelectedEvents /* 60 */
-};
-
-/*****************************************************************
- *
- * Globals referenced elsewhere in the server.
- *
- */
-
-int IReqCode = 0;
-int IEventBase = 0;
-int BadDevice = 0;
-static int BadEvent = 1;
-int BadMode = 2;
-int DeviceBusy = 3;
-int BadClass = 4;
-
-int DeviceValuator;
-int DeviceKeyPress;
-int DeviceKeyRelease;
-int DeviceButtonPress;
-int DeviceButtonRelease;
-int DeviceMotionNotify;
-int DeviceFocusIn;
-int DeviceFocusOut;
-int ProximityIn;
-int ProximityOut;
-int DeviceStateNotify;
-int DeviceKeyStateNotify;
-int DeviceButtonStateNotify;
-int DeviceMappingNotify;
-int ChangeDeviceNotify;
-int DevicePresenceNotify;
-int DevicePropertyNotify;
-
-int RT_INPUTCLIENT;
-
-/*****************************************************************
- *
- * Externs defined elsewhere in the X server.
- *
- */
-
-extern XExtensionVersion XIVersion;
-
-
-Mask PropagateMask[MAXDEVICES];
-
-/*****************************************************************
- *
- * Versioning support
- *
- */
-
-DevPrivateKeyRec XIClientPrivateKeyRec;
-
-/*****************************************************************
- *
- * Declarations of local routines.
- *
- */
-
-static void
-XIClientCallback(CallbackListPtr *list,
- pointer closure,
- pointer data)
-{
- NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
- ClientPtr pClient = clientinfo->client;
- XIClientPtr pXIClient;
-
- pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
- pXIClient->major_version = 0;
- pXIClient->minor_version = 0;
-}
-
-/*************************************************************************
- *
- * ProcIDispatch - main dispatch routine for requests to this extension.
- * This routine is used if server and client have the same byte ordering.
- *
- */
-
-static int
-ProcIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
- return BadRequest;
-
- return (*ProcIVector[stuff->data])(client);
-}
-
-/*******************************************************************************
- *
- * SProcXDispatch
- *
- * Main swapped dispatch routine for requests to this extension.
- * This routine is used if server and client do not have the same byte ordering.
- *
- */
-
-static int
-SProcIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
- return BadRequest;
-
- return (*SProcIVector[stuff->data])(client);
-}
-
-/**********************************************************************
- *
- * SReplyIDispatch
- * Swap any replies defined in this extension.
- *
- */
-
-static void
-SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
- /* All we look at is the type field */
-{ /* This is common to all replies */
- if (rep->RepType == X_GetExtensionVersion)
- SRepXGetExtensionVersion(client, len,
- (xGetExtensionVersionReply *) rep);
- else if (rep->RepType == X_ListInputDevices)
- SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
- else if (rep->RepType == X_OpenDevice)
- SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
- else if (rep->RepType == X_SetDeviceMode)
- SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
- else if (rep->RepType == X_GetSelectedExtensionEvents)
- SRepXGetSelectedExtensionEvents(client, len,
- (xGetSelectedExtensionEventsReply *)
- rep);
- else if (rep->RepType == X_GetDeviceDontPropagateList)
- SRepXGetDeviceDontPropagateList(client, len,
- (xGetDeviceDontPropagateListReply *)
- rep);
- else if (rep->RepType == X_GetDeviceMotionEvents)
- SRepXGetDeviceMotionEvents(client, len,
- (xGetDeviceMotionEventsReply *) rep);
- else if (rep->RepType == X_GrabDevice)
- SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
- else if (rep->RepType == X_GetDeviceFocus)
- SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
- else if (rep->RepType == X_GetFeedbackControl)
- SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
- else if (rep->RepType == X_GetDeviceKeyMapping)
- SRepXGetDeviceKeyMapping(client, len,
- (xGetDeviceKeyMappingReply *) rep);
- else if (rep->RepType == X_GetDeviceModifierMapping)
- SRepXGetDeviceModifierMapping(client, len,
- (xGetDeviceModifierMappingReply *) rep);
- else if (rep->RepType == X_SetDeviceModifierMapping)
- SRepXSetDeviceModifierMapping(client, len,
- (xSetDeviceModifierMappingReply *) rep);
- else if (rep->RepType == X_GetDeviceButtonMapping)
- SRepXGetDeviceButtonMapping(client, len,
- (xGetDeviceButtonMappingReply *) rep);
- else if (rep->RepType == X_SetDeviceButtonMapping)
- SRepXSetDeviceButtonMapping(client, len,
- (xSetDeviceButtonMappingReply *) rep);
- else if (rep->RepType == X_QueryDeviceState)
- SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
- else if (rep->RepType == X_SetDeviceValuators)
- SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
- else if (rep->RepType == X_GetDeviceControl)
- SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
- else if (rep->RepType == X_ChangeDeviceControl)
- SRepXChangeDeviceControl(client, len,
- (xChangeDeviceControlReply *) rep);
- else if (rep->RepType == X_ListDeviceProperties)
- SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
- else if (rep->RepType == X_GetDeviceProperty)
- SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
- else if (rep->RepType == X_XIQueryPointer)
- SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
- else if (rep->RepType == X_XIGetClientPointer)
- SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
- else if (rep->RepType == X_XIQueryVersion)
- SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
- else if (rep->RepType == X_XIQueryDevice)
- SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
- else if (rep->RepType == X_XIGrabDevice)
- SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
- else if (rep->RepType == X_XIGrabDevice)
- SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
- else if (rep->RepType == X_XIListProperties)
- SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
- else if (rep->RepType == X_XIGetProperty)
- SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
- else if (rep->RepType == X_XIGetSelectedEvents)
- SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
- else if (rep->RepType == X_XIGetFocus)
- SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
- else {
- FatalError("XINPUT confused sending swapped reply");
- }
-}
-
-/************************************************************************
- *
- * This function swaps the DeviceValuator event.
- *
- */
-
-static void
-SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
-{
- char n;
- int i;
- INT32 *ip B32;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swaps(&to->device_state, n);
- ip = &to->valuator0;
- for (i = 0; i < 6; i++) {
- swapl((ip + i), n); /* macro - braces are required */
- }
-}
-
-static void
-SEventFocus(deviceFocus * from, deviceFocus * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
- swapl(&to->window, n);
-}
-
-static void
-SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
-{
- int i;
- char n;
- INT32 *ip B32;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
- ip = &to->valuator0;
- for (i = 0; i < 3; i++) {
- swapl((ip + i), n); /* macro - braces are required */
- }
-}
-
-static void
-SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
- deviceKeyStateNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
-}
-
-static void
-SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
- deviceButtonStateNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
-}
-
-static void
-SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
-}
-
-static void
-SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
-}
-
-static void
-SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swaps(&to->control, n);
-}
-
-static void
-SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swapl(&to->atom, n);
-}
-
-static void
-SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->sourceid, n);
- swaps(&to->buttons_len, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
-}
-
-static void
-SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
-{
- char n;
- int i, j;
- xXIAnyInfo *any;
-
- *to = *from;
- memcpy(&to[1], &from[1], from->length * 4);
-
- any = (xXIAnyInfo*)&to[1];
- for (i = 0; i < to->num_classes; i++)
- {
- int length = any->length;
-
- switch(any->type)
- {
- case KeyClass:
- {
- xXIKeyInfo *ki = (xXIKeyInfo*)any;
- uint32_t *key = (uint32_t*)&ki[1];
- for (j = 0; j < ki->num_keycodes; j++, key++)
- swapl(key, n);
- swaps(&ki->num_keycodes, n);
- }
- break;
- case ButtonClass:
- {
- xXIButtonInfo *bi = (xXIButtonInfo*)any;
- Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
- pad_to_int32(bits_to_bytes(bi->num_buttons)));
- for (j = 0; j < bi->num_buttons; j++)
- swapl(&labels[j], n);
- swaps(&bi->num_buttons, n);
- }
- break;
- case ValuatorClass:
- {
- xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
- swapl(&ai->label, n);
- swapl(&ai->min.integral, n);
- swapl(&ai->min.frac, n);
- swapl(&ai->max.integral, n);
- swapl(&ai->max.frac, n);
- swapl(&ai->resolution, n);
- swaps(&ai->number, n);
- }
- break;
- }
-
- swaps(&any->type, n);
- swaps(&any->length, n);
- swaps(&any->sourceid, n);
-
- any = (xXIAnyInfo*)((char*)any + length * 4);
- }
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swaps(&to->num_classes, n);
- swaps(&to->sourceid, n);
-
-}
-
-static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
-{
- int i;
- char n;
- char *ptr;
- char *vmask;
-
- memcpy(to, from, sizeof(xEvent) + from->length * 4);
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->buttons_len, n);
- swaps(&to->valuators_len, n);
- swaps(&to->sourceid, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
- swapl(&to->mods.effective_mods, n);
- swapl(&to->flags, n);
-
- ptr = (char*)(&to[1]);
- ptr += from->buttons_len * 4;
- vmask = ptr; /* valuator mask */
- ptr += from->valuators_len * 4;
- for (i = 0; i < from->valuators_len * 32; i++)
- {
- if (BitIsOn(vmask, i))
- {
- swapl(((uint32_t*)ptr), n);
- ptr += 4;
- swapl(((uint32_t*)ptr), n);
- ptr += 4;
- }
- }
-}
-
-static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
- xXIHierarchyEvent *to)
-{
- int i;
- char n;
- xXIHierarchyInfo *info;
-
- *to = *from;
- memcpy(&to[1], &from[1], from->length * 4);
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->flags, n);
- swaps(&to->num_info, n);
-
- info = (xXIHierarchyInfo*)&to[1];
- for (i = 0; i< from->num_info; i++)
- {
- swaps(&info->deviceid, n);
- swaps(&info->attachment, n);
- info++;
- }
-}
-
-static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
-{
- char n;
-
- *to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->property, n);
-}
-
-static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
-{
- char n;
- int i;
- FP3232 *values;
- unsigned char *mask;
-
- memcpy(to, from, sizeof(xEvent) + from->length * 4);
-
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
-
-
- mask = (unsigned char*)&to[1];
- values = (FP3232*)(mask + from->valuators_len * 4);
-
- for (i = 0; i < from->valuators_len * 4 * 8; i++)
- {
- if (BitIsOn(mask, i))
- {
- /* for each bit set there are two FP3232 values on the wire, in
- * the order abcABC for data and data_raw. Here we swap as if
- * they were in aAbBcC order because it's easier and really
- * doesn't matter.
- */
- swapl(&values->integral, n);
- swapl(&values->frac, n);
- values++;
- swapl(&values->integral, n);
- swapl(&values->frac, n);
- values++;
- }
- }
-
- swaps(&to->valuators_len, n);
-}
-
-
-/** Event swapping function for XI2 events. */
-void
-XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
-{
- switch(from->evtype)
- {
- case XI_Enter:
- case XI_Leave:
- SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
- break;
- case XI_DeviceChanged:
- SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
- (xXIDeviceChangedEvent*)to);
- break;
- case XI_HierarchyChanged:
- SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
- break;
- case XI_PropertyEvent:
- SXIPropertyEvent((xXIPropertyEvent*)from,
- (xXIPropertyEvent*)to);
- break;
- case XI_Motion:
- case XI_KeyPress:
- case XI_KeyRelease:
- case XI_ButtonPress:
- case XI_ButtonRelease:
- SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
- break;
- case XI_RawMotion:
- case XI_RawKeyPress:
- case XI_RawKeyRelease:
- case XI_RawButtonPress:
- case XI_RawButtonRelease:
- SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
- break;
- default:
- ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
- break;
- }
-}
-
-/**************************************************************************
- *
- * Allow the specified event to have its propagation suppressed.
- * The default is to not allow suppression of propagation.
- *
- */
-
-static void
-AllowPropagateSuppress(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAXDEVICES; i++)
- PropagateMask[i] |= mask;
-}
-
-/**************************************************************************
- *
- * Record an event mask where there is no unique corresponding event type.
- * We can't call SetMaskForEvent, since that would clobber the existing
- * mask for that event. MotionHint and ButtonMotion are examples.
- *
- * Since extension event types will never be less than 64, we can use
- * 0-63 in the EventInfo array as the "type" to be used to look up this
- * mask. This means that the corresponding macros such as
- * DevicePointerMotionHint must have access to the same constants.
- *
- */
-
-static void
-SetEventInfo(Mask mask, int constant)
-{
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = constant;
-}
-
-/**************************************************************************
- *
- * Allow the specified event to be restricted to being selected by one
- * client at a time.
- * The default is to allow more than one client to select the event.
- *
- */
-
-static void
-SetExclusiveAccess(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAXDEVICES; i++)
- ExtExclusiveMasks[i] |= mask;
-}
-
-/**************************************************************************
- *
- * Assign the specified mask to the specified event.
- *
- */
-
-static void
-SetMaskForExtEvent(Mask mask, int event)
-{
- int i;
-
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = event;
-
- if ((event < LASTEvent) || (event >= 128))
- FatalError("MaskForExtensionEvent: bogus event number");
-
- for (i = 0; i < MAXDEVICES; i++)
- SetMaskForEvent(i, mask, event);
-}
-
-/************************************************************************
- *
- * This function sets up extension event types and masks.
- *
- */
-
-static void
-FixExtensionEvents(ExtensionEntry * extEntry)
-{
- DeviceValuator = extEntry->eventBase;
- DeviceKeyPress = DeviceValuator + 1;
- DeviceKeyRelease = DeviceKeyPress + 1;
- DeviceButtonPress = DeviceKeyRelease + 1;
- DeviceButtonRelease = DeviceButtonPress + 1;
- DeviceMotionNotify = DeviceButtonRelease + 1;
- DeviceFocusIn = DeviceMotionNotify + 1;
- DeviceFocusOut = DeviceFocusIn + 1;
- ProximityIn = DeviceFocusOut + 1;
- ProximityOut = ProximityIn + 1;
- DeviceStateNotify = ProximityOut + 1;
- DeviceMappingNotify = DeviceStateNotify + 1;
- ChangeDeviceNotify = DeviceMappingNotify + 1;
- DeviceKeyStateNotify = ChangeDeviceNotify + 1;
- DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
- DevicePresenceNotify = DeviceButtonStateNotify + 1;
- DevicePropertyNotify = DevicePresenceNotify + 1;
-
- event_base[KeyClass] = DeviceKeyPress;
- event_base[ButtonClass] = DeviceButtonPress;
- event_base[ValuatorClass] = DeviceMotionNotify;
- event_base[ProximityClass] = ProximityIn;
- event_base[FocusClass] = DeviceFocusIn;
- event_base[OtherClass] = DeviceStateNotify;
-
- BadDevice += extEntry->errorBase;
- BadEvent += extEntry->errorBase;
- BadMode += extEntry->errorBase;
- DeviceBusy += extEntry->errorBase;
- BadClass += extEntry->errorBase;
-
- SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
- AllowPropagateSuppress(DeviceKeyPressMask);
- SetCriticalEvent(DeviceKeyPress);
-
- SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
- AllowPropagateSuppress(DeviceKeyReleaseMask);
- SetCriticalEvent(DeviceKeyRelease);
-
- SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
- AllowPropagateSuppress(DeviceButtonPressMask);
- SetCriticalEvent(DeviceButtonPress);
-
- SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
- AllowPropagateSuppress(DeviceButtonReleaseMask);
- SetCriticalEvent(DeviceButtonRelease);
-
- SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
- SetMaskForExtEvent(DeviceProximityMask, ProximityOut);
-
- SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
-
- SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
- AllowPropagateSuppress(DevicePointerMotionMask);
- SetCriticalEvent(DeviceMotionNotify);
-
- SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
- SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion);
- SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion);
- SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion);
- SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion);
- SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion);
- SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
-
- SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
- SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
-
- SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify);
- SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
-
- SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
- SetExclusiveAccess(DeviceButtonGrabMask);
-
- SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
- SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
- SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
-
- SetEventInfo(0, _noExtensionEvent);
-}
-
-/************************************************************************
- *
- * This function restores extension event types and masks to their
- * initial state.
- *
- */
-
-static void
-RestoreExtensionEvents(void)
-{
- int i, j;
-
- IReqCode = 0;
- IEventBase = 0;
-
- for (i = 0; i < ExtEventIndex - 1; i++) {
- if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
- {
- for (j = 0; j < MAXDEVICES; j++)
- SetMaskForEvent(j, 0, EventInfo[i].type);
- }
- EventInfo[i].mask = 0;
- EventInfo[i].type = 0;
- }
- ExtEventIndex = 0;
- DeviceValuator = 0;
- DeviceKeyPress = 1;
- DeviceKeyRelease = 2;
- DeviceButtonPress = 3;
- DeviceButtonRelease = 4;
- DeviceMotionNotify = 5;
- DeviceFocusIn = 6;
- DeviceFocusOut = 7;
- ProximityIn = 8;
- ProximityOut = 9;
- DeviceStateNotify = 10;
- DeviceMappingNotify = 11;
- ChangeDeviceNotify = 12;
- DeviceKeyStateNotify = 13;
- DeviceButtonStateNotify = 13;
- DevicePresenceNotify = 14;
- DevicePropertyNotify = 15;
-
- BadDevice = 0;
- BadEvent = 1;
- BadMode = 2;
- DeviceBusy = 3;
- BadClass = 4;
-
-}
-
-/***********************************************************************
- *
- * IResetProc.
- * Remove reply-swapping routine.
- * Remove event-swapping routine.
- *
- */
-
-static void
-IResetProc(ExtensionEntry * unused)
-{
- ReplySwapVector[IReqCode] = ReplyNotSwappd;
- EventSwapVector[DeviceValuator] = NotImplemented;
- EventSwapVector[DeviceKeyPress] = NotImplemented;
- EventSwapVector[DeviceKeyRelease] = NotImplemented;
- EventSwapVector[DeviceButtonPress] = NotImplemented;
- EventSwapVector[DeviceButtonRelease] = NotImplemented;
- EventSwapVector[DeviceMotionNotify] = NotImplemented;
- EventSwapVector[DeviceFocusIn] = NotImplemented;
- EventSwapVector[DeviceFocusOut] = NotImplemented;
- EventSwapVector[ProximityIn] = NotImplemented;
- EventSwapVector[ProximityOut] = NotImplemented;
- EventSwapVector[DeviceStateNotify] = NotImplemented;
- EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
- EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
- EventSwapVector[DeviceMappingNotify] = NotImplemented;
- EventSwapVector[ChangeDeviceNotify] = NotImplemented;
- EventSwapVector[DevicePresenceNotify] = NotImplemented;
- EventSwapVector[DevicePropertyNotify] = NotImplemented;
- RestoreExtensionEvents();
-}
-
-
-/***********************************************************************
- *
- * Assign an id and type to an input device.
- *
- */
-
-void
-AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
-{
- dev->xinput_type = type;
- dev->name = strdup(name);
-}
-
-/***********************************************************************
- *
- * Make device type atoms.
- *
- */
-
-static void
-MakeDeviceTypeAtoms(void)
-{
- int i;
-
- for (i = 0; i < NUMTYPES; i++)
- dev_type[i].type =
- MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
-}
-
-/*****************************************************************************
- *
- * SEventIDispatch
- *
- * Swap any events defined in this extension.
- */
-#define DO_SWAP(func,type) func ((type *)from, (type *)to)
-
-static void
-SEventIDispatch(xEvent * from, xEvent * to)
-{
- int type = from->u.u.type & 0177;
-
- if (type == DeviceValuator)
- DO_SWAP(SEventDeviceValuator, deviceValuator);
- else if (type == DeviceKeyPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceKeyRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceMotionNotify) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceFocusIn)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == DeviceFocusOut)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == ProximityIn) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == ProximityOut) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceStateNotify)
- DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
- else if (type == DeviceKeyStateNotify)
- DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
- else if (type == DeviceButtonStateNotify)
- DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
- else if (type == DeviceMappingNotify)
- DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
- else if (type == ChangeDeviceNotify)
- DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
- else if (type == DevicePresenceNotify)
- DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
- else if (type == DevicePropertyNotify)
- DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
- else {
- FatalError("XInputExtension: Impossible event!\n");
- }
-}
-
-/**********************************************************************
- *
- * IExtensionInit - initialize the input extension.
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- * This extension has several events and errors.
- *
- * XI is mandatory nowadays, so if we fail to init XI, we die.
- */
-
-void
-XInputExtensionInit(void)
-{
- ExtensionEntry *extEntry;
- XExtensionVersion thisversion = { XI_Present,
- SERVER_XI_MAJOR_VERSION,
- SERVER_XI_MINOR_VERSION,
- };
-
- if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
- FatalError("Cannot request private for XI.\n");
-
- if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
- FatalError("Failed to add callback to XI.\n");
-
- extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
- SProcIDispatch, IResetProc, StandardMinorOpcode);
- if (extEntry) {
- IReqCode = extEntry->base;
- IEventBase = extEntry->eventBase;
- XIVersion = thisversion;
- MakeDeviceTypeAtoms();
- RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
- "INPUTCLIENT");
- if (!RT_INPUTCLIENT)
- FatalError("Failed to add resource type for XI.\n");
- FixExtensionEvents(extEntry);
- ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
- EventSwapVector[DeviceValuator] = SEventIDispatch;
- EventSwapVector[DeviceKeyPress] = SEventIDispatch;
- EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
- EventSwapVector[DeviceButtonPress] = SEventIDispatch;
- EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
- EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
- EventSwapVector[DeviceFocusIn] = SEventIDispatch;
- EventSwapVector[DeviceFocusOut] = SEventIDispatch;
- EventSwapVector[ProximityIn] = SEventIDispatch;
- EventSwapVector[ProximityOut] = SEventIDispatch;
- EventSwapVector[DeviceStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
- EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
- EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
-
- GERegisterExtension(IReqCode, XI2EventSwap);
-
-
- memset(&xi_all_devices, 0, sizeof(xi_all_devices));
- memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
- xi_all_devices.id = XIAllDevices;
- xi_all_devices.name = "XIAllDevices";
- xi_all_master_devices.id = XIAllMasterDevices;
- xi_all_master_devices.name = "XIAllMasterDevices";
-
- inputInfo.all_devices = &xi_all_devices;
- inputInfo.all_master_devices = &xi_all_master_devices;
-
- XIResetProperties();
- } else {
- FatalError("IExtensionInit: AddExtensions failed\n");
- }
-}
-
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/********************************************************************
+ *
+ * Dispatch routines and initialization routines for the X input extension.
+ *
+ */
+
+#define NUMTYPES 15
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h"
+#include "gcstruct.h" /* pointer for extnsionst.h */
+#include "extnsionst.h" /* extension entry */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/geproto.h>
+#include "geext.h" /* extension interfaces for ge */
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+#include "swaprep.h"
+#include "privates.h"
+#include "protocol-versions.h"
+
+/* modules local to Xi */
+#include "allowev.h"
+#include "chgdctl.h"
+#include "chgfctl.h"
+#include "chgkbd.h"
+#include "chgprop.h"
+#include "chgptr.h"
+#include "closedev.h"
+#include "devbell.h"
+#include "getbmap.h"
+#include "getbmap.h"
+#include "getdctl.h"
+#include "getfctl.h"
+#include "getfocus.h"
+#include "getkmap.h"
+#include "getmmap.h"
+#include "getprop.h"
+#include "getselev.h"
+#include "getvers.h"
+#include "getvers.h"
+#include "grabdev.h"
+#include "grabdevb.h"
+#include "grabdevk.h"
+#include "gtmotion.h"
+#include "listdev.h"
+#include "opendev.h"
+#include "queryst.h"
+#include "selectev.h"
+#include "sendexev.h"
+#include "chgkmap.h"
+#include "setbmap.h"
+#include "setdval.h"
+#include "setfocus.h"
+#include "setmmap.h"
+#include "setmode.h"
+#include "ungrdev.h"
+#include "ungrdevb.h"
+#include "ungrdevk.h"
+#include "xiallowev.h"
+#include "xiselectev.h"
+#include "xigrabdev.h"
+#include "xipassivegrab.h"
+#include "xisetdevfocus.h"
+#include "xiproperty.h"
+#include "xichangecursor.h"
+#include "xichangehierarchy.h"
+#include "xigetclientpointer.h"
+#include "xiquerydevice.h"
+#include "xiquerypointer.h"
+#include "xiqueryversion.h"
+#include "xisetclientpointer.h"
+#include "xiwarppointer.h"
+
+
+/* Masks for XI events have to be aligned with core event (partially anyway).
+ * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
+ * breaks down. The device needs the dev->button->motionMask. If DBMM is
+ * the same as BMM, we can ensure that both core and device events can be
+ * delivered, without the need for extra structures in the DeviceIntRec. */
+const Mask DeviceKeyPressMask = KeyPressMask;
+const Mask DeviceKeyReleaseMask = KeyReleaseMask;
+const Mask DeviceButtonPressMask = ButtonPressMask;
+const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
+const Mask DeviceProximityMask = (1L << 4);
+const Mask DeviceStateNotifyMask = (1L << 5);
+const Mask DevicePointerMotionMask = PointerMotionMask;
+const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
+const Mask DeviceButton1MotionMask = Button1MotionMask;
+const Mask DeviceButton2MotionMask = Button2MotionMask;
+const Mask DeviceButton3MotionMask = Button3MotionMask;
+const Mask DeviceButton4MotionMask = Button4MotionMask;
+const Mask DeviceButton5MotionMask = Button5MotionMask;
+const Mask DeviceButtonMotionMask = ButtonMotionMask;
+const Mask DeviceFocusChangeMask = (1L << 14);
+const Mask DeviceMappingNotifyMask = (1L << 15);
+const Mask ChangeDeviceNotifyMask = (1L << 16);
+const Mask DeviceButtonGrabMask = (1L << 17);
+const Mask DeviceOwnerGrabButtonMask = (1L << 17);
+const Mask DevicePresenceNotifyMask = (1L << 18);
+const Mask DeviceEnterWindowMask = (1L << 18);
+const Mask DeviceLeaveWindowMask = (1L << 19);
+const Mask DevicePropertyNotifyMask = (1L << 20);
+const Mask XIAllMasks = (1L << 21) - 1;
+
+int ExtEventIndex;
+Mask ExtExclusiveMasks[EMASKSIZE];
+
+static struct dev_type
+{
+ Atom type;
+ char *name;
+} dev_type[] = {
+ {
+ 0, XI_KEYBOARD}, {
+ 0, XI_MOUSE}, {
+ 0, XI_TABLET}, {
+ 0, XI_TOUCHSCREEN}, {
+ 0, XI_TOUCHPAD}, {
+ 0, XI_BARCODE}, {
+ 0, XI_BUTTONBOX}, {
+ 0, XI_KNOB_BOX}, {
+ 0, XI_ONE_KNOB}, {
+ 0, XI_NINE_KNOB}, {
+ 0, XI_TRACKBALL}, {
+ 0, XI_QUADRATURE}, {
+ 0, XI_ID_MODULE}, {
+ 0, XI_SPACEBALL}, {
+ 0, XI_DATAGLOVE}, {
+ 0, XI_EYETRACKER}, {
+ 0, XI_CURSORKEYS}, {
+0, XI_FOOTMOUSE}};
+
+CARD8 event_base[numInputClasses];
+XExtEventInfo EventInfo[32];
+
+static DeviceIntRec xi_all_devices;
+static DeviceIntRec xi_all_master_devices;
+
+/**
+ * Dispatch vector. Functions defined in here will be called when the matching
+ * request arrives.
+ */
+static int (*ProcIVector[])(ClientPtr) = {
+ NULL, /* 0 */
+ ProcXGetExtensionVersion, /* 1 */
+ ProcXListInputDevices, /* 2 */
+ ProcXOpenDevice, /* 3 */
+ ProcXCloseDevice, /* 4 */
+ ProcXSetDeviceMode, /* 5 */
+ ProcXSelectExtensionEvent, /* 6 */
+ ProcXGetSelectedExtensionEvents, /* 7 */
+ ProcXChangeDeviceDontPropagateList, /* 8 */
+ ProcXGetDeviceDontPropagateList, /* 9 */
+ ProcXGetDeviceMotionEvents, /* 10 */
+ ProcXChangeKeyboardDevice, /* 11 */
+ ProcXChangePointerDevice, /* 12 */
+ ProcXGrabDevice, /* 13 */
+ ProcXUngrabDevice, /* 14 */
+ ProcXGrabDeviceKey, /* 15 */
+ ProcXUngrabDeviceKey, /* 16 */
+ ProcXGrabDeviceButton, /* 17 */
+ ProcXUngrabDeviceButton, /* 18 */
+ ProcXAllowDeviceEvents, /* 19 */
+ ProcXGetDeviceFocus, /* 20 */
+ ProcXSetDeviceFocus, /* 21 */
+ ProcXGetFeedbackControl, /* 22 */
+ ProcXChangeFeedbackControl, /* 23 */
+ ProcXGetDeviceKeyMapping, /* 24 */
+ ProcXChangeDeviceKeyMapping, /* 25 */
+ ProcXGetDeviceModifierMapping, /* 26 */
+ ProcXSetDeviceModifierMapping, /* 27 */
+ ProcXGetDeviceButtonMapping, /* 28 */
+ ProcXSetDeviceButtonMapping, /* 29 */
+ ProcXQueryDeviceState, /* 30 */
+ ProcXSendExtensionEvent, /* 31 */
+ ProcXDeviceBell, /* 32 */
+ ProcXSetDeviceValuators, /* 33 */
+ ProcXGetDeviceControl, /* 34 */
+ ProcXChangeDeviceControl, /* 35 */
+ /* XI 1.5 */
+ ProcXListDeviceProperties, /* 36 */
+ ProcXChangeDeviceProperty, /* 37 */
+ ProcXDeleteDeviceProperty, /* 38 */
+ ProcXGetDeviceProperty, /* 39 */
+ /* XI 2 */
+ ProcXIQueryPointer, /* 40 */
+ ProcXIWarpPointer, /* 41 */
+ ProcXIChangeCursor, /* 42 */
+ ProcXIChangeHierarchy, /* 43 */
+ ProcXISetClientPointer, /* 44 */
+ ProcXIGetClientPointer, /* 45 */
+ ProcXISelectEvents, /* 46 */
+ ProcXIQueryVersion, /* 47 */
+ ProcXIQueryDevice, /* 48 */
+ ProcXISetFocus, /* 49 */
+ ProcXIGetFocus, /* 50 */
+ ProcXIGrabDevice, /* 51 */
+ ProcXIUngrabDevice, /* 52 */
+ ProcXIAllowEvents, /* 53 */
+ ProcXIPassiveGrabDevice, /* 54 */
+ ProcXIPassiveUngrabDevice, /* 55 */
+ ProcXIListProperties, /* 56 */
+ ProcXIChangeProperty, /* 57 */
+ ProcXIDeleteProperty, /* 58 */
+ ProcXIGetProperty, /* 59 */
+ ProcXIGetSelectedEvents /* 60 */
+};
+
+/* For swapped clients */
+static int (*SProcIVector[])(ClientPtr) = {
+ NULL, /* 0 */
+ SProcXGetExtensionVersion, /* 1 */
+ SProcXListInputDevices, /* 2 */
+ SProcXOpenDevice, /* 3 */
+ SProcXCloseDevice, /* 4 */
+ SProcXSetDeviceMode, /* 5 */
+ SProcXSelectExtensionEvent, /* 6 */
+ SProcXGetSelectedExtensionEvents, /* 7 */
+ SProcXChangeDeviceDontPropagateList, /* 8 */
+ SProcXGetDeviceDontPropagateList, /* 9 */
+ SProcXGetDeviceMotionEvents, /* 10 */
+ SProcXChangeKeyboardDevice, /* 11 */
+ SProcXChangePointerDevice, /* 12 */
+ SProcXGrabDevice, /* 13 */
+ SProcXUngrabDevice, /* 14 */
+ SProcXGrabDeviceKey, /* 15 */
+ SProcXUngrabDeviceKey, /* 16 */
+ SProcXGrabDeviceButton, /* 17 */
+ SProcXUngrabDeviceButton, /* 18 */
+ SProcXAllowDeviceEvents, /* 19 */
+ SProcXGetDeviceFocus, /* 20 */
+ SProcXSetDeviceFocus, /* 21 */
+ SProcXGetFeedbackControl, /* 22 */
+ SProcXChangeFeedbackControl, /* 23 */
+ SProcXGetDeviceKeyMapping, /* 24 */
+ SProcXChangeDeviceKeyMapping, /* 25 */
+ SProcXGetDeviceModifierMapping, /* 26 */
+ SProcXSetDeviceModifierMapping, /* 27 */
+ SProcXGetDeviceButtonMapping, /* 28 */
+ SProcXSetDeviceButtonMapping, /* 29 */
+ SProcXQueryDeviceState, /* 30 */
+ SProcXSendExtensionEvent, /* 31 */
+ SProcXDeviceBell, /* 32 */
+ SProcXSetDeviceValuators, /* 33 */
+ SProcXGetDeviceControl, /* 34 */
+ SProcXChangeDeviceControl, /* 35 */
+ SProcXListDeviceProperties, /* 36 */
+ SProcXChangeDeviceProperty, /* 37 */
+ SProcXDeleteDeviceProperty, /* 38 */
+ SProcXGetDeviceProperty, /* 39 */
+ SProcXIQueryPointer, /* 40 */
+ SProcXIWarpPointer, /* 41 */
+ SProcXIChangeCursor, /* 42 */
+ SProcXIChangeHierarchy, /* 43 */
+ SProcXISetClientPointer, /* 44 */
+ SProcXIGetClientPointer, /* 45 */
+ SProcXISelectEvents, /* 46 */
+ SProcXIQueryVersion, /* 47 */
+ SProcXIQueryDevice, /* 48 */
+ SProcXISetFocus, /* 49 */
+ SProcXIGetFocus, /* 50 */
+ SProcXIGrabDevice, /* 51 */
+ SProcXIUngrabDevice, /* 52 */
+ SProcXIAllowEvents, /* 53 */
+ SProcXIPassiveGrabDevice, /* 54 */
+ SProcXIPassiveUngrabDevice, /* 55 */
+ SProcXIListProperties, /* 56 */
+ SProcXIChangeProperty, /* 57 */
+ SProcXIDeleteProperty, /* 58 */
+ SProcXIGetProperty, /* 59 */
+ SProcXIGetSelectedEvents /* 60 */
+};
+
+/*****************************************************************
+ *
+ * Globals referenced elsewhere in the server.
+ *
+ */
+
+int IReqCode = 0;
+int IEventBase = 0;
+int BadDevice = 0;
+static int BadEvent = 1;
+int BadMode = 2;
+int DeviceBusy = 3;
+int BadClass = 4;
+
+int DeviceValuator;
+int DeviceKeyPress;
+int DeviceKeyRelease;
+int DeviceButtonPress;
+int DeviceButtonRelease;
+int DeviceMotionNotify;
+int DeviceFocusIn;
+int DeviceFocusOut;
+int ProximityIn;
+int ProximityOut;
+int DeviceStateNotify;
+int DeviceKeyStateNotify;
+int DeviceButtonStateNotify;
+int DeviceMappingNotify;
+int ChangeDeviceNotify;
+int DevicePresenceNotify;
+int DevicePropertyNotify;
+
+RESTYPE RT_INPUTCLIENT;
+
+/*****************************************************************
+ *
+ * Externs defined elsewhere in the X server.
+ *
+ */
+
+extern XExtensionVersion XIVersion;
+
+
+Mask PropagateMask[MAXDEVICES];
+
+/*****************************************************************
+ *
+ * Versioning support
+ *
+ */
+
+DevPrivateKeyRec XIClientPrivateKeyRec;
+
+/*****************************************************************
+ *
+ * Declarations of local routines.
+ *
+ */
+
+static void
+XIClientCallback(CallbackListPtr *list,
+ pointer closure,
+ pointer data)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
+ ClientPtr pClient = clientinfo->client;
+ XIClientPtr pXIClient;
+
+ pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
+ pXIClient->major_version = 0;
+ pXIClient->minor_version = 0;
+}
+
+/*************************************************************************
+ *
+ * ProcIDispatch - main dispatch routine for requests to this extension.
+ * This routine is used if server and client have the same byte ordering.
+ *
+ */
+
+static int
+ProcIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
+ return BadRequest;
+
+ return (*ProcIVector[stuff->data])(client);
+}
+
+/*******************************************************************************
+ *
+ * SProcXDispatch
+ *
+ * Main swapped dispatch routine for requests to this extension.
+ * This routine is used if server and client do not have the same byte ordering.
+ *
+ */
+
+static int
+SProcIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
+ return BadRequest;
+
+ return (*SProcIVector[stuff->data])(client);
+}
+
+/**********************************************************************
+ *
+ * SReplyIDispatch
+ * Swap any replies defined in this extension.
+ *
+ */
+
+static void
+SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
+ /* All we look at is the type field */
+{ /* This is common to all replies */
+ if (rep->RepType == X_GetExtensionVersion)
+ SRepXGetExtensionVersion(client, len,
+ (xGetExtensionVersionReply *) rep);
+ else if (rep->RepType == X_ListInputDevices)
+ SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
+ else if (rep->RepType == X_OpenDevice)
+ SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
+ else if (rep->RepType == X_SetDeviceMode)
+ SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
+ else if (rep->RepType == X_GetSelectedExtensionEvents)
+ SRepXGetSelectedExtensionEvents(client, len,
+ (xGetSelectedExtensionEventsReply *)
+ rep);
+ else if (rep->RepType == X_GetDeviceDontPropagateList)
+ SRepXGetDeviceDontPropagateList(client, len,
+ (xGetDeviceDontPropagateListReply *)
+ rep);
+ else if (rep->RepType == X_GetDeviceMotionEvents)
+ SRepXGetDeviceMotionEvents(client, len,
+ (xGetDeviceMotionEventsReply *) rep);
+ else if (rep->RepType == X_GrabDevice)
+ SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
+ else if (rep->RepType == X_GetDeviceFocus)
+ SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
+ else if (rep->RepType == X_GetFeedbackControl)
+ SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
+ else if (rep->RepType == X_GetDeviceKeyMapping)
+ SRepXGetDeviceKeyMapping(client, len,
+ (xGetDeviceKeyMappingReply *) rep);
+ else if (rep->RepType == X_GetDeviceModifierMapping)
+ SRepXGetDeviceModifierMapping(client, len,
+ (xGetDeviceModifierMappingReply *) rep);
+ else if (rep->RepType == X_SetDeviceModifierMapping)
+ SRepXSetDeviceModifierMapping(client, len,
+ (xSetDeviceModifierMappingReply *) rep);
+ else if (rep->RepType == X_GetDeviceButtonMapping)
+ SRepXGetDeviceButtonMapping(client, len,
+ (xGetDeviceButtonMappingReply *) rep);
+ else if (rep->RepType == X_SetDeviceButtonMapping)
+ SRepXSetDeviceButtonMapping(client, len,
+ (xSetDeviceButtonMappingReply *) rep);
+ else if (rep->RepType == X_QueryDeviceState)
+ SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
+ else if (rep->RepType == X_SetDeviceValuators)
+ SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
+ else if (rep->RepType == X_GetDeviceControl)
+ SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
+ else if (rep->RepType == X_ChangeDeviceControl)
+ SRepXChangeDeviceControl(client, len,
+ (xChangeDeviceControlReply *) rep);
+ else if (rep->RepType == X_ListDeviceProperties)
+ SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
+ else if (rep->RepType == X_GetDeviceProperty)
+ SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
+ else if (rep->RepType == X_XIQueryPointer)
+ SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
+ else if (rep->RepType == X_XIGetClientPointer)
+ SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
+ else if (rep->RepType == X_XIQueryVersion)
+ SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
+ else if (rep->RepType == X_XIQueryDevice)
+ SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIListProperties)
+ SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
+ else if (rep->RepType == X_XIGetProperty)
+ SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
+ else if (rep->RepType == X_XIGetSelectedEvents)
+ SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
+ else if (rep->RepType == X_XIGetFocus)
+ SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
+ else {
+ FatalError("XINPUT confused sending swapped reply");
+ }
+}
+
+/************************************************************************
+ *
+ * This function swaps the DeviceValuator event.
+ *
+ */
+
+static void
+SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
+{
+ char n;
+ int i;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swaps(&to->device_state, n);
+ ip = &to->valuator0;
+ for (i = 0; i < 6; i++) {
+ swapl((ip + i), n); /* macro - braces are required */
+ }
+}
+
+static void
+SEventFocus(deviceFocus * from, deviceFocus * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+ swapl(&to->window, n);
+}
+
+static void
+SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
+{
+ int i;
+ char n;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+ ip = &to->valuator0;
+ for (i = 0; i < 3; i++) {
+ swapl((ip + i), n); /* macro - braces are required */
+ }
+}
+
+static void
+SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
+ deviceKeyStateNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+}
+
+static void
+SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
+ deviceButtonStateNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+}
+
+static void
+SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+}
+
+static void
+SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->time, n);
+}
+
+static void
+SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swaps(&to->control, n);
+}
+
+static void
+SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swapl(&to->atom, n);
+}
+
+static void
+SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->sourceid, n);
+ swaps(&to->buttons_len, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+}
+
+static void
+SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
+{
+ char n;
+ int i, j;
+ xXIAnyInfo *any;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+
+ any = (xXIAnyInfo*)&to[1];
+ for (i = 0; i < to->num_classes; i++)
+ {
+ int length = any->length;
+
+ switch(any->type)
+ {
+ case KeyClass:
+ {
+ xXIKeyInfo *ki = (xXIKeyInfo*)any;
+ uint32_t *key = (uint32_t*)&ki[1];
+ for (j = 0; j < ki->num_keycodes; j++, key++)
+ swapl(key, n);
+ swaps(&ki->num_keycodes, n);
+ }
+ break;
+ case ButtonClass:
+ {
+ xXIButtonInfo *bi = (xXIButtonInfo*)any;
+ Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
+ pad_to_int32(bits_to_bytes(bi->num_buttons)));
+ for (j = 0; j < bi->num_buttons; j++)
+ swapl(&labels[j], n);
+ swaps(&bi->num_buttons, n);
+ }
+ break;
+ case ValuatorClass:
+ {
+ xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
+ swapl(&ai->label, n);
+ swapl(&ai->min.integral, n);
+ swapl(&ai->min.frac, n);
+ swapl(&ai->max.integral, n);
+ swapl(&ai->max.frac, n);
+ swapl(&ai->resolution, n);
+ swaps(&ai->number, n);
+ }
+ break;
+ }
+
+ swaps(&any->type, n);
+ swaps(&any->length, n);
+ swaps(&any->sourceid, n);
+
+ any = (xXIAnyInfo*)((char*)any + length * 4);
+ }
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swaps(&to->num_classes, n);
+ swaps(&to->sourceid, n);
+
+}
+
+static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
+{
+ int i;
+ char n;
+ char *ptr;
+ char *vmask;
+
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->buttons_len, n);
+ swaps(&to->valuators_len, n);
+ swaps(&to->sourceid, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+ swapl(&to->mods.effective_mods, n);
+ swapl(&to->flags, n);
+
+ ptr = (char*)(&to[1]);
+ ptr += from->buttons_len * 4;
+ vmask = ptr; /* valuator mask */
+ ptr += from->valuators_len * 4;
+ for (i = 0; i < from->valuators_len * 32; i++)
+ {
+ if (BitIsOn(vmask, i))
+ {
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ }
+ }
+}
+
+static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
+ xXIHierarchyEvent *to)
+{
+ int i;
+ char n;
+ xXIHierarchyInfo *info;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->flags, n);
+ swaps(&to->num_info, n);
+
+ info = (xXIHierarchyInfo*)&to[1];
+ for (i = 0; i< from->num_info; i++)
+ {
+ swaps(&info->deviceid, n);
+ swaps(&info->attachment, n);
+ info++;
+ }
+}
+
+static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->property, n);
+}
+
+static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
+{
+ char n;
+ int i;
+ FP3232 *values;
+ unsigned char *mask;
+
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+
+
+ mask = (unsigned char*)&to[1];
+ values = (FP3232*)(mask + from->valuators_len * 4);
+
+ for (i = 0; i < from->valuators_len * 4 * 8; i++)
+ {
+ if (BitIsOn(mask, i))
+ {
+ /* for each bit set there are two FP3232 values on the wire, in
+ * the order abcABC for data and data_raw. Here we swap as if
+ * they were in aAbBcC order because it's easier and really
+ * doesn't matter.
+ */
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ }
+ }
+
+ swaps(&to->valuators_len, n);
+}
+
+
+/** Event swapping function for XI2 events. */
+void
+XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
+{
+ switch(from->evtype)
+ {
+ case XI_Enter:
+ case XI_Leave:
+ SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
+ break;
+ case XI_DeviceChanged:
+ SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
+ (xXIDeviceChangedEvent*)to);
+ break;
+ case XI_HierarchyChanged:
+ SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
+ break;
+ case XI_PropertyEvent:
+ SXIPropertyEvent((xXIPropertyEvent*)from,
+ (xXIPropertyEvent*)to);
+ break;
+ case XI_Motion:
+ case XI_KeyPress:
+ case XI_KeyRelease:
+ case XI_ButtonPress:
+ case XI_ButtonRelease:
+ SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
+ break;
+ case XI_RawMotion:
+ case XI_RawKeyPress:
+ case XI_RawKeyRelease:
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
+ break;
+ default:
+ ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
+ break;
+ }
+}
+
+/**************************************************************************
+ *
+ * Allow the specified event to have its propagation suppressed.
+ * The default is to not allow suppression of propagation.
+ *
+ */
+
+static void
+AllowPropagateSuppress(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAXDEVICES; i++)
+ PropagateMask[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Record an event mask where there is no unique corresponding event type.
+ * We can't call SetMaskForEvent, since that would clobber the existing
+ * mask for that event. MotionHint and ButtonMotion are examples.
+ *
+ * Since extension event types will never be less than 64, we can use
+ * 0-63 in the EventInfo array as the "type" to be used to look up this
+ * mask. This means that the corresponding macros such as
+ * DevicePointerMotionHint must have access to the same constants.
+ *
+ */
+
+static void
+SetEventInfo(Mask mask, int constant)
+{
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = constant;
+}
+
+/**************************************************************************
+ *
+ * Allow the specified event to be restricted to being selected by one
+ * client at a time.
+ * The default is to allow more than one client to select the event.
+ *
+ */
+
+static void
+SetExclusiveAccess(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAXDEVICES; i++)
+ ExtExclusiveMasks[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Assign the specified mask to the specified event.
+ *
+ */
+
+static void
+SetMaskForExtEvent(Mask mask, int event)
+{
+ int i;
+
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = event;
+
+ if ((event < LASTEvent) || (event >= 128))
+ FatalError("MaskForExtensionEvent: bogus event number");
+
+ for (i = 0; i < MAXDEVICES; i++)
+ SetMaskForEvent(i, mask, event);
+}
+
+/************************************************************************
+ *
+ * This function sets up extension event types and masks.
+ *
+ */
+
+static void
+FixExtensionEvents(ExtensionEntry * extEntry)
+{
+ DeviceValuator = extEntry->eventBase;
+ DeviceKeyPress = DeviceValuator + 1;
+ DeviceKeyRelease = DeviceKeyPress + 1;
+ DeviceButtonPress = DeviceKeyRelease + 1;
+ DeviceButtonRelease = DeviceButtonPress + 1;
+ DeviceMotionNotify = DeviceButtonRelease + 1;
+ DeviceFocusIn = DeviceMotionNotify + 1;
+ DeviceFocusOut = DeviceFocusIn + 1;
+ ProximityIn = DeviceFocusOut + 1;
+ ProximityOut = ProximityIn + 1;
+ DeviceStateNotify = ProximityOut + 1;
+ DeviceMappingNotify = DeviceStateNotify + 1;
+ ChangeDeviceNotify = DeviceMappingNotify + 1;
+ DeviceKeyStateNotify = ChangeDeviceNotify + 1;
+ DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
+ DevicePresenceNotify = DeviceButtonStateNotify + 1;
+ DevicePropertyNotify = DevicePresenceNotify + 1;
+
+ event_base[KeyClass] = DeviceKeyPress;
+ event_base[ButtonClass] = DeviceButtonPress;
+ event_base[ValuatorClass] = DeviceMotionNotify;
+ event_base[ProximityClass] = ProximityIn;
+ event_base[FocusClass] = DeviceFocusIn;
+ event_base[OtherClass] = DeviceStateNotify;
+
+ BadDevice += extEntry->errorBase;
+ BadEvent += extEntry->errorBase;
+ BadMode += extEntry->errorBase;
+ DeviceBusy += extEntry->errorBase;
+ BadClass += extEntry->errorBase;
+
+ SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
+ AllowPropagateSuppress(DeviceKeyPressMask);
+ SetCriticalEvent(DeviceKeyPress);
+
+ SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
+ AllowPropagateSuppress(DeviceKeyReleaseMask);
+ SetCriticalEvent(DeviceKeyRelease);
+
+ SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
+ AllowPropagateSuppress(DeviceButtonPressMask);
+ SetCriticalEvent(DeviceButtonPress);
+
+ SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
+ AllowPropagateSuppress(DeviceButtonReleaseMask);
+ SetCriticalEvent(DeviceButtonRelease);
+
+ SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
+ SetMaskForExtEvent(DeviceProximityMask, ProximityOut);
+
+ SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
+
+ SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
+ AllowPropagateSuppress(DevicePointerMotionMask);
+ SetCriticalEvent(DeviceMotionNotify);
+
+ SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
+ SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion);
+ SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion);
+ SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion);
+ SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion);
+ SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion);
+ SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
+
+ SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
+ SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
+
+ SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify);
+ SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
+
+ SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
+ SetExclusiveAccess(DeviceButtonGrabMask);
+
+ SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
+ SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
+ SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
+
+ SetEventInfo(0, _noExtensionEvent);
+}
+
+/************************************************************************
+ *
+ * This function restores extension event types and masks to their
+ * initial state.
+ *
+ */
+
+static void
+RestoreExtensionEvents(void)
+{
+ int i, j;
+
+ IReqCode = 0;
+ IEventBase = 0;
+
+ for (i = 0; i < ExtEventIndex - 1; i++) {
+ if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
+ {
+ for (j = 0; j < MAXDEVICES; j++)
+ SetMaskForEvent(j, 0, EventInfo[i].type);
+ }
+ EventInfo[i].mask = 0;
+ EventInfo[i].type = 0;
+ }
+ ExtEventIndex = 0;
+ DeviceValuator = 0;
+ DeviceKeyPress = 1;
+ DeviceKeyRelease = 2;
+ DeviceButtonPress = 3;
+ DeviceButtonRelease = 4;
+ DeviceMotionNotify = 5;
+ DeviceFocusIn = 6;
+ DeviceFocusOut = 7;
+ ProximityIn = 8;
+ ProximityOut = 9;
+ DeviceStateNotify = 10;
+ DeviceMappingNotify = 11;
+ ChangeDeviceNotify = 12;
+ DeviceKeyStateNotify = 13;
+ DeviceButtonStateNotify = 13;
+ DevicePresenceNotify = 14;
+ DevicePropertyNotify = 15;
+
+ BadDevice = 0;
+ BadEvent = 1;
+ BadMode = 2;
+ DeviceBusy = 3;
+ BadClass = 4;
+
+}
+
+/***********************************************************************
+ *
+ * IResetProc.
+ * Remove reply-swapping routine.
+ * Remove event-swapping routine.
+ *
+ */
+
+static void
+IResetProc(ExtensionEntry * unused)
+{
+ ReplySwapVector[IReqCode] = ReplyNotSwappd;
+ EventSwapVector[DeviceValuator] = NotImplemented;
+ EventSwapVector[DeviceKeyPress] = NotImplemented;
+ EventSwapVector[DeviceKeyRelease] = NotImplemented;
+ EventSwapVector[DeviceButtonPress] = NotImplemented;
+ EventSwapVector[DeviceButtonRelease] = NotImplemented;
+ EventSwapVector[DeviceMotionNotify] = NotImplemented;
+ EventSwapVector[DeviceFocusIn] = NotImplemented;
+ EventSwapVector[DeviceFocusOut] = NotImplemented;
+ EventSwapVector[ProximityIn] = NotImplemented;
+ EventSwapVector[ProximityOut] = NotImplemented;
+ EventSwapVector[DeviceStateNotify] = NotImplemented;
+ EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
+ EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
+ EventSwapVector[DeviceMappingNotify] = NotImplemented;
+ EventSwapVector[ChangeDeviceNotify] = NotImplemented;
+ EventSwapVector[DevicePresenceNotify] = NotImplemented;
+ EventSwapVector[DevicePropertyNotify] = NotImplemented;
+ RestoreExtensionEvents();
+}
+
+
+/***********************************************************************
+ *
+ * Assign an id and type to an input device.
+ *
+ */
+
+void
+AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
+{
+ dev->xinput_type = type;
+ dev->name = strdup(name);
+}
+
+/***********************************************************************
+ *
+ * Make device type atoms.
+ *
+ */
+
+static void
+MakeDeviceTypeAtoms(void)
+{
+ int i;
+
+ for (i = 0; i < NUMTYPES; i++)
+ dev_type[i].type =
+ MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
+}
+
+/*****************************************************************************
+ *
+ * SEventIDispatch
+ *
+ * Swap any events defined in this extension.
+ */
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
+
+static void
+SEventIDispatch(xEvent * from, xEvent * to)
+{
+ int type = from->u.u.type & 0177;
+
+ if (type == DeviceValuator)
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
+ else if (type == DeviceKeyPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceKeyRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceMotionNotify) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceFocusIn)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == DeviceFocusOut)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == ProximityIn) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == ProximityOut) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceStateNotify)
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
+ else if (type == DeviceKeyStateNotify)
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
+ else if (type == DeviceButtonStateNotify)
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
+ else if (type == DeviceMappingNotify)
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
+ else if (type == ChangeDeviceNotify)
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+ else if (type == DevicePresenceNotify)
+ DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
+ else if (type == DevicePropertyNotify)
+ DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
+ else {
+ FatalError("XInputExtension: Impossible event!\n");
+ }
+}
+
+/**********************************************************************
+ *
+ * IExtensionInit - initialize the input extension.
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ * This extension has several events and errors.
+ *
+ * XI is mandatory nowadays, so if we fail to init XI, we die.
+ */
+
+void
+XInputExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+ XExtensionVersion thisversion = { XI_Present,
+ SERVER_XI_MAJOR_VERSION,
+ SERVER_XI_MINOR_VERSION,
+ };
+
+ if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
+ FatalError("Cannot request private for XI.\n");
+
+ if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
+ FatalError("Failed to add callback to XI.\n");
+
+ extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
+ SProcIDispatch, IResetProc, StandardMinorOpcode);
+ if (extEntry) {
+ IReqCode = extEntry->base;
+ IEventBase = extEntry->eventBase;
+ XIVersion = thisversion;
+ MakeDeviceTypeAtoms();
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
+ "INPUTCLIENT");
+ if (!RT_INPUTCLIENT)
+ FatalError("Failed to add resource type for XI.\n");
+ FixExtensionEvents(extEntry);
+ ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
+ EventSwapVector[DeviceValuator] = SEventIDispatch;
+ EventSwapVector[DeviceKeyPress] = SEventIDispatch;
+ EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
+ EventSwapVector[DeviceButtonPress] = SEventIDispatch;
+ EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
+ EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
+ EventSwapVector[DeviceFocusIn] = SEventIDispatch;
+ EventSwapVector[DeviceFocusOut] = SEventIDispatch;
+ EventSwapVector[ProximityIn] = SEventIDispatch;
+ EventSwapVector[ProximityOut] = SEventIDispatch;
+ EventSwapVector[DeviceStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
+ EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
+
+ GERegisterExtension(IReqCode, XI2EventSwap);
+
+
+ memset(&xi_all_devices, 0, sizeof(xi_all_devices));
+ memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
+ xi_all_devices.id = XIAllDevices;
+ xi_all_devices.name = "XIAllDevices";
+ xi_all_master_devices.id = XIAllMasterDevices;
+ xi_all_master_devices.name = "XIAllMasterDevices";
+
+ inputInfo.all_devices = &xi_all_devices;
+ inputInfo.all_master_devices = &xi_all_master_devices;
+
+ XIResetProperties();
+ } else {
+ FatalError("IExtensionInit: AddExtensions failed\n");
+ }
+}
+
diff --git a/xorg-server/dix/Makefile.am b/xorg-server/dix/Makefile.am
index 5ff75c0ba..c48c71e98 100644
--- a/xorg-server/dix/Makefile.am
+++ b/xorg-server/dix/Makefile.am
@@ -10,7 +10,6 @@ libdix_la_SOURCES = \
atom.c \
colormap.c \
cursor.c \
- deprecated.c \
devices.c \
dispatch.c \
dispatch.h \
diff --git a/xorg-server/dix/deprecated.c b/xorg-server/dix/deprecated.c
deleted file mode 100644
index b1f4d6c5c..000000000
--- a/xorg-server/dix/deprecated.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dix.h"
-#include "misc.h"
-#include "dixstruct.h"
-
-/*
- * These are deprecated compatibility functions and will be marked as such
- * and removed soon!
- *
- * Please use the noted replacements instead.
- */
-
-/* replaced by dixLookupWindow */
-WindowPtr
-SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
-{
- WindowPtr pWin;
- static int warn = 1;
- dixLookupWindow(&pWin, id, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupWindow().\n");
- return pWin;
-}
-
-/* replaced by dixLookupWindow */
-WindowPtr
-LookupWindow(XID id, ClientPtr client)
-{
- return SecurityLookupWindow(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
-{
- DrawablePtr pDraw;
- static int warn = 1;
- dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupDrawable().\n");
- return pDraw;
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-LookupDrawable(XID id, ClientPtr client)
-{
- return SecurityLookupDrawable(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupClient */
-ClientPtr
-LookupClient(XID id, ClientPtr client)
-{
- ClientPtr pClient;
- static int warn = 1;
- dixLookupClient(&pClient, id, client, DixUnknownAccess);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupClient() is deprecated. Please convert your "
- "driver/module to use dixLookupClient().\n");
- return pClient;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
- Mask access_mode)
-{
- pointer retval;
- static int warn = 1;
- dixLookupResourceByType(&retval, id, rtype, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByType().\n");
- return retval;
-}
-
-pointer
-SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
- Mask access_mode)
-{
- pointer retval;
- static int warn = 1;
- dixLookupResourceByClass(&retval, id, classes, client, access_mode);
- if (warn > 0 && warn--)
- ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByClass().\n");
- return retval;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-LookupIDByType(XID id, RESTYPE rtype)
-{
- pointer val;
- dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* replaced by dixLookupResourceByClass */
-pointer
-LookupIDByClass(XID id, RESTYPE classes)
-{
- pointer val;
- dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* end deprecated functions */
diff --git a/xorg-server/exa/exa.h b/xorg-server/exa/exa.h
index 8c93d156f..b65118883 100644
--- a/xorg-server/exa/exa.h
+++ b/xorg-server/exa/exa.h
@@ -1,843 +1,843 @@
-/*
- *
- * Copyright (C) 2000 Keith Packard
- * 2004 Eric Anholt
- * 2005 Zack Rusin
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Copyright holders make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/** @file
- * This is the header containing the public API of EXA for exa drivers.
- */
-
-#ifndef EXA_H
-#define EXA_H
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "picturestr.h"
-#include "fb.h"
-
-#define EXA_VERSION_MAJOR 2
-#define EXA_VERSION_MINOR 5
-#define EXA_VERSION_RELEASE 0
-
-typedef struct _ExaOffscreenArea ExaOffscreenArea;
-
-typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
-
-typedef enum _ExaOffscreenState {
- ExaOffscreenAvail,
- ExaOffscreenRemovable,
- ExaOffscreenLocked
-} ExaOffscreenState;
-
-struct _ExaOffscreenArea {
- int base_offset; /* allocation base */
- int offset; /* aligned offset */
- int size; /* total allocation size */
- unsigned last_use;
- pointer privData;
-
- ExaOffscreenSaveProc save;
-
- ExaOffscreenState state;
-
- ExaOffscreenArea *next;
-
- unsigned eviction_cost;
-
- ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
- int align; /* required alignment */
-};
-
-/**
- * The ExaDriver structure is allocated through exaDriverAlloc(), and then
- * fllled in by drivers.
- */
-typedef struct _ExaDriver {
- /**
- * exa_major and exa_minor should be set by the driver to the version of
- * EXA which the driver was compiled for (or configures itself at runtime
- * to support). This allows EXA to extend the structure for new features
- * without breaking ABI for drivers compiled against older versions.
- */
- int exa_major, exa_minor;
-
- /**
- * memoryBase is the address of the beginning of framebuffer memory.
- * The visible screen should be within memoryBase to memoryBase +
- * memorySize.
- */
- CARD8 *memoryBase;
-
- /**
- * offScreenBase is the offset from memoryBase of the beginning of the area
- * to be managed by EXA's linear offscreen memory manager.
- *
- * In XFree86 DDX drivers, this is probably:
- * (pScrn->displayWidth * cpp * pScrn->virtualY)
- */
- unsigned long offScreenBase;
-
- /**
- * memorySize is the length (in bytes) of framebuffer memory beginning
- * from memoryBase.
- *
- * The offscreen memory manager will manage the area beginning at
- * (memoryBase + offScreenBase), with a length of (memorySize -
- * offScreenBase)
- *
- * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
- */
- unsigned long memorySize;
-
- /**
- * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
- * within framebuffer.
- *
- * Hardware typically has a required alignment of offsets, which may or may
- * not be a power of two. EXA will ensure that pixmaps managed by the
- * offscreen memory manager meet this alignment requirement.
- */
- int pixmapOffsetAlign;
-
- /**
- * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
- * within the framebuffer.
- *
- * Hardware typically has a required alignment of pitches for acceleration.
- * For 3D hardware, Composite acceleration often requires that source and
- * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
- * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
- * pixmaps managed by the offscreen memory manager. Thus, it is up to the
- * driver to ensure that the visible screen has an appropriate pitch for
- * acceleration.
- */
- int pixmapPitchAlign;
-
- /**
- * The flags field is bitfield of boolean values controlling EXA's behavior.
- *
- * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
- * EXA_TWO_BITBLT_DIRECTIONS.
- */
- int flags;
-
- /** @{ */
- /**
- * maxX controls the X coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxX
- * in the X direction from the origin of a pixmap.
- */
- int maxX;
-
- /**
- * maxY controls the Y coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxY
- * in the Y direction from the origin of a pixmap.
- */
- int maxY;
- /** @} */
-
- /* private */
- ExaOffscreenArea *offScreenAreas;
- Bool needsSync;
- int lastMarker;
-
- /** @name Solid
- * @{
- */
- /**
- * PrepareSolid() sets up the driver for doing a solid fill.
- * @param pPixmap Destination pixmap
- * @param alu raster operation
- * @param planemask write mask for the fill
- * @param fg "foreground" color for the fill
- *
- * This call should set up the driver for doing a series of solid fills
- * through the Solid() call. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls
- * which bits of the destination should be affected, and will only represent
- * the bits up to the depth of pPixmap. The fg is the pixel value of the
- * foreground color referred to in ROP descriptions.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareSolid() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareSolid) (PixmapPtr pPixmap,
- int alu,
- Pixel planemask,
- Pixel fg);
-
- /**
- * Solid() performs a solid fill set up in the last PrepareSolid() call.
- *
- * @param pPixmap destination pixmap
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- *
- * Performs the fill set up by the last PrepareSolid() call, covering the
- * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
- * in the coordinate space of the destination pixmap, so the driver will
- * need to set up the hardware's offset and pitch for the destination
- * coordinates according to the pixmap's offset and pitch within
- * framebuffer. This likely means using exaGetPixmapOffset() and
- * exaGetPixmapPitch().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
-
- /**
- * DoneSolid() finishes a set of solid fills.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneSolid() call is called at the end of a series of consecutive
- * Solid() calls following a successful PrepareSolid(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareSolid().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*DoneSolid) (PixmapPtr pPixmap);
- /** @} */
-
- /** @name Copy
- * @{
- */
- /**
- * PrepareCopy() sets up the driver for doing a copy within video
- * memory.
- *
- * @param pSrcPixmap source pixmap
- * @param pDstPixmap destination pixmap
- * @param dx X copy direction
- * @param dy Y copy direction
- * @param alu raster operation
- * @param planemask write mask for the fill
- *
- * This call should set up the driver for doing a series of copies from the
- * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
- * hardware should do the copy from the left to the right, and dy will be
- * positive if the copy should be done from the top to the bottom. This
- * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
- * If your hardware can only support blits that are (left to right, top to
- * bottom) or (right to left, bottom to top), then you should set
- * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
- * ones that meet those requirements. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls which
- * bits of the destination should be affected, and will only represent the
- * bits up to the depth of pPixmap.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareCopy() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel planemask);
-
- /**
- * Copy() performs a copy set up in the last PrepareCopy call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied.
- *
- * Performs the copy set up by the last PrepareCopy() call, copying the
- * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
- * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
- * pixmap. Those rectangles may overlap in memory, if
- * pSrcPixmap == pDstPixmap. Note that this call does not receive the
- * pSrcPixmap as an argument -- if it's needed in this function, it should
- * be stored in the driver private during PrepareCopy(). As with Solid(),
- * the coordinates are in the coordinate space of each pixmap, so the driver
- * will need to set up source and destination pitches and offsets from those
- * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
- *
- * This call is required if PrepareCopy ever succeeds.
- */
- void (*Copy) (PixmapPtr pDstPixmap,
- int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneCopy() finishes a set of copies.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneCopy() call is called at the end of a series of consecutive
- * Copy() calls following a successful PrepareCopy(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareCopy().
- *
- * This call is required if PrepareCopy() ever succeeds.
- */
- void (*DoneCopy) (PixmapPtr pDstPixmap);
- /** @} */
-
- /** @name Composite
- * @{
- */
- /**
- * CheckComposite() checks to see if a composite operation could be
- * accelerated.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- *
- * The CheckComposite() call checks if the driver could handle acceleration
- * of op with the given source, mask, and destination pictures. This allows
- * drivers to check source and destination formats, supported operations,
- * transformations, and component alpha state, and send operations it can't
- * support to software rendering early on. This avoids costly pixmap
- * migration to the wrong places when the driver can't accelerate
- * operations. Note that because migration hasn't happened, the driver
- * can't know during CheckComposite() what the offsets and pitches of the
- * pixmaps are going to be.
- *
- * See PrepareComposite() for more details on likely issues that drivers
- * will have in accelerating Composite operations.
- *
- * The CheckComposite() call is recommended if PrepareComposite() is
- * implemented, but is not required.
- */
- Bool (*CheckComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture);
-
- /**
- * PrepareComposite() sets up the driver for doing a Composite operation
- * described in the Render extension protocol spec.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- * @param pSrc source pixmap
- * @param pMask mask pixmap
- * @param pDst destination pixmap
- *
- * This call should set up the driver for doing a series of Composite
- * operations, as described in the Render protocol spec, with the given
- * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
- * pDst are the pixmaps containing the pixel data, and should be used for
- * setting the offset and pitch used for the coordinate spaces for each of
- * the Pictures.
- *
- * Notes on interpreting Picture structures:
- * - The Picture structures will always have a valid pDrawable.
- * - The Picture structures will never have alphaMap set.
- * - The mask Picture (and therefore pMask) may be NULL, in which case the
- * operation is simply src OP dst instead of src IN mask OP dst, and
- * mask coordinates should be ignored.
- * - pMarkPicture may have componentAlpha set, which greatly changes
- * the behavior of the Composite operation. componentAlpha has no effect
- * when set on pSrcPicture or pDstPicture.
- * - The source and mask Pictures may have a transformation set
- * (Picture->transform != NULL), which means that the source coordinates
- * should be transformed by that transformation, resulting in scaling,
- * rotation, etc. The PictureTransformPoint() call can transform
- * coordinates for you. Transforms have no effect on Pictures when used
- * as a destination.
- * - The source and mask pictures may have a filter set. PictFilterNearest
- * and PictFilterBilinear are defined in the Render protocol, but others
- * may be encountered, and must be handled correctly (usually by
- * PrepareComposite failing, and falling back to software). Filters have
- * no effect on Pictures when used as a destination.
- * - The source and mask Pictures may have repeating set, which must be
- * respected. Many chipsets will be unable to support repeating on
- * pixmaps that have a width or height that is not a power of two.
- *
- * If your hardware can't support source pictures (textures) with
- * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareComposite() call is not required. However, it is highly
- * recommended for performance of antialiased font rendering and performance
- * of cairo applications. Failure results in a fallback to software
- * rendering.
- */
- Bool (*PrepareComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pMask,
- PixmapPtr pDst);
-
- /**
- * Composite() performs a Composite operation set up in the last
- * PrepareComposite() call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param maskX source X coordinate
- * @param maskY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width destination rectangle width
- * @param height destination rectangle height
- *
- * Performs the Composite operation set up by the last PrepareComposite()
- * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
- * in the destination Pixmap. Note that if a transformation was set on
- * the source or mask Pictures, the source rectangles may not be the same
- * size as the destination rectangles and filtering. Getting the coordinate
- * transformation right at the subpixel level can be tricky, and rendercheck
- * can test this for you.
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*Composite) (PixmapPtr pDst,
- int srcX,
- int srcY,
- int maskX,
- int maskY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneComposite() finishes a set of Composite operations.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneComposite() call is called at the end of a series of consecutive
- * Composite() calls following a successful PrepareComposite(). This allows
- * drivers to finish up emitting drawing commands that were buffered, or
- * clean up state from PrepareComposite().
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*DoneComposite) (PixmapPtr pDst);
- /** @} */
-
- /**
- * UploadToScreen() loads a rectangle of data from src into pDst.
- *
- * @param pDst destination pixmap
- * @param x destination X coordinate.
- * @param y destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param src pointer to the beginning of the source data
- * @param src_pitch pitch (in bytes) of the lines of source data.
- *
- * UploadToScreen() copies data in system memory beginning at src (with
- * pitch src_pitch) into the destination pixmap from (x, y) to
- * (x + width, y + height). This is typically done with hostdata uploads,
- * where the CPU sets up a blit command on the hardware with instructions
- * that the blit data will be fed through some sort of aperture on the card.
- *
- * If UploadToScreen() is performed asynchronously, it is up to the driver
- * to call exaMarkSync(). This is in contrast to most other acceleration
- * calls in EXA.
- *
- * UploadToScreen() can aid in pixmap migration, but is most important for
- * the performance of exaGlyphs() (antialiased font drawing) by allowing
- * pipelining of data uploads, avoiding a sync of the card after each glyph.
- *
- * @return TRUE if the driver successfully uploaded the data. FALSE
- * indicates that EXA should fall back to doing the upload in software.
- *
- * UploadToScreen() is not required, but is recommended if Composite
- * acceleration is supported.
- */
- Bool (*UploadToScreen) (PixmapPtr pDst,
- int x,
- int y,
- int w,
- int h,
- char *src,
- int src_pitch);
-
- /**
- * UploadToScratch() is no longer used and will be removed next time the EXA
- * major version needs to be bumped.
- */
- Bool (*UploadToScratch) (PixmapPtr pSrc,
- PixmapPtr pDst);
-
- /**
- * DownloadFromScreen() loads a rectangle of data from pSrc into dst
- *
- * @param pSrc source pixmap
- * @param x source X coordinate.
- * @param y source Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param dst pointer to the beginning of the destination data
- * @param dst_pitch pitch (in bytes) of the lines of destination data.
- *
- * DownloadFromScreen() copies data from offscreen memory in pSrc from
- * (x, y) to (x + width, y + height), to system memory starting at
- * dst (with pitch dst_pitch). This would usually be done
- * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
- * and then synchronously reading from AGP. Because the implementation
- * might be synchronous, EXA leaves it up to the driver to call
- * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
- * contrast to most other acceleration calls in EXA.
- *
- * DownloadFromScreen() can aid in the largest bottleneck in pixmap
- * migration, which is the read from framebuffer when evicting pixmaps from
- * framebuffer memory. Thus, it is highly recommended, even though
- * implementations are typically complicated.
- *
- * @return TRUE if the driver successfully downloaded the data. FALSE
- * indicates that EXA should fall back to doing the download in software.
- *
- * DownloadFromScreen() is not required, but is highly recommended.
- */
- Bool (*DownloadFromScreen)(PixmapPtr pSrc,
- int x, int y,
- int w, int h,
- char *dst, int dst_pitch);
-
- /**
- * MarkSync() requests that the driver mark a synchronization point,
- * returning an driver-defined integer marker which could be requested for
- * synchronization to later in WaitMarker(). This might be used in the
- * future to avoid waiting for full hardware stalls before accessing pixmap
- * data with the CPU, but is not important in the current incarnation of
- * EXA.
- *
- * Note that drivers should call exaMarkSync() when they have done some
- * acceleration, rather than their own MarkSync() handler, as otherwise EXA
- * will be unaware of the driver's acceleration and not sync to it during
- * fallbacks.
- *
- * MarkSync() is optional.
- */
- int (*MarkSync) (ScreenPtr pScreen);
-
- /**
- * WaitMarker() waits for all rendering before the given marker to have
- * completed. If the driver does not implement MarkSync(), marker is
- * meaningless, and all rendering by the hardware should be completed before
- * WaitMarker() returns.
- *
- * Note that drivers should call exaWaitSync() to wait for all acceleration
- * to finish, as otherwise EXA will be unaware of the driver having
- * synchronized, resulting in excessive WaitMarker() calls.
- *
- * WaitMarker() is required of all drivers.
- */
- void (*WaitMarker) (ScreenPtr pScreen, int marker);
-
- /** @{ */
- /**
- * PrepareAccess() is called before CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * PrepareAccess() will be called before CPU access to an offscreen pixmap.
- * This can be used to set up hardware surfaces for byteswapping or
- * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
- * making CPU access use a different aperture.
- *
- * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
- * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
- * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
- * will have PrepareAccess() called on them per operation, drivers can have
- * a small, statically-allocated space to maintain state for PrepareAccess()
- * and FinishAccess() in. Note that PrepareAccess() is only called once per
- * pixmap and operation, regardless of whether the pixmap is used as a
- * destination and/or source, and the index may not reflect the usage.
- *
- * PrepareAccess() may fail. An example might be the case of hardware that
- * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
- * fails, EXA will migrate the pixmap to system memory.
- * DownloadFromScreen() must be implemented and must not fail if a driver
- * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
- * pPix is the visible screen, because the visible screen can not be
- * migrated.
- *
- * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
- * drawing.
- * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
- * DownloadFromScreen() to migate the pixmap out.
- */
- Bool (*PrepareAccess)(PixmapPtr pPix, int index);
-
- /**
- * FinishAccess() is called after CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * FinishAccess() will be called after finishing CPU access of an offscreen
- * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
- * called if PrepareAccess() failed and the pixmap was migrated out.
- */
- void (*FinishAccess)(PixmapPtr pPix, int index);
-
- /**
- * PixmapIsOffscreen() is an optional driver replacement to
- * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
- * of exaPixmapHasGpuCopy().
- *
- * @param pPix the pixmap
- * @return TRUE if the given drawable is in framebuffer memory.
- *
- * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
- * memory, meaning that acceleration could probably be done to it, and that it
- * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
- * with the CPU.
- *
- *
- */
- Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
-
- /** @name PrepareAccess() and FinishAccess() indices
- * @{
- */
- /**
- * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
- * read from.
- */
- #define EXA_PREPARE_DEST 0
- /**
- * EXA_PREPARE_SRC is the index for a pixmap that may be read from
- */
- #define EXA_PREPARE_SRC 1
- /**
- * EXA_PREPARE_SRC is the index for a second pixmap that may be read
- * from.
- */
- #define EXA_PREPARE_MASK 2
- /**
- * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
- * separate alpha maps with Composite operations.
- */
- #define EXA_PREPARE_AUX_DEST 3
- #define EXA_PREPARE_AUX_SRC 4
- #define EXA_PREPARE_AUX_MASK 5
- #define EXA_NUM_PREPARE_INDICES 6
- /** @} */
-
- /**
- * maxPitchPixels controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in pixels) beyond maxPitchPixels.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in pixels, don't set this. If neither this value
- * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
- * If set, it must not be smaller than maxX.
- *
- * @sa maxPitchBytes
- */
- int maxPitchPixels;
-
- /**
- * maxPitchBytes controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in bytes) beyond maxPitchBytes.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in bytes, don't set this.
- * If set, it must not be smaller than maxX * 4.
- * There's no default value for maxPitchBytes.
- *
- * @sa maxPitchPixels
- */
- int maxPitchBytes;
-
- /* Hooks to allow driver to its own pixmap memory management */
- void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
- void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
- /**
- * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
- * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
- * be called.
- */
- Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
- int depth, int bitsPerPixel, int devKind,
- pointer pPixData);
-
- /* hooks for drivers with tiling support:
- * driver MUST fill out new_fb_pitch with valid pitch of pixmap
- */
- void *(*CreatePixmap2)(ScreenPtr pScreen, int width, int height,
- int depth, int usage_hint, int bitsPerPixel,
- int *new_fb_pitch);
- /** @} */
-} ExaDriverRec, *ExaDriverPtr;
-
-/** @name EXA driver flags
- * @{
- */
-/**
- * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
- * offscreen pixmaps.
- */
-#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
-
-/**
- * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
- * to have a power-of-two pitch.
- */
-#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
-
-/**
- * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
- * support copies that are (left-to-right, top-to-bottom) or
- * (right-to-left, bottom-to-top).
- */
-#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
-
-/**
- * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
- * all pixmap addressing and migration.
- */
-#define EXA_HANDLES_PIXMAPS (1 << 3)
-
-/**
- * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
- * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
- * such hooks, this flag has no effect.
- */
-#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
-
-/**
- * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
- * can handle the source and destination occupying overlapping offscreen memory
- * areas. This allows the offscreen memory defragmentation code to defragment
- * areas where the defragmented position overlaps the fragmented position.
- *
- * Typically this is supported by traditional 2D engines but not by 3D engines.
- */
-#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
-
-/**
- * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
- * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
- * into a driver pixmap and then pins it.
- */
-#define EXA_MIXED_PIXMAPS (1 << 6)
-
-/** @} */
-
-/* in exa.c */
-extern _X_EXPORT ExaDriverPtr
-exaDriverAlloc(void);
-
-extern _X_EXPORT Bool
-exaDriverInit(ScreenPtr pScreen,
- ExaDriverPtr pScreenInfo);
-
-extern _X_EXPORT void
-exaDriverFini(ScreenPtr pScreen);
-
-extern _X_EXPORT void
-exaMarkSync(ScreenPtr pScreen);
-extern _X_EXPORT void
-exaWaitSync(ScreenPtr pScreen);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapOffset(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapPitch(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapSize(PixmapPtr pPix);
-
-extern _X_EXPORT void *
-exaGetPixmapDriverPrivate(PixmapPtr p);
-
-
-/* in exa_offscreen.c */
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
- Bool locked,
- ExaOffscreenSaveProc save,
- pointer privData);
-
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
-
-extern _X_EXPORT void
-ExaOffscreenMarkUsed (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaEnableDisableFBAccess (int index, Bool enable);
-
-extern _X_EXPORT Bool
-exaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-/* in exa.c */
-extern _X_EXPORT void
-exaMoveInPixmap (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaMoveOutPixmap (PixmapPtr pPixmap);
-
-
-/* in exa_unaccel.c */
-extern _X_EXPORT CARD32
-exaGetPixmapFirstPixel (PixmapPtr pPixmap);
-
-
-/**
- * Returns TRUE if the given planemask covers all the significant bits in the
- * pixel values for pDrawable.
- */
-#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
- (((_pm) & FbFullMask((_pDrawable)->depth)) == \
- FbFullMask((_pDrawable)->depth))
-
-#endif /* EXA_H */
+/*
+ *
+ * Copyright (C) 2000 Keith Packard
+ * 2004 Eric Anholt
+ * 2005 Zack Rusin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Copyright holders make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/** @file
+ * This is the header containing the public API of EXA for exa drivers.
+ */
+
+#ifndef EXA_H
+#define EXA_H
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "picturestr.h"
+#include "fb.h"
+
+#define EXA_VERSION_MAJOR 2
+#define EXA_VERSION_MINOR 5
+#define EXA_VERSION_RELEASE 0
+
+typedef struct _ExaOffscreenArea ExaOffscreenArea;
+
+typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
+
+typedef enum _ExaOffscreenState {
+ ExaOffscreenAvail,
+ ExaOffscreenRemovable,
+ ExaOffscreenLocked
+} ExaOffscreenState;
+
+struct _ExaOffscreenArea {
+ int base_offset; /* allocation base */
+ int offset; /* aligned offset */
+ int size; /* total allocation size */
+ unsigned last_use;
+ pointer privData;
+
+ ExaOffscreenSaveProc save;
+
+ ExaOffscreenState state;
+
+ ExaOffscreenArea *next;
+
+ unsigned eviction_cost;
+
+ ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
+ int align; /* required alignment */
+};
+
+/**
+ * The ExaDriver structure is allocated through exaDriverAlloc(), and then
+ * fllled in by drivers.
+ */
+typedef struct _ExaDriver {
+ /**
+ * exa_major and exa_minor should be set by the driver to the version of
+ * EXA which the driver was compiled for (or configures itself at runtime
+ * to support). This allows EXA to extend the structure for new features
+ * without breaking ABI for drivers compiled against older versions.
+ */
+ int exa_major, exa_minor;
+
+ /**
+ * memoryBase is the address of the beginning of framebuffer memory.
+ * The visible screen should be within memoryBase to memoryBase +
+ * memorySize.
+ */
+ CARD8 *memoryBase;
+
+ /**
+ * offScreenBase is the offset from memoryBase of the beginning of the area
+ * to be managed by EXA's linear offscreen memory manager.
+ *
+ * In XFree86 DDX drivers, this is probably:
+ * (pScrn->displayWidth * cpp * pScrn->virtualY)
+ */
+ unsigned long offScreenBase;
+
+ /**
+ * memorySize is the length (in bytes) of framebuffer memory beginning
+ * from memoryBase.
+ *
+ * The offscreen memory manager will manage the area beginning at
+ * (memoryBase + offScreenBase), with a length of (memorySize -
+ * offScreenBase)
+ *
+ * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
+ */
+ unsigned long memorySize;
+
+ /**
+ * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
+ * within framebuffer.
+ *
+ * Hardware typically has a required alignment of offsets, which may or may
+ * not be a power of two. EXA will ensure that pixmaps managed by the
+ * offscreen memory manager meet this alignment requirement.
+ */
+ int pixmapOffsetAlign;
+
+ /**
+ * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
+ * within the framebuffer.
+ *
+ * Hardware typically has a required alignment of pitches for acceleration.
+ * For 3D hardware, Composite acceleration often requires that source and
+ * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
+ * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
+ * pixmaps managed by the offscreen memory manager. Thus, it is up to the
+ * driver to ensure that the visible screen has an appropriate pitch for
+ * acceleration.
+ */
+ int pixmapPitchAlign;
+
+ /**
+ * The flags field is bitfield of boolean values controlling EXA's behavior.
+ *
+ * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
+ * EXA_TWO_BITBLT_DIRECTIONS.
+ */
+ int flags;
+
+ /** @{ */
+ /**
+ * maxX controls the X coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxX
+ * in the X direction from the origin of a pixmap.
+ */
+ int maxX;
+
+ /**
+ * maxY controls the Y coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxY
+ * in the Y direction from the origin of a pixmap.
+ */
+ int maxY;
+ /** @} */
+
+ /* private */
+ ExaOffscreenArea *offScreenAreas;
+ Bool needsSync;
+ int lastMarker;
+
+ /** @name Solid
+ * @{
+ */
+ /**
+ * PrepareSolid() sets up the driver for doing a solid fill.
+ * @param pPixmap Destination pixmap
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ * @param fg "foreground" color for the fill
+ *
+ * This call should set up the driver for doing a series of solid fills
+ * through the Solid() call. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls
+ * which bits of the destination should be affected, and will only represent
+ * the bits up to the depth of pPixmap. The fg is the pixel value of the
+ * foreground color referred to in ROP descriptions.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareSolid() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareSolid) (PixmapPtr pPixmap,
+ int alu,
+ Pixel planemask,
+ Pixel fg);
+
+ /**
+ * Solid() performs a solid fill set up in the last PrepareSolid() call.
+ *
+ * @param pPixmap destination pixmap
+ * @param x1 left coordinate
+ * @param y1 top coordinate
+ * @param x2 right coordinate
+ * @param y2 bottom coordinate
+ *
+ * Performs the fill set up by the last PrepareSolid() call, covering the
+ * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
+ * in the coordinate space of the destination pixmap, so the driver will
+ * need to set up the hardware's offset and pitch for the destination
+ * coordinates according to the pixmap's offset and pitch within
+ * framebuffer. This likely means using exaGetPixmapOffset() and
+ * exaGetPixmapPitch().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
+
+ /**
+ * DoneSolid() finishes a set of solid fills.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneSolid() call is called at the end of a series of consecutive
+ * Solid() calls following a successful PrepareSolid(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareSolid().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*DoneSolid) (PixmapPtr pPixmap);
+ /** @} */
+
+ /** @name Copy
+ * @{
+ */
+ /**
+ * PrepareCopy() sets up the driver for doing a copy within video
+ * memory.
+ *
+ * @param pSrcPixmap source pixmap
+ * @param pDstPixmap destination pixmap
+ * @param dx X copy direction
+ * @param dy Y copy direction
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ *
+ * This call should set up the driver for doing a series of copies from the
+ * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
+ * hardware should do the copy from the left to the right, and dy will be
+ * positive if the copy should be done from the top to the bottom. This
+ * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
+ * If your hardware can only support blits that are (left to right, top to
+ * bottom) or (right to left, bottom to top), then you should set
+ * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
+ * ones that meet those requirements. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls which
+ * bits of the destination should be affected, and will only represent the
+ * bits up to the depth of pPixmap.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareCopy() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel planemask);
+
+ /**
+ * Copy() performs a copy set up in the last PrepareCopy call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied.
+ *
+ * Performs the copy set up by the last PrepareCopy() call, copying the
+ * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
+ * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
+ * pixmap. Those rectangles may overlap in memory, if
+ * pSrcPixmap == pDstPixmap. Note that this call does not receive the
+ * pSrcPixmap as an argument -- if it's needed in this function, it should
+ * be stored in the driver private during PrepareCopy(). As with Solid(),
+ * the coordinates are in the coordinate space of each pixmap, so the driver
+ * will need to set up source and destination pitches and offsets from those
+ * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
+ *
+ * This call is required if PrepareCopy ever succeeds.
+ */
+ void (*Copy) (PixmapPtr pDstPixmap,
+ int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+
+ /**
+ * DoneCopy() finishes a set of copies.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneCopy() call is called at the end of a series of consecutive
+ * Copy() calls following a successful PrepareCopy(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareCopy().
+ *
+ * This call is required if PrepareCopy() ever succeeds.
+ */
+ void (*DoneCopy) (PixmapPtr pDstPixmap);
+ /** @} */
+
+ /** @name Composite
+ * @{
+ */
+ /**
+ * CheckComposite() checks to see if a composite operation could be
+ * accelerated.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ *
+ * The CheckComposite() call checks if the driver could handle acceleration
+ * of op with the given source, mask, and destination pictures. This allows
+ * drivers to check source and destination formats, supported operations,
+ * transformations, and component alpha state, and send operations it can't
+ * support to software rendering early on. This avoids costly pixmap
+ * migration to the wrong places when the driver can't accelerate
+ * operations. Note that because migration hasn't happened, the driver
+ * can't know during CheckComposite() what the offsets and pitches of the
+ * pixmaps are going to be.
+ *
+ * See PrepareComposite() for more details on likely issues that drivers
+ * will have in accelerating Composite operations.
+ *
+ * The CheckComposite() call is recommended if PrepareComposite() is
+ * implemented, but is not required.
+ */
+ Bool (*CheckComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+
+ /**
+ * PrepareComposite() sets up the driver for doing a Composite operation
+ * described in the Render extension protocol spec.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ * @param pSrc source pixmap
+ * @param pMask mask pixmap
+ * @param pDst destination pixmap
+ *
+ * This call should set up the driver for doing a series of Composite
+ * operations, as described in the Render protocol spec, with the given
+ * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
+ * pDst are the pixmaps containing the pixel data, and should be used for
+ * setting the offset and pitch used for the coordinate spaces for each of
+ * the Pictures.
+ *
+ * Notes on interpreting Picture structures:
+ * - The Picture structures will always have a valid pDrawable.
+ * - The Picture structures will never have alphaMap set.
+ * - The mask Picture (and therefore pMask) may be NULL, in which case the
+ * operation is simply src OP dst instead of src IN mask OP dst, and
+ * mask coordinates should be ignored.
+ * - pMarkPicture may have componentAlpha set, which greatly changes
+ * the behavior of the Composite operation. componentAlpha has no effect
+ * when set on pSrcPicture or pDstPicture.
+ * - The source and mask Pictures may have a transformation set
+ * (Picture->transform != NULL), which means that the source coordinates
+ * should be transformed by that transformation, resulting in scaling,
+ * rotation, etc. The PictureTransformPoint() call can transform
+ * coordinates for you. Transforms have no effect on Pictures when used
+ * as a destination.
+ * - The source and mask pictures may have a filter set. PictFilterNearest
+ * and PictFilterBilinear are defined in the Render protocol, but others
+ * may be encountered, and must be handled correctly (usually by
+ * PrepareComposite failing, and falling back to software). Filters have
+ * no effect on Pictures when used as a destination.
+ * - The source and mask Pictures may have repeating set, which must be
+ * respected. Many chipsets will be unable to support repeating on
+ * pixmaps that have a width or height that is not a power of two.
+ *
+ * If your hardware can't support source pictures (textures) with
+ * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareComposite() call is not required. However, it is highly
+ * recommended for performance of antialiased font rendering and performance
+ * of cairo applications. Failure results in a fallback to software
+ * rendering.
+ */
+ Bool (*PrepareComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pMask,
+ PixmapPtr pDst);
+
+ /**
+ * Composite() performs a Composite operation set up in the last
+ * PrepareComposite() call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param maskX source X coordinate
+ * @param maskY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width destination rectangle width
+ * @param height destination rectangle height
+ *
+ * Performs the Composite operation set up by the last PrepareComposite()
+ * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
+ * in the destination Pixmap. Note that if a transformation was set on
+ * the source or mask Pictures, the source rectangles may not be the same
+ * size as the destination rectangles and filtering. Getting the coordinate
+ * transformation right at the subpixel level can be tricky, and rendercheck
+ * can test this for you.
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*Composite) (PixmapPtr pDst,
+ int srcX,
+ int srcY,
+ int maskX,
+ int maskY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+
+ /**
+ * DoneComposite() finishes a set of Composite operations.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneComposite() call is called at the end of a series of consecutive
+ * Composite() calls following a successful PrepareComposite(). This allows
+ * drivers to finish up emitting drawing commands that were buffered, or
+ * clean up state from PrepareComposite().
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*DoneComposite) (PixmapPtr pDst);
+ /** @} */
+
+ /**
+ * UploadToScreen() loads a rectangle of data from src into pDst.
+ *
+ * @param pDst destination pixmap
+ * @param x destination X coordinate.
+ * @param y destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param src pointer to the beginning of the source data
+ * @param src_pitch pitch (in bytes) of the lines of source data.
+ *
+ * UploadToScreen() copies data in system memory beginning at src (with
+ * pitch src_pitch) into the destination pixmap from (x, y) to
+ * (x + width, y + height). This is typically done with hostdata uploads,
+ * where the CPU sets up a blit command on the hardware with instructions
+ * that the blit data will be fed through some sort of aperture on the card.
+ *
+ * If UploadToScreen() is performed asynchronously, it is up to the driver
+ * to call exaMarkSync(). This is in contrast to most other acceleration
+ * calls in EXA.
+ *
+ * UploadToScreen() can aid in pixmap migration, but is most important for
+ * the performance of exaGlyphs() (antialiased font drawing) by allowing
+ * pipelining of data uploads, avoiding a sync of the card after each glyph.
+ *
+ * @return TRUE if the driver successfully uploaded the data. FALSE
+ * indicates that EXA should fall back to doing the upload in software.
+ *
+ * UploadToScreen() is not required, but is recommended if Composite
+ * acceleration is supported.
+ */
+ Bool (*UploadToScreen) (PixmapPtr pDst,
+ int x,
+ int y,
+ int w,
+ int h,
+ char *src,
+ int src_pitch);
+
+ /**
+ * UploadToScratch() is no longer used and will be removed next time the EXA
+ * major version needs to be bumped.
+ */
+ Bool (*UploadToScratch) (PixmapPtr pSrc,
+ PixmapPtr pDst);
+
+ /**
+ * DownloadFromScreen() loads a rectangle of data from pSrc into dst
+ *
+ * @param pSrc source pixmap
+ * @param x source X coordinate.
+ * @param y source Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param dst pointer to the beginning of the destination data
+ * @param dst_pitch pitch (in bytes) of the lines of destination data.
+ *
+ * DownloadFromScreen() copies data from offscreen memory in pSrc from
+ * (x, y) to (x + width, y + height), to system memory starting at
+ * dst (with pitch dst_pitch). This would usually be done
+ * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
+ * and then synchronously reading from AGP. Because the implementation
+ * might be synchronous, EXA leaves it up to the driver to call
+ * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
+ * contrast to most other acceleration calls in EXA.
+ *
+ * DownloadFromScreen() can aid in the largest bottleneck in pixmap
+ * migration, which is the read from framebuffer when evicting pixmaps from
+ * framebuffer memory. Thus, it is highly recommended, even though
+ * implementations are typically complicated.
+ *
+ * @return TRUE if the driver successfully downloaded the data. FALSE
+ * indicates that EXA should fall back to doing the download in software.
+ *
+ * DownloadFromScreen() is not required, but is highly recommended.
+ */
+ Bool (*DownloadFromScreen)(PixmapPtr pSrc,
+ int x, int y,
+ int w, int h,
+ char *dst, int dst_pitch);
+
+ /**
+ * MarkSync() requests that the driver mark a synchronization point,
+ * returning an driver-defined integer marker which could be requested for
+ * synchronization to later in WaitMarker(). This might be used in the
+ * future to avoid waiting for full hardware stalls before accessing pixmap
+ * data with the CPU, but is not important in the current incarnation of
+ * EXA.
+ *
+ * Note that drivers should call exaMarkSync() when they have done some
+ * acceleration, rather than their own MarkSync() handler, as otherwise EXA
+ * will be unaware of the driver's acceleration and not sync to it during
+ * fallbacks.
+ *
+ * MarkSync() is optional.
+ */
+ int (*MarkSync) (ScreenPtr pScreen);
+
+ /**
+ * WaitMarker() waits for all rendering before the given marker to have
+ * completed. If the driver does not implement MarkSync(), marker is
+ * meaningless, and all rendering by the hardware should be completed before
+ * WaitMarker() returns.
+ *
+ * Note that drivers should call exaWaitSync() to wait for all acceleration
+ * to finish, as otherwise EXA will be unaware of the driver having
+ * synchronized, resulting in excessive WaitMarker() calls.
+ *
+ * WaitMarker() is required of all drivers.
+ */
+ void (*WaitMarker) (ScreenPtr pScreen, int marker);
+
+ /** @{ */
+ /**
+ * PrepareAccess() is called before CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * PrepareAccess() will be called before CPU access to an offscreen pixmap.
+ * This can be used to set up hardware surfaces for byteswapping or
+ * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
+ * making CPU access use a different aperture.
+ *
+ * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
+ * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
+ * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
+ * will have PrepareAccess() called on them per operation, drivers can have
+ * a small, statically-allocated space to maintain state for PrepareAccess()
+ * and FinishAccess() in. Note that PrepareAccess() is only called once per
+ * pixmap and operation, regardless of whether the pixmap is used as a
+ * destination and/or source, and the index may not reflect the usage.
+ *
+ * PrepareAccess() may fail. An example might be the case of hardware that
+ * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
+ * fails, EXA will migrate the pixmap to system memory.
+ * DownloadFromScreen() must be implemented and must not fail if a driver
+ * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
+ * pPix is the visible screen, because the visible screen can not be
+ * migrated.
+ *
+ * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
+ * drawing.
+ * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
+ * DownloadFromScreen() to migate the pixmap out.
+ */
+ Bool (*PrepareAccess)(PixmapPtr pPix, int index);
+
+ /**
+ * FinishAccess() is called after CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * FinishAccess() will be called after finishing CPU access of an offscreen
+ * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
+ * called if PrepareAccess() failed and the pixmap was migrated out.
+ */
+ void (*FinishAccess)(PixmapPtr pPix, int index);
+
+ /**
+ * PixmapIsOffscreen() is an optional driver replacement to
+ * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
+ * of exaPixmapHasGpuCopy().
+ *
+ * @param pPix the pixmap
+ * @return TRUE if the given drawable is in framebuffer memory.
+ *
+ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
+ * memory, meaning that acceleration could probably be done to it, and that it
+ * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
+ * with the CPU.
+ *
+ *
+ */
+ Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
+
+ /** @name PrepareAccess() and FinishAccess() indices
+ * @{
+ */
+ /**
+ * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
+ * read from.
+ */
+ #define EXA_PREPARE_DEST 0
+ /**
+ * EXA_PREPARE_SRC is the index for a pixmap that may be read from
+ */
+ #define EXA_PREPARE_SRC 1
+ /**
+ * EXA_PREPARE_SRC is the index for a second pixmap that may be read
+ * from.
+ */
+ #define EXA_PREPARE_MASK 2
+ /**
+ * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
+ * separate alpha maps with Composite operations.
+ */
+ #define EXA_PREPARE_AUX_DEST 3
+ #define EXA_PREPARE_AUX_SRC 4
+ #define EXA_PREPARE_AUX_MASK 5
+ #define EXA_NUM_PREPARE_INDICES 6
+ /** @} */
+
+ /**
+ * maxPitchPixels controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in pixels) beyond maxPitchPixels.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in pixels, don't set this. If neither this value
+ * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
+ * If set, it must not be smaller than maxX.
+ *
+ * @sa maxPitchBytes
+ */
+ int maxPitchPixels;
+
+ /**
+ * maxPitchBytes controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in bytes) beyond maxPitchBytes.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in bytes, don't set this.
+ * If set, it must not be smaller than maxX * 4.
+ * There's no default value for maxPitchBytes.
+ *
+ * @sa maxPitchPixels
+ */
+ int maxPitchBytes;
+
+ /* Hooks to allow driver to its own pixmap memory management */
+ void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
+ void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
+ /**
+ * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
+ * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
+ * be called.
+ */
+ Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData);
+
+ /* hooks for drivers with tiling support:
+ * driver MUST fill out new_fb_pitch with valid pitch of pixmap
+ */
+ void *(*CreatePixmap2)(ScreenPtr pScreen, int width, int height,
+ int depth, int class, int bitsPerPixel,
+ int *new_fb_pitch);
+ /** @} */
+} ExaDriverRec, *ExaDriverPtr;
+
+/** @name EXA driver flags
+ * @{
+ */
+/**
+ * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
+ * offscreen pixmaps.
+ */
+#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
+
+/**
+ * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
+ * to have a power-of-two pitch.
+ */
+#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
+
+/**
+ * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
+ * support copies that are (left-to-right, top-to-bottom) or
+ * (right-to-left, bottom-to-top).
+ */
+#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
+
+/**
+ * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
+ * all pixmap addressing and migration.
+ */
+#define EXA_HANDLES_PIXMAPS (1 << 3)
+
+/**
+ * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
+ * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
+ * such hooks, this flag has no effect.
+ */
+#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
+
+/**
+ * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
+ * can handle the source and destination occupying overlapping offscreen memory
+ * areas. This allows the offscreen memory defragmentation code to defragment
+ * areas where the defragmented position overlaps the fragmented position.
+ *
+ * Typically this is supported by traditional 2D engines but not by 3D engines.
+ */
+#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
+
+/**
+ * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
+ * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
+ * into a driver pixmap and then pins it.
+ */
+#define EXA_MIXED_PIXMAPS (1 << 6)
+
+/** @} */
+
+/* in exa.c */
+extern _X_EXPORT ExaDriverPtr
+exaDriverAlloc(void);
+
+extern _X_EXPORT Bool
+exaDriverInit(ScreenPtr pScreen,
+ ExaDriverPtr pScreenInfo);
+
+extern _X_EXPORT void
+exaDriverFini(ScreenPtr pScreen);
+
+extern _X_EXPORT void
+exaMarkSync(ScreenPtr pScreen);
+extern _X_EXPORT void
+exaWaitSync(ScreenPtr pScreen);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapOffset(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapPitch(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+exaGetPixmapSize(PixmapPtr pPix);
+
+extern _X_EXPORT void *
+exaGetPixmapDriverPrivate(PixmapPtr p);
+
+
+/* in exa_offscreen.c */
+extern _X_EXPORT ExaOffscreenArea *
+exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
+ Bool locked,
+ ExaOffscreenSaveProc save,
+ pointer privData);
+
+extern _X_EXPORT ExaOffscreenArea *
+exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
+
+extern _X_EXPORT void
+ExaOffscreenMarkUsed (PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+exaEnableDisableFBAccess (int index, Bool enable);
+
+extern _X_EXPORT Bool
+exaDrawableIsOffscreen (DrawablePtr pDrawable);
+
+/* in exa.c */
+extern _X_EXPORT void
+exaMoveInPixmap (PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+exaMoveOutPixmap (PixmapPtr pPixmap);
+
+
+/* in exa_unaccel.c */
+extern _X_EXPORT CARD32
+exaGetPixmapFirstPixel (PixmapPtr pPixmap);
+
+
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
+ (((_pm) & FbFullMask((_pDrawable)->depth)) == \
+ FbFullMask((_pDrawable)->depth))
+
+#endif /* EXA_H */
diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c
index 1a1467848..809b3f660 100644
--- a/xorg-server/exa/exa_classic.c
+++ b/xorg-server/exa/exa_classic.c
@@ -54,7 +54,7 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
@@ -66,7 +66,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, usage_hint);
+ pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, class);
swap(pExaScr, pScreen, CreatePixmap);
if (!pPixmap)
diff --git a/xorg-server/exa/exa_driver.c b/xorg-server/exa/exa_driver.c
index b9903d1bc..8893452a8 100644
--- a/xorg-server/exa/exa_driver.c
+++ b/xorg-server/exa/exa_driver.c
@@ -1,226 +1,226 @@
-/*
- * Copyright © 2009 Maarten Maathuis
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "exa_priv.h"
-#include "exa.h"
-
-/* This file holds the driver allocated pixmaps specific implementation. */
-
-static _X_INLINE void*
-ExaGetPixmapAddress(PixmapPtr p)
-{
- ExaPixmapPriv(p);
-
- return pExaPixmap->sys_ptr;
-}
-
-/**
- * exaCreatePixmap() creates a new pixmap.
- *
- * Pixmaps are always marked as pinned, because exa has no control over them.
- */
-PixmapPtr
-exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
- int bpp;
- size_t paddedWidth, datasize;
- ExaScreenPriv(pScreen);
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
- swap(pExaScr, pScreen, CreatePixmap);
-
- if (!pPixmap)
- return NULL;
-
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
- pExaPixmap->driverPriv = NULL;
-
- bpp = pPixmap->drawable.bitsPerPixel;
-
- /* Set this before driver hooks, to allow for driver pixmaps without gpu
- * memory to back it. These pixmaps have a valid pointer at all times.
- */
- pPixmap->devPrivate.ptr = NULL;
-
- if (pExaScr->info->CreatePixmap2) {
- int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
- paddedWidth = pExaPixmap->fb_pitch = new_pitch;
- }
- else {
- paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return NullPixmap;
-
- exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
-
- if (paddedWidth < pExaPixmap->fb_pitch)
- paddedWidth = pExaPixmap->fb_pitch;
- datasize = h * paddedWidth;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
- }
-
- if (!pExaPixmap->driverPriv) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
- }
-
- /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
- pExaPixmap->fb_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- pExaPixmap->sys_ptr = NULL;
-
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
-
- pExaPixmap->area = NULL;
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
-
- pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
-
- /* During a fallback we must prepare access. */
- if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
-
- return pPixmap;
-}
-
-Bool
-exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- ScreenPtr pScreen;
- ExaScreenPrivPtr pExaScr;
- ExaPixmapPrivPtr pExaPixmap;
- Bool ret;
-
- if (!pPixmap)
- return FALSE;
-
- pScreen = pPixmap->drawable.pScreen;
- pExaScr = ExaGetScreenPriv(pScreen);
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
-
- if (pExaPixmap) {
- if (pPixData)
- pExaPixmap->sys_ptr = pPixData;
-
- if (devKind > 0)
- pExaPixmap->sys_pitch = devKind;
-
- if (width > 0 && height > 0 && bitsPerPixel > 0) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
- }
- }
-
- if (pExaScr->info->ModifyPixmapHeader) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
- * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
- * !has_gpu_copy pixmap. We need to store the pointer,
- * because PrepareAccess won't be called.
- */
- if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
- }
- if (ret == TRUE)
- goto out;
- }
-
- swap(pExaScr, pScreen, ModifyPixmapHeader);
- ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- swap(pExaScr, pScreen, ModifyPixmapHeader);
-
-out:
- /* Always NULL this, we don't want lingering pointers. */
- pPixmap->devPrivate.ptr = NULL;
-
- return ret;
-}
-
-Bool
-exaDestroyPixmap_driver (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- Bool ret;
-
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
-
- exaDestroyPixmap(pPixmap);
-
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
-
- swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
-}
-
-Bool
-exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- pointer saved_ptr;
- Bool ret;
-
- saved_ptr = pPixmap->devPrivate.ptr;
- pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
- ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
- pPixmap->devPrivate.ptr = saved_ptr;
-
- return ret;
-}
+/*
+ * Copyright © 2009 Maarten Maathuis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "exa_priv.h"
+#include "exa.h"
+
+/* This file holds the driver allocated pixmaps specific implementation. */
+
+static _X_INLINE void*
+ExaGetPixmapAddress(PixmapPtr p)
+{
+ ExaPixmapPriv(p);
+
+ return pExaPixmap->sys_ptr;
+}
+
+/**
+ * exaCreatePixmap() creates a new pixmap.
+ *
+ * Pixmaps are always marked as pinned, because exa has no control over them.
+ */
+PixmapPtr
+exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned class)
+{
+ PixmapPtr pPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
+ int bpp;
+ size_t paddedWidth, datasize;
+ ExaScreenPriv(pScreen);
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ swap(pExaScr, pScreen, CreatePixmap);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, class);
+ swap(pExaScr, pScreen, CreatePixmap);
+
+ if (!pPixmap)
+ return NULL;
+
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+ pExaPixmap->driverPriv = NULL;
+
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ /* Set this before driver hooks, to allow for driver pixmaps without gpu
+ * memory to back it. These pixmaps have a valid pointer at all times.
+ */
+ pPixmap->devPrivate.ptr = NULL;
+
+ if (pExaScr->info->CreatePixmap2) {
+ int new_pitch = 0;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, class, bpp, &new_pitch);
+ paddedWidth = pExaPixmap->fb_pitch = new_pitch;
+ }
+ else {
+ paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
+ if (paddedWidth / 4 > 32767 || h > 32767)
+ return NullPixmap;
+
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
+ if (paddedWidth < pExaPixmap->fb_pitch)
+ paddedWidth = pExaPixmap->fb_pitch;
+ datasize = h * paddedWidth;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
+ }
+
+ if (!pExaPixmap->driverPriv) {
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
+ }
+
+ /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ pExaPixmap->fb_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ pExaPixmap->sys_ptr = NULL;
+
+ (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
+ paddedWidth, NULL);
+
+ pExaPixmap->area = NULL;
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ w, h, bpp);
+
+ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+
+ /* During a fallback we must prepare access. */
+ if (pExaScr->fallback_counter)
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+
+ return pPixmap;
+}
+
+Bool
+exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ ScreenPtr pScreen;
+ ExaScreenPrivPtr pExaScr;
+ ExaPixmapPrivPtr pExaPixmap;
+ Bool ret;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pExaScr = ExaGetScreenPriv(pScreen);
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+
+ if (pExaPixmap) {
+ if (pPixData)
+ pExaPixmap->sys_ptr = pPixData;
+
+ if (devKind > 0)
+ pExaPixmap->sys_pitch = devKind;
+
+ if (width > 0 && height > 0 && bitsPerPixel > 0) {
+ exaSetFbPitch(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+ }
+ }
+
+ if (pExaScr->info->ModifyPixmapHeader) {
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
+ * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
+ * !has_gpu_copy pixmap. We need to store the pointer,
+ * because PrepareAccess won't be called.
+ */
+ if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
+ }
+ if (ret == TRUE)
+ goto out;
+ }
+
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+ ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+
+out:
+ /* Always NULL this, we don't want lingering pointers. */
+ pPixmap->devPrivate.ptr = NULL;
+
+ return ret;
+}
+
+Bool
+exaDestroyPixmap_driver (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret;
+
+ if (pPixmap->refcnt == 1)
+ {
+ ExaPixmapPriv (pPixmap);
+
+ exaDestroyPixmap(pPixmap);
+
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+ }
+
+ swap(pExaScr, pScreen, DestroyPixmap);
+ ret = pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+
+ return ret;
+}
+
+Bool
+exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ pointer saved_ptr;
+ Bool ret;
+
+ saved_ptr = pPixmap->devPrivate.ptr;
+ pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
+ ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
+ pPixmap->devPrivate.ptr = saved_ptr;
+
+ return ret;
+}
diff --git a/xorg-server/exa/exa_migration_mixed.c b/xorg-server/exa/exa_migration_mixed.c
index 9489b2927..00227e3c4 100644
--- a/xorg-server/exa/exa_migration_mixed.c
+++ b/xorg-server/exa/exa_migration_mixed.c
@@ -39,7 +39,7 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
ExaPixmapPriv(pPixmap);
int w = pPixmap->drawable.width, h = pPixmap->drawable.height;
int depth = pPixmap->drawable.depth, bpp = pPixmap->drawable.bitsPerPixel;
- int usage_hint = pPixmap->usage_hint;
+ int class = pPixmap->drawable.class;
int paddedWidth = pExaPixmap->sys_pitch;
/* Already done. */
@@ -55,7 +55,7 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
if (pExaScr->info->CreatePixmap2) {
int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, class, bpp, &new_pitch);
paddedWidth = pExaPixmap->fb_pitch = new_pitch;
} else {
if (paddedWidth < pExaPixmap->fb_pitch)
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 188a7e0a6..38700e900 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -47,7 +47,7 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
@@ -59,7 +59,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, class);
swap(pExaScr, pScreen, CreatePixmap);
if (!pPixmap)
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h
index 1b8cf294a..546a3e6e8 100644
--- a/xorg-server/exa/exa_priv.h
+++ b/xorg-server/exa/exa_priv.h
@@ -588,7 +588,7 @@ extern const GCFuncs exaGCFuncs;
/* exa_classic.c */
PixmapPtr
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
@@ -603,7 +603,7 @@ exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
/* exa_driver.c */
PixmapPtr
exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
@@ -618,7 +618,7 @@ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
/* exa_mixed.c */
PixmapPtr
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h
index 29eecadb3..a33cc40ce 100644
--- a/xorg-server/fb/fb.h
+++ b/xorg-server/fb/fb.h
@@ -1598,11 +1598,11 @@ fbPictureInit (ScreenPtr pScreen,
extern _X_EXPORT PixmapPtr
fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint);
+ unsigned class);
extern _X_EXPORT PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+ unsigned class);
extern _X_EXPORT Bool
fbDestroyPixmap (PixmapPtr pPixmap);
diff --git a/xorg-server/fb/fb24_32.c b/xorg-server/fb/fb24_32.c
index 748a0ec04..b402a2357 100644
--- a/xorg-server/fb/fb24_32.c
+++ b/xorg-server/fb/fb24_32.c
@@ -546,7 +546,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
pOldTile->drawable.height,
pOldTile->drawable.depth,
- pOldTile->usage_hint);
+ pOldTile->drawable.class);
if (!pNewTile)
return 0;
fbGetDrawable (&pOldTile->drawable,
diff --git a/xorg-server/fb/fbpixmap.c b/xorg-server/fb/fbpixmap.c
index 80d3252d2..e73a2f02d 100644
--- a/xorg-server/fb/fbpixmap.c
+++ b/xorg-server/fb/fbpixmap.c
@@ -30,7 +30,7 @@
PixmapPtr
fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
size_t datasize;
@@ -54,7 +54,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = bpp;
@@ -78,14 +78,12 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
pPixmap->screen_y = 0;
#endif
- pPixmap->usage_hint = usage_hint;
-
return pPixmap;
}
PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
int bpp;
bpp = BitsPerPixel (depth);
@@ -93,7 +91,7 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
if (bpp == 32 && depth <= 24)
bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
#endif
- return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
+ return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, class);
}
Bool
diff --git a/xorg-server/glx/glapi.c b/xorg-server/glx/glapi.c
index 09b7149dc..7c75d2d5a 100644
--- a/xorg-server/glx/glapi.c
+++ b/xorg-server/glx/glapi.c
@@ -220,8 +220,6 @@ PUBLIC const void *_glapi_Context = NULL;
#if defined(THREADS)
-static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */
-
_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
@@ -268,31 +266,11 @@ _glthread_DECLARE_STATIC_MUTEX(ThreadCheckMutex);
#define CHECK_MULTITHREAD_UNLOCK() _glthread_UNLOCK_MUTEX(ThreadCheckMutex)
#endif
/**
- * We should call this periodically from a function such as glXMakeCurrent
- * in order to test if multiple threads are being used.
+ * xserver's gl is not multithreaded, we promise.
*/
PUBLIC void
_glapi_check_multithread(void)
{
- static unsigned long knownID;
- static GLboolean firstCall = GL_TRUE;
-
- if (ThreadSafe)
- return;
-
- CHECK_MULTITHREAD_LOCK();
- if (firstCall) {
- _glapi_init_multithread();
-
- knownID = _glthread_GetID();
- firstCall = GL_FALSE;
- }
- else if (knownID != _glthread_GetID()) {
- ThreadSafe = GL_TRUE;
- _glapi_set_dispatch(NULL);
- _glapi_set_context(NULL);
- }
- CHECK_MULTITHREAD_UNLOCK();
}
#else
@@ -321,7 +299,7 @@ _glapi_set_context(void *context)
_glapi_tls_Context = context;
#elif defined(THREADS)
_glthread_SetTSD(&ContextTSD, context);
- _glapi_Context = (ThreadSafe) ? NULL : context;
+ _glapi_Context = context;
#else
_glapi_Context = context;
#endif
@@ -339,8 +317,6 @@ _glapi_get_context(void)
{
#if defined(GLX_USE_TLS)
return _glapi_tls_Context;
-#elif defined(THREADS)
- return (ThreadSafe) ? _glthread_GetTSD(&ContextTSD) : _glapi_Context;
#else
return _glapi_Context;
#endif
@@ -362,18 +338,9 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
/* use the no-op functions */
dispatch = (struct _glapi_table *) __glapi_noop_table;
}
-#ifdef DEBUG
- else {
- _glapi_check_table_not_null(dispatch);
- _glapi_check_table(dispatch);
- }
-#endif
#if defined(GLX_USE_TLS)
_glapi_tls_Dispatch = dispatch;
-#elif defined(THREADS)
- _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
- _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch;
#else
_glapi_Dispatch = dispatch;
#endif
@@ -389,10 +356,6 @@ _glapi_get_dispatch(void)
{
#if defined(GLX_USE_TLS)
return _glapi_tls_Dispatch;
-#elif defined(THREADS)
- return (ThreadSafe)
- ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD)
- : _glapi_Dispatch;
#else
return _glapi_Dispatch;
#endif
@@ -1128,84 +1091,3 @@ _glapi_get_dispatch_table_size(void)
return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS;
}
-
-/**
- * Make sure there are no NULL pointers in the given dispatch table.
- * Intended for debugging purposes.
- */
-void
-_glapi_check_table_not_null(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- const GLuint entries = _glapi_get_dispatch_table_size();
- const void **tab = (const void **) table;
- GLuint i;
- for (i = 1; i < entries; i++) {
- assert(tab[i]);
- }
-#else
- (void) table;
-#endif
-}
-
-
-/**
- * Do some spot checks to be sure that the dispatch table
- * slots are assigned correctly. For debugging only.
- */
-void
-_glapi_check_table(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- {
- GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
- char *BeginFunc = (char*) &table->Begin;
- GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
- assert(BeginOffset == offset);
- }
- {
- GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
- char *viewportFunc = (char*) &table->Viewport;
- GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
- assert(viewportOffset == offset);
- }
- {
- GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
- char *VertexPointerFunc = (char*) &table->VertexPointer;
- GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
- assert(VertexPointerOffset == offset);
- }
- {
- GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
- char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
- GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
- assert(ResetMinMaxOffset == offset);
- }
- {
- GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
- char *blendColorFunc = (char*) &table->BlendColor;
- GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
- assert(blendColorOffset == offset);
- }
- {
- GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
- char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
- GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
- assert(secondaryColor3fOffset == offset);
- }
- {
- GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
- char *pointParameterivFunc = (char*) &table->PointParameterivNV;
- GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
- assert(pointParameterivOffset == offset);
- }
- {
- GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
- char *setFenceFunc = (char*) &table->SetFenceNV;
- GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
- assert(setFenceOffset == offset);
- }
-#else
- (void) table;
-#endif
-}
diff --git a/xorg-server/glx/glthread.c b/xorg-server/glx/glthread.c
index c466e9bf0..5da7e433c 100644
--- a/xorg-server/glx/glthread.c
+++ b/xorg-server/glx/glthread.c
@@ -25,15 +25,13 @@
/*
* XXX There's probably some work to do in order to make this file
- * truly reusable outside of Mesa. First, the glheader.h include must go.
+ * truly reusable outside of Mesa.
*/
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/Xfuncproto.h>
-#ifndef PUBLIC
-#define PUBLIC
-#endif
#endif
#include <stdlib.h>
@@ -74,7 +72,7 @@
*/
#ifdef PTHREADS
-PUBLIC unsigned long
+_X_EXPORT unsigned long
_glthread_GetID(void)
{
return (unsigned long) pthread_self();
@@ -116,8 +114,6 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
#endif /* PTHREADS */
-
-
/*
* Win32 Threads. The only available option for Windows 95/NT.
* Be sure that you compile using the Multithreaded runtime, otherwise
@@ -125,12 +121,20 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
*/
#ifdef WIN32_THREADS
-static void InsteadOf_exit(int nCode)
+void FreeTSD(_glthread_TSD *p)
{
- DWORD dwErr = GetLastError();
+ if (p->initMagic==INIT_MAGIC) {
+ TlsFree(p->key);
+ p->initMagic=0;
+ }
}
-PUBLIC unsigned long
+void InsteadOf_exit(int nCode)
+{
+ DWORD dwErr=GetLastError();
+}
+
+unsigned long
_glthread_GetID(void)
{
return GetCurrentThreadId();
@@ -142,24 +146,13 @@ _glthread_InitTSD(_glthread_TSD *tsd)
{
tsd->key = TlsAlloc();
if (tsd->key == TLS_OUT_OF_INDEXES) {
- perror(INIT_TSD_ERROR);
+ perror("Mesa:_glthread_InitTSD");
InsteadOf_exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
-void
-_glthread_DestroyTSD(_glthread_TSD *tsd)
-{
- if (tsd->initMagic != INIT_MAGIC) {
- return;
- }
- TlsFree(tsd->key);
- tsd->initMagic = 0x0;
-}
-
-
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
@@ -179,61 +172,20 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
_glthread_InitTSD(tsd);
}
if (TlsSetValue(tsd->key, ptr) == 0) {
- perror(SET_TSD_ERROR);
- InsteadOf_exit(-1);
+ perror("Mesa:_glthread_SetTSD");
+ InsteadOf_exit(-1);
}
}
#endif /* WIN32_THREADS */
-/*
- * BeOS threads
- */
-#ifdef BEOS_THREADS
-
-PUBLIC unsigned long
-_glthread_GetID(void)
-{
- return (unsigned long) find_thread(NULL);
-}
-
-void
-_glthread_InitTSD(_glthread_TSD *tsd)
-{
- tsd->key = tls_allocate();
- tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD *tsd)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return tls_get(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
-{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- tls_set(tsd->key, ptr);
-}
-
-#endif /* BEOS_THREADS */
-
-
-
#else /* THREADS */
-
/*
* no-op functions
*/
-PUBLIC unsigned long
+_X_EXPORT unsigned long
_glthread_GetID(void)
{
return 0;
diff --git a/xorg-server/glx/glthread.h b/xorg-server/glx/glthread.h
index 4fe99284a..28793fcc7 100644
--- a/xorg-server/glx/glthread.h
+++ b/xorg-server/glx/glthread.h
@@ -64,12 +64,18 @@
#define GLTHREAD_H
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
-#ifndef THREADS
-#define THREADS
+#if defined(USE_MGL_NAMESPACE)
+#define _glapi_Dispatch _mglapi_Dispatch
#endif
+
+#if (defined(PTHREADS) || defined(WIN32_THREADS)) \
+ && !defined(THREADS)
+# define THREADS
#endif
+#ifdef VMS
+#include <GL/vms_x_fix.h>
+#endif
/*
* POSIX threads. This should be your choice in the Unix world
@@ -110,6 +116,18 @@ typedef pthread_mutex_t _glthread_Mutex;
#endif /* PTHREADS */
+
+
+/*
+ * Solaris threads. Use only up to Solaris 2.4.
+ * Solaris 2.5 and higher provide POSIX threads.
+ * Be sure to compile with -mt on the Solaris compilers, or
+ * use -D_REENTRANT if using gcc.
+ */
+
+
+
+
/*
* Windows threads. Should work with Windows NT and 95.
* IMPORTANT: Link with multithreaded runtime library when THREADS are
@@ -127,44 +145,22 @@ typedef HANDLE _glthread_Thread;
typedef CRITICAL_SECTION _glthread_Mutex;
-#define _glthread_DECLARE_STATIC_MUTEX(name) \
- /* static */ _glthread_Mutex name = { 0, 0, 0, 0, 0, 0 }
-
-#define _glthread_INIT_MUTEX(name) \
- InitializeCriticalSection(&name)
-
-#define _glthread_DESTROY_MUTEX(name) \
- DeleteCriticalSection(&name)
-
-#define _glthread_LOCK_MUTEX(name) \
- EnterCriticalSection(&name)
-
-#define _glthread_UNLOCK_MUTEX(name) \
- LeaveCriticalSection(&name)
+#define _glthread_DECLARE_STATIC_MUTEX(name) /*static*/ _glthread_Mutex name = {0,0,0,0,0,0}
+#define _glthread_INIT_MUTEX(name) InitializeCriticalSection(&name)
+#define _glthread_DESTROY_MUTEX(name) DeleteCriticalSection(&name)
+#define _glthread_LOCK_MUTEX(name) EnterCriticalSection(&name)
+#define _glthread_UNLOCK_MUTEX(name) LeaveCriticalSection(&name)
#endif /* WIN32_THREADS */
-
/*
* BeOS threads. R5.x required.
*/
#ifdef BEOS_THREADS
-/* Problem with OS.h and this file on haiku */
-#ifndef __HAIKU__
#include <kernel/OS.h>
-#endif
-
#include <support/TLS.h>
-/* The only two typedefs required here
- * this is cause of the OS.h problem
- */
-#ifdef __HAIKU__
-typedef int32 thread_id;
-typedef int32 sem_id;
-#endif
-
typedef struct {
int32 key;
int initMagic;
@@ -179,40 +175,28 @@ typedef struct {
} benaphore;
typedef benaphore _glthread_Mutex;
-#define _glthread_DECLARE_STATIC_MUTEX(name) \
- static _glthread_Mutex name = { 0, 0 }
+#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 }
+#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
+#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0
+#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \
+ if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
+#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
-#define _glthread_INIT_MUTEX(name) \
- name.sem = create_sem(0, #name"_benaphore"), \
- name.lock = 0
-
-#define _glthread_DESTROY_MUTEX(name) \
- delete_sem(name.sem), \
- name.lock = 0
-
-#define _glthread_LOCK_MUTEX(name) \
- if (name.sem == 0) \
- _glthread_INIT_MUTEX(name); \
- if (atomic_add(&(name.lock), 1) >= 1) \
- acquire_sem(name.sem)
+#endif /* BEOS_THREADS */
-#define _glthread_UNLOCK_MUTEX(name) \
- if (atomic_add(&(name.lock), -1) > 1) \
- release_sem(name.sem)
-#endif /* BEOS_THREADS */
+#ifndef THREADS
/*
* THREADS not defined
*/
-#ifndef THREADS
-typedef unsigned _glthread_TSD;
+typedef int _glthread_TSD;
-typedef unsigned _glthread_Thread;
+typedef int _glthread_Thread;
-typedef unsigned _glthread_Mutex;
+typedef int _glthread_Mutex;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
@@ -240,10 +224,6 @@ extern void
_glthread_InitTSD(_glthread_TSD *);
-extern void
-_glthread_DestroyTSD(_glthread_TSD *); /* WIN32 only */
-
-
extern void *
_glthread_GetTSD(_glthread_TSD *);
@@ -251,5 +231,22 @@ _glthread_GetTSD(_glthread_TSD *);
extern void
_glthread_SetTSD(_glthread_TSD *, void *);
+#if defined(GLX_USE_TLS)
+
+extern __thread struct _glapi_table * _glapi_tls_Dispatch
+ __attribute__((tls_model("initial-exec")));
+
+#define GET_DISPATCH() _glapi_tls_Dispatch
+
+#elif !defined(GL_CALL)
+# if defined(THREADS)
+# define GET_DISPATCH() \
+ ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
+ ? _glapi_Dispatch : _glapi_get_dispatch())
+# else
+# define GET_DISPATCH() _glapi_Dispatch
+# endif /* defined(THREADS) */
+#endif /* ndef GL_CALL */
+
#endif /* THREADS_H */
diff --git a/xorg-server/hw/dmx/dmxpixmap.c b/xorg-server/hw/dmx/dmxpixmap.c
index 119dd1134..9a098777d 100644
--- a/xorg-server/hw/dmx/dmxpixmap.c
+++ b/xorg-server/hw/dmx/dmxpixmap.c
@@ -82,7 +82,7 @@ void dmxBECreatePixmap(PixmapPtr pPixmap)
/** Create a pixmap for \a pScreen with the specified \a width, \a
* height, and \a depth. */
PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
PixmapPtr pPixmap;
@@ -104,7 +104,7 @@ PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = bpp;
@@ -116,7 +116,6 @@ PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.height = height;
pPixmap->devKind = PixmapBytePad(width, bpp);
pPixmap->refcnt = 1;
- pPixmap->usage_hint = usage_hint;
pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
pPixPriv->pixmap = (Pixmap)0;
diff --git a/xorg-server/hw/dmx/dmxpixmap.h b/xorg-server/hw/dmx/dmxpixmap.h
index a41918ce4..70aa5075c 100644
--- a/xorg-server/hw/dmx/dmxpixmap.h
+++ b/xorg-server/hw/dmx/dmxpixmap.h
@@ -50,7 +50,7 @@ extern Bool dmxInitPixmap(ScreenPtr pScreen);
extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen,
int width, int height, int depth,
- unsigned usage_hint);
+ unsigned class);
extern Bool dmxDestroyPixmap(PixmapPtr pPixmap);
extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap);
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 1dea47feb..bd90e6ca3 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -1787,9 +1787,11 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
XF86ConfDisplayPtr dispptr;
XF86ConfAdaptorLinkPtr conf_adaptor;
Bool defaultMonitor = FALSE;
+ XF86ConfScreenRec local_conf_screen;
if (!conf_screen) {
- conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec));
+ memset(&local_conf_screen, 0, sizeof(local_conf_screen));
+ conf_screen = &local_conf_screen;
conf_screen->scrn_identifier = "Default Screen Section";
xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
}
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index 0aa6f2cf4..a6266e725 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -369,13 +369,13 @@ VGAarbiterClearToBackground (
}
static PixmapPtr
-VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned class)
{
PixmapPtr pPix;
SCREEN_PROLOG ( CreatePixmap);
VGAGet(pScreen);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, class);
VGAPut();
SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index 13fde5e79..0f8416b71 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -155,7 +155,7 @@ static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
int h, Bool generateExposures);
static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
- int depth, unsigned int usage_hint);
+ int depth, unsigned int class);
static Bool VGAarbiterCreateGC(GCPtr pGC);
static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c
index 5120b3199..082cfae4f 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.c
+++ b/xorg-server/hw/xfree86/vbe/vbe.c
@@ -395,7 +395,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
i = 0;
while (modes[i] != 0xffff)
i++;
- block->VideoModePtr = malloc(sizeof(CARD16) * i + 1);
+ block->VideoModePtr = malloc(sizeof(CARD16) * (i + 1));
memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
block->VideoModePtr[i] = 0xffff;
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index ff1dd3d8b..c0617149a 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -34,7 +34,7 @@ static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
int *pwidth, int nspans, char *pdstStart);
static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned class);
static Bool XAADestroyPixmap(PixmapPtr pPixmap);
static Bool XAAEnterVT (int index, int flags);
static void XAALeaveVT (int index, int flags);
@@ -331,7 +331,7 @@ XAAInitializeOffscreenDepths (ScreenPtr pScreen)
}
static PixmapPtr
-XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned class)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -346,7 +346,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
XAAInitializeOffscreenDepths (pScreen);
if(pScrn->vtSema &&
- (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
+ (class != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
(infoRec->offscreenDepths & (1 << (depth - 1))) &&
(size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
(!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
@@ -379,7 +379,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
}
XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, class);
XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
if (!pPix) {
@@ -411,7 +411,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
}
BAILOUT:
XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, class);
XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
if(pPix) {
diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c
index da81a1d06..efb2774d3 100644
--- a/xorg-server/hw/xnest/Pixmap.c
+++ b/xorg-server/hw/xnest/Pixmap.c
@@ -37,7 +37,7 @@ DevPrivateKeyRec xnestPixmapPrivateKeyRec;
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+ unsigned class)
{
PixmapPtr pPixmap;
@@ -45,7 +45,7 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = depth;
pPixmap->drawable.id = 0;
@@ -57,7 +57,6 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
- pPixmap->usage_hint = usage_hint;
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h
index 0d7c6b61e..c9223e5ce 100644
--- a/xorg-server/hw/xnest/XNPixmap.h
+++ b/xorg-server/hw/xnest/XNPixmap.h
@@ -30,7 +30,7 @@ typedef struct {
#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++)
PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
- int depth, unsigned usage_hint);
+ int depth, unsigned class);
Bool xnestDestroyPixmap(PixmapPtr pPixmap);
RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index df939b494..e01955cb1 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -1,1465 +1,1465 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- * Kensuke Matsuzaki
- */
-
-#ifndef _WIN_H_
-#define _WIN_H_
-
-#ifndef NO
-#define NO 0
-#endif
-#ifndef YES
-#define YES 1
-#endif
-
-/* WM_XBUTTON Messages. They should go into w32api. */
-#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-# define WM_XBUTTONUP 524
-#endif
-#ifndef WM_XBUTTONDBLCLK
-# define WM_XBUTTONDBLCLK 525
-#endif
-
-
-#define WIN_DEFAULT_BPP 0
-#define WIN_DEFAULT_WHITEPIXEL 255
-#define WIN_DEFAULT_BLACKPIXEL 0
-#define WIN_DEFAULT_LINEBIAS 0
-#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
-#define WIN_DEFAULT_DPI 75
-#define WIN_DEFAULT_REFRESH 0
-#define WIN_DEFAULT_WIN_KILL TRUE
-#define WIN_DEFAULT_UNIX_KILL FALSE
-#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
-#ifdef XWIN_EMULATEPSEUDO
-#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
-#endif
-#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
-
-/*
- * Windows only supports 256 color palettes
- */
-#define WIN_NUM_PALETTE_ENTRIES 256
-
-/*
- * Number of times to call Restore in an attempt to restore the primary surface
- */
-#define WIN_REGAIN_SURFACE_RETRIES 1
-
-/*
- * Build a supported display depths mask by shifting one to the left
- * by the number of bits in the supported depth.
- */
-#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
- | (1 << (16 - 1)) | (1 << (15 - 1)) \
- | (1 << ( 8 - 1)))
-#define WIN_CHECK_DEPTH YES
-
-/*
- * Timer IDs for WM_TIMER
- */
-#define WIN_E3B_TIMER_ID 1
-#define WIN_POLLING_MOUSE_TIMER_ID 2
-
-#define MOUSE_POLLING_INTERVAL 50
-
-#define WIN_E3B_OFF -1
-#define WIN_FD_INVALID -1
-
-#define WIN_SERVER_NONE 0x0L /* 0 */
-#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
-#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
-#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
-#endif
-#ifdef XWIN_NATIVEGDI
-# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
-#endif
-
-#define AltMapIndex Mod1MapIndex
-#define NumLockMapIndex Mod2MapIndex
-#define AltLangMapIndex Mod3MapIndex
-#define KanaMapIndex Mod4MapIndex
-#define ScrollLockMapIndex Mod5MapIndex
-
-#define WIN_MOD_LALT 0x00000001
-#define WIN_MOD_RALT 0x00000002
-#define WIN_MOD_LCONTROL 0x00000004
-#define WIN_MOD_RCONTROL 0x00000008
-
-#define WIN_24BPP_MASK_RED 0x00FF0000
-#define WIN_24BPP_MASK_GREEN 0x0000FF00
-#define WIN_24BPP_MASK_BLUE 0x000000FF
-
-#define WIN_MAX_KEYS_PER_KEY 4
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-
-#include <errno.h>
-#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-#define HANDLE void *
-#ifdef _MSC_VER
-typedef int pid_t;
-#endif
-#include <pthread.h>
-#undef HANDLE
-#endif
-
-#ifdef HAS_MMAP
-#include <sys/mman.h>
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif /* MAP_FILE */
-#endif /* HAS_MMAP */
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <X11/Xprotostr.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "pixmap.h"
-#include "region.h"
-#include "gcstruct.h"
-#include "colormap.h"
-#include "colormapst.h"
-#include "miscstruct.h"
-#include "servermd.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "micmap.h"
-#include "mifillarc.h"
-#include "mifpoly.h"
-#include "mibstore.h"
-#include "input.h"
-#include "mipointer.h"
-#include "X11/keysym.h"
-#include "mibstore.h"
-#include "micoord.h"
-#include "dix.h"
-#include "miline.h"
-#include "shadow.h"
-#include "fb.h"
-#include "rootless.h"
-
-#include "mipict.h"
-#include "picturestr.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-/*
- * Windows headers
- */
-#include "winms.h"
-#include "winresource.h"
-
-
-/*
- * Define Windows constants
- */
-
-#define WM_TRAYICON (WM_USER + 1000)
-#define WM_INIT_SYS_MENU (WM_USER + 1001)
-#define WM_GIVEUP (WM_USER + 1002)
-
-
-/* Local includes */
-#include "winwindow.h"
-#include "winmsg.h"
-
-#define PROFILEPOINT(point,thresh)\
-{\
-static unsigned int PROFPT##point = 0;\
-if (++PROFPT##point % thresh == 0)\
-ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
-}
-
-
-/* We use xor this macro for detecting toggle key state changes */
-#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
-
-#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; \
-}
-
-/*
- * Typedefs for engine dependent function pointers
- */
-
-typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
-
-typedef void (*winFreeFBProcPtr)(ScreenPtr);
-
-typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
-
-typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
-
-typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
-
-typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
-
-typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
-
-typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
-
-typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
-
-typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
- int ndef, xColorItem *pdefs);
-
-typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
-
-typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
-
-#ifdef XWIN_NATIVEGDI
-/* Typedefs for native GDI wrappers */
-typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-
-/*
- * GC (graphics context) privates
- */
-
-typedef struct
-{
- HDC hdc;
- HDC hdcMem;
-} winPrivGCRec, *winPrivGCPtr;
-
-
-/*
- * Pixmap privates
- */
-
-typedef struct
-{
- HDC hdcSelected;
- HBITMAP hBitmap;
- BYTE *pbBits;
- DWORD dwScanlineBytes;
- BITMAPINFOHEADER *pbmih;
-} winPrivPixmapRec, *winPrivPixmapPtr;
-
-
-/*
- * Colormap privates
- */
-
-typedef struct
-{
- HPALETTE hPalette;
- LPDIRECTDRAWPALETTE lpDDPalette;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
- PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
-} winPrivCmapRec, *winPrivCmapPtr;
-
-/*
- * Windows Cursor handling.
- */
-
-typedef struct {
- /* from GetSystemMetrics */
- int sm_cx;
- int sm_cy;
-
- BOOL visible;
- HCURSOR handle;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
-} winCursorRec;
-
-/*
- * Resize modes
- */
-typedef enum {
- notAllowed,
- resizeWithScrollbars,
- resizeWithRandr
-} winResizeMode;
-
-/*
- * Screen information structure that we need before privates are available
- * in the server startup sequence.
- */
-
-typedef struct
-{
- ScreenPtr pScreen;
-
- /* Did the user specify a height and width? */
- Bool fUserGaveHeightAndWidth;
-
- DWORD dwScreen;
-
- int iMonitor;
- DWORD dwUserWidth;
- DWORD dwUserHeight;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwPaddedWidth;
-
- /* Did the user specify a screen position? */
- Bool fUserGavePosition;
- DWORD dwInitialX;
- DWORD dwInitialY;
-
- /*
- * dwStride is the number of whole pixels that occupy a scanline,
- * including those pixels that are not displayed. This is basically
- * a rounding up of the width.
- */
- DWORD dwStride;
-
- /* Offset of the screen in the window when using scrollbars */
- DWORD dwXOffset;
- DWORD dwYOffset;
-
- DWORD dwBPP;
- DWORD dwDepth;
- DWORD dwRefreshRate;
- char *pfb;
- DWORD dwEngine;
- DWORD dwEnginePreferred;
- DWORD dwClipUpdatesNBoxes;
-#ifdef XWIN_EMULATEPSEUDO
- Bool fEmulatePseudo;
-#endif
- Bool fFullScreen;
- Bool fDecoration;
-#ifdef XWIN_MULTIWINDOWEXTWM
- Bool fMWExtWM;
- Bool fAnotherWMRunning;
-#endif
-#ifdef XWIN_MULTIWINDOWINTWM
- Bool fInternalWM;
-#endif
- Bool fRootless;
-#ifdef XWIN_MULTIWINDOW
- Bool fMultiWindow;
-#endif
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- Bool fMultiMonitorOverride;
-#endif
- Bool fMultipleMonitors;
- Bool fLessPointer;
- winResizeMode iResizeMode;
- Bool fNoTrayIcon;
- int iE3BTimeout;
- /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
- Bool fUseWinKillKey;
- Bool fUseUnixKillKey;
- Bool fIgnoreInput;
-
- /* Did the user explicitly set this screen? */
- Bool fExplicitScreen;
-} winScreenInfo, *winScreenInfoPtr;
-
-
-/*
- * Screen privates
- */
-
-typedef struct _winPrivScreenRec
-{
- winScreenInfoPtr pScreenInfo;
-
- Bool fEnabled;
- Bool fClosed;
- Bool fActive;
- Bool fBadDepth;
-
- int iDeltaZ;
-
- int iConnectedClients;
-
- CloseScreenProcPtr CloseScreen;
-
- DWORD dwRedMask;
- DWORD dwGreenMask;
- DWORD dwBlueMask;
- DWORD dwBitsPerRGB;
-
- DWORD dwModeKeyStates;
-
- /* Handle to icons that must be freed */
- HICON hiconNotifyIcon;
-
- /* Palette management */
- ColormapPtr pcmapInstalled;
-
- /* Pointer to the root visual so we only have to look it up once */
- VisualPtr pRootVisual;
-
- /* 3 button emulation variables */
- int iE3BCachedPress;
- Bool fE3BFakeButton2Sent;
-
- /* Privates used by shadow fb GDI server */
- HBITMAP hbmpShadow;
- HDC hdcScreen;
- HDC hdcShadow;
- HWND hwndScreen;
- BITMAPINFOHEADER *pbmih;
-
- /* Privates used by shadow fb and primary fb DirectDraw servers */
- LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE pddsPrimary;
- LPDIRECTDRAW2 pdd2;
-
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
-
-#ifdef XWIN_PRIMARYFB
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
-#endif
-
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAW4 pdd4;
- LPDIRECTDRAWSURFACE4 pddsShadow4;
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
-
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- /* Privates used by multi-window external window manager */
- RootlessFrameID widTop;
- Bool fRestacking;
-#endif
-
-#ifdef XWIN_MULTIWINDOW
- /* Privates used by multi-window */
- pthread_t ptWMProc;
- pthread_t ptXMsgProc;
- void *pWMInfo;
-#endif
-
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- /* Privates used by both multi-window and rootless */
- Bool fRootWindowShown;
-#endif
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Privates used for any module running in a seperate thread */
- pthread_mutex_t pmServerStarted;
- Bool fServerStarted;
-#endif
-
- /* Engine specific functions */
- winAllocateFBProcPtr pwinAllocateFB;
- winFreeFBProcPtr pwinFreeFB;
- winShadowUpdateProcPtr pwinShadowUpdate;
- winInitScreenProcPtr pwinInitScreen;
- winCloseScreenProcPtr pwinCloseScreen;
- winInitVisualsProcPtr pwinInitVisuals;
- winAdjustVideoModeProcPtr pwinAdjustVideoMode;
- winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
- winFinishScreenInitProcPtr pwinFinishScreenInit;
- winBltExposedRegionsProcPtr pwinBltExposedRegions;
- winActivateAppProcPtr pwinActivateApp;
- winRedrawScreenProcPtr pwinRedrawScreen;
- winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
- winInstallColormapProcPtr pwinInstallColormap;
- winStoreColorsProcPtr pwinStoreColors;
- winCreateColormapProcPtr pwinCreateColormap;
- winDestroyColormapProcPtr pwinDestroyColormap;
- winHotKeyAltTabProcPtr pwinHotKeyAltTab;
- winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
- winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
-
- winCreateScreenResourcesProc pwinCreateScreenResources;
-
-#ifdef XWIN_MULTIWINDOW
- /* Window Procedures for MultiWindow mode */
- winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
-#endif
-
- /* Window Procedures for Rootless mode */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
- ReparentWindowProcPtr ReparentWindow;
- ResizeWindowProcPtr ResizeWindow;
- MoveWindowProcPtr MoveWindow;
- SetShapeProcPtr SetShape;
-
- winCursorRec cursor;
-
-#ifdef XWIN_NATIVEGDI
- RealizeFontPtr RealizeFont;
- UnrealizeFontPtr UnrealizeFont;
-#endif
-
-} winPrivScreenRec;
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-typedef struct {
- RootlessWindowPtr pFrame;
- HWND hWnd;
- int dwWidthBytes;
- BITMAPINFOHEADER *pbmihShadow;
- HBITMAP hbmpShadow;
- HDC hdcShadow;
- HDC hdcScreen;
- BOOL fResized;
- BOOL fRestackingNow;
- BOOL fClose;
- BOOL fMovingOrSizing;
- BOOL fDestroyed;//for debug
- char *pfb;
-} win32RootlessWindowRec, *win32RootlessWindowPtr;
-#endif
-
-
-typedef struct {
- pointer value;
- XID id;
-} WindowIDPairRec, *WindowIDPairPtr;
-
-
-/*
- * Extern declares for general global variables
- */
-
-#include "winglobals.h"
-
-extern winScreenInfo * g_ScreenInfo;
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern DWORD g_dwEvents;
-#ifdef HAS_DEVWINDOWS
-extern int g_fdMessageQueue;
-#endif
-extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
-#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
-extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
-#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iGCPrivateKeyRec;
-#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
-extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
-#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
-#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
-
-extern unsigned long g_ulServerGeneration;
-extern DWORD g_dwEnginesSupported;
-extern HINSTANCE g_hInstance;
-extern int g_copyROP[];
-extern int g_patternROP[];
-extern const char * g_pszQueryHost;
-extern DeviceIntPtr g_pwinPointer;
-extern DeviceIntPtr g_pwinKeyboard;
-
-/*
- * Extern declares for dynamically loaded library function pointers
- */
-
-extern FARPROC g_fpDirectDrawCreate;
-extern FARPROC g_fpDirectDrawCreateClipper;
-extern FARPROC g_fpTrackMouseEvent;
-
-
-/*
- * Screen privates macros
- */
-
-#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
-
-#define winSetScreenPriv(pScreen,v) \
- dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
-
-#define winScreenPriv(pScreen) \
- winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
-
-
-/*
- * Colormap privates macros
- */
-
-#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
- dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
-
-#define winSetCmapPriv(pCmap,v) \
- dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
-
-#define winCmapPriv(pCmap) \
- winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
-
-
-/*
- * GC privates macros
- */
-
-#define winGetGCPriv(pGC) ((winPrivGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
-
-#define winSetGCPriv(pGC,v) \
- dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
-
-#define winGCPriv(pGC) \
- winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
-
-
-/*
- * Pixmap privates macros
- */
-
-#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
-
-#define winSetPixmapPriv(pPixmap,v) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
-
-#define winPixmapPriv(pPixmap) \
- winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
-
-
-/*
- * Window privates macros
- */
-
-#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
-
-#define winSetWindowPriv(pWin,v) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
-
-#define winWindowPriv(pWin) \
- winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
-
-/*
- * wrapper macros
- */
-#define _WIN_WRAP(priv, real, mem, func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define _WIN_UNWRAP(priv, real, mem) {\
- real->mem = priv->mem; \
-}
-
-#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
-
-#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
-
-/*
- * BEGIN DDX and DIX Function Prototypes
- */
-
-
-/*
- * winallpriv.c
- */
-
-Bool
-winAllocatePrivates (ScreenPtr pScreen);
-
-Bool
-winInitCmapPrivates (ColormapPtr pCmap, int index);
-
-Bool
-winAllocateCmapPrivates (ColormapPtr pCmap);
-
-
-/*
- * winauth.c
- */
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-Bool
-winGenerateAuthorization (void);
-void winSetAuthorization(void);
-#endif
-
-
-/*
- * winblock.c
- */
-
-void
-winBlockHandler (int nScreen,
- pointer pBlockData,
- pointer pTimeout,
- pointer pReadMask);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winclip.c
- */
-
-RegionPtr
-winPixmapToRegionNativeGDI (PixmapPtr pPix);
-#endif
-
-
-#ifdef XWIN_CLIPBOARD
-/*
- * winclipboardinit.c
- */
-
-Bool
-winInitClipboard (void);
-
-void
-winFixClipboardChain (int Removed);
-#endif
-
-
-/*
- * wincmap.c
- */
-
-void
-winSetColormapFunctions (ScreenPtr pScreen);
-
-Bool
-winCreateDefColormap (ScreenPtr pScreen);
-
-
-/*
- * wincreatewnd.c
- */
-
-Bool
-winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
-
-Bool
-winCreateBoundingWindowWindowed (ScreenPtr pScreen);
-
-
-/*
- * windialogs.c
- */
-
-int
-GetLiveClients (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winengine.c
- */
-
-void
-winDetectSupportedEngines (void);
-
-Bool
-winSetEngine (ScreenPtr pScreen);
-
-Bool
-winGetDDProcAddresses (void);
-
-void
-winReleaseDDProcAddresses(void);
-
-
-/*
- * winerror.c
- */
-
-#ifdef DDXOSVERRORF
-void
-OSVenderVErrorF (const char *pszFormat, va_list va_args);
-#endif
-
-void
-winMessageBoxF (const char *pszError, UINT uType, ...);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfillsp.c
- */
-
-void
-winFillSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSpans,
- DDXPointPtr pPoints,
- int *pWidths,
- int fSorted);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfont.c
- */
-
-Bool
-winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-
-Bool
-winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingc.c
- */
-
-Bool
-winCreateGCNativeGDI (GCPtr pGC);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingetsp.c
- */
-
-void
-winGetSpansNativeGDI (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr pPoints,
- int *pWidths,
- int nSpans,
- char *pDst);
-#endif
-
-
-/*
- * winglobals.c
- */
-
-void
-winInitializeGlobals (void);
-
-
-/*
- * winkeybd.c
- */
-
-void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
-
-int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
-
-void
-winInitializeModeKeyStates (void);
-
-void
-winRestoreModeKeyStates (void);
-
-Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
-
-void
-winKeybdReleaseKeys (void);
-
-void
-winSendKeyEvent (DWORD dwKey, Bool fDown);
-
-BOOL
-winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
-
-void
-winFixShiftKeys (int iScanCode);
-
-/*
- * winkeyhook.c
- */
-
-Bool
-winInstallKeyboardHookLL (void);
-
-void
-winRemoveKeyboardHookLL (void);
-
-
-/*
- * winmisc.c
- */
-
-#ifdef XWIN_NATIVEGDI
-void
-winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
-#endif
-
-CARD8
-winCountBits (DWORD dw);
-
-Bool
-winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
-
-#ifdef XWIN_NATIVEGDI
-BOOL
-winPaintBackground (HWND hwnd, COLORREF colorref);
-#endif
-
-
-/*
- * winmouse.c
- */
-
-int
-winMouseProc (DeviceIntPtr pDeviceInt, int iState);
-
-int
-winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
-
-void
-winMouseButtonsSendEvent (int iEventType, int iButton);
-
-int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam);
-
-void
-winEnqueueMotion(int x, int y);
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winnativegdi.c
- */
-
-HBITMAP
-winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
- BYTE **ppbBits, BITMAPINFO **ppbmi);
-
-Bool
-winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_PRIMARYFB
-/*
- * winpfbddd.c
- */
-
-Bool
-winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpixmap.c
- */
-
-PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
-
-Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
-
-Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpolyline.c
- */
-
-void
-winPolyLineNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
-#endif
-
-
-/*
- * winscrinit.c
- */
-
-Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-#if defined(XWIN_NATIVEGDI)
-Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winsetsp.c
- */
-
-void
-winSetSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrc,
- DDXPointPtr pPoints,
- int *pWidth,
- int nSpans,
- int fSorted);
-#endif
-
-
-/*
- * winshaddd.c
- */
-
-Bool
-winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
-
-
-/*
- * winshadddnl.c
- */
-
-Bool
-winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
-
-
-/*
- * winshadgdi.c
- */
-
-Bool
-winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
-
-
-/*
- * winwakeup.c
- */
-
-void
-winWakeupHandler (int nScreen,
- pointer pWakeupData,
- unsigned long ulResult,
- pointer pReadmask);
-
-
-/*
- * winwindow.c
- */
-
-#ifdef XWIN_NATIVEGDI
-Bool
-winCreateWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winDestroyWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
-
-void
-winCopyWindowNativeGDI (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-Bool
-winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
-
-Bool
-winUnmapWindowNativeGDI (WindowPtr pWindow);
-
-Bool
-winMapWindowNativeGDI (WindowPtr pWindow);
-#endif
-
-Bool
-winCreateWindowRootless (WindowPtr pWindow);
-
-Bool
-winDestroyWindowRootless (WindowPtr pWindow);
-
-Bool
-winPositionWindowRootless (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowRootless (WindowPtr pWindow);
-
-Bool
-winMapWindowRootless (WindowPtr pWindow);
-
-void
-winSetShapeRootless (WindowPtr pWindow, int kind);
-
-
-/*
- * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
- */
-
-HICON
-winXIconToHICON (WindowPtr pWin, int iconSize);
-
-void
-winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowshape.c
- */
-
-void
-winReshapeMultiWindow (WindowPtr pWin);
-
-void
-winSetShapeMultiWindow (WindowPtr pWindow, int kind);
-
-void
-winUpdateRgnMultiWindow (WindowPtr pWindow);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwindow.c
- */
-
-Bool
-winCreateWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winDestroyWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winMapWindowMultiWindow (WindowPtr pWindow);
-
-void
-winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
-
-void
-winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
-
-void
-winReorderWindowsMultiWindow (void);
-
-void
-winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib);
-void
-winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind);
-
-void
-winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion);
-
-XID
-winGetWindowID (WindowPtr pWin);
-
-int
-winAdjustXWindow (WindowPtr pWin, HWND hwnd);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwndproc.c
- */
-
-LRESULT CALLBACK
-winTopLevelWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * wintrayicon.c
- */
-
-void
-winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
-
-void
-winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
-
-LRESULT
-winHandleIconMessage (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winwndproc.c
- */
-
-LRESULT CALLBACK
-winWindowProc (HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootless.c
- */
-
-Bool
-winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape);
-
-void
-winMWExtWMDestroyFrame (RootlessFrameID wid);
-
-void
-winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
-
-void
-winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
-
-void
-winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
-
-void
-winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
-
-void
-winMWExtWMUnmapFrame (RootlessFrameID wid);
-
-void
-winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
-
-void
-winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
-
-void
-winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
-
-void
-winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
- int shift_x, int shift_y);
-
-void
-winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
-
-void
-winMWExtWMCopyBytes (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
-
-void
-winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
- int dx, int dy);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswindow.c
- */
-
-void
-winMWExtWMReorderWindows (ScreenPtr pScreen);
-
-void
-winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
-
-void
-winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
-
-void
-winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
-
-void
-winMWExtWMUpdateIcon (Window id);
-
-void
-winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo);
-
-wBOOL CALLBACK
-winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
-
-void
-winMWExtWMRestackWindows (ScreenPtr pScreen);
-#endif
-#ifdef XWIN_MULTIWINDOWINTWM
-Bool
-winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
-#endif
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswndproc.c
- */
-
-LRESULT CALLBACK
-winMWExtWMWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * winwindowswm.c
- */
-
-void
-winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h);
-
-void
-winWindowsWMExtensionInit (void);
-
-/*
- * wincursor.c
- */
-
-Bool
-winInitCursor (ScreenPtr pScreen);
-
-/*
- * winprocarg.c
- */
-void
-winInitializeScreens(int maxscreens);
-
-/*
- * windisplay.c
- */
-
-void
-winGetDisplayName(char *szDisplay, unsigned int screen);
-
-/*
- * winrandr.c
- */
-Bool
-winRandRInit (ScreenPtr pScreen);
-void
-winDoRandRScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight);
-
-/*
- * END DDX and DIX Function Prototypes
- */
-
-#endif /* _WIN_H_ */
-
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifndef _WIN_H_
+#define _WIN_H_
+
+#ifndef NO
+#define NO 0
+#endif
+#ifndef YES
+#define YES 1
+#endif
+
+/* WM_XBUTTON Messages. They should go into w32api. */
+#ifndef WM_XBUTTONDOWN
+# define WM_XBUTTONDOWN 523
+#endif
+#ifndef WM_XBUTTONUP
+# define WM_XBUTTONUP 524
+#endif
+#ifndef WM_XBUTTONDBLCLK
+# define WM_XBUTTONDBLCLK 525
+#endif
+
+
+#define WIN_DEFAULT_BPP 0
+#define WIN_DEFAULT_WHITEPIXEL 255
+#define WIN_DEFAULT_BLACKPIXEL 0
+#define WIN_DEFAULT_LINEBIAS 0
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_DPI 75
+#define WIN_DEFAULT_REFRESH 0
+#define WIN_DEFAULT_WIN_KILL TRUE
+#define WIN_DEFAULT_UNIX_KILL FALSE
+#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
+#ifdef XWIN_EMULATEPSEUDO
+#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
+#endif
+#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
+
+/*
+ * Windows only supports 256 color palettes
+ */
+#define WIN_NUM_PALETTE_ENTRIES 256
+
+/*
+ * Number of times to call Restore in an attempt to restore the primary surface
+ */
+#define WIN_REGAIN_SURFACE_RETRIES 1
+
+/*
+ * Build a supported display depths mask by shifting one to the left
+ * by the number of bits in the supported depth.
+ */
+#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
+ | (1 << (16 - 1)) | (1 << (15 - 1)) \
+ | (1 << ( 8 - 1)))
+#define WIN_CHECK_DEPTH YES
+
+/*
+ * Timer IDs for WM_TIMER
+ */
+#define WIN_E3B_TIMER_ID 1
+#define WIN_POLLING_MOUSE_TIMER_ID 2
+
+#define MOUSE_POLLING_INTERVAL 50
+
+#define WIN_E3B_OFF -1
+#define WIN_FD_INVALID -1
+
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#ifdef XWIN_PRIMARYFB
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#endif
+#ifdef XWIN_NATIVEGDI
+# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+#endif
+
+#define AltMapIndex Mod1MapIndex
+#define NumLockMapIndex Mod2MapIndex
+#define AltLangMapIndex Mod3MapIndex
+#define KanaMapIndex Mod4MapIndex
+#define ScrollLockMapIndex Mod5MapIndex
+
+#define WIN_MOD_LALT 0x00000001
+#define WIN_MOD_RALT 0x00000002
+#define WIN_MOD_LCONTROL 0x00000004
+#define WIN_MOD_RCONTROL 0x00000008
+
+#define WIN_24BPP_MASK_RED 0x00FF0000
+#define WIN_24BPP_MASK_GREEN 0x0000FF00
+#define WIN_24BPP_MASK_BLUE 0x000000FF
+
+#define WIN_MAX_KEYS_PER_KEY 4
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+
+#include <errno.h>
+#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+#define HANDLE void *
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
+#include <pthread.h>
+#undef HANDLE
+#endif
+
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif /* MAP_FILE */
+#endif /* HAS_MMAP */
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include <X11/Xprotostr.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "region.h"
+#include "gcstruct.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "miscstruct.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "micmap.h"
+#include "mifillarc.h"
+#include "mifpoly.h"
+#include "mibstore.h"
+#include "input.h"
+#include "mipointer.h"
+#include "X11/keysym.h"
+#include "mibstore.h"
+#include "micoord.h"
+#include "dix.h"
+#include "miline.h"
+#include "shadow.h"
+#include "fb.h"
+#include "rootless.h"
+
+#include "mipict.h"
+#include "picturestr.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+/*
+ * Windows headers
+ */
+#include "winms.h"
+#include "winresource.h"
+
+
+/*
+ * Define Windows constants
+ */
+
+#define WM_TRAYICON (WM_USER + 1000)
+#define WM_INIT_SYS_MENU (WM_USER + 1001)
+#define WM_GIVEUP (WM_USER + 1002)
+
+
+/* Local includes */
+#include "winwindow.h"
+#include "winmsg.h"
+
+#define PROFILEPOINT(point,thresh)\
+{\
+static unsigned int PROFPT##point = 0;\
+if (++PROFPT##point % thresh == 0)\
+ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
+}
+
+
+/* We use xor this macro for detecting toggle key state changes */
+#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
+
+#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; \
+}
+
+/*
+ * Typedefs for engine dependent function pointers
+ */
+
+typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
+
+typedef void (*winFreeFBProcPtr)(ScreenPtr);
+
+typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
+
+typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
+
+typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
+
+typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
+
+typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
+
+typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
+
+typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
+
+typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
+ int ndef, xColorItem *pdefs);
+
+typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+
+typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
+
+#ifdef XWIN_NATIVEGDI
+/* Typedefs for native GDI wrappers */
+typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
+typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+/*
+ * GC (graphics context) privates
+ */
+
+typedef struct
+{
+ HDC hdc;
+ HDC hdcMem;
+} winPrivGCRec, *winPrivGCPtr;
+
+
+/*
+ * Pixmap privates
+ */
+
+typedef struct
+{
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
+} winPrivPixmapRec, *winPrivPixmapPtr;
+
+
+/*
+ * Colormap privates
+ */
+
+typedef struct
+{
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+} winPrivCmapRec, *winPrivCmapPtr;
+
+/*
+ * Windows Cursor handling.
+ */
+
+typedef struct {
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} winCursorRec;
+
+/*
+ * Resize modes
+ */
+typedef enum {
+ notAllowed,
+ resizeWithScrollbars,
+ resizeWithRandr
+} winResizeMode;
+
+/*
+ * Screen information structure that we need before privates are available
+ * in the server startup sequence.
+ */
+
+typedef struct
+{
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
+
+ DWORD dwScreen;
+
+ int iMonitor;
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
+#ifdef XWIN_EMULATEPSEUDO
+ Bool fEmulatePseudo;
+#endif
+ Bool fFullScreen;
+ Bool fDecoration;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ Bool fMWExtWM;
+ Bool fAnotherWMRunning;
+#endif
+#ifdef XWIN_MULTIWINDOWINTWM
+ Bool fInternalWM;
+#endif
+ Bool fRootless;
+#ifdef XWIN_MULTIWINDOW
+ Bool fMultiWindow;
+#endif
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ Bool fMultiMonitorOverride;
+#endif
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ winResizeMode iResizeMode;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
+} winScreenInfo, *winScreenInfoPtr;
+
+
+/*
+ * Screen privates
+ */
+
+typedef struct _winPrivScreenRec
+{
+ winScreenInfoPtr pScreenInfo;
+
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
+
+ int iDeltaZ;
+
+ int iConnectedClients;
+
+ CloseScreenProcPtr CloseScreen;
+
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
+
+ DWORD dwModeKeyStates;
+
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
+
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
+
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
+
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
+
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+ BITMAPINFOHEADER *pbmih;
+
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
+
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
+
+#ifdef XWIN_PRIMARYFB
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
+#endif
+
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
+
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
+#endif
+
+#ifdef XWIN_MULTIWINDOW
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
+#endif
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winFreeFBProcPtr pwinFreeFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winInitScreenProcPtr pwinInitScreen;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+ winCreateScreenResourcesProc pwinCreateScreenResources;
+
+#ifdef XWIN_MULTIWINDOW
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+#endif
+
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+ SetShapeProcPtr SetShape;
+
+ winCursorRec cursor;
+
+#ifdef XWIN_NATIVEGDI
+ RealizeFontPtr RealizeFont;
+ UnrealizeFontPtr UnrealizeFont;
+#endif
+
+} winPrivScreenRec;
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+typedef struct {
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed;//for debug
+ char *pfb;
+} win32RootlessWindowRec, *win32RootlessWindowPtr;
+#endif
+
+
+typedef struct {
+ pointer value;
+ XID id;
+} WindowIDPairRec, *WindowIDPairPtr;
+
+
+/*
+ * Extern declares for general global variables
+ */
+
+#include "winglobals.h"
+
+extern winScreenInfo * g_ScreenInfo;
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
+#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
+extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
+#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
+extern DevPrivateKeyRec g_iGCPrivateKeyRec;
+#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
+extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
+#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
+extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
+#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
+
+extern unsigned long g_ulServerGeneration;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char * g_pszQueryHost;
+extern DeviceIntPtr g_pwinPointer;
+extern DeviceIntPtr g_pwinKeyboard;
+
+/*
+ * Extern declares for dynamically loaded library function pointers
+ */
+
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
+extern FARPROC g_fpTrackMouseEvent;
+
+
+/*
+ * Screen privates macros
+ */
+
+#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
+
+#define winSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
+
+#define winScreenPriv(pScreen) \
+ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
+
+
+/*
+ * Colormap privates macros
+ */
+
+#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
+ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
+
+#define winSetCmapPriv(pCmap,v) \
+ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
+
+#define winCmapPriv(pCmap) \
+ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
+
+
+/*
+ * GC privates macros
+ */
+
+#define winGetGCPriv(pGC) ((winPrivGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
+
+#define winSetGCPriv(pGC,v) \
+ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
+
+#define winGCPriv(pGC) \
+ winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
+
+
+/*
+ * Pixmap privates macros
+ */
+
+#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
+
+#define winSetPixmapPriv(pPixmap,v) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
+
+#define winPixmapPriv(pPixmap) \
+ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
+
+
+/*
+ * Window privates macros
+ */
+
+#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
+
+#define winSetWindowPriv(pWin,v) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
+
+#define winWindowPriv(pWin) \
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
+
+/*
+ * wrapper macros
+ */
+#define _WIN_WRAP(priv, real, mem, func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define _WIN_UNWRAP(priv, real, mem) {\
+ real->mem = priv->mem; \
+}
+
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+
+#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
+
+/*
+ * BEGIN DDX and DIX Function Prototypes
+ */
+
+
+/*
+ * winallpriv.c
+ */
+
+Bool
+winAllocatePrivates (ScreenPtr pScreen);
+
+Bool
+winInitCmapPrivates (ColormapPtr pCmap, int index);
+
+Bool
+winAllocateCmapPrivates (ColormapPtr pCmap);
+
+
+/*
+ * winauth.c
+ */
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+Bool
+winGenerateAuthorization (void);
+void winSetAuthorization(void);
+#endif
+
+
+/*
+ * winblock.c
+ */
+
+void
+winBlockHandler (int nScreen,
+ pointer pBlockData,
+ pointer pTimeout,
+ pointer pReadMask);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winclip.c
+ */
+
+RegionPtr
+winPixmapToRegionNativeGDI (PixmapPtr pPix);
+#endif
+
+
+#ifdef XWIN_CLIPBOARD
+/*
+ * winclipboardinit.c
+ */
+
+Bool
+winInitClipboard (void);
+
+void
+winFixClipboardChain (int Removed);
+#endif
+
+
+/*
+ * wincmap.c
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen);
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen);
+
+
+/*
+ * wincreatewnd.c
+ */
+
+Bool
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
+
+Bool
+winCreateBoundingWindowWindowed (ScreenPtr pScreen);
+
+
+/*
+ * windialogs.c
+ */
+
+int
+GetLiveClients (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winengine.c
+ */
+
+void
+winDetectSupportedEngines (void);
+
+Bool
+winSetEngine (ScreenPtr pScreen);
+
+Bool
+winGetDDProcAddresses (void);
+
+void
+winReleaseDDProcAddresses(void);
+
+
+/*
+ * winerror.c
+ */
+
+#ifdef DDXOSVERRORF
+void
+OSVenderVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winMessageBoxF (const char *pszError, UINT uType, ...);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfillsp.c
+ */
+
+void
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfont.c
+ */
+
+Bool
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+
+Bool
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingc.c
+ */
+
+Bool
+winCreateGCNativeGDI (GCPtr pGC);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingetsp.c
+ */
+
+void
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ char *pDst);
+#endif
+
+
+/*
+ * winglobals.c
+ */
+
+void
+winInitializeGlobals (void);
+
+
+/*
+ * winkeybd.c
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
+
+void
+winInitializeModeKeyStates (void);
+
+void
+winRestoreModeKeyStates (void);
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
+
+void
+winKeybdReleaseKeys (void);
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown);
+
+BOOL
+winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
+
+void
+winFixShiftKeys (int iScanCode);
+
+/*
+ * winkeyhook.c
+ */
+
+Bool
+winInstallKeyboardHookLL (void);
+
+void
+winRemoveKeyboardHookLL (void);
+
+
+/*
+ * winmisc.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+void
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
+#endif
+
+CARD8
+winCountBits (DWORD dw);
+
+Bool
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
+
+#ifdef XWIN_NATIVEGDI
+BOOL
+winPaintBackground (HWND hwnd, COLORREF colorref);
+#endif
+
+
+/*
+ * winmouse.c
+ */
+
+int
+winMouseProc (DeviceIntPtr pDeviceInt, int iState);
+
+int
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
+
+void
+winMouseButtonsSendEvent (int iEventType, int iButton);
+
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam);
+
+void
+winEnqueueMotion(int x, int y);
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winnativegdi.c
+ */
+
+HBITMAP
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi);
+
+Bool
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_PRIMARYFB
+/*
+ * winpfbddd.c
+ */
+
+Bool
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpixmap.c
+ */
+
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned class);
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData);
+#endif
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpolyline.c
+ */
+
+void
+winPolyLineNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpushpxl.c
+ */
+
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+#endif
+
+
+/*
+ * winscrinit.c
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+#if defined(XWIN_NATIVEGDI)
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winsetsp.c
+ */
+
+void
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidth,
+ int nSpans,
+ int fSorted);
+#endif
+
+
+/*
+ * winshaddd.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
+
+
+/*
+ * winshadddnl.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
+
+
+/*
+ * winshadgdi.c
+ */
+
+Bool
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
+
+
+/*
+ * winwakeup.c
+ */
+
+void
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult,
+ pointer pReadmask);
+
+
+/*
+ * winwindow.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+Bool
+winCreateWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winDestroyWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
+
+void
+winCopyWindowNativeGDI (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+Bool
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
+
+Bool
+winUnmapWindowNativeGDI (WindowPtr pWindow);
+
+Bool
+winMapWindowNativeGDI (WindowPtr pWindow);
+#endif
+
+Bool
+winCreateWindowRootless (WindowPtr pWindow);
+
+Bool
+winDestroyWindowRootless (WindowPtr pWindow);
+
+Bool
+winPositionWindowRootless (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowRootless (WindowPtr pWindow);
+
+Bool
+winMapWindowRootless (WindowPtr pWindow);
+
+void
+winSetShapeRootless (WindowPtr pWindow, int kind);
+
+
+/*
+ * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
+ */
+
+HICON
+winXIconToHICON (WindowPtr pWin, int iconSize);
+
+void
+winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowshape.c
+ */
+
+void
+winReshapeMultiWindow (WindowPtr pWin);
+
+void
+winSetShapeMultiWindow (WindowPtr pWindow, int kind);
+
+void
+winUpdateRgnMultiWindow (WindowPtr pWindow);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwindow.c
+ */
+
+Bool
+winCreateWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winDestroyWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winMapWindowMultiWindow (WindowPtr pWindow);
+
+void
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
+
+void
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
+
+void
+winReorderWindowsMultiWindow (void);
+
+void
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
+void
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
+
+void
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
+
+XID
+winGetWindowID (WindowPtr pWin);
+
+int
+winAdjustXWindow (WindowPtr pWin, HWND hwnd);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwndproc.c
+ */
+
+LRESULT CALLBACK
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * wintrayicon.c
+ */
+
+void
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
+
+void
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
+
+LRESULT
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winwndproc.c
+ */
+
+LRESULT CALLBACK
+winWindowProc (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootless.c
+ */
+
+Bool
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
+
+void
+winMWExtWMDestroyFrame (RootlessFrameID wid);
+
+void
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+void
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+
+void
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
+
+void
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
+
+void
+winMWExtWMUnmapFrame (RootlessFrameID wid);
+
+void
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+void
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
+
+void
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
+
+void
+winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
+ int shift_x, int shift_y);
+
+void
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
+
+void
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
+
+void
+winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswindow.c
+ */
+
+void
+winMWExtWMReorderWindows (ScreenPtr pScreen);
+
+void
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
+
+void
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
+
+void
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
+
+void
+winMWExtWMUpdateIcon (Window id);
+
+void
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
+
+wBOOL CALLBACK
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
+
+void
+winMWExtWMRestackWindows (ScreenPtr pScreen);
+#endif
+#ifdef XWIN_MULTIWINDOWINTWM
+Bool
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
+#endif
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswndproc.c
+ */
+
+LRESULT CALLBACK
+winMWExtWMWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * winwindowswm.c
+ */
+
+void
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
+
+void
+winWindowsWMExtensionInit (void);
+
+/*
+ * wincursor.c
+ */
+
+Bool
+winInitCursor (ScreenPtr pScreen);
+
+/*
+ * winprocarg.c
+ */
+void
+winInitializeScreens(int maxscreens);
+
+/*
+ * windisplay.c
+ */
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen);
+
+/*
+ * winrandr.c
+ */
+Bool
+winRandRInit (ScreenPtr pScreen);
+void
+winDoRandRScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight);
+
+/*
+ * END DDX and DIX Function Prototypes
+ */
+
+#endif /* _WIN_H_ */
+
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
index 2af95f225..d174d70d3 100644
--- a/xorg-server/hw/xwin/winpixmap.c
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -57,7 +57,7 @@ winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
PixmapPtr
winCreatePixmapNativeGDI (ScreenPtr pScreen,
int iWidth, int iHeight,
- int iDepth, unsigned usage_hint)
+ int iDepth, unsigned class)
{
winPrivPixmapPtr pPixmapPriv = NULL;
PixmapPtr pPixmap = NULL;
@@ -71,12 +71,12 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
}
winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
- iWidth, iHeight, iDepth, usage_hint,
+ iWidth, iHeight, iDepth, class,
PixmapBytePad (iWidth, iDepth));
/* Setup pixmap values */
pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
+ pPixmap->drawable.class = class;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = iDepth;
pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
@@ -89,7 +89,6 @@ winCreatePixmapNativeGDI (ScreenPtr pScreen,
pPixmap->devKind = 0;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = NULL;
- pPixmap->usage_hint = usage_hint;
/* Pixmap privates are allocated by AllocatePixmap */
pPixmapPriv = winGetPixmapPriv (pPixmap);
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index 6bba40aef..de78b7e24 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -576,35 +576,4 @@ extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what);
-
-/*
- * These are deprecated compatibility functions and will be removed soon!
- * Please use the noted replacements instead.
- */
-/* replaced by dixLookupWindow */
-extern _X_EXPORT WindowPtr SecurityLookupWindow(
- XID id,
- ClientPtr client,
- Mask access_mode);
-/* replaced by dixLookupWindow */
-extern _X_EXPORT WindowPtr LookupWindow(
- XID id,
- ClientPtr client);
-
-/* replaced by dixLookupDrawable */
-extern _X_EXPORT pointer SecurityLookupDrawable(
- XID id,
- ClientPtr client,
- Mask access_mode);
-
-/* replaced by dixLookupDrawable */
-extern _X_EXPORT pointer LookupDrawable(
- XID id,
- ClientPtr client);
-
-/* replaced by dixLookupClient */
-extern _X_EXPORT ClientPtr LookupClient(
- XID id,
- ClientPtr client);
-
#endif /* DIX_H */
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index 4c474464f..044a5740b 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -96,10 +96,8 @@ OF THIS SOFTWARE.
#define EXTENSION_EVENT_BASE 64
#define EXTENSION_BASE 128
-typedef unsigned long PIXEL;
typedef unsigned long ATOM;
-
#ifndef TRUE
#define TRUE 1
#define FALSE 0
diff --git a/xorg-server/include/pixmapstr.h b/xorg-server/include/pixmapstr.h
index 8002b170a..47dce91e1 100644
--- a/xorg-server/include/pixmapstr.h
+++ b/xorg-server/include/pixmapstr.h
@@ -1,84 +1,83 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef PIXMAPSTRUCT_H
-#define PIXMAPSTRUCT_H
-#include "pixmap.h"
-#include "screenint.h"
-#include "regionstr.h"
-#include "privates.h"
-
-typedef struct _Drawable {
- unsigned char type; /* DRAWABLE_<type> */
- unsigned char class; /* specific to type */
- unsigned char depth;
- unsigned char bitsPerPixel;
- XID id; /* resource id */
- short x; /* window: screen absolute, pixmap: 0 */
- short y; /* window: screen absolute, pixmap: 0 */
- unsigned short width;
- unsigned short height;
- ScreenPtr pScreen;
- unsigned long serialNumber;
-} DrawableRec;
-
-/*
- * PIXMAP -- device dependent
- */
-
-typedef struct _Pixmap {
- DrawableRec drawable;
- PrivateRec *devPrivates;
- int refcnt;
- int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */
- DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */
- short screen_x;
- short screen_y;
- unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */
-} PixmapRec;
-
-#endif /* PIXMAPSTRUCT_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PIXMAPSTRUCT_H
+#define PIXMAPSTRUCT_H
+#include "pixmap.h"
+#include "screenint.h"
+#include "regionstr.h"
+#include "privates.h"
+
+typedef struct _Drawable {
+ unsigned char type; /* DRAWABLE_<type> */
+ unsigned char class; /* specific to type */
+ unsigned char depth;
+ unsigned char bitsPerPixel;
+ XID id; /* resource id */
+ short x; /* window: screen absolute, pixmap: 0 */
+ short y; /* window: screen absolute, pixmap: 0 */
+ unsigned short width;
+ unsigned short height;
+ ScreenPtr pScreen;
+ unsigned long serialNumber;
+} DrawableRec;
+
+/*
+ * PIXMAP -- device dependent
+ */
+
+typedef struct _Pixmap {
+ DrawableRec drawable;
+ PrivateRec *devPrivates;
+ int refcnt;
+ int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */
+ DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */
+ short screen_x;
+ short screen_y;
+} PixmapRec;
+
+#endif /* PIXMAPSTRUCT_H */
diff --git a/xorg-server/include/resource.h b/xorg-server/include/resource.h
index 82068fe0e..95e34a9b8 100644
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
@@ -251,34 +251,5 @@ extern _X_EXPORT unsigned int GetXIDList(
extern _X_EXPORT RESTYPE lastResourceType;
extern _X_EXPORT RESTYPE TypeMask;
-/*
- * These are deprecated compatibility functions and will be removed soon!
- * Please use the noted replacements instead.
- */
-
-/* replaced by dixLookupResourceByType */
-extern _X_EXPORT pointer SecurityLookupIDByType(
- ClientPtr client,
- XID id,
- RESTYPE rtype,
- Mask access_mode) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByClass */
-extern _X_EXPORT pointer SecurityLookupIDByClass(
- ClientPtr client,
- XID id,
- RESTYPE classes,
- Mask access_mode) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByType */
-extern _X_EXPORT pointer LookupIDByType(
- XID id,
- RESTYPE rtype) _X_DEPRECATED;
-
-/* replaced by dixLookupResourceByClass */
-extern _X_EXPORT pointer LookupIDByClass(
- XID id,
- RESTYPE classes) _X_DEPRECATED;
-
#endif /* RESOURCE_H */
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index a373acd27..28dd2c011 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -208,7 +208,7 @@ typedef PixmapPtr (* CreatePixmapProcPtr)(
int /*width*/,
int /*height*/,
int /*depth*/,
- unsigned /*usage_hint*/);
+ unsigned /*class*/);
typedef Bool (* DestroyPixmapProcPtr)(
PixmapPtr /*pPixmap*/);
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index 9f1b4701f..04ae0e122 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -239,7 +239,7 @@ RenderClientCallback (CallbackListPtr *list,
}
#ifdef PANORAMIX
-unsigned long XRT_PICTURE;
+RESTYPE XRT_PICTURE;
#endif
void