aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/extinit.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/Xi/extinit.c
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/Xi/extinit.c')
-rw-r--r--xorg-server/Xi/extinit.c534
1 files changed, 414 insertions, 120 deletions
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 14eb3cbe1..84b999c0c 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -52,8 +52,6 @@ SOFTWARE.
#define NUMTYPES 15
-#define NEED_EVENTS
-#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -63,6 +61,7 @@ SOFTWARE.
#include "extnsionst.h" /* extension entry */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "geext.h" /* extension interfaces for ge */
@@ -112,12 +111,53 @@ SOFTWARE.
#include "ungrdev.h"
#include "ungrdevb.h"
#include "ungrdevk.h"
+#include "xiallowev.h"
+#include "xiselectev.h"
+#include "xigrabdev.h"
+#include "xipassivegrab.h"
+#include "xisetdevfocus.h"
#include "xiproperty.h"
+#include "xichangecursor.h"
+#include "xichangehierarchy.h"
+#include "xigetclientpointer.h"
+#include "xiquerydevice.h"
+#include "xiquerypointer.h"
+#include "xiqueryversion.h"
+#include "xisetclientpointer.h"
+#include "xiwarppointer.h"
+
+
+/* Masks for XI events have to be aligned with core event (partially anyway).
+ * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
+ * breaks down. The device needs the dev->button->motionMask. If DBMM is
+ * the same as BMM, we can ensure that both core and device events can be
+ * delivered, without the need for extra structures in the DeviceIntRec. */
+const Mask DeviceKeyPressMask = KeyPressMask;
+const Mask DeviceKeyReleaseMask = KeyReleaseMask;
+const Mask DeviceButtonPressMask = ButtonPressMask;
+const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
+const Mask DeviceProximityMask = (1L << 4);
+const Mask DeviceStateNotifyMask = (1L << 5);
+const Mask DevicePointerMotionMask = PointerMotionMask;
+const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
+const Mask DeviceButton1MotionMask = Button1MotionMask;
+const Mask DeviceButton2MotionMask = Button2MotionMask;
+const Mask DeviceButton3MotionMask = Button3MotionMask;
+const Mask DeviceButton4MotionMask = Button4MotionMask;
+const Mask DeviceButton5MotionMask = Button5MotionMask;
+const Mask DeviceButtonMotionMask = ButtonMotionMask;
+const Mask DeviceFocusChangeMask = (1L << 14);
+const Mask DeviceMappingNotifyMask = (1L << 15);
+const Mask ChangeDeviceNotifyMask = (1L << 16);
+const Mask DeviceButtonGrabMask = (1L << 17);
+const Mask DeviceOwnerGrabButtonMask = (1L << 17);
+const Mask DevicePresenceNotifyMask = (1L << 18);
+const Mask DeviceEnterWindowMask = (1L << 18);
+const Mask DeviceLeaveWindowMask = (1L << 19);
+const Mask DevicePropertyNotifyMask = (1L << 20);
+const Mask XIAllMasks = (1L << 21) - 1;
-
-static Mask lastExtEventMask = 1;
int ExtEventIndex;
-Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE];
static struct dev_type
@@ -148,6 +188,9 @@ static struct dev_type
CARD8 event_base[numInputClasses];
XExtEventInfo EventInfo[32];
+static DeviceIntRec xi_all_devices;
+static DeviceIntRec xi_all_master_devices;
+
/**
* Dispatch vector. Functions defined in here will be called when the matching
* request arrives.
@@ -193,7 +236,29 @@ static int (*ProcIVector[])(ClientPtr) = {
ProcXListDeviceProperties, /* 36 */
ProcXChangeDeviceProperty, /* 37 */
ProcXDeleteDeviceProperty, /* 38 */
- ProcXGetDeviceProperty /* 39 */
+ ProcXGetDeviceProperty, /* 39 */
+ /* XI 2 */
+ ProcXIQueryPointer, /* 40 */
+ ProcXIWarpPointer, /* 41 */
+ ProcXIChangeCursor, /* 42 */
+ ProcXIChangeHierarchy, /* 43 */
+ ProcXISetClientPointer, /* 44 */
+ ProcXIGetClientPointer, /* 45 */
+ ProcXISelectEvents, /* 46 */
+ ProcXIQueryVersion, /* 47 */
+ ProcXIQueryDevice, /* 48 */
+ ProcXISetFocus, /* 49 */
+ ProcXIGetFocus, /* 50 */
+ ProcXIGrabDevice, /* 51 */
+ ProcXIUngrabDevice, /* 52 */
+ ProcXIAllowEvents, /* 53 */
+ ProcXIPassiveGrabDevice, /* 54 */
+ ProcXIPassiveUngrabDevice, /* 55 */
+ ProcXIListProperties, /* 56 */
+ ProcXIChangeProperty, /* 57 */
+ ProcXIDeleteProperty, /* 58 */
+ ProcXIGetProperty, /* 59 */
+ ProcXIGetSelectedEvents /* 60 */
};
/* For swapped clients */
@@ -237,7 +302,28 @@ static int (*SProcIVector[])(ClientPtr) = {
SProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
- SProcXGetDeviceProperty /* 39 */
+ SProcXGetDeviceProperty, /* 39 */
+ SProcXIQueryPointer, /* 40 */
+ SProcXIWarpPointer, /* 41 */
+ SProcXIChangeCursor, /* 42 */
+ SProcXIChangeHierarchy, /* 43 */
+ SProcXISetClientPointer, /* 44 */
+ SProcXIGetClientPointer, /* 45 */
+ SProcXISelectEvents, /* 46 */
+ SProcXIQueryVersion, /* 47 */
+ SProcXIQueryDevice, /* 48 */
+ SProcXISetFocus, /* 49 */
+ SProcXIGetFocus, /* 50 */
+ SProcXIGrabDevice, /* 51 */
+ SProcXIUngrabDevice, /* 52 */
+ SProcXIAllowEvents, /* 53 */
+ SProcXIPassiveGrabDevice, /* 54 */
+ SProcXIPassiveUngrabDevice, /* 55 */
+ SProcXIListProperties, /* 56 */
+ SProcXIChangeProperty, /* 57 */
+ SProcXIDeleteProperty, /* 58 */
+ SProcXIGetProperty, /* 59 */
+ SProcXIGetSelectedEvents /* 60 */
};
/*****************************************************************
@@ -254,18 +340,6 @@ int BadMode = 2;
int DeviceBusy = 3;
int BadClass = 4;
-Mask DevicePointerMotionMask;
-Mask DevicePointerMotionHintMask;
-Mask DeviceFocusChangeMask;
-Mask DeviceStateNotifyMask;
-static Mask ChangeDeviceNotifyMask;
-Mask DeviceMappingNotifyMask;
-Mask DeviceOwnerGrabButtonMask;
-Mask DeviceButtonGrabMask;
-Mask DeviceButtonMotionMask;
-Mask DevicePresenceNotifyMask;
-Mask DevicePropertyNotifyMask;
-
int DeviceValuator;
int DeviceKeyPress;
int DeviceKeyRelease;
@@ -292,7 +366,7 @@ int RT_INPUTCLIENT;
*
*/
-extern XExtensionVersion AllExtensionVersions[];
+extern XExtensionVersion XIVersion;
Mask PropagateMask[MAXDEVICES];
@@ -307,8 +381,8 @@ static int XIClientPrivateKeyIndex;
DevPrivateKey XIClientPrivateKey = &XIClientPrivateKeyIndex;
static XExtensionVersion thisversion = { XI_Present,
- XI_Add_DeviceProperties_Major,
- XI_Add_DeviceProperties_Minor
+ XI_2_Major,
+ XI_2_Minor
};
@@ -343,7 +417,7 @@ static int
ProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
- if (stuff->data > IREQUESTS || !ProcIVector[stuff->data])
+ if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
return BadRequest;
return (*ProcIVector[stuff->data])(client);
@@ -433,6 +507,26 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
else if (rep->RepType == X_GetDeviceProperty)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
+ else if (rep->RepType == X_XIQueryPointer)
+ SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
+ else if (rep->RepType == X_XIGetClientPointer)
+ SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
+ else if (rep->RepType == X_XIQueryVersion)
+ SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
+ else if (rep->RepType == X_XIQueryDevice)
+ SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIGrabDevice)
+ SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
+ else if (rep->RepType == X_XIListProperties)
+ SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
+ else if (rep->RepType == X_XIGetProperty)
+ SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
+ else if (rep->RepType == X_XIGetSelectedEvents)
+ SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
+ else if (rep->RepType == X_XIGetFocus)
+ SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
else {
FatalError("XINPUT confused sending swapped reply");
}
@@ -549,42 +643,279 @@ SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to
swapl(&to->atom, n);
}
-/**************************************************************************
- *
- * Allow the specified event to have its propagation suppressed.
- * The default is to not allow suppression of propagation.
- *
- */
+static void
+SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->sourceid, n);
+ swaps(&to->buttons_len, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+}
static void
-AllowPropagateSuppress(Mask mask)
+SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
+{
+ char n;
+ int i, j;
+ xXIAnyInfo *any;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+
+ any = (xXIAnyInfo*)&to[1];
+ for (i = 0; i < to->num_classes; i++)
+ {
+ int length = any->length;
+
+ switch(any->type)
+ {
+ case KeyClass:
+ {
+ xXIKeyInfo *ki = (xXIKeyInfo*)any;
+ uint32_t *key = (uint32_t*)&ki[1];
+ for (j = 0; j < ki->num_keycodes; j++, key++)
+ swapl(key, n);
+ swaps(&ki->num_keycodes, n);
+ }
+ break;
+ case ButtonClass:
+ {
+ xXIButtonInfo *bi = (xXIButtonInfo*)any;
+ Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
+ pad_to_int32(bits_to_bytes(bi->num_buttons)));
+ for (j = 0; j < bi->num_buttons; j++)
+ swapl(&labels[j], n);
+ swaps(&bi->num_buttons, n);
+ }
+ break;
+ case ValuatorClass:
+ {
+ xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
+ swapl(&ai->label, n);
+ swapl(&ai->min.integral, n);
+ swapl(&ai->min.frac, n);
+ swapl(&ai->max.integral, n);
+ swapl(&ai->max.frac, n);
+ swapl(&ai->resolution, n);
+ swaps(&ai->number, n);
+ }
+ break;
+ }
+
+ swaps(&any->type, n);
+ swaps(&any->length, n);
+ swaps(&any->sourceid, n);
+
+ any = (xXIAnyInfo*)((char*)any + length * 4);
+ }
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swaps(&to->num_classes, n);
+ swaps(&to->sourceid, n);
+
+}
+
+static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
{
int i;
+ char n;
+ char *ptr;
+ char *vmask;
- for (i = 0; i < MAXDEVICES; i++)
- PropagateMask[i] |= mask;
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+ swapl(&to->root, n);
+ swapl(&to->event, n);
+ swapl(&to->child, n);
+ swapl(&to->root_x, n);
+ swapl(&to->root_y, n);
+ swapl(&to->event_x, n);
+ swapl(&to->event_y, n);
+ swaps(&to->buttons_len, n);
+ swaps(&to->valuators_len, n);
+ swaps(&to->sourceid, n);
+ swapl(&to->mods.base_mods, n);
+ swapl(&to->mods.latched_mods, n);
+ swapl(&to->mods.locked_mods, n);
+ swapl(&to->mods.effective_mods, n);
+
+ ptr = (char*)(&to[1]);
+ ptr += from->buttons_len * 4;
+ vmask = ptr; /* valuator mask */
+ ptr += from->valuators_len * 4;
+ for (i = 0; i < from->valuators_len * 32; i++)
+ {
+ if (BitIsOn(vmask, i))
+ {
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ swapl(((uint32_t*)ptr), n);
+ ptr += 4;
+ }
+ }
+}
+
+static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
+ xXIHierarchyEvent *to)
+{
+ int i;
+ char n;
+ xXIHierarchyInfo *info;
+
+ *to = *from;
+ memcpy(&to[1], &from[1], from->length * 4);
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->flags, n);
+ swaps(&to->num_info, n);
+
+ info = (xXIHierarchyInfo*)&to[1];
+ for (i = 0; i< from->num_info; i++)
+ {
+ swaps(&info->deviceid, n);
+ swaps(&info->attachment, n);
+ info++;
+ }
+}
+
+static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
+{
+ char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->property, n);
+}
+
+static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
+{
+ char n;
+ int i;
+ FP3232 *values;
+ unsigned char *mask;
+
+ memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+ swaps(&to->sequenceNumber, n);
+ swapl(&to->length, n);
+ swaps(&to->evtype, n);
+ swaps(&to->deviceid, n);
+ swapl(&to->time, n);
+ swapl(&to->detail, n);
+
+
+ mask = (unsigned char*)&to[1];
+ values = (FP3232*)(mask + from->valuators_len * 4);
+
+ for (i = 0; i < from->valuators_len * 4 * 8; i++)
+ {
+ if (BitIsOn(mask, i))
+ {
+ /* for each bit set there are two FP3232 values on the wire, in
+ * the order abcABC for data and data_raw. Here we swap as if
+ * they were in aAbBcC order because it's easier and really
+ * doesn't matter.
+ */
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ swapl(&values->integral, n);
+ swapl(&values->frac, n);
+ values++;
+ }
+ }
+
+ swaps(&to->valuators_len, n);
+}
+
+
+/** Event swapping function for XI2 events. */
+void
+XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
+{
+ switch(from->evtype)
+ {
+ case XI_Enter:
+ case XI_Leave:
+ SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
+ break;
+ case XI_DeviceChanged:
+ SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
+ (xXIDeviceChangedEvent*)to);
+ break;
+ case XI_HierarchyChanged:
+ SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
+ break;
+ case XI_PropertyEvent:
+ SXIPropertyEvent((xXIPropertyEvent*)from,
+ (xXIPropertyEvent*)to);
+ break;
+ case XI_Motion:
+ case XI_KeyPress:
+ case XI_KeyRelease:
+ case XI_ButtonPress:
+ case XI_ButtonRelease:
+ SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
+ break;
+ case XI_RawMotion:
+ case XI_RawKeyPress:
+ case XI_RawKeyRelease:
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
+ break;
+ default:
+ ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
+ break;
+ }
}
/**************************************************************************
*
- * Return the next available extension event mask.
+ * Allow the specified event to have its propagation suppressed.
+ * The default is to not allow suppression of propagation.
*
*/
-static Mask
-GetNextExtEventMask(void)
+static void
+AllowPropagateSuppress(Mask mask)
{
int i;
- Mask mask = lastExtEventMask;
-
- if (lastExtEventMask == 0) {
- FatalError("GetNextExtEventMask: no more events are available.");
- }
- lastExtEventMask <<= 1;
for (i = 0; i < MAXDEVICES; i++)
- ExtValidMasks[i] |= mask;
- return mask;
+ PropagateMask[i] |= mask;
}
/**************************************************************************
@@ -654,8 +985,6 @@ SetMaskForExtEvent(Mask mask, int event)
static void
FixExtensionEvents(ExtensionEntry * extEntry)
{
- Mask mask;
-
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
DeviceKeyRelease = DeviceKeyPress + 1;
@@ -687,81 +1016,50 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceBusy += extEntry->errorBase;
BadClass += extEntry->errorBase;
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, DeviceKeyPress);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
+ AllowPropagateSuppress(DeviceKeyPressMask);
+ SetCriticalEvent(DeviceKeyPress);
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, DeviceKeyRelease);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
+ AllowPropagateSuppress(DeviceKeyReleaseMask);
+ SetCriticalEvent(DeviceKeyRelease);
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, DeviceButtonPress);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
+ AllowPropagateSuppress(DeviceButtonPressMask);
+ SetCriticalEvent(DeviceButtonPress);
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, DeviceButtonRelease);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
+ AllowPropagateSuppress(DeviceButtonReleaseMask);
+ SetCriticalEvent(DeviceButtonRelease);
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, ProximityIn);
- SetMaskForExtEvent(mask, ProximityOut);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
+ SetMaskForExtEvent(DeviceProximityMask, ProximityOut);
- mask = GetNextExtEventMask();
- DeviceStateNotifyMask = mask;
- SetMaskForExtEvent(mask, DeviceStateNotify);
+ SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
- mask = GetNextExtEventMask();
- DevicePointerMotionMask = mask;
- SetMaskForExtEvent(mask, DeviceMotionNotify);
- AllowPropagateSuppress(mask);
+ SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
+ AllowPropagateSuppress(DevicePointerMotionMask);
+ SetCriticalEvent(DeviceMotionNotify);
- DevicePointerMotionHintMask = GetNextExtEventMask();
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
- SetEventInfo(GetNextExtEventMask(), _deviceButton1Motion);
- SetEventInfo(GetNextExtEventMask(), _deviceButton2Motion);
- SetEventInfo(GetNextExtEventMask(), _deviceButton3Motion);
- SetEventInfo(GetNextExtEventMask(), _deviceButton4Motion);
- SetEventInfo(GetNextExtEventMask(), _deviceButton5Motion);
-
- /* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
- * breaks down. The device needs the dev->button->motionMask. If DBMM is
- * the same as BMM, we can ensure that both core and device events can be
- * delivered, without the need for extra structures in the DeviceIntRec.
- */
- DeviceButtonMotionMask = GetNextExtEventMask();
+ SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion);
+ SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion);
+ SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion);
+ SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion);
+ SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion);
SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
- if (DeviceButtonMotionMask != ButtonMotionMask)
- {
- /* This should never happen, but if it does, hide under the
- * bed and cry for help. */
- ErrorF("[Xi] DeviceButtonMotionMask != ButtonMotionMask. Trouble!\n");
- }
- DeviceFocusChangeMask = GetNextExtEventMask();
SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, DeviceMappingNotify);
- DeviceMappingNotifyMask = mask;
-
- mask = GetNextExtEventMask();
- SetMaskForExtEvent(mask, ChangeDeviceNotify);
- ChangeDeviceNotifyMask = mask;
+ SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify);
+ SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
- DeviceButtonGrabMask = GetNextExtEventMask();
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
- DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
-
- DevicePresenceNotifyMask = GetNextExtEventMask();
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
-
- DevicePropertyNotifyMask = GetNextExtEventMask();
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
SetEventInfo(0, _noExtensionEvent);
@@ -792,7 +1090,6 @@ RestoreExtensionEvents(void)
EventInfo[i].type = 0;
}
ExtEventIndex = 0;
- lastExtEventMask = 1;
DeviceValuator = 0;
DeviceKeyPress = 1;
DeviceKeyRelease = 2;
@@ -852,21 +1149,6 @@ IResetProc(ExtensionEntry * unused)
RestoreExtensionEvents();
}
-/*****************************************************************
- *
- * Returns TRUE if the device has some sort of pointer type.
- *
- */
-
-Bool
-DeviceIsPointerType(DeviceIntPtr dev)
-{
- if (dev_type[1].type == dev->type)
- return TRUE;
-
- return FALSE;
-}
-
/***********************************************************************
*
@@ -877,7 +1159,7 @@ DeviceIsPointerType(DeviceIntPtr dev)
void
AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
{
- dev->type = type;
+ dev->xinput_type = type;
dev->name = (char *)xalloc(strlen(name) + 1);
strcpy(dev->name, name);
}
@@ -985,9 +1267,8 @@ XInputExtensionInit(void)
if (extEntry) {
IReqCode = extEntry->base;
IEventBase = extEntry->eventBase;
- AllExtensionVersions[IReqCode - 128] = thisversion;
+ XIVersion = thisversion;
MakeDeviceTypeAtoms();
- XIInitKnownProperties();
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT");
FixExtensionEvents(extEntry);
@@ -1009,7 +1290,20 @@ XInputExtensionInit(void)
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
+ GERegisterExtension(IReqCode, XI2EventSwap);
+
+
+ memset(&xi_all_devices, 0, sizeof(xi_all_devices));
+ memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
+ xi_all_devices.id = XIAllDevices;
+ xi_all_devices.name = "XIAllDevices";
+ xi_all_master_devices.id = XIAllMasterDevices;
+ xi_all_master_devices.name = "XIAllMasterDevices";
+
+ inputInfo.all_devices = &xi_all_devices;
+ inputInfo.all_master_devices = &xi_all_master_devices;
} else {
FatalError("IExtensionInit: AddExtensions failed\n");
}
}
+