Index: xorg-server-1.16.3/dix/events.c =================================================================== --- xorg-server-1.16.3.orig/dix/events.c +++ xorg-server-1.16.3/dix/events.c @@ -1586,28 +1586,36 @@ DeactivatePointerGrab(DeviceIntPtr mouse } TouchRemovePointerGrab(mouse); - + if (grab!=mouse->deviceGrab.grab) { + fprintf(stderr, "Pointer Grab changed by touch functions (%p -> %p)\n", grab, mouse->deviceGrab.grab); + grab = mouse->deviceGrab.grab; + } mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.fromPassiveGrab = FALSE; - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev->deviceGrab.sync.other == grab) - dev->deviceGrab.sync.other = NullGrab; + if (grab != NullGrab) { + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev->deviceGrab.sync.other == grab) + dev->deviceGrab.sync.other = NullGrab; + } + DoEnterLeaveEvents(mouse, mouse->id, grab->window, + mouse->spriteInfo->sprite->win, NotifyUngrab); + if (grab->confineTo) + ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); + PostNewCursor(mouse); + + if (!wasImplicit && grab->grabtype == XI2) + ReattachToOldMaster(mouse); + + ComputeFreezes(); + + FreeGrab(grab); + } else { + PostNewCursor(mouse); + ComputeFreezes(); } - DoEnterLeaveEvents(mouse, mouse->id, grab->window, - mouse->spriteInfo->sprite->win, NotifyUngrab); - if (grab->confineTo) - ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); - PostNewCursor(mouse); - - if (!wasImplicit && grab->grabtype == XI2) - ReattachToOldMaster(mouse); - - ComputeFreezes(); - - FreeGrab(grab); } /**