Hook up the ownership events
This patch applies most of the protocol conversions and the internal event type for ownership events. Note that ownership events are generated by the DIX only, they do not pass through the event queue. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
3390d3fc03
commit
93c2a1628a
20
Xi/extinit.c
20
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:
|
||||
|
|
|
@ -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;
|
||||
|
@ -721,6 +726,27 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
|||
return Success;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user