diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-11-11 09:03:17 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-11-11 09:03:17 +0000 |
commit | 79250ad1e2b76f2ba5aa8d6dc0134c6c07ceac3a (patch) | |
tree | 6d31264b9d5ca7fc0d7c690ef6a3340917c949e4 /xserver/mi/mieq.c | |
parent | 0c0a487400d29e7404b66758c41ad54ee01d46ee (diff) |
Update to xserver 21.1.0
Diffstat (limited to 'xserver/mi/mieq.c')
-rw-r--r-- | xserver/mi/mieq.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/xserver/mi/mieq.c b/xserver/mi/mieq.c index 555f0ec7e..c98d46862 100644 --- a/xserver/mi/mieq.c +++ b/xserver/mi/mieq.c @@ -87,6 +87,8 @@ typedef struct _EventQueue { static EventQueueRec miEventQueue; +static CallbackListPtr miCallbacksWhenDrained = NULL; + static size_t mieqNumEnqueued(EventQueuePtr eventQueue) { @@ -126,11 +128,13 @@ mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents) /* First copy the existing events */ first_hunk = eventQueue->nevents - eventQueue->head; - memcpy(new_events, - &eventQueue->events[eventQueue->head], - first_hunk * sizeof(EventRec)); - memcpy(&new_events[first_hunk], - eventQueue->events, eventQueue->head * sizeof(EventRec)); + if (eventQueue->events) { + memcpy(new_events, + &eventQueue->events[eventQueue->head], + first_hunk * sizeof(EventRec)); + memcpy(&new_events[first_hunk], + eventQueue->events, eventQueue->head * sizeof(EventRec)); + } /* Initialize the new portion */ for (i = eventQueue->nevents; i < new_nevents; i++) { @@ -289,7 +293,7 @@ mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool set_dequeue_screen) void mieqSetHandler(int event, mieqHandler handler) { - if (handler && miEventQueue.handlers[event]) + if (handler && miEventQueue.handlers[event] != handler) ErrorF("[mi] mieq: warning: overriding existing handler %p with %p for " "event %d\n", miEventQueue.handlers[event], handler, event); @@ -338,6 +342,14 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event) case ET_BarrierLeave: event->barrier_event.deviceid = dev->id; break; + case ET_GesturePinchBegin: + case ET_GesturePinchUpdate: + case ET_GesturePinchEnd: + case ET_GestureSwipeBegin: + case ET_GestureSwipeUpdate: + case ET_GestureSwipeEnd: + event->gesture_event.deviceid = dev->id; + break; default: ErrorF("[mi] Unknown event type (%d), cannot change id.\n", event->any.type); @@ -563,5 +575,21 @@ mieqProcessInputEvents(void) inProcessInputEvents = FALSE; + CallCallbacks(&miCallbacksWhenDrained, NULL); + + input_unlock(); +} + +void mieqAddCallbackOnDrained(CallbackProcPtr callback, void *param) +{ + input_lock(); + AddCallback(&miCallbacksWhenDrained, callback, param); + input_unlock(); +} + +void mieqRemoveCallbackOnDrained(CallbackProcPtr callback, void *param) +{ + input_lock(); + DeleteCallback(&miCallbacksWhenDrained, callback, param); input_unlock(); } |