summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xi/extinit.c20
-rw-r--r--dix/eventconvert.c27
-rw-r--r--dix/events.c7
-rw-r--r--include/events.h1
-rw-r--r--include/eventstr.h20
-rw-r--r--mi/mieq.c3
6 files changed, 78 insertions, 0 deletions
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 0b7bc3424..a81c8f1ff 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -829,6 +829,22 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
swaps(&to->valuators_len);
}
+static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
+ xXITouchOwnershipEvent *to)
+{
+ *to = *from;
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swaps(&to->sourceid);
+ swapl(&to->touchid);
+ swapl(&to->flags);
+ swapl(&to->root);
+ swapl(&to->event);
+ swapl(&to->child);
+}
/** Event swapping function for XI2 events. */
void
@@ -863,6 +879,10 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
case XI_TouchEnd:
SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
break;
+ case XI_TouchOwnership:
+ STouchOwnershipEvent((xXITouchOwnershipEvent*)from,
+ (xXITouchOwnershipEvent*)to);
+ break;
case XI_RawMotion:
case XI_RawKeyPress:
case XI_RawKeyRelease:
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 582769ad8..017c87190 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -58,6 +58,7 @@ static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
static int eventToRawEvent(RawDeviceEvent *ev, xEvent **xi);
+static int eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi);
/* Do not use, read comments below */
BOOL EventIsKeyRepeat(xEvent *event);
@@ -164,6 +165,7 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
case ET_TouchBegin:
case ET_TouchUpdate:
case ET_TouchEnd:
+ case ET_TouchOwnership:
ret = BadMatch;
break;
default:
@@ -220,6 +222,7 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
case ET_TouchBegin:
case ET_TouchUpdate:
case ET_TouchEnd:
+ case ET_TouchOwnership:
*count = 0;
*xi = NULL;
return BadMatch;
@@ -265,6 +268,8 @@ EventToXI2(InternalEvent *ev, xEvent **xi)
case ET_TouchUpdate:
case ET_TouchEnd:
return eventToDeviceEvent(&ev->device_event, xi);
+ case ET_TouchOwnership:
+ return eventToTouchOwnershipEvent(&ev->touch_ownership_event, xi);
case ET_ProximityIn:
case ET_ProximityOut:
*xi = NULL;
@@ -722,6 +727,27 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
}
static int
+eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
+{
+ int len = sizeof(xXITouchOwnershipEvent);
+ xXITouchOwnershipEvent *xtoe;
+
+ *xi = calloc(1, len);
+ xtoe = (xXITouchOwnershipEvent*)*xi;
+ xtoe->type = GenericEvent;
+ xtoe->extension = IReqCode;
+ xtoe->length = bytes_to_int32(len - sizeof(xEvent));
+ xtoe->evtype = GetXI2Type(ev->type);
+ xtoe->deviceid = ev->deviceid;
+ xtoe->time = ev->time;
+ xtoe->sourceid = ev->sourceid;
+ xtoe->touchid = ev->touchid;
+ xtoe->flags = 0; /* we don't have wire flags for ownership yet */
+
+ return Success;
+}
+
+static int
eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
{
xXIRawEvent* raw;
@@ -844,6 +870,7 @@ GetXI2Type(enum EventType type)
case ET_TouchBegin: xi2type = XI_TouchBegin; break;
case ET_TouchEnd: xi2type = XI_TouchEnd; break;
case ET_TouchUpdate: xi2type = XI_TouchUpdate; break;
+ case ET_TouchOwnership: xi2type = XI_TouchOwnership; break;
default:
break;
}
diff --git a/dix/events.c b/dix/events.c
index f80b8fddf..f8ea94f8e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2476,6 +2476,13 @@ FixUpEventFromWindow(
event->root = RootWindow(pSprite)->drawable.id;
event->event = pWin->drawable.id;
+
+ if (evtype == XI_TouchOwnership)
+ {
+ event->child = child;
+ return;
+ }
+
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
{
event->event_x = event->root_x - FP1616(pWin->drawable.x, 0);
diff --git a/include/events.h b/include/events.h
index 375173adc..222cc3d19 100644
--- a/include/events.h
+++ b/include/events.h
@@ -26,6 +26,7 @@
#define EVENTS_H
typedef struct _DeviceEvent DeviceEvent;
typedef struct _DeviceChangedEvent DeviceChangedEvent;
+typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
#if XFreeXDGA
typedef struct _DGAEvent DGAEvent;
#endif
diff --git a/include/eventstr.h b/include/eventstr.h
index 332307374..e4410a79f 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -53,6 +53,7 @@ enum EventType {
ET_TouchBegin,
ET_TouchUpdate,
ET_TouchEnd,
+ ET_TouchOwnership,
ET_Enter,
ET_Leave,
ET_FocusIn,
@@ -123,6 +124,24 @@ struct _DeviceEvent
uint32_t flags; /**< Flags to be copied into the generated event */
};
+/**
+ * Generated internally whenever a touch ownership chain changes - an owner
+ * has accepted or rejected a touch, or a grab/event selection in the delivery
+ * chain has been removed.
+ */
+struct _TouchOwnershipEvent
+{
+ unsigned char header; /**< Always ET_Internal */
+ enum EventType type; /**< One of EventType */
+ int length; /**< Length in bytes */
+ Time time; /**< Time in ms */
+ int deviceid; /**< Device to post this event for */
+ int sourceid; /**< The physical source device */
+ uint32_t touchid; /**< Touch ID (client_id) */
+ uint8_t reason; /**< ::XIAcceptTouch, ::XIRejectTouch */
+ uint32_t resource; /**< Provoking grab or event selection */
+ uint32_t flags; /**< Flags to be copied into the generated event */
+};
/* Flags used in DeviceChangedEvent to signal if the slave has changed */
#define DEVCHANGE_SLAVE_SWITCH 0x2
@@ -238,6 +257,7 @@ union _InternalEvent {
} any;
DeviceEvent device_event;
DeviceChangedEvent changed_event;
+ TouchOwnershipEvent touch_ownership_event;
#if XFreeXDGA
DGAEvent dga_event;
#endif
diff --git a/mi/mieq.c b/mi/mieq.c
index 8335289c5..ea8bcf044 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -375,6 +375,9 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent* event)
case ET_TouchEnd:
event->device_event.deviceid = dev->id;
break;
+ case ET_TouchOwnership:
+ event->touch_ownership_event.deviceid = dev->id;
+ break;
#if XFreeXDGA
case ET_DGAEvent:
break;