diff options
-rw-r--r-- | dix/events.c | 49 | ||||
-rw-r--r-- | include/dix.h | 4 |
2 files changed, 33 insertions, 20 deletions
diff --git a/dix/events.c b/dix/events.c index 22880008a..1441cff25 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4256,7 +4256,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, GrabPtr grab; GrabInfoPtr grabinfo; int deliveries = 0; - DeviceIntPtr dev; SpritePtr pSprite = thisDev->spriteInfo->sprite; BOOL sendCore = FALSE; @@ -4304,30 +4303,40 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, event->any.type == ET_KeyRelease || event->any.type == ET_ButtonPress || event->any.type == ET_ButtonRelease)) { - switch (grabinfo->sync.state) { - case FREEZE_BOTH_NEXT_EVENT: - dev = GetPairedDevice(thisDev); - if (dev) { - FreezeThaw(dev, TRUE); - if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && - (CLIENT_BITS(grab->resource) == - CLIENT_BITS(dev->deviceGrab.grab->resource))) - dev->deviceGrab.sync.state = FROZEN_NO_EVENT; - else - dev->deviceGrab.sync.other = grab; - } - /* fall through */ - case FREEZE_NEXT_EVENT: - grabinfo->sync.state = FROZEN_WITH_EVENT; - FreezeThaw(thisDev, TRUE); - *grabinfo->sync.event = *event; - break; - } + FreezeThisEventIfNeededForSyncGrab(thisDev, event); } return deliveries; } +void +FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, InternalEvent *event) +{ + GrabInfoPtr grabinfo = &thisDev->deviceGrab; + GrabPtr grab = grabinfo->grab; + DeviceIntPtr dev; + + switch (grabinfo->sync.state) { + case FREEZE_BOTH_NEXT_EVENT: + dev = GetPairedDevice(thisDev); + if (dev) { + FreezeThaw(dev, TRUE); + if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && + (CLIENT_BITS(grab->resource) == + CLIENT_BITS(dev->deviceGrab.grab->resource))) + dev->deviceGrab.sync.state = FROZEN_NO_EVENT; + else + dev->deviceGrab.sync.other = grab; + } + /* fall through */ + case FREEZE_NEXT_EVENT: + grabinfo->sync.state = FROZEN_WITH_EVENT; + FreezeThaw(thisDev, TRUE); + *grabinfo->sync.event = *event; + break; + } +} + /* This function is used to set the key pressed or key released state - this is only used when the pressing of keys does not cause the device's processInputProc to be called, as in for example Mouse Keys. diff --git a/include/dix.h b/include/dix.h index 017be8a49..ece8b6f76 100644 --- a/include/dix.h +++ b/include/dix.h @@ -450,6 +450,10 @@ DeliverGrabbedEvent(InternalEvent * /* event */ , Bool /* deactivateGrab */ ); extern void +FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, + InternalEvent *event); + +extern void FixKeyState(DeviceEvent * /* event */ , DeviceIntPtr /* keybd */ ); |