diff options
Diffstat (limited to 'xorg-server/dix/events.c')
-rw-r--r-- | xorg-server/dix/events.c | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 42f7c1b06..9c15ad429 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -152,6 +152,7 @@ typedef const char *string; #include "eventstr.h" #include "enterleave.h" #include "eventconvert.h" +#include "mi.h" /* Extension events type numbering starts at EXTENSION_EVENT_BASE. */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ @@ -1118,13 +1119,14 @@ NoticeEventTime(InternalEvent *ev) void EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) { - QdEventPtr tail; + QdEventPtr tail = NULL; QdEventPtr qe; SpritePtr pSprite = device->spriteInfo->sprite; int eventlen; DeviceEvent *event = &ev->device_event; - tail = list_last_entry(&syncEvents.pending, QdEventRec, next); + if (!list_is_empty(&syncEvents.pending)) + tail = list_last_entry(&syncEvents.pending, QdEventRec, next); NoticeTime((InternalEvent*)event); @@ -1311,7 +1313,17 @@ ComputeFreezes(void) event->root_x, event->root_y); if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) { - if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) + if (IsTouchEvent((InternalEvent*)event)) + { + InternalEvent *events = InitEventList(GetMaximumEventsNum()); + int i, nev; + TouchPointInfoPtr ti = TouchFindByClientID(replayDev, event->touchid); + BUG_WARN(!ti); + nev = GetTouchOwnershipEvents(events, replayDev, ti, XIRejectTouch, ti->listeners[0].listener, 0); + for (i = 0; i < nev; i++) + mieqProcessDeviceEvent(replayDev, events + i, NULL); + ProcessInputEvents(); + } else if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); else DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, @@ -1516,6 +1528,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse) Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); + TouchRemovePointerGrab(mouse); + mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.sync.state = NOT_GRABBED; @@ -2466,6 +2480,9 @@ FixUpEventFromWindow( case XI_RawButtonPress: case XI_RawButtonRelease: case XI_RawMotion: + case XI_RawTouchBegin: + case XI_RawTouchUpdate: + case XI_RawTouchEnd: case XI_DeviceChanged: case XI_HierarchyChanged: case XI_PropertyEvent: @@ -2476,6 +2493,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); @@ -2984,6 +3008,9 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) case ET_ButtonPress: case ET_ButtonRelease: case ET_Motion: + case ET_TouchBegin: + case ET_TouchUpdate: + case ET_TouchEnd: break; default: /* all other events return FALSE */ @@ -3636,11 +3663,15 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) * @param device The device of the event to check. * @param grab The grab to check. * @param event The current device event. + * @param real_event The original event, in case of touch emulation. The + * real event is the one stored in the sync queue. * * @return Whether the grab has been activated. */ Bool -ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event) +ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, + InternalEvent *real_event) + { SpritePtr pSprite = device->spriteInfo->sprite; GrabInfoPtr grabinfo = &device->deviceGrab; @@ -3712,7 +3743,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event) if (grabinfo->sync.state == FROZEN_NO_EVENT) grabinfo->sync.state = FROZEN_WITH_EVENT; - *grabinfo->sync.event = event->device_event; + *grabinfo->sync.event = real_event->device_event; free(xE); return TRUE; @@ -3818,6 +3849,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, DeviceIntPtr gdev; XkbSrvInfoPtr xkbi = NULL; enum MatchFlags match = 0; + int emulated_type = 0; gdev = grab->modifierDevice; if (grab->grabtype == CORE) @@ -3839,13 +3871,26 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; /* Check for XI2 and XI grabs first */ - match = MatchForType(grab, tempGrab, XI2, GetXI2Type(event->any.type)); + match = MatchForType(grab, tempGrab, XI2, event->any.type); + + if (!match && IsTouchEvent(event) && (event->device_event.flags & TOUCH_POINTER_EMULATED)) + { + emulated_type = TouchGetPointerEventType(event); + match = MatchForType(grab, tempGrab, XI2, emulated_type); + } if (!match) - match = MatchForType(grab, tempGrab, XI, GetXIType(event->any.type)); + match = MatchForType(grab, tempGrab, XI, event->any.type); + + if (!match && emulated_type) + match = MatchForType(grab, tempGrab, XI, emulated_type); if (!match && checkCore) - match = MatchForType(grab, tempGrab, CORE, GetCoreType(event->any.type)); + { + match = MatchForType(grab, tempGrab, CORE, event->any.type); + if (!match && emulated_type) + match = MatchForType(grab, tempGrab, CORE, emulated_type); + } if (!match || (grab->confineTo && (!grab->confineTo->realized || @@ -3919,6 +3964,8 @@ CheckPassiveGrabsOnWindow( break; case ET_ButtonPress: case ET_ButtonRelease: + case ET_TouchBegin: + case ET_TouchEnd: tempGrab->detail.exact = event->device_event.detail.button; break; default: @@ -3936,7 +3983,7 @@ CheckPassiveGrabsOnWindow( if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab)) continue; - if (activate && !ActivatePassiveGrab(device, grab, event)) + if (activate && !ActivatePassiveGrab(device, grab, event, event)) continue; break; @@ -4151,8 +4198,8 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel l if (rc == Success) { int evtype = xi2_get_type(xE); - mask = xi2mask_isset(grab->xi2mask, dev, evtype); - filter = 1; + mask = GetXI2MaskByte(grab->xi2mask, dev, evtype); + filter = GetEventFilter(dev, xE); } break; case XI: |