aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/include
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/include')
-rw-r--r--xorg-server/include/input.h1188
-rw-r--r--xorg-server/include/misc.h592
-rw-r--r--xorg-server/include/propertyst.h136
-rw-r--r--xorg-server/include/ptrveloc.h282
-rw-r--r--xorg-server/include/resource.h510
5 files changed, 1362 insertions, 1346 deletions
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index 643866f98..ec915b37e 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -1,595 +1,593 @@
-/************************************************************
-
-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 INPUT_H
-#define INPUT_H
-
-#include "misc.h"
-#include "screenint.h"
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include <stdint.h>
-#include "window.h" /* for WindowPtr */
-#include "xkbrules.h"
-#include "events.h"
-
-#define DEVICE_INIT 0
-#define DEVICE_ON 1
-#define DEVICE_OFF 2
-#define DEVICE_CLOSE 3
-
-#define POINTER_RELATIVE (1 << 1)
-#define POINTER_ABSOLUTE (1 << 2)
-#define POINTER_ACCELERATE (1 << 3)
-#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
-
-/*int constants for pointer acceleration schemes*/
-#define PtrAccelNoOp 0
-#define PtrAccelPredictable 1
-#define PtrAccelLightweight 2
-#define PtrAccelDefault PtrAccelPredictable
-
-#define MAX_VALUATORS 36
-/* Maximum number of valuators, divided by six, rounded up, to get number
- * of events. */
-#define MAX_VALUATOR_EVENTS 6
-#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
-
-#define NO_AXIS_LIMITS -1
-
-#define MAP_LENGTH 256
-#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
-#define NullGrab ((GrabPtr)NULL)
-#define PointerRootWin ((WindowPtr)PointerRoot)
-#define NoneWin ((WindowPtr)None)
-#define NullDevice ((DevicePtr)NULL)
-
-#ifndef FollowKeyboard
-#define FollowKeyboard 3
-#endif
-#ifndef FollowKeyboardWin
-#define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
-#endif
-#ifndef RevertToFollowKeyboard
-#define RevertToFollowKeyboard 3
-#endif
-
-typedef unsigned long Leds;
-typedef struct _OtherClients *OtherClientsPtr;
-typedef struct _InputClients *InputClientsPtr;
-typedef struct _DeviceIntRec *DeviceIntPtr;
-typedef struct _ClassesRec *ClassesPtr;
-typedef struct _SpriteRec *SpritePtr;
-typedef union _GrabMask GrabMask;
-
-typedef struct _EventList {
- xEvent* event;
- int evlen; /* length of allocated memory for event in bytes. This is not
- the actual length of the event. The event's actual length is
- 32 for standard events or 32 +
- ((xGenericEvent*)event)->length * 4 for GenericEvents.
- For events in the EQ, the length is
- ((InternalEvent*)event)->u.any.length */
-} EventList, *EventListPtr;
-
-/* The DIX stores incoming input events in this list */
-extern EventListPtr InputEventList;
-extern int InputEventListLen;
-
-typedef int (*DeviceProc)(
- DeviceIntPtr /*device*/,
- int /*what*/);
-
-typedef void (*ProcessInputProc)(
- InternalEvent * /*event*/,
- DeviceIntPtr /*device*/);
-
-typedef Bool (*DeviceHandleProc)(
- DeviceIntPtr /*device*/,
- void* /*data*/
- );
-
-typedef void (*DeviceUnwrapProc)(
- DeviceIntPtr /*device*/,
- DeviceHandleProc /*proc*/,
- void* /*data*/
- );
-
-/* pointer acceleration handling */
-typedef void (*PointerAccelSchemeProc)(
- DeviceIntPtr /*pDev*/,
- int /*first_valuator*/,
- int /*num_valuators*/,
- int* /*valuators*/,
- int /*evtime*/);
-
-typedef void (*DeviceCallbackProc)(
- DeviceIntPtr /*pDev*/);
-
-struct _ValuatorAccelerationRec;
-typedef Bool (*PointerAccelSchemeInitProc)(
- DeviceIntPtr /*dev*/,
- struct _ValuatorAccelerationRec* /*protoScheme*/);
-
-typedef struct _DeviceRec {
- pointer devicePrivate;
- ProcessInputProc processInputProc; /* current */
- ProcessInputProc realInputProc; /* deliver */
- ProcessInputProc enqueueInputProc; /* enqueue */
- Bool on; /* used by DDX to keep state */
-} DeviceRec, *DevicePtr;
-
-typedef struct _ValuatorMask ValuatorMask;
-
-typedef struct {
- int click, bell, bell_pitch, bell_duration;
- Bool autoRepeat;
- unsigned char autoRepeats[32];
- Leds leds;
- unsigned char id;
-} KeybdCtrl;
-
-typedef struct {
- KeySym *map;
- KeyCode minKeyCode,
- maxKeyCode;
- int mapWidth;
-} KeySymsRec, *KeySymsPtr;
-
-typedef struct {
- int num, den, threshold;
- unsigned char id;
-} PtrCtrl;
-
-typedef struct {
- int resolution, min_value, max_value;
- int integer_displayed;
- unsigned char id;
-} IntegerCtrl;
-
-typedef struct {
- int max_symbols, num_symbols_supported;
- int num_symbols_displayed;
- KeySym *symbols_supported;
- KeySym *symbols_displayed;
- unsigned char id;
-} StringCtrl;
-
-typedef struct {
- int percent, pitch, duration;
- unsigned char id;
-} BellCtrl;
-
-typedef struct {
- Leds led_values;
- Mask led_mask;
- unsigned char id;
-} LedCtrl;
-
-extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
-extern _X_EXPORT PtrCtrl defaultPointerControl;
-
-typedef struct _InputOption {
- char *key;
- char *value;
- struct _InputOption *next;
-} InputOption;
-
-typedef struct _InputAttributes {
- char *product;
- char *vendor;
- char *device;
- char *pnp_id;
- char *usb_id;
- char **tags; /* null-terminated */
- uint32_t flags;
-} InputAttributes;
-
-#define ATTR_KEYBOARD (1<<0)
-#define ATTR_POINTER (1<<1)
-#define ATTR_JOYSTICK (1<<2)
-#define ATTR_TABLET (1<<3)
-#define ATTR_TOUCHPAD (1<<4)
-#define ATTR_TOUCHSCREEN (1<<5)
-
-/* Key/Button has been run through all input processing and events sent to clients. */
-#define KEY_PROCESSED 1
-#define BUTTON_PROCESSED 1
-/* Key/Button has not been fully processed, no events have been sent. */
-#define KEY_POSTED 2
-#define BUTTON_POSTED 2
-
-extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
-extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_button_down(DeviceIntPtr pDev, int button, int type);
-extern void set_button_up(DeviceIntPtr pDev, int button, int type);
-extern int button_is_down(DeviceIntPtr pDev, int button, int type);
-
-extern void InitCoreDevices(void);
-extern void InitXTestDevices(void);
-
-extern _X_EXPORT DeviceIntPtr AddInputDevice(
- ClientPtr /*client*/,
- DeviceProc /*deviceProc*/,
- Bool /*autoStart*/);
-
-extern _X_EXPORT Bool EnableDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
-
-extern _X_EXPORT Bool ActivateDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
-
-extern _X_EXPORT Bool DisableDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
-
-extern int InitAndStartDevices(void);
-
-extern void CloseDownDevices(void);
-
-extern void UndisplayDevices(void);
-
-extern _X_EXPORT int RemoveDevice(
- DeviceIntPtr /*dev*/,
- BOOL /* sendevent */);
-
-extern _X_EXPORT int NumMotionEvents(void);
-
-extern _X_EXPORT int dixLookupDevice(
- DeviceIntPtr * /* dev */,
- int /* id */,
- ClientPtr /* client */,
- Mask /* access_mode */);
-
-extern _X_EXPORT void QueryMinMaxKeyCodes(
- KeyCode* /*minCode*/,
- KeyCode* /*maxCode*/);
-
-extern _X_EXPORT Bool SetKeySymsMap(
- KeySymsPtr /*dst*/,
- KeySymsPtr /*src*/);
-
-extern _X_EXPORT Bool InitButtonClassDeviceStruct(
- DeviceIntPtr /*device*/,
- int /*numButtons*/,
- Atom* /* labels */,
- CARD8* /*map*/);
-
-extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
- DeviceIntPtr /*device*/,
- int /*numAxes*/,
- Atom* /* labels */,
- int /*numMotionEvents*/,
- int /*mode*/);
-
-extern _X_EXPORT Bool InitPointerAccelerationScheme(
- DeviceIntPtr /*dev*/,
- int /*scheme*/);
-
-extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct(
- DeviceIntPtr /*device*/);
-
-extern _X_EXPORT Bool InitFocusClassDeviceStruct(
- DeviceIntPtr /*device*/);
-
-typedef void (*BellProcPtr)(
- int /*percent*/,
- DeviceIntPtr /*device*/,
- pointer /*ctrl*/,
- int);
-
-typedef void (*KbdCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- KeybdCtrl * /*ctrl*/);
-
-typedef void (*PtrCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- PtrCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- PtrCtrlProcPtr /*controlProc*/);
-
-typedef void (*StringCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- StringCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- StringCtrlProcPtr /*controlProc*/,
- int /*max_symbols*/,
- int /*num_symbols_supported*/,
- KeySym* /*symbols*/);
-
-typedef void (*BellCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- BellCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- BellProcPtr /*bellProc*/,
- BellCtrlProcPtr /*controlProc*/);
-
-typedef void (*LedCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- LedCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- LedCtrlProcPtr /*controlProc*/);
-
-typedef void (*IntegerCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- IntegerCtrl * /*ctrl*/);
-
-
-extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- IntegerCtrlProcPtr /*controlProc*/);
-
-extern _X_EXPORT Bool InitPointerDeviceStruct(
- DevicePtr /*device*/,
- CARD8* /*map*/,
- int /*numButtons*/,
- Atom* /* btn_labels */,
- PtrCtrlProcPtr /*controlProc*/,
- int /*numMotionEvents*/,
- int /*numAxes*/,
- Atom* /* axes_labels */);
-
-extern _X_EXPORT Bool InitKeyboardDeviceStruct(
- DeviceIntPtr /*device*/,
- XkbRMLVOSet * /*rmlvo*/,
- BellProcPtr /*bellProc*/,
- KbdCtrlProcPtr /*controlProc*/);
-
-extern int ApplyPointerMapping(
- DeviceIntPtr /* pDev */,
- CARD8 * /* map */,
- int /* len */,
- ClientPtr /* client */);
-
-extern Bool BadDeviceMap(
- BYTE* /*buff*/,
- int /*length*/,
- unsigned /*low*/,
- unsigned /*high*/,
- XID* /*errval*/);
-
-extern void NoteLedState(
- DeviceIntPtr /*keybd*/,
- int /*led*/,
- Bool /*on*/);
-
-extern void MaybeStopHint(
- DeviceIntPtr /*device*/,
- ClientPtr /*client*/);
-
-extern void ProcessPointerEvent(
- InternalEvent* /* ev */,
- DeviceIntPtr /*mouse*/);
-
-extern void ProcessKeyboardEvent(
- InternalEvent* /*ev*/,
- DeviceIntPtr /*keybd*/);
-
-extern Bool LegalModifier(
- unsigned int /*key*/,
- DeviceIntPtr /*pDev*/);
-
-extern _X_EXPORT void ProcessInputEvents(void);
-
-extern _X_EXPORT void InitInput(
- int /*argc*/,
- char ** /*argv*/);
-extern _X_EXPORT void CloseInput(void);
-
-extern _X_EXPORT int GetMaximumEventsNum(void);
-
-extern _X_EXPORT int GetEventList(EventListPtr* list);
-extern _X_EXPORT EventListPtr InitEventList(int num_events);
-extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events);
-
-extern void CreateClassesChangedEvent(EventListPtr event,
- DeviceIntPtr master,
- DeviceIntPtr slave,
- int type);
-extern EventListPtr UpdateFromMaster(
- EventListPtr events,
- DeviceIntPtr pDev,
- int type,
- int *num_events);
-
-extern _X_EXPORT int GetPointerEvents(
- EventListPtr events,
- DeviceIntPtr pDev,
- int type,
- int buttons,
- int flags,
- const ValuatorMask *mask);
-
-extern _X_EXPORT int GetKeyboardEvents(
- EventListPtr events,
- DeviceIntPtr pDev,
- int type,
- int key_code);
-
-extern int GetKeyboardValuatorEvents(
- EventListPtr events,
- DeviceIntPtr pDev,
- int type,
- int key_code,
- const ValuatorMask *mask);
-
-extern int GetProximityEvents(
- EventListPtr events,
- DeviceIntPtr pDev,
- int type,
- const ValuatorMask *mask);
-
-extern void PostSyntheticMotion(
- DeviceIntPtr pDev,
- int x,
- int y,
- int screen,
- unsigned long time);
-
-extern _X_EXPORT int GetMotionHistorySize(
- void);
-
-extern _X_EXPORT void AllocateMotionHistory(
- DeviceIntPtr pDev);
-
-extern _X_EXPORT int GetMotionHistory(
- DeviceIntPtr pDev,
- xTimecoord **buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen,
- BOOL core);
-
-extern int AttachDevice(ClientPtr client,
- DeviceIntPtr slave,
- DeviceIntPtr master);
-
-extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
-extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
-
-extern _X_EXPORT int AllocDevicePair(ClientPtr client,
- char* name,
- DeviceIntPtr* ptr,
- DeviceIntPtr* keybd,
- DeviceProc ptr_proc,
- DeviceProc keybd_proc,
- Bool master);
-extern void DeepCopyDeviceClasses(DeviceIntPtr from,
- DeviceIntPtr to,
- DeviceChangedEvent *dce);
-
-/* Helper functions. */
-extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
- KeyCode **modkeymap, int *max_keys_per_mod);
-extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
- int max_keys_per_mod);
-extern int AllocXTestDevice(ClientPtr client,
- char* name,
- DeviceIntPtr* ptr,
- DeviceIntPtr* keybd,
- DeviceIntPtr master_ptr,
- DeviceIntPtr master_keybd);
-extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
-extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
-extern void SendDevicePresenceEvent(int deviceid, int type);
-extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
-extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
-
-/* misc event helpers */
-extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
-extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
-extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
-void FixUpEventFromWindow(SpritePtr pSprite,
- xEvent *xE,
- WindowPtr pWin,
- Window child,
- Bool calcChild);
-extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
-extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
- WindowPtr win);
-/**
- * Masks specifying the type of event to deliver for an InternalEvent; used
- * by EventIsDeliverable.
- * @defgroup EventIsDeliverable return flags
- * @{
- */
-#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
-#define EVENT_CORE_MASK (1 << 1) /**< Core event */
-#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
-#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
-/* @} */
-
-/* Implemented by the DDX. */
-extern _X_EXPORT int NewInputDeviceRequest(
- InputOption *options,
- InputAttributes *attrs,
- DeviceIntPtr *dev);
-extern _X_EXPORT void DeleteInputDeviceRequest(
- DeviceIntPtr dev);
-
-extern _X_EXPORT void DDXRingBell(
- int volume,
- int pitch,
- int duration);
-
-#define VALUATOR_MODE_ALL_AXES -1
-extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
-extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
-
-/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
- xfixes/cursor.c uses it to determine if the cursor is enabled */
-extern Bool EnableCursor;
-
-extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
-extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
-extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
- int first_valuator, int num_valuators,
- const int* valuators);
-extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
- int valuator,
- int data);
-extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
-extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
-extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
-extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
-extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
-extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
- const ValuatorMask *src);
-extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
-
-#endif /* INPUT_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 INPUT_H
+#define INPUT_H
+
+#include "misc.h"
+#include "screenint.h"
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include <stdint.h>
+#include "window.h" /* for WindowPtr */
+#include "xkbrules.h"
+#include "events.h"
+
+#define DEVICE_INIT 0
+#define DEVICE_ON 1
+#define DEVICE_OFF 2
+#define DEVICE_CLOSE 3
+
+#define POINTER_RELATIVE (1 << 1)
+#define POINTER_ABSOLUTE (1 << 2)
+#define POINTER_ACCELERATE (1 << 3)
+#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
+
+/*int constants for pointer acceleration schemes*/
+#define PtrAccelNoOp 0
+#define PtrAccelPredictable 1
+#define PtrAccelLightweight 2
+#define PtrAccelDefault PtrAccelPredictable
+
+#define MAX_VALUATORS 36
+/* Maximum number of valuators, divided by six, rounded up, to get number
+ * of events. */
+#define MAX_VALUATOR_EVENTS 6
+#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
+
+#define NO_AXIS_LIMITS -1
+
+#define MAP_LENGTH 256
+#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
+#define NullGrab ((GrabPtr)NULL)
+#define PointerRootWin ((WindowPtr)PointerRoot)
+#define NoneWin ((WindowPtr)None)
+#define NullDevice ((DevicePtr)NULL)
+
+#ifndef FollowKeyboard
+#define FollowKeyboard 3
+#endif
+#ifndef FollowKeyboardWin
+#define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
+#endif
+#ifndef RevertToFollowKeyboard
+#define RevertToFollowKeyboard 3
+#endif
+
+typedef unsigned long Leds;
+typedef struct _OtherClients *OtherClientsPtr;
+typedef struct _InputClients *InputClientsPtr;
+typedef struct _DeviceIntRec *DeviceIntPtr;
+typedef struct _ClassesRec *ClassesPtr;
+typedef struct _SpriteRec *SpritePtr;
+typedef union _GrabMask GrabMask;
+
+typedef struct _ValuatorMask ValuatorMask;
+
+typedef struct _EventList {
+ xEvent* event;
+ int evlen; /* length of allocated memory for event in bytes. This is not
+ the actual length of the event. The event's actual length is
+ 32 for standard events or 32 +
+ ((xGenericEvent*)event)->length * 4 for GenericEvents.
+ For events in the EQ, the length is
+ ((InternalEvent*)event)->u.any.length */
+} EventList, *EventListPtr;
+
+/* The DIX stores incoming input events in this list */
+extern EventListPtr InputEventList;
+extern int InputEventListLen;
+
+typedef int (*DeviceProc)(
+ DeviceIntPtr /*device*/,
+ int /*what*/);
+
+typedef void (*ProcessInputProc)(
+ InternalEvent * /*event*/,
+ DeviceIntPtr /*device*/);
+
+typedef Bool (*DeviceHandleProc)(
+ DeviceIntPtr /*device*/,
+ void* /*data*/
+ );
+
+typedef void (*DeviceUnwrapProc)(
+ DeviceIntPtr /*device*/,
+ DeviceHandleProc /*proc*/,
+ void* /*data*/
+ );
+
+/* pointer acceleration handling */
+typedef void (*PointerAccelSchemeProc)(
+ DeviceIntPtr /*device*/,
+ ValuatorMask* /*valuators*/,
+ CARD32 /*evtime*/);
+
+typedef void (*DeviceCallbackProc)(
+ DeviceIntPtr /*pDev*/);
+
+struct _ValuatorAccelerationRec;
+typedef Bool (*PointerAccelSchemeInitProc)(
+ DeviceIntPtr /*dev*/,
+ struct _ValuatorAccelerationRec* /*protoScheme*/);
+
+typedef struct _DeviceRec {
+ pointer devicePrivate;
+ ProcessInputProc processInputProc; /* current */
+ ProcessInputProc realInputProc; /* deliver */
+ ProcessInputProc enqueueInputProc; /* enqueue */
+ Bool on; /* used by DDX to keep state */
+} DeviceRec, *DevicePtr;
+
+typedef struct {
+ int click, bell, bell_pitch, bell_duration;
+ Bool autoRepeat;
+ unsigned char autoRepeats[32];
+ Leds leds;
+ unsigned char id;
+} KeybdCtrl;
+
+typedef struct {
+ KeySym *map;
+ KeyCode minKeyCode,
+ maxKeyCode;
+ int mapWidth;
+} KeySymsRec, *KeySymsPtr;
+
+typedef struct {
+ int num, den, threshold;
+ unsigned char id;
+} PtrCtrl;
+
+typedef struct {
+ int resolution, min_value, max_value;
+ int integer_displayed;
+ unsigned char id;
+} IntegerCtrl;
+
+typedef struct {
+ int max_symbols, num_symbols_supported;
+ int num_symbols_displayed;
+ KeySym *symbols_supported;
+ KeySym *symbols_displayed;
+ unsigned char id;
+} StringCtrl;
+
+typedef struct {
+ int percent, pitch, duration;
+ unsigned char id;
+} BellCtrl;
+
+typedef struct {
+ Leds led_values;
+ Mask led_mask;
+ unsigned char id;
+} LedCtrl;
+
+extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
+extern _X_EXPORT PtrCtrl defaultPointerControl;
+
+typedef struct _InputOption {
+ char *key;
+ char *value;
+ struct _InputOption *next;
+} InputOption;
+
+typedef struct _InputAttributes {
+ char *product;
+ char *vendor;
+ char *device;
+ char *pnp_id;
+ char *usb_id;
+ char **tags; /* null-terminated */
+ uint32_t flags;
+} InputAttributes;
+
+#define ATTR_KEYBOARD (1<<0)
+#define ATTR_POINTER (1<<1)
+#define ATTR_JOYSTICK (1<<2)
+#define ATTR_TABLET (1<<3)
+#define ATTR_TOUCHPAD (1<<4)
+#define ATTR_TOUCHSCREEN (1<<5)
+
+/* Key/Button has been run through all input processing and events sent to clients. */
+#define KEY_PROCESSED 1
+#define BUTTON_PROCESSED 1
+/* Key/Button has not been fully processed, no events have been sent. */
+#define KEY_POSTED 2
+#define BUTTON_POSTED 2
+
+extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
+extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
+extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
+extern void set_button_down(DeviceIntPtr pDev, int button, int type);
+extern void set_button_up(DeviceIntPtr pDev, int button, int type);
+extern int button_is_down(DeviceIntPtr pDev, int button, int type);
+
+extern void InitCoreDevices(void);
+extern void InitXTestDevices(void);
+
+extern _X_EXPORT DeviceIntPtr AddInputDevice(
+ ClientPtr /*client*/,
+ DeviceProc /*deviceProc*/,
+ Bool /*autoStart*/);
+
+extern _X_EXPORT Bool EnableDevice(
+ DeviceIntPtr /*device*/,
+ BOOL /* sendevent */);
+
+extern _X_EXPORT Bool ActivateDevice(
+ DeviceIntPtr /*device*/,
+ BOOL /* sendevent */);
+
+extern _X_EXPORT Bool DisableDevice(
+ DeviceIntPtr /*device*/,
+ BOOL /* sendevent */);
+
+extern int InitAndStartDevices(void);
+
+extern void CloseDownDevices(void);
+
+extern void UndisplayDevices(void);
+
+extern _X_EXPORT int RemoveDevice(
+ DeviceIntPtr /*dev*/,
+ BOOL /* sendevent */);
+
+extern _X_EXPORT int NumMotionEvents(void);
+
+extern _X_EXPORT int dixLookupDevice(
+ DeviceIntPtr * /* dev */,
+ int /* id */,
+ ClientPtr /* client */,
+ Mask /* access_mode */);
+
+extern _X_EXPORT void QueryMinMaxKeyCodes(
+ KeyCode* /*minCode*/,
+ KeyCode* /*maxCode*/);
+
+extern _X_EXPORT Bool SetKeySymsMap(
+ KeySymsPtr /*dst*/,
+ KeySymsPtr /*src*/);
+
+extern _X_EXPORT Bool InitButtonClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ int /*numButtons*/,
+ Atom* /* labels */,
+ CARD8* /*map*/);
+
+extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ int /*numAxes*/,
+ Atom* /* labels */,
+ int /*numMotionEvents*/,
+ int /*mode*/);
+
+extern _X_EXPORT Bool InitPointerAccelerationScheme(
+ DeviceIntPtr /*dev*/,
+ int /*scheme*/);
+
+extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct(
+ DeviceIntPtr /*device*/);
+
+extern _X_EXPORT Bool InitFocusClassDeviceStruct(
+ DeviceIntPtr /*device*/);
+
+typedef void (*BellProcPtr)(
+ int /*percent*/,
+ DeviceIntPtr /*device*/,
+ pointer /*ctrl*/,
+ int);
+
+typedef void (*KbdCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ KeybdCtrl * /*ctrl*/);
+
+typedef void (*PtrCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ PtrCtrl * /*ctrl*/);
+
+extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ PtrCtrlProcPtr /*controlProc*/);
+
+typedef void (*StringCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ StringCtrl * /*ctrl*/);
+
+extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ StringCtrlProcPtr /*controlProc*/,
+ int /*max_symbols*/,
+ int /*num_symbols_supported*/,
+ KeySym* /*symbols*/);
+
+typedef void (*BellCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ BellCtrl * /*ctrl*/);
+
+extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ BellProcPtr /*bellProc*/,
+ BellCtrlProcPtr /*controlProc*/);
+
+typedef void (*LedCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ LedCtrl * /*ctrl*/);
+
+extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ LedCtrlProcPtr /*controlProc*/);
+
+typedef void (*IntegerCtrlProcPtr)(
+ DeviceIntPtr /*device*/,
+ IntegerCtrl * /*ctrl*/);
+
+
+extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
+ DeviceIntPtr /*device*/,
+ IntegerCtrlProcPtr /*controlProc*/);
+
+extern _X_EXPORT Bool InitPointerDeviceStruct(
+ DevicePtr /*device*/,
+ CARD8* /*map*/,
+ int /*numButtons*/,
+ Atom* /* btn_labels */,
+ PtrCtrlProcPtr /*controlProc*/,
+ int /*numMotionEvents*/,
+ int /*numAxes*/,
+ Atom* /* axes_labels */);
+
+extern _X_EXPORT Bool InitKeyboardDeviceStruct(
+ DeviceIntPtr /*device*/,
+ XkbRMLVOSet * /*rmlvo*/,
+ BellProcPtr /*bellProc*/,
+ KbdCtrlProcPtr /*controlProc*/);
+
+extern int ApplyPointerMapping(
+ DeviceIntPtr /* pDev */,
+ CARD8 * /* map */,
+ int /* len */,
+ ClientPtr /* client */);
+
+extern Bool BadDeviceMap(
+ BYTE* /*buff*/,
+ int /*length*/,
+ unsigned /*low*/,
+ unsigned /*high*/,
+ XID* /*errval*/);
+
+extern void NoteLedState(
+ DeviceIntPtr /*keybd*/,
+ int /*led*/,
+ Bool /*on*/);
+
+extern void MaybeStopHint(
+ DeviceIntPtr /*device*/,
+ ClientPtr /*client*/);
+
+extern void ProcessPointerEvent(
+ InternalEvent* /* ev */,
+ DeviceIntPtr /*mouse*/);
+
+extern void ProcessKeyboardEvent(
+ InternalEvent* /*ev*/,
+ DeviceIntPtr /*keybd*/);
+
+extern Bool LegalModifier(
+ unsigned int /*key*/,
+ DeviceIntPtr /*pDev*/);
+
+extern _X_EXPORT void ProcessInputEvents(void);
+
+extern _X_EXPORT void InitInput(
+ int /*argc*/,
+ char ** /*argv*/);
+extern _X_EXPORT void CloseInput(void);
+
+extern _X_EXPORT int GetMaximumEventsNum(void);
+
+extern _X_EXPORT int GetEventList(EventListPtr* list);
+extern _X_EXPORT EventListPtr InitEventList(int num_events);
+extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events);
+
+extern void CreateClassesChangedEvent(EventListPtr event,
+ DeviceIntPtr master,
+ DeviceIntPtr slave,
+ int type);
+extern EventListPtr UpdateFromMaster(
+ EventListPtr events,
+ DeviceIntPtr pDev,
+ int type,
+ int *num_events);
+
+extern _X_EXPORT int GetPointerEvents(
+ EventListPtr events,
+ DeviceIntPtr pDev,
+ int type,
+ int buttons,
+ int flags,
+ const ValuatorMask *mask);
+
+extern _X_EXPORT int GetKeyboardEvents(
+ EventListPtr events,
+ DeviceIntPtr pDev,
+ int type,
+ int key_code);
+
+extern int GetKeyboardValuatorEvents(
+ EventListPtr events,
+ DeviceIntPtr pDev,
+ int type,
+ int key_code,
+ const ValuatorMask *mask);
+
+extern int GetProximityEvents(
+ EventListPtr events,
+ DeviceIntPtr pDev,
+ int type,
+ const ValuatorMask *mask);
+
+extern void PostSyntheticMotion(
+ DeviceIntPtr pDev,
+ int x,
+ int y,
+ int screen,
+ unsigned long time);
+
+extern _X_EXPORT int GetMotionHistorySize(
+ void);
+
+extern _X_EXPORT void AllocateMotionHistory(
+ DeviceIntPtr pDev);
+
+extern _X_EXPORT int GetMotionHistory(
+ DeviceIntPtr pDev,
+ xTimecoord **buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen,
+ BOOL core);
+
+extern int AttachDevice(ClientPtr client,
+ DeviceIntPtr slave,
+ DeviceIntPtr master);
+
+extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
+extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
+
+extern _X_EXPORT int AllocDevicePair(ClientPtr client,
+ char* name,
+ DeviceIntPtr* ptr,
+ DeviceIntPtr* keybd,
+ DeviceProc ptr_proc,
+ DeviceProc keybd_proc,
+ Bool master);
+extern void DeepCopyDeviceClasses(DeviceIntPtr from,
+ DeviceIntPtr to,
+ DeviceChangedEvent *dce);
+
+/* Helper functions. */
+extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
+ KeyCode **modkeymap, int *max_keys_per_mod);
+extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
+ int max_keys_per_mod);
+extern int AllocXTestDevice(ClientPtr client,
+ char* name,
+ DeviceIntPtr* ptr,
+ DeviceIntPtr* keybd,
+ DeviceIntPtr master_ptr,
+ DeviceIntPtr master_keybd);
+extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
+extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
+extern void SendDevicePresenceEvent(int deviceid, int type);
+extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
+extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
+
+/* misc event helpers */
+extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
+extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
+extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
+void FixUpEventFromWindow(SpritePtr pSprite,
+ xEvent *xE,
+ WindowPtr pWin,
+ Window child,
+ Bool calcChild);
+extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
+extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
+ WindowPtr win);
+/**
+ * Masks specifying the type of event to deliver for an InternalEvent; used
+ * by EventIsDeliverable.
+ * @defgroup EventIsDeliverable return flags
+ * @{
+ */
+#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
+#define EVENT_CORE_MASK (1 << 1) /**< Core event */
+#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
+#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
+/* @} */
+
+/* Implemented by the DDX. */
+extern _X_EXPORT int NewInputDeviceRequest(
+ InputOption *options,
+ InputAttributes *attrs,
+ DeviceIntPtr *dev);
+extern _X_EXPORT void DeleteInputDeviceRequest(
+ DeviceIntPtr dev);
+
+extern _X_EXPORT void DDXRingBell(
+ int volume,
+ int pitch,
+ int duration);
+
+#define VALUATOR_MODE_ALL_AXES -1
+extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
+extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
+
+/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
+ xfixes/cursor.c uses it to determine if the cursor is enabled */
+extern Bool EnableCursor;
+
+extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
+extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
+extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
+ int first_valuator, int num_valuators,
+ const int* valuators);
+extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
+ int valuator,
+ int data);
+extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
+extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
+extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
+extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
+extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
+extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
+ const ValuatorMask *src);
+extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
+
+#endif /* INPUT_H */
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index 0717db64d..42f225b17 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -1,290 +1,302 @@
-/***********************************************************
-
-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.
-
-Copyright 1992, 1993 Data General Corporation;
-Copyright 1992, 1993 OMRON Corporation
-
-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
-neither the name OMRON or DATA GENERAL be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission of the party whose name is to be used. Neither OMRON or
-DATA GENERAL make any representation about the suitability of this software
-for any purpose. It is provided "as is" without express or implied warranty.
-
-OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL OMRON OR DATA GENERAL 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 MISC_H
-#define MISC_H 1
-/*
- * X internal definitions
- *
- */
-
-#include <X11/Xosdefs.h>
-#include <X11/Xfuncproto.h>
-#include <X11/Xmd.h>
-#include <X11/X.h>
-#include <X11/Xdefs.h>
-
-#include <stddef.h>
-
-#ifndef MAXSCREENS
-#define MAXSCREENS 16
-#endif
-#define MAXCLIENTS 256
-#define MAXEXTENSIONS 128
-#define MAXFORMATS 8
-#define MAXDEVICES 40 /* input devices */
-
-#define EXTENSION_EVENT_BASE 64
-#define EXTENSION_BASE 128
-
-typedef unsigned long ATOM;
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#ifndef _XTYPEDEF_CALLBACKLISTPTR
-typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
-#define _XTYPEDEF_CALLBACKLISTPTR
-#endif
-
-typedef struct _xReq *xReqPtr;
-
-#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
-#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
-
-#define NullBox ((BoxPtr)0)
-#define MILLI_PER_MIN (1000 * 60)
-#define MILLI_PER_SECOND (1000)
-
- /* this next is used with None and ParentRelative to tell
- PaintWin() what to use to paint the background. Also used
- in the macro IS_VALID_PIXMAP */
-
-#define USE_BACKGROUND_PIXEL 3
-#define USE_BORDER_PIXEL 3
-
-
-/* byte swap a 32-bit literal */
-#define lswapl(x) ((((x) & 0xff) << 24) |\
- (((x) & 0xff00) << 8) |\
- (((x) & 0xff0000) >> 8) |\
- (((x) >> 24) & 0xff))
-
-/* byte swap a short literal */
-#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
-
-#undef min
-#undef max
-
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-/* abs() is a function, not a macro; include the file declaring
- * it in case we haven't done that yet.
- */
-#include <stdlib.h>
-#ifndef Fabs
-#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
-#endif
-#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
-/* this assumes b > 0 */
-#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
-/*
- * return the least significant bit in x which is set
- *
- * This works on 1's complement and 2's complement machines.
- * If you care about the extra instruction on 2's complement
- * machines, change to ((x) & (-(x)))
- */
-#define lowbit(x) ((x) & (~(x) + 1))
-
-/* XXX Not for modules */
-#include <limits.h>
-#if !defined(MAXSHORT) || !defined(MINSHORT) || \
- !defined(MAXINT) || !defined(MININT)
-/*
- * Some implementations #define these through <math.h>, so preclude
- * #include'ing it later.
- */
-
-#include <math.h>
-#undef MAXSHORT
-#define MAXSHORT SHRT_MAX
-#undef MINSHORT
-#define MINSHORT SHRT_MIN
-#undef MAXINT
-#define MAXINT INT_MAX
-#undef MININT
-#define MININT INT_MIN
-
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h> /* for fopen, etc... */
-
-#endif
-
-/**
- * Calculate the number of bytes needed to hold bits.
- * @param bits The minimum number of bits needed.
- * @return The number of bytes needed to hold bits.
- */
-static inline int
-bits_to_bytes(const int bits) {
- return ((bits + 7) >> 3);
-}
-/**
- * Calculate the number of 4-byte units needed to hold the given number of
- * bytes.
- * @param bytes The minimum number of bytes needed.
- * @return The number of 4-byte units needed to hold bytes.
- */
-static inline int
-bytes_to_int32(const int bytes) {
- return (((bytes) + 3) >> 2);
-}
-
-/**
- * Calculate the number of bytes (in multiples of 4) needed to hold bytes.
- * @param bytes The minimum number of bytes needed.
- * @return The closest multiple of 4 that is equal or higher than bytes.
- */
-static inline int
-pad_to_int32(const int bytes) {
- return (((bytes) + 3) & ~3);
-}
-
-extern char**
-xstrtokenize(const char *str, const char* separators);
-
-/* some macros to help swap requests, replies, and events */
-
-#define LengthRestB(stuff) \
- ((client->req_len << 2) - sizeof(*stuff))
-
-#define LengthRestS(stuff) \
- ((client->req_len << 1) - (sizeof(*stuff) >> 1))
-
-#define LengthRestL(stuff) \
- (client->req_len - (sizeof(*stuff) >> 2))
-
-#define SwapRestS(stuff) \
- SwapShorts((short *)(stuff + 1), LengthRestS(stuff))
-
-#define SwapRestL(stuff) \
- SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
-
-/* byte swap a 32-bit value */
-#define swapl(x, n) { \
- n = ((char *) (x))[0];\
- ((char *) (x))[0] = ((char *) (x))[3];\
- ((char *) (x))[3] = n;\
- n = ((char *) (x))[1];\
- ((char *) (x))[1] = ((char *) (x))[2];\
- ((char *) (x))[2] = n; }
-
-/* byte swap a short */
-#define swaps(x, n) { \
- n = ((char *) (x))[0];\
- ((char *) (x))[0] = ((char *) (x))[1];\
- ((char *) (x))[1] = n; }
-
-/* copy 32-bit value from src to dst byteswapping on the way */
-#define cpswapl(src, dst) { \
- ((char *)&(dst))[0] = ((char *) &(src))[3];\
- ((char *)&(dst))[1] = ((char *) &(src))[2];\
- ((char *)&(dst))[2] = ((char *) &(src))[1];\
- ((char *)&(dst))[3] = ((char *) &(src))[0]; }
-
-/* copy short from src to dst byteswapping on the way */
-#define cpswaps(src, dst) { \
- ((char *) &(dst))[0] = ((char *) &(src))[1];\
- ((char *) &(dst))[1] = ((char *) &(src))[0]; }
-
-extern _X_EXPORT void SwapLongs(
- CARD32 *list,
- unsigned long count);
-
-extern _X_EXPORT void SwapShorts(
- short *list,
- unsigned long count);
-
-extern _X_EXPORT void MakePredeclaredAtoms(void);
-
-extern _X_EXPORT int Ones(
- unsigned long /*mask*/);
-
-typedef struct _xPoint *DDXPointPtr;
-typedef struct pixman_box16 *BoxPtr;
-typedef struct _xEvent *xEventPtr;
-typedef struct _xRectangle *xRectanglePtr;
-typedef struct _GrabRec *GrabPtr;
-
-/* typedefs from other places - duplicated here to minimize the amount
- * of unnecessary junk that one would normally have to include to get
- * these symbols defined
- */
-
-#ifndef _XTYPEDEF_CHARINFOPTR
-typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
-#define _XTYPEDEF_CHARINFOPTR
-#endif
-
-extern _X_EXPORT unsigned long globalSerialNumber;
-extern _X_EXPORT unsigned long serverGeneration;
-
-#endif /* MISC_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.
+
+Copyright 1992, 1993 Data General Corporation;
+Copyright 1992, 1993 OMRON Corporation
+
+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
+neither the name OMRON or DATA GENERAL be used in advertising or publicity
+pertaining to distribution of the software without specific, written prior
+permission of the party whose name is to be used. Neither OMRON or
+DATA GENERAL make any representation about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+IN NO EVENT SHALL OMRON OR DATA GENERAL 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 MISC_H
+#define MISC_H 1
+/*
+ * X internal definitions
+ *
+ */
+
+#include <X11/Xosdefs.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xmd.h>
+#include <X11/X.h>
+#include <X11/Xdefs.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifndef MAXSCREENS
+#define MAXSCREENS 16
+#endif
+#define MAXCLIENTS 256
+#define MAXEXTENSIONS 128
+#define MAXFORMATS 8
+#define MAXDEVICES 40 /* input devices */
+
+#define EXTENSION_EVENT_BASE 64
+#define EXTENSION_BASE 128
+
+typedef uint32_t ATOM;
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+#ifndef _XTYPEDEF_CALLBACKLISTPTR
+typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
+#define _XTYPEDEF_CALLBACKLISTPTR
+#endif
+
+typedef struct _xReq *xReqPtr;
+
+#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
+#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
+
+#define NullBox ((BoxPtr)0)
+#define MILLI_PER_MIN (1000 * 60)
+#define MILLI_PER_SECOND (1000)
+
+ /* this next is used with None and ParentRelative to tell
+ PaintWin() what to use to paint the background. Also used
+ in the macro IS_VALID_PIXMAP */
+
+#define USE_BACKGROUND_PIXEL 3
+#define USE_BORDER_PIXEL 3
+
+
+/* byte swap a 32-bit literal */
+#define lswapl(x) ((((x) & 0xff) << 24) |\
+ (((x) & 0xff00) << 8) |\
+ (((x) & 0xff0000) >> 8) |\
+ (((x) >> 24) & 0xff))
+
+/* byte swap a short literal */
+#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
+
+#undef min
+#undef max
+
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+/* abs() is a function, not a macro; include the file declaring
+ * it in case we haven't done that yet.
+ */
+#include <stdlib.h>
+#ifndef Fabs
+#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
+#endif
+#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
+/* this assumes b > 0 */
+#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
+/*
+ * return the least significant bit in x which is set
+ *
+ * This works on 1's complement and 2's complement machines.
+ * If you care about the extra instruction on 2's complement
+ * machines, change to ((x) & (-(x)))
+ */
+#define lowbit(x) ((x) & (~(x) + 1))
+
+/* XXX Not for modules */
+#include <limits.h>
+#if !defined(MAXSHORT) || !defined(MINSHORT) || \
+ !defined(MAXINT) || !defined(MININT)
+/*
+ * Some implementations #define these through <math.h>, so preclude
+ * #include'ing it later.
+ */
+
+#include <math.h>
+#undef MAXSHORT
+#define MAXSHORT SHRT_MAX
+#undef MINSHORT
+#define MINSHORT SHRT_MIN
+#undef MAXINT
+#define MAXINT INT_MAX
+#undef MININT
+#define MININT INT_MIN
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h> /* for fopen, etc... */
+
+#endif
+
+#ifndef PATH_MAX
+#include <sys/param.h>
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif
+
+/**
+ * Calculate the number of bytes needed to hold bits.
+ * @param bits The minimum number of bits needed.
+ * @return The number of bytes needed to hold bits.
+ */
+static inline int
+bits_to_bytes(const int bits) {
+ return ((bits + 7) >> 3);
+}
+/**
+ * Calculate the number of 4-byte units needed to hold the given number of
+ * bytes.
+ * @param bytes The minimum number of bytes needed.
+ * @return The number of 4-byte units needed to hold bytes.
+ */
+static inline int
+bytes_to_int32(const int bytes) {
+ return (((bytes) + 3) >> 2);
+}
+
+/**
+ * Calculate the number of bytes (in multiples of 4) needed to hold bytes.
+ * @param bytes The minimum number of bytes needed.
+ * @return The closest multiple of 4 that is equal or higher than bytes.
+ */
+static inline int
+pad_to_int32(const int bytes) {
+ return (((bytes) + 3) & ~3);
+}
+
+extern char**
+xstrtokenize(const char *str, const char* separators);
+
+/* some macros to help swap requests, replies, and events */
+
+#define LengthRestB(stuff) \
+ ((client->req_len << 2) - sizeof(*stuff))
+
+#define LengthRestS(stuff) \
+ ((client->req_len << 1) - (sizeof(*stuff) >> 1))
+
+#define LengthRestL(stuff) \
+ (client->req_len - (sizeof(*stuff) >> 2))
+
+#define SwapRestS(stuff) \
+ SwapShorts((short *)(stuff + 1), LengthRestS(stuff))
+
+#define SwapRestL(stuff) \
+ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
+
+/* byte swap a 32-bit value */
+#define swapl(x, n) { \
+ n = ((char *) (x))[0];\
+ ((char *) (x))[0] = ((char *) (x))[3];\
+ ((char *) (x))[3] = n;\
+ n = ((char *) (x))[1];\
+ ((char *) (x))[1] = ((char *) (x))[2];\
+ ((char *) (x))[2] = n; }
+
+/* byte swap a short */
+#define swaps(x, n) { \
+ n = ((char *) (x))[0];\
+ ((char *) (x))[0] = ((char *) (x))[1];\
+ ((char *) (x))[1] = n; }
+
+/* copy 32-bit value from src to dst byteswapping on the way */
+#define cpswapl(src, dst) { \
+ ((char *)&(dst))[0] = ((char *) &(src))[3];\
+ ((char *)&(dst))[1] = ((char *) &(src))[2];\
+ ((char *)&(dst))[2] = ((char *) &(src))[1];\
+ ((char *)&(dst))[3] = ((char *) &(src))[0]; }
+
+/* copy short from src to dst byteswapping on the way */
+#define cpswaps(src, dst) { \
+ ((char *) &(dst))[0] = ((char *) &(src))[1];\
+ ((char *) &(dst))[1] = ((char *) &(src))[0]; }
+
+extern _X_EXPORT void SwapLongs(
+ CARD32 *list,
+ unsigned long count);
+
+extern _X_EXPORT void SwapShorts(
+ short *list,
+ unsigned long count);
+
+extern _X_EXPORT void MakePredeclaredAtoms(void);
+
+extern _X_EXPORT int Ones(
+ unsigned long /*mask*/);
+
+typedef struct _xPoint *DDXPointPtr;
+typedef struct pixman_box16 *BoxPtr;
+typedef struct _xEvent *xEventPtr;
+typedef struct _xRectangle *xRectanglePtr;
+typedef struct _GrabRec *GrabPtr;
+
+/* typedefs from other places - duplicated here to minimize the amount
+ * of unnecessary junk that one would normally have to include to get
+ * these symbols defined
+ */
+
+#ifndef _XTYPEDEF_CHARINFOPTR
+typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
+#define _XTYPEDEF_CHARINFOPTR
+#endif
+
+extern _X_EXPORT unsigned long globalSerialNumber;
+extern _X_EXPORT unsigned long serverGeneration;
+
+#endif /* MISC_H */
diff --git a/xorg-server/include/propertyst.h b/xorg-server/include/propertyst.h
index fd1148eb7..fd3e0118d 100644
--- a/xorg-server/include/propertyst.h
+++ b/xorg-server/include/propertyst.h
@@ -1,68 +1,68 @@
-/***********************************************************
-
-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 PROPERTYSTRUCT_H
-#define PROPERTYSTRUCT_H
-#include "misc.h"
-#include "property.h"
-#include "privates.h"
-/*
- * PROPERTY -- property element
- */
-
-typedef struct _Property {
- struct _Property *next;
- ATOM propertyName;
- ATOM type; /* ignored by server */
- short format; /* format of data for swapping - 8,16,32 */
- long size; /* size of data in (format/8) bytes */
- pointer data; /* private to client */
- PrivateRec *devPrivates;
-} PropertyRec;
-
-#endif /* PROPERTYSTRUCT_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 PROPERTYSTRUCT_H
+#define PROPERTYSTRUCT_H
+#include "misc.h"
+#include "property.h"
+#include "privates.h"
+/*
+ * PROPERTY -- property element
+ */
+
+typedef struct _Property {
+ struct _Property *next;
+ ATOM propertyName;
+ ATOM type; /* ignored by server */
+ uint32_t format; /* format of data for swapping - 8,16,32 */
+ uint32_t size; /* size of data in (format/8) bytes */
+ pointer data; /* private to client */
+ PrivateRec *devPrivates;
+} PropertyRec;
+
+#endif /* PROPERTYSTRUCT_H */
+
diff --git a/xorg-server/include/ptrveloc.h b/xorg-server/include/ptrveloc.h
index 8c59c0361..1198146f1 100644
--- a/xorg-server/include/ptrveloc.h
+++ b/xorg-server/include/ptrveloc.h
@@ -1,138 +1,144 @@
-/*
- *
- * Copyright © 2006-2009 Simon Thum simon dot thum at gmx dot de
- *
- * 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.
- */
-
-#ifndef POINTERVELOCITY_H
-#define POINTERVELOCITY_H
-
-#include <input.h> /* DeviceIntPtr */
-
-/* constants for acceleration profiles */
-
-#define AccelProfileNone -1
-#define AccelProfileClassic 0
-#define AccelProfileDeviceSpecific 1
-#define AccelProfilePolynomial 2
-#define AccelProfileSmoothLinear 3
-#define AccelProfileSimple 4
-#define AccelProfilePower 5
-#define AccelProfileLinear 6
-#define AccelProfileSmoothLimited 7
-#define AccelProfileLAST AccelProfileSmoothLimited
-
-/* fwd */
-struct _DeviceVelocityRec;
-
-/**
- * profile
- * returns actual acceleration depending on velocity, acceleration control,...
- */
-typedef float (*PointerAccelerationProfileFunc)
- (DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
- float velocity, float threshold, float accelCoeff);
-
-/**
- * a motion history, with just enough information to
- * calc mean velocity and decide which motion was along
- * a more or less straight line
- */
-typedef struct _MotionTracker {
- int dx, dy; /* accumulated delta for each axis */
- int time; /* time of creation */
- int dir; /* initial direction bitfield */
-} MotionTracker, *MotionTrackerPtr;
-
-/* number of properties for predictable acceleration */
-#define NPROPS_PREDICTABLE_ACCEL 4
-
-/**
- * Contains all data needed to implement mouse ballistics
- */
-typedef struct _DeviceVelocityRec {
- MotionTrackerPtr tracker;
- int num_tracker;
- int cur_tracker; /* current index */
- float velocity; /* velocity as guessed by algorithm */
- float last_velocity; /* previous velocity estimate */
- int last_dx; /* last time-difference */
- int last_dy ; /* phase of last/current estimate */
- float corr_mul; /* config: multiply this into velocity */
- float const_acceleration; /* config: (recipr.) const deceleration */
- float min_acceleration; /* config: minimum acceleration */
- short reset_time; /* config: reset non-visible state after # ms */
- short use_softening; /* config: use softening of mouse values */
- float max_rel_diff; /* config: max. relative difference */
- float max_diff; /* config: max. difference */
- int initial_range; /* config: max. offset used as initial velocity */
- Bool average_accel; /* config: average acceleration over velocity */
- PointerAccelerationProfileFunc Profile;
- PointerAccelerationProfileFunc deviceSpecificProfile;
- void* profile_private;/* extended data, see SetAccelerationProfile() */
- struct { /* to be able to query this information */
- int profile_number;
- } statistics;
- long prop_handlers[NPROPS_PREDICTABLE_ACCEL];
-} DeviceVelocityRec, *DeviceVelocityPtr;
-
-extern _X_EXPORT void
-InitVelocityData(DeviceVelocityPtr vel);
-
-extern _X_EXPORT void
-InitTrackers(DeviceVelocityPtr vel, int ntracker);
-
-extern _X_EXPORT short
-ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
-
-extern _X_EXPORT float
-BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
- float velocity, float threshold, float acc);
-
-extern _X_EXPORT void
-FreeVelocityData(DeviceVelocityPtr vel);
-
-extern _X_EXPORT int
-SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
-
-extern _X_EXPORT DeviceVelocityPtr
-GetDevicePredictableAccelData(DeviceIntPtr dev);
-
-extern _X_EXPORT void
-SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
- PointerAccelerationProfileFunc profile);
-
-extern _X_INTERNAL void
-AccelerationDefaultCleanup(DeviceIntPtr dev);
-
-extern _X_INTERNAL Bool
-InitPredictableAccelerationScheme(DeviceIntPtr dev,
- struct _ValuatorAccelerationRec* protoScheme);
-
-extern _X_INTERNAL void
-acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
- int num_valuators, int *valuators, int evtime);
-
-extern _X_INTERNAL void
-acceleratePointerLightweight(DeviceIntPtr dev, int first_valuator,
- int num_valuators, int *valuators, int ignored);
-
-#endif /* POINTERVELOCITY_H */
+/*
+ *
+ * Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de
+ *
+ * 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.
+ */
+
+#ifndef POINTERVELOCITY_H
+#define POINTERVELOCITY_H
+
+#include <input.h>
+
+/* constants for acceleration profiles */
+
+#define AccelProfileNone -1
+#define AccelProfileClassic 0
+#define AccelProfileDeviceSpecific 1
+#define AccelProfilePolynomial 2
+#define AccelProfileSmoothLinear 3
+#define AccelProfileSimple 4
+#define AccelProfilePower 5
+#define AccelProfileLinear 6
+#define AccelProfileSmoothLimited 7
+#define AccelProfileLAST AccelProfileSmoothLimited
+
+/* fwd */
+struct _DeviceVelocityRec;
+
+/**
+ * profile
+ * returns actual acceleration depending on velocity, acceleration control,...
+ */
+typedef float (*PointerAccelerationProfileFunc)
+ (DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
+ float velocity, float threshold, float accelCoeff);
+
+/**
+ * a motion history, with just enough information to
+ * calc mean velocity and decide which motion was along
+ * a more or less straight line
+ */
+typedef struct _MotionTracker {
+ int dx, dy; /* accumulated delta for each axis */
+ int time; /* time of creation */
+ int dir; /* initial direction bitfield */
+} MotionTracker, *MotionTrackerPtr;
+
+/**
+ * Contains all data needed to implement mouse ballistics
+ */
+typedef struct _DeviceVelocityRec {
+ MotionTrackerPtr tracker;
+ int num_tracker;
+ int cur_tracker; /* current index */
+ float velocity; /* velocity as guessed by algorithm */
+ float last_velocity; /* previous velocity estimate */
+ int last_dx; /* last time-difference */
+ int last_dy ; /* phase of last/current estimate */
+ float corr_mul; /* config: multiply this into velocity */
+ float const_acceleration; /* config: (recipr.) const deceleration */
+ float min_acceleration; /* config: minimum acceleration */
+ short reset_time; /* config: reset non-visible state after # ms */
+ short use_softening; /* config: use softening of mouse values */
+ float max_rel_diff; /* config: max. relative difference */
+ float max_diff; /* config: max. difference */
+ int initial_range; /* config: max. offset used as initial velocity */
+ Bool average_accel; /* config: average acceleration over velocity */
+ PointerAccelerationProfileFunc Profile;
+ PointerAccelerationProfileFunc deviceSpecificProfile;
+ void* profile_private;/* extended data, see SetAccelerationProfile() */
+ struct { /* to be able to query this information */
+ int profile_number;
+ } statistics;
+} DeviceVelocityRec, *DeviceVelocityPtr;
+
+/**
+ * contains the run-time data for the predictable scheme, that is, a
+ * DeviceVelocityPtr and the property handlers.
+ */
+typedef struct _PredictableAccelSchemeRec {
+ DeviceVelocityPtr vel;
+ long* prop_handlers;
+ int num_prop_handlers;
+} PredictableAccelSchemeRec, *PredictableAccelSchemePtr;
+
+extern _X_EXPORT void
+InitVelocityData(DeviceVelocityPtr vel);
+
+extern _X_EXPORT void
+InitTrackers(DeviceVelocityPtr vel, int ntracker);
+
+extern _X_EXPORT short
+ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
+
+extern _X_EXPORT float
+BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
+ float velocity, float threshold, float acc);
+
+extern _X_EXPORT void
+FreeVelocityData(DeviceVelocityPtr vel);
+
+extern _X_EXPORT int
+SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+
+extern _X_EXPORT DeviceVelocityPtr
+GetDevicePredictableAccelData(DeviceIntPtr dev);
+
+extern _X_EXPORT void
+SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
+ PointerAccelerationProfileFunc profile);
+
+extern _X_INTERNAL void
+AccelerationDefaultCleanup(DeviceIntPtr dev);
+
+extern _X_INTERNAL Bool
+InitPredictableAccelerationScheme(DeviceIntPtr dev,
+ struct _ValuatorAccelerationRec* protoScheme);
+
+extern _X_INTERNAL void
+acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val,
+ CARD32 evtime);
+
+extern _X_INTERNAL void
+acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val,
+ CARD32 evtime);
+
+#endif /* POINTERVELOCITY_H */
diff --git a/xorg-server/include/resource.h b/xorg-server/include/resource.h
index 763aa99d9..17bebe7d4 100644
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
@@ -1,255 +1,255 @@
-/***********************************************************
-
-Copyright 1987, 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 1987, 1989 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 RESOURCE_H
-#define RESOURCE_H 1
-#include "misc.h"
-#include "dixaccess.h"
-
-/*****************************************************************
- * STUFF FOR RESOURCES
- *****************************************************************/
-
-/* classes for Resource routines */
-
-typedef unsigned long RESTYPE;
-
-#define RC_VANILLA ((RESTYPE)0)
-#define RC_CACHED ((RESTYPE)1<<31)
-#define RC_DRAWABLE ((RESTYPE)1<<30)
-/* Use class RC_NEVERRETAIN for resources that should not be retained
- * regardless of the close down mode when the client dies. (A client's
- * event selections on objects that it doesn't own are good candidates.)
- * Extensions can use this too!
- */
-#define RC_NEVERRETAIN ((RESTYPE)1<<29)
-#define RC_LASTPREDEF RC_NEVERRETAIN
-#define RC_ANY (~(RESTYPE)0)
-
-/* types for Resource routines */
-
-#define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE)
-#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE)
-#define RT_GC ((RESTYPE)3)
-#undef RT_FONT
-#undef RT_CURSOR
-#define RT_FONT ((RESTYPE)4)
-#define RT_CURSOR ((RESTYPE)5)
-#define RT_COLORMAP ((RESTYPE)6)
-#define RT_CMAPENTRY ((RESTYPE)7)
-#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
-#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
-#define RT_LASTPREDEF ((RESTYPE)9)
-#define RT_NONE ((RESTYPE)0)
-
-/* bits and fields within a resource id */
-#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
-#if MAXCLIENTS == 64
-#define RESOURCE_CLIENT_BITS 6
-#endif
-#if MAXCLIENTS == 128
-#define RESOURCE_CLIENT_BITS 7
-#endif
-#if MAXCLIENTS == 256
-#define RESOURCE_CLIENT_BITS 8
-#endif
-#if MAXCLIENTS == 512
-#define RESOURCE_CLIENT_BITS 9
-#endif
-/* client field offset */
-#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
-/* resource field */
-#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)
-/* client field */
-#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
-/* extract the client mask from an XID */
-#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
-/* extract the client id from an XID */
-#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
-#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
-
-#ifdef INVALID
-#undef INVALID /* needed on HP/UX */
-#endif
-
-/* Invalid resource id */
-#define INVALID (0)
-
-#define BAD_RESOURCE 0xe0000000
-
-#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-
-/* Resource state callback */
-extern _X_EXPORT CallbackListPtr ResourceStateCallback;
-
-typedef enum {ResourceStateAdding,
- ResourceStateFreeing} ResourceState;
-
-typedef struct {
- ResourceState state;
- XID id;
- RESTYPE type;
- pointer value;
-} ResourceStateInfoRec;
-
-typedef int (*DeleteType)(
- pointer /*value*/,
- XID /*id*/);
-
-typedef void (*FindResType)(
- pointer /*value*/,
- XID /*id*/,
- pointer /*cdata*/);
-
-typedef void (*FindAllRes)(
- pointer /*value*/,
- XID /*id*/,
- RESTYPE /*type*/,
- pointer /*cdata*/);
-
-typedef Bool (*FindComplexResType)(
- pointer /*value*/,
- XID /*id*/,
- pointer /*cdata*/);
-
-extern _X_EXPORT RESTYPE CreateNewResourceType(
- DeleteType /*deleteFunc*/, char * /*name*/);
-
-extern _X_EXPORT void SetResourceTypeErrorValue(
- RESTYPE /*type*/, int /*errorValue*/);
-
-extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
-
-extern _X_EXPORT Bool InitClientResources(
- ClientPtr /*client*/);
-
-extern _X_EXPORT XID FakeClientID(
- int /*client*/);
-
-/* Quartz support on Mac OS X uses the CarbonCore
- framework whose AddResource function conflicts here. */
-#ifdef __APPLE__
-#define AddResource Darwin_X_AddResource
-#endif
-extern _X_EXPORT Bool AddResource(
- XID /*id*/,
- RESTYPE /*type*/,
- pointer /*value*/);
-
-extern _X_EXPORT void FreeResource(
- XID /*id*/,
- RESTYPE /*skipDeleteFuncType*/);
-
-extern _X_EXPORT void FreeResourceByType(
- XID /*id*/,
- RESTYPE /*type*/,
- Bool /*skipFree*/);
-
-extern _X_EXPORT Bool ChangeResourceValue(
- XID /*id*/,
- RESTYPE /*rtype*/,
- pointer /*value*/);
-
-extern _X_EXPORT void FindClientResourcesByType(
- ClientPtr /*client*/,
- RESTYPE /*type*/,
- FindResType /*func*/,
- pointer /*cdata*/);
-
-extern _X_EXPORT void FindAllClientResources(
- ClientPtr /*client*/,
- FindAllRes /*func*/,
- pointer /*cdata*/);
-
-extern _X_EXPORT void FreeClientNeverRetainResources(
- ClientPtr /*client*/);
-
-extern _X_EXPORT void FreeClientResources(
- ClientPtr /*client*/);
-
-extern _X_EXPORT void FreeAllResources(void);
-
-extern _X_EXPORT Bool LegalNewID(
- XID /*id*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT pointer LookupClientResourceComplex(
- ClientPtr client,
- RESTYPE type,
- FindComplexResType func,
- pointer cdata);
-
-extern _X_EXPORT int dixLookupResourceByType(
- pointer *result,
- XID id,
- RESTYPE rtype,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupResourceByClass(
- pointer *result,
- XID id,
- RESTYPE rclass,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT void GetXIDRange(
- int /*client*/,
- Bool /*server*/,
- XID * /*minp*/,
- XID * /*maxp*/);
-
-extern _X_EXPORT unsigned int GetXIDList(
- ClientPtr /*client*/,
- unsigned int /*count*/,
- XID * /*pids*/);
-
-extern _X_EXPORT RESTYPE lastResourceType;
-extern _X_EXPORT RESTYPE TypeMask;
-
-#endif /* RESOURCE_H */
-
+/***********************************************************
+
+Copyright 1987, 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 1987, 1989 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 RESOURCE_H
+#define RESOURCE_H 1
+#include "misc.h"
+#include "dixaccess.h"
+
+/*****************************************************************
+ * STUFF FOR RESOURCES
+ *****************************************************************/
+
+/* classes for Resource routines */
+
+typedef uint32_t RESTYPE;
+
+#define RC_VANILLA ((RESTYPE)0)
+#define RC_CACHED ((RESTYPE)1<<31)
+#define RC_DRAWABLE ((RESTYPE)1<<30)
+/* Use class RC_NEVERRETAIN for resources that should not be retained
+ * regardless of the close down mode when the client dies. (A client's
+ * event selections on objects that it doesn't own are good candidates.)
+ * Extensions can use this too!
+ */
+#define RC_NEVERRETAIN ((RESTYPE)1<<29)
+#define RC_LASTPREDEF RC_NEVERRETAIN
+#define RC_ANY (~(RESTYPE)0)
+
+/* types for Resource routines */
+
+#define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE)
+#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE)
+#define RT_GC ((RESTYPE)3)
+#undef RT_FONT
+#undef RT_CURSOR
+#define RT_FONT ((RESTYPE)4)
+#define RT_CURSOR ((RESTYPE)5)
+#define RT_COLORMAP ((RESTYPE)6)
+#define RT_CMAPENTRY ((RESTYPE)7)
+#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
+#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
+#define RT_LASTPREDEF ((RESTYPE)9)
+#define RT_NONE ((RESTYPE)0)
+
+/* bits and fields within a resource id */
+#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
+#if MAXCLIENTS == 64
+#define RESOURCE_CLIENT_BITS 6
+#endif
+#if MAXCLIENTS == 128
+#define RESOURCE_CLIENT_BITS 7
+#endif
+#if MAXCLIENTS == 256
+#define RESOURCE_CLIENT_BITS 8
+#endif
+#if MAXCLIENTS == 512
+#define RESOURCE_CLIENT_BITS 9
+#endif
+/* client field offset */
+#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
+/* resource field */
+#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)
+/* client field */
+#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
+/* extract the client mask from an XID */
+#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
+/* extract the client id from an XID */
+#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
+#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
+
+#ifdef INVALID
+#undef INVALID /* needed on HP/UX */
+#endif
+
+/* Invalid resource id */
+#define INVALID (0)
+
+#define BAD_RESOURCE 0xe0000000
+
+#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
+
+/* Resource state callback */
+extern _X_EXPORT CallbackListPtr ResourceStateCallback;
+
+typedef enum {ResourceStateAdding,
+ ResourceStateFreeing} ResourceState;
+
+typedef struct {
+ ResourceState state;
+ XID id;
+ RESTYPE type;
+ pointer value;
+} ResourceStateInfoRec;
+
+typedef int (*DeleteType)(
+ pointer /*value*/,
+ XID /*id*/);
+
+typedef void (*FindResType)(
+ pointer /*value*/,
+ XID /*id*/,
+ pointer /*cdata*/);
+
+typedef void (*FindAllRes)(
+ pointer /*value*/,
+ XID /*id*/,
+ RESTYPE /*type*/,
+ pointer /*cdata*/);
+
+typedef Bool (*FindComplexResType)(
+ pointer /*value*/,
+ XID /*id*/,
+ pointer /*cdata*/);
+
+extern _X_EXPORT RESTYPE CreateNewResourceType(
+ DeleteType /*deleteFunc*/, char * /*name*/);
+
+extern _X_EXPORT void SetResourceTypeErrorValue(
+ RESTYPE /*type*/, int /*errorValue*/);
+
+extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
+
+extern _X_EXPORT Bool InitClientResources(
+ ClientPtr /*client*/);
+
+extern _X_EXPORT XID FakeClientID(
+ int /*client*/);
+
+/* Quartz support on Mac OS X uses the CarbonCore
+ framework whose AddResource function conflicts here. */
+#ifdef __APPLE__
+#define AddResource Darwin_X_AddResource
+#endif
+extern _X_EXPORT Bool AddResource(
+ XID /*id*/,
+ RESTYPE /*type*/,
+ pointer /*value*/);
+
+extern _X_EXPORT void FreeResource(
+ XID /*id*/,
+ RESTYPE /*skipDeleteFuncType*/);
+
+extern _X_EXPORT void FreeResourceByType(
+ XID /*id*/,
+ RESTYPE /*type*/,
+ Bool /*skipFree*/);
+
+extern _X_EXPORT Bool ChangeResourceValue(
+ XID /*id*/,
+ RESTYPE /*rtype*/,
+ pointer /*value*/);
+
+extern _X_EXPORT void FindClientResourcesByType(
+ ClientPtr /*client*/,
+ RESTYPE /*type*/,
+ FindResType /*func*/,
+ pointer /*cdata*/);
+
+extern _X_EXPORT void FindAllClientResources(
+ ClientPtr /*client*/,
+ FindAllRes /*func*/,
+ pointer /*cdata*/);
+
+extern _X_EXPORT void FreeClientNeverRetainResources(
+ ClientPtr /*client*/);
+
+extern _X_EXPORT void FreeClientResources(
+ ClientPtr /*client*/);
+
+extern _X_EXPORT void FreeAllResources(void);
+
+extern _X_EXPORT Bool LegalNewID(
+ XID /*id*/,
+ ClientPtr /*client*/);
+
+extern _X_EXPORT pointer LookupClientResourceComplex(
+ ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func,
+ pointer cdata);
+
+extern _X_EXPORT int dixLookupResourceByType(
+ pointer *result,
+ XID id,
+ RESTYPE rtype,
+ ClientPtr client,
+ Mask access_mode);
+
+extern _X_EXPORT int dixLookupResourceByClass(
+ pointer *result,
+ XID id,
+ RESTYPE rclass,
+ ClientPtr client,
+ Mask access_mode);
+
+extern _X_EXPORT void GetXIDRange(
+ int /*client*/,
+ Bool /*server*/,
+ XID * /*minp*/,
+ XID * /*maxp*/);
+
+extern _X_EXPORT unsigned int GetXIDList(
+ ClientPtr /*client*/,
+ unsigned int /*count*/,
+ XID * /*pids*/);
+
+extern _X_EXPORT RESTYPE lastResourceType;
+extern _X_EXPORT RESTYPE TypeMask;
+
+#endif /* RESOURCE_H */
+