4c221b0da1816acf2ca302b10092df059484468dvboxsync/************************************************************
4c221b0da1816acf2ca302b10092df059484468dvboxsyncCopyright 1987, 1998 The Open Group
4c221b0da1816acf2ca302b10092df059484468dvboxsyncPermission to use, copy, modify, distribute, and sell this software and its
4c221b0da1816acf2ca302b10092df059484468dvboxsyncdocumentation for any purpose is hereby granted without fee, provided that
4c221b0da1816acf2ca302b10092df059484468dvboxsyncthe above copyright notice appear in all copies and that both that
4c221b0da1816acf2ca302b10092df059484468dvboxsynccopyright notice and this permission notice appear in supporting
4c221b0da1816acf2ca302b10092df059484468dvboxsyncdocumentation.
4c221b0da1816acf2ca302b10092df059484468dvboxsyncThe above copyright notice and this permission notice shall be included in
4c221b0da1816acf2ca302b10092df059484468dvboxsyncall copies or substantial portions of the Software.
4c221b0da1816acf2ca302b10092df059484468dvboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4c221b0da1816acf2ca302b10092df059484468dvboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4c221b0da1816acf2ca302b10092df059484468dvboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4c221b0da1816acf2ca302b10092df059484468dvboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
4c221b0da1816acf2ca302b10092df059484468dvboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4c221b0da1816acf2ca302b10092df059484468dvboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4c221b0da1816acf2ca302b10092df059484468dvboxsyncExcept as contained in this notice, the name of The Open Group shall not be
4c221b0da1816acf2ca302b10092df059484468dvboxsyncused in advertising or otherwise to promote the sale, use or other dealings
4c221b0da1816acf2ca302b10092df059484468dvboxsyncin this Software without prior written authorization from The Open Group.
4c221b0da1816acf2ca302b10092df059484468dvboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
4c221b0da1816acf2ca302b10092df059484468dvboxsync All Rights Reserved
4c221b0da1816acf2ca302b10092df059484468dvboxsyncPermission to use, copy, modify, and distribute this software and its
4c221b0da1816acf2ca302b10092df059484468dvboxsyncdocumentation for any purpose and without fee is hereby granted,
4c221b0da1816acf2ca302b10092df059484468dvboxsyncprovided that the above copyright notice appear in all copies and that
4c221b0da1816acf2ca302b10092df059484468dvboxsyncboth that copyright notice and this permission notice appear in
4c221b0da1816acf2ca302b10092df059484468dvboxsyncsupporting documentation, and that the name of Digital not be
4c221b0da1816acf2ca302b10092df059484468dvboxsyncused in advertising or publicity pertaining to distribution of the
4c221b0da1816acf2ca302b10092df059484468dvboxsyncsoftware without specific, written prior permission.
4c221b0da1816acf2ca302b10092df059484468dvboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
4c221b0da1816acf2ca302b10092df059484468dvboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
4c221b0da1816acf2ca302b10092df059484468dvboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4c221b0da1816acf2ca302b10092df059484468dvboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4c221b0da1816acf2ca302b10092df059484468dvboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4c221b0da1816acf2ca302b10092df059484468dvboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4c221b0da1816acf2ca302b10092df059484468dvboxsync********************************************************/
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
4c221b0da1816acf2ca302b10092df059484468dvboxsyncextern _X_EXPORT int CountBits(const uint8_t *mask, int len);
4c221b0da1816acf2ca302b10092df059484468dvboxsync (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
4c221b0da1816acf2ca302b10092df059484468dvboxsync/* This is the last XI2 event supported by the server. If you add
4c221b0da1816acf2ca302b10092df059484468dvboxsync * events to the protocol, the server will not support these events until
4c221b0da1816acf2ca302b10092df059484468dvboxsync * this number here is bumped.
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * This struct stores the core event mask for each client except the client
4c221b0da1816acf2ca302b10092df059484468dvboxsync * that created the window.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Each window that has events selected from other clients has at least one of
4c221b0da1816acf2ca302b10092df059484468dvboxsync * these masks. If multiple clients selected for events on the same window,
4c221b0da1816acf2ca302b10092df059484468dvboxsync * these masks are in a linked list.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The event mask for the client that created the window is stored in
4c221b0da1816acf2ca302b10092df059484468dvboxsync * win->eventMask instead.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The resource id is simply a fake client ID to associate this mask with a
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Kludge: OtherClients and InputClients must be compatible, see code.
4c221b0da1816acf2ca302b10092df059484468dvboxsync OtherClientsPtr next; /**< Pointer to the next mask */
4c221b0da1816acf2ca302b10092df059484468dvboxsync XID resource; /**< id for putting into resource manager */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * This struct stores the XI event mask for each client.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Each window that has events selected has at least one of these masks. If
4c221b0da1816acf2ca302b10092df059484468dvboxsync * multiple client selected for events on the same window, these masks are in
4c221b0da1816acf2ca302b10092df059484468dvboxsync * a linked list.
4c221b0da1816acf2ca302b10092df059484468dvboxsync InputClientsPtr next; /**< Pointer to the next mask */
4c221b0da1816acf2ca302b10092df059484468dvboxsync XID resource; /**< id for putting into resource manager */
4c221b0da1816acf2ca302b10092df059484468dvboxsync Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /** XI2 event masks. One per device, each bit is a mask of (1 << type) */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Combined XI event masks from all devices.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * This is the XI equivalent of the deliverableEvents, eventMask and
4c221b0da1816acf2ca302b10092df059484468dvboxsync * dontPropagate mask of the WindowRec (or WindowOptRec).
4c221b0da1816acf2ca302b10092df059484468dvboxsync * A window that has an XI client selecting for events has exactly one
4c221b0da1816acf2ca302b10092df059484468dvboxsync * OtherInputMasks struct and exactly one InputClients struct hanging off
4c221b0da1816acf2ca302b10092df059484468dvboxsync * inputClients. Each further client appends to the inputClients list.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Each Mask field is per-device, with the device id as the index.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Exception: for non-device events (Presence events), the MAXDEVICES
4c221b0da1816acf2ca302b10092df059484468dvboxsync * deviceid is used.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Bitwise OR of all masks by all clients and the window's parent's masks.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Bitwise OR of all masks by all clients on this window.
4c221b0da1816acf2ca302b10092df059484468dvboxsync /** The do-not-propagate masks for each device. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /** The clients that selected for events */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The following structure gets used for both active and passive grabs. For
4c221b0da1816acf2ca302b10092df059484468dvboxsync * active grabs some of the fields (e.g. modifiers) are not used. However,
4c221b0da1816acf2ca302b10092df059484468dvboxsync * that is not much waste since there aren't many active grabs (one per
4c221b0da1816acf2ca302b10092df059484468dvboxsync * keyboard/pointer device) going at once in the server.
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
4c221b0da1816acf2ca302b10092df059484468dvboxsync modifier combinations, but only
4c221b0da1816acf2ca302b10092df059484468dvboxsync 3 buttons. */
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _DetailRec { /* Grab details may be bit masks */
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef enum {
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Central struct for device grabs.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The same struct is used for both core grabs and device grabs, with
4c221b0da1816acf2ca302b10092df059484468dvboxsync * different fields being set.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask
4c221b0da1816acf2ca302b10092df059484468dvboxsync * is a combination of standard event masks (i.e. PointerMotionMask |
4c221b0da1816acf2ca302b10092df059484468dvboxsync * ButtonPressMask).
4c221b0da1816acf2ca302b10092df059484468dvboxsync * If the grab is a device grab (GrabDevice), then the eventMask is a
4c221b0da1816acf2ca302b10092df059484468dvboxsync * combination of event masks for a given XI event type (see SetEventInfo).
4c221b0da1816acf2ca302b10092df059484468dvboxsync * If the grab is a result of a ButtonPress, then eventMask is the core mask
4c221b0da1816acf2ca302b10092df059484468dvboxsync * and deviceMask is set to the XI event mask for the grab.
4c221b0da1816acf2ca302b10092df059484468dvboxsync WindowPtr confineTo; /* always NULL for keyboards */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Sprite information for a device.
4c221b0da1816acf2ca302b10092df059484468dvboxsync BoxRec hotLimits; /* logical constraints of hot spot */
4c221b0da1816acf2ca302b10092df059484468dvboxsync RegionPtr hotShape; /* additional logical shape constraint */
4c221b0da1816acf2ca302b10092df059484468dvboxsync BoxRec physLimits; /* physical constraints of hot spot */
4c221b0da1816acf2ca302b10092df059484468dvboxsync ScreenPtr screen; /* all others are in Screen 0 coordinates */
4c221b0da1816acf2ca302b10092df059484468dvboxsync RegionRec Reg1; /* Region 1 for confining motion */
4c221b0da1816acf2ca302b10092df059484468dvboxsync RegionRec Reg2; /* Region 2 for confining virtual motion */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* The window trace information is used at dix/events.c to avoid having
4c221b0da1816acf2ca302b10092df059484468dvboxsync * to compute all the windows between the root and the current pointer
4c221b0da1816acf2ca302b10092df059484468dvboxsync * window each time a button or key goes down. The grabs on each of those
4c221b0da1816acf2ca302b10092df059484468dvboxsync * windows must be checked.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * spriteTraces should only be used at dix/events.c! */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* Due to delays between event generation and event processing, it is
4c221b0da1816acf2ca302b10092df059484468dvboxsync * possible that the pointer has crossed screen boundaries between the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * time in which it begins generating events and the time when
4c221b0da1816acf2ca302b10092df059484468dvboxsync * those events are processed.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * pEnqueueScreen: screen the pointer was on when the event was generated
4c221b0da1816acf2ca302b10092df059484468dvboxsync * pDequeueScreen: screen the pointer was on when the event is processed
4c221b0da1816acf2ca302b10092df059484468dvboxsync} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsync void *motion; /* motion history buffer. Different layout
4c221b0da1816acf2ca302b10092df059484468dvboxsync for MDs and SDs!*/
4c221b0da1816acf2ca302b10092df059484468dvboxsync double *axisVal; /* always absolute, but device-coord system */
4c221b0da1816acf2ca302b10092df059484468dvboxsync CARD8 buttonsDown; /* number of buttons currently down
4c221b0da1816acf2ca302b10092df059484468dvboxsync This counts logical buttons, not
4c221b0da1816acf2ca302b10092df059484468dvboxsync physical ones, i.e if some buttons
4c221b0da1816acf2ca302b10092df059484468dvboxsync are mapped to 0, they're not counted
4c221b0da1816acf2ca302b10092df059484468dvboxsync WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* Calibration. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* Area. */
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _StringFeedbackClassRec *StringFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _BellFeedbackClassRec *BellFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct _LedFeedbackClassRec *LedFeedbackPtr;
4c221b0da1816acf2ca302b10092df059484468dvboxsync/* Device properties */
4c221b0da1816acf2ca302b10092df059484468dvboxsync short format; /* format of data for swapping - 8,16,32 */
4c221b0da1816acf2ca302b10092df059484468dvboxsync BOOL deletable; /* clients can delete this prop? */
4c221b0da1816acf2ca302b10092df059484468dvboxsync/* states for devices */
4c221b0da1816acf2ca302b10092df059484468dvboxsync#define FROZEN 5 /* any state >= has device frozen */
4c221b0da1816acf2ca302b10092df059484468dvboxsync Bool fromPassiveGrab; /* true if from passive grab */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* sprite must always point to a valid sprite. For devices sharing the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * sprite, let sprite point to a paired spriteOwner's sprite. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync Bool spriteOwner; /* True if device owns the sprite */
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceIntPtr paired; /* The paired device. Keyboard if
4c221b0da1816acf2ca302b10092df059484468dvboxsync spriteOwner is TRUE, otherwise the
4c221b0da1816acf2ca302b10092df059484468dvboxsync pointer that owns the sprite. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* keep states for animated cursor */
4c221b0da1816acf2ca302b10092df059484468dvboxsync/* device types */
4c221b0da1816acf2ca302b10092df059484468dvboxsync server intialization time */
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
4c221b0da1816acf2ca302b10092df059484468dvboxsync used to initialize, turn on, or
4c221b0da1816acf2ca302b10092df059484468dvboxsync turn off the device */
4c221b0da1816acf2ca302b10092df059484468dvboxsync Bool coreEvents; /* TRUE if device also sends core */
4c221b0da1816acf2ca302b10092df059484468dvboxsync int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
4c221b0da1816acf2ca302b10092df059484468dvboxsync ClassesPtr unused_classes; /* for master devices */
4c221b0da1816acf2ca302b10092df059484468dvboxsync int saved_master_id; /* for slaves while grabbed */
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceIntPtr lastSlave; /* last slave device used */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* last valuator values recorded, not posted to client;
4c221b0da1816acf2ca302b10092df059484468dvboxsync * for slave devices, valuators is in device coordinates
4c221b0da1816acf2ca302b10092df059484468dvboxsync * for master devices, valuators is in screen coordinates
4c221b0da1816acf2ca302b10092df059484468dvboxsync * remainder supports acceleration
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* Input device property handling. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync XIPropertyHandlerPtr handlers; /* NULL-terminated */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* coordinate transformation matrix for absolute input devices */
4c221b0da1816acf2ca302b10092df059484468dvboxsync /* XTest related master device id */
4c221b0da1816acf2ca302b10092df059484468dvboxsynctypedef struct {
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceIntPtr off_devices; /* all devices turned off */
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceIntPtr keyboard; /* the main one for the server */
4c221b0da1816acf2ca302b10092df059484468dvboxsync/* for keeping the events for devices grabbed synchronously */
4c221b0da1816acf2ca302b10092df059484468dvboxsync ScreenPtr pScreen; /* what screen the pointer was on */
4c221b0da1816acf2ca302b10092df059484468dvboxsync unsigned long months; /* milliseconds is in the event */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * syncEvents is the global structure for queued events.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Devices can be frozen through GrabModeSync pointer grabs. If this is the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * case, events from these devices are added to "pending" instead of being
4c221b0da1816acf2ca302b10092df059484468dvboxsync * processed normally. When the device is unfrozen, events in "pending" are
4c221b0da1816acf2ca302b10092df059484468dvboxsync * replayed and processed as if they would come from the device directly.
4c221b0da1816acf2ca302b10092df059484468dvboxsync /** The device to replay events for. Only set in AllowEvents(), in which
4c221b0da1816acf2ca302b10092df059484468dvboxsync * case it is set to the device specified in the request. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync DeviceIntPtr replayDev; /* kludgy rock to put flag for */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The window the events are supposed to be replayed on.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * This window may be set to the grab's window (but only when
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Replay{Pointer|Keyboard} is given in the XAllowEvents()
4c221b0da1816acf2ca302b10092df059484468dvboxsync * request. */
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Flag to indicate whether we're in the process of
4c221b0da1816acf2ca302b10092df059484468dvboxsync * replaying events. Only set in ComputeFreezes(). */
4c221b0da1816acf2ca302b10092df059484468dvboxsync#endif /* INPUTSTRUCT_H */