summaryrefslogtreecommitdiff
path: root/xserver/Xi/extinit.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-06-07 17:28:57 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-06-07 17:28:57 +0000
commitc0190187060808fe0ad2a09b31f4244757572ff9 (patch)
treeb028697436476ae3ff34218b0b233a233d8a7818 /xserver/Xi/extinit.c
parent33eda071f5846d332b428de759c5b1649e9cf1ba (diff)
Update to X server 1.14.1. Tested by many during t2k13. Thanks.
Diffstat (limited to 'xserver/Xi/extinit.c')
-rw-r--r--xserver/Xi/extinit.c105
1 files changed, 71 insertions, 34 deletions
diff --git a/xserver/Xi/extinit.c b/xserver/Xi/extinit.c
index 2637f08e5..619d0e468 100644
--- a/xserver/Xi/extinit.c
+++ b/xserver/Xi/extinit.c
@@ -49,8 +49,6 @@ SOFTWARE.
* Dispatch routines and initialization routines for the X input extension.
*
*/
-#define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0]))
-
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
@@ -124,6 +122,7 @@ SOFTWARE.
#include "xiqueryversion.h"
#include "xisetclientpointer.h"
#include "xiwarppointer.h"
+#include "xibarriers.h"
/* Masks for XI events have to be aligned with core event (partially anyway).
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
@@ -150,10 +149,8 @@ const Mask ChangeDeviceNotifyMask = (1L << 16);
const Mask DeviceButtonGrabMask = (1L << 17);
const Mask DeviceOwnerGrabButtonMask = (1L << 17);
const Mask DevicePresenceNotifyMask = (1L << 18);
-const Mask DeviceEnterWindowMask = (1L << 18);
-const Mask DeviceLeaveWindowMask = (1L << 19);
-const Mask DevicePropertyNotifyMask = (1L << 20);
-const Mask XIAllMasks = (1L << 21) - 1;
+const Mask DevicePropertyNotifyMask = (1L << 19);
+const Mask XIAllMasks = (1L << 20) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
@@ -162,25 +159,25 @@ static struct dev_type {
Atom type;
const char *name;
} dev_type[] = {
- {
- 0, XI_KEYBOARD}, {
- 0, XI_MOUSE}, {
- 0, XI_TABLET}, {
- 0, XI_TOUCHSCREEN}, {
- 0, XI_TOUCHPAD}, {
- 0, XI_BARCODE}, {
- 0, XI_BUTTONBOX}, {
- 0, XI_KNOB_BOX}, {
- 0, XI_ONE_KNOB}, {
- 0, XI_NINE_KNOB}, {
- 0, XI_TRACKBALL}, {
- 0, XI_QUADRATURE}, {
- 0, XI_ID_MODULE}, {
- 0, XI_SPACEBALL}, {
- 0, XI_DATAGLOVE}, {
- 0, XI_EYETRACKER}, {
- 0, XI_CURSORKEYS}, {
-0, XI_FOOTMOUSE}};
+ {0, XI_KEYBOARD},
+ {0, XI_MOUSE},
+ {0, XI_TABLET},
+ {0, XI_TOUCHSCREEN},
+ {0, XI_TOUCHPAD},
+ {0, XI_BARCODE},
+ {0, XI_BUTTONBOX},
+ {0, XI_KNOB_BOX},
+ {0, XI_ONE_KNOB},
+ {0, XI_NINE_KNOB},
+ {0, XI_TRACKBALL},
+ {0, XI_QUADRATURE},
+ {0, XI_ID_MODULE},
+ {0, XI_SPACEBALL},
+ {0, XI_DATAGLOVE},
+ {0, XI_EYETRACKER},
+ {0, XI_CURSORKEYS},
+ {0, XI_FOOTMOUSE}
+};
CARD8 event_base[numInputClasses];
XExtEventInfo EventInfo[32];
@@ -255,7 +252,8 @@ static int (*ProcIVector[]) (ClientPtr) = {
ProcXIChangeProperty, /* 57 */
ProcXIDeleteProperty, /* 58 */
ProcXIGetProperty, /* 59 */
- ProcXIGetSelectedEvents /* 60 */
+ ProcXIGetSelectedEvents, /* 60 */
+ ProcXIBarrierReleasePointer /* 61 */
};
/* For swapped clients */
@@ -320,7 +318,8 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
- SProcXIGetSelectedEvents /* 60 */
+ SProcXIGetSelectedEvents, /* 60 */
+ SProcXIBarrierReleasePointer /* 61 */
};
/*****************************************************************
@@ -438,8 +437,9 @@ SProcIDispatch(ClientPtr client)
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
- /* All we look at is the type field */
-{ /* This is common to all replies */
+{
+ /* All we look at is the type field */
+ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
@@ -649,7 +649,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
*to = *from;
memcpy(&to[1], &from[1], from->length * 4);
- any = (xXIAnyInfo *) & to[1];
+ any = (xXIAnyInfo *) &to[1];
for (i = 0; i < to->num_classes; i++) {
int length = any->length;
@@ -657,7 +657,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
case KeyClass:
{
xXIKeyInfo *ki = (xXIKeyInfo *) any;
- uint32_t *key = (uint32_t *) & ki[1];
+ uint32_t *key = (uint32_t *) &ki[1];
for (j = 0; j < ki->num_keycodes; j++, key++)
swapl(key);
@@ -768,7 +768,7 @@ SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
swapl(&to->flags);
swaps(&to->num_info);
- info = (xXIHierarchyInfo *) & to[1];
+ info = (xXIHierarchyInfo *) &to[1];
for (i = 0; i < from->num_info; i++) {
swaps(&info->deviceid);
swaps(&info->attachment);
@@ -842,6 +842,32 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
swapl(&to->child);
}
+static void
+SBarrierEvent(xXIBarrierEvent * from,
+ xXIBarrierEvent * to) {
+
+ *to = *from;
+
+ swaps(&from->sequenceNumber);
+ swapl(&from->length);
+ swaps(&from->evtype);
+ swapl(&from->time);
+ swaps(&from->deviceid);
+ swaps(&from->sourceid);
+ swapl(&from->event);
+ swapl(&from->root);
+ swapl(&from->root_x);
+ swapl(&from->root_y);
+
+ swapl(&from->dx.integral);
+ swapl(&from->dx.frac);
+ swapl(&from->dy.integral);
+ swapl(&from->dy.frac);
+ swapl(&from->dtime);
+ swapl(&from->barrier);
+ swapl(&from->eventid);
+}
+
/** Event swapping function for XI2 events. */
void
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@@ -888,6 +914,11 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
case XI_RawTouchEnd:
SRawEvent((xXIRawEvent *) from, (xXIRawEvent *) to);
break;
+ case XI_BarrierHit:
+ case XI_BarrierLeave:
+ SBarrierEvent((xXIBarrierEvent *) from,
+ (xXIBarrierEvent *) to);
+ break;
default:
ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
break;
@@ -1137,6 +1168,9 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DevicePresenceNotify] = NotImplemented;
EventSwapVector[DevicePropertyNotify] = NotImplemented;
RestoreExtensionEvents();
+
+ free(xi_all_devices.name);
+ free(xi_all_master_devices.name);
}
/***********************************************************************
@@ -1263,6 +1297,9 @@ XInputExtensionInit(void)
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
FatalError("Failed to add callback to XI.\n");
+ if (!XIBarrierInit())
+ FatalError("Could not initialize barriers.\n");
+
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
@@ -1298,9 +1335,9 @@ XInputExtensionInit(void)
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
xi_all_devices.id = XIAllDevices;
- xi_all_devices.name = "XIAllDevices";
+ xi_all_devices.name = strdup("XIAllDevices");
xi_all_master_devices.id = XIAllMasterDevices;
- xi_all_master_devices.name = "XIAllMasterDevices";
+ xi_all_master_devices.name = strdup("XIAllMasterDevices");
inputInfo.all_devices = &xi_all_devices;
inputInfo.all_master_devices = &xi_all_master_devices;