diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2020-10-10 02:51:39 +0300 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-11-25 04:20:22 +0000 |
commit | f5220117e970a40c09babe199709bb2db69c4311 (patch) | |
tree | 6f55d8d4e9d42ac5e44b61da27d06b6d9bf24e3b /dix/events.c | |
parent | 36f8dacc0652ddc5657e70942269f1f9e22710c6 (diff) |
dix: Extract FreezeThisEventIfNeededForSyncGrab()
Diffstat (limited to 'dix/events.c')
-rw-r--r-- | dix/events.c | 49 |
1 files changed, 29 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. |