From a7401945c4d133bcda29ba838ec966680e38d8bd Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 25 Feb 2025 19:43:28 +0100 Subject: [PATCH] dix: add prefix to grab state value defines make it a bit easier to diffenciate from other symbols by adding a prefix to their names. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- Xi/allowev.c | 12 ++++----- Xi/xiallowev.c | 12 ++++----- dix/events.c | 70 ++++++++++++++++++++++++------------------------ dix/input_priv.h | 18 ++++++------- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Xi/allowev.c b/Xi/allowev.c index 1700e72d0..0753a033c 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -101,22 +101,22 @@ ProcXAllowDeviceEvents(ClientPtr client) switch (stuff->mode) { case ReplayThisDevice: - AllowSome(client, time, thisdev, NOT_GRABBED); + AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED); break; case SyncThisDevice: - AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT); + AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT); break; case AsyncThisDevice: - AllowSome(client, time, thisdev, THAWED); + AllowSome(client, time, thisdev, GRAB_STATE_THAWED); break; case AsyncOtherDevices: - AllowSome(client, time, thisdev, THAW_OTHERS); + AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS); break; case SyncAll: - AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT); + AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT); break; case AsyncAll: - AllowSome(client, time, thisdev, THAWED_BOTH); + AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH); break; default: client->errorValue = stuff->mode; diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c index e6b2bea27..b9979a824 100644 --- a/Xi/xiallowev.c +++ b/Xi/xiallowev.c @@ -95,25 +95,25 @@ ProcXIAllowEvents(ClientPtr client) switch (stuff->mode) { case XIReplayDevice: - AllowSome(client, time, dev, NOT_GRABBED); + AllowSome(client, time, dev, GRAB_STATE_NOT_GRABBED); break; case XISyncDevice: - AllowSome(client, time, dev, FREEZE_NEXT_EVENT); + AllowSome(client, time, dev, GRAB_STATE_FREEZE_NEXT_EVENT); break; case XIAsyncDevice: - AllowSome(client, time, dev, THAWED); + AllowSome(client, time, dev, GRAB_STATE_THAWED); break; case XIAsyncPairedDevice: if (IsMaster(dev)) - AllowSome(client, time, dev, THAW_OTHERS); + AllowSome(client, time, dev, GRAB_STATE_THAW_OTHERS); break; case XISyncPair: if (IsMaster(dev)) - AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT); + AllowSome(client, time, dev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT); break; case XIAsyncPair: if (IsMaster(dev)) - AllowSome(client, time, dev, THAWED_BOTH); + AllowSome(client, time, dev, GRAB_STATE_THAWED_BOTH); break; case XIRejectTouch: case XIAcceptTouch: diff --git a/dix/events.c b/dix/events.c index 420375668..c8fd77ec8 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1318,7 +1318,7 @@ ComputeFreezes(void) for (dev = inputInfo.devices; dev; dev = dev->next) FreezeThaw(dev, dev->deviceGrab.sync.other || - (dev->deviceGrab.sync.state >= FROZEN)); + (dev->deviceGrab.sync.state >= GRAB_STATE_FROZEN)); if (syncEvents.playingEvents || (!replayDev && xorg_list_is_empty(&syncEvents.pending))) return; @@ -1420,9 +1420,9 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) DeviceIntPtr dev; if (thisMode == GrabModeSync) - thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; + thisDev->deviceGrab.sync.state = GRAB_STATE_FROZEN_NO_EVENT; else { /* free both if same client owns both */ - thisDev->deviceGrab.sync.state = THAWED; + thisDev->deviceGrab.sync.state = GRAB_STATE_THAWED; if (thisDev->deviceGrab.sync.other && (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) @@ -1660,7 +1660,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; - mouse->deviceGrab.sync.state = NOT_GRABBED; + mouse->deviceGrab.sync.state = GRAB_STATE_NOT_GRABBED; mouse->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { @@ -1752,7 +1752,7 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd) if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; keybd->deviceGrab.grab = NullGrab; - keybd->deviceGrab.sync.state = NOT_GRABBED; + keybd->deviceGrab.sync.state = GRAB_STATE_NOT_GRABBED; keybd->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { @@ -1805,37 +1805,37 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) otherGrabbed = TRUE; if (grabinfo->sync.other == devgrabinfo->grab) thisSynced = TRUE; - if (devgrabinfo->sync.state >= FROZEN) + if (devgrabinfo->sync.state >= GRAB_STATE_FROZEN) othersFrozen = TRUE; } } - if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) + if (!((thisGrabbed && grabinfo->sync.state >= GRAB_STATE_FROZEN) || thisSynced)) return; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabTime) == EARLIER)) return; switch (newState) { - case THAWED: /* Async */ + case GRAB_STATE_THAWED: /* Async */ if (thisGrabbed) - grabinfo->sync.state = THAWED; + grabinfo->sync.state = GRAB_STATE_THAWED; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); break; - case FREEZE_NEXT_EVENT: /* Sync */ + case GRAB_STATE_FREEZE_NEXT_EVENT: /* Sync */ if (thisGrabbed) { - grabinfo->sync.state = FREEZE_NEXT_EVENT; + grabinfo->sync.state = GRAB_STATE_FREEZE_NEXT_EVENT; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); } break; - case THAWED_BOTH: /* AsyncBoth */ + case GRAB_STATE_THAWED_BOTH: /* AsyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = THAWED; + devgrabinfo->sync.state = GRAB_STATE_THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; @@ -1843,12 +1843,12 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) ComputeFreezes(); } break; - case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ + case GRAB_STATE_FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; + devgrabinfo->sync.state = GRAB_STATE_FREEZE_BOTH_NEXT_EVENT; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; @@ -1856,8 +1856,8 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) ComputeFreezes(); } break; - case NOT_GRABBED: /* Replay */ - if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) { + case GRAB_STATE_NOT_GRABBED: /* Replay */ + if (thisGrabbed && grabinfo->sync.state == GRAB_STATE_FROZEN_WITH_EVENT) { if (thisSynced) grabinfo->sync.other = NullGrab; syncEvents.replayDev = thisDev; @@ -1866,14 +1866,14 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) syncEvents.replayDev = (DeviceIntPtr) NULL; } break; - case THAW_OTHERS: /* AsyncOthers */ + case GRAB_STATE_THAW_OTHERS: /* AsyncOthers */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = THAWED; + devgrabinfo->sync.state = GRAB_STATE_THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; @@ -1888,7 +1888,7 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) * we've handled in ComputeFreezes() (during DeactivateGrab) above, * anything else is accept. */ - if (newState != NOT_GRABBED /* Replay */ && + if (newState != GRAB_STATE_NOT_GRABBED /* Replay */ && IsTouchEvent(grabinfo->sync.event)) { TouchAcceptAndEnd(thisDev, grabinfo->sync.event->device_event.touchid); } @@ -1917,28 +1917,28 @@ ProcAllowEvents(ClientPtr client) switch (stuff->mode) { case ReplayPointer: - AllowSome(client, time, mouse, NOT_GRABBED); + AllowSome(client, time, mouse, GRAB_STATE_NOT_GRABBED); break; case SyncPointer: - AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); + AllowSome(client, time, mouse, GRAB_STATE_FREEZE_NEXT_EVENT); break; case AsyncPointer: - AllowSome(client, time, mouse, THAWED); + AllowSome(client, time, mouse, GRAB_STATE_THAWED); break; case ReplayKeyboard: - AllowSome(client, time, keybd, NOT_GRABBED); + AllowSome(client, time, keybd, GRAB_STATE_NOT_GRABBED); break; case SyncKeyboard: - AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); + AllowSome(client, time, keybd, GRAB_STATE_FREEZE_NEXT_EVENT); break; case AsyncKeyboard: - AllowSome(client, time, keybd, THAWED); + AllowSome(client, time, keybd, GRAB_STATE_THAWED); break; case SyncBoth: - AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); + AllowSome(client, time, keybd, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT); break; case AsyncBoth: - AllowSome(client, time, keybd, THAWED_BOTH); + AllowSome(client, time, keybd, GRAB_STATE_THAWED_BOTH); break; default: client->errorValue = stuff->mode; @@ -3819,8 +3819,8 @@ void ActivateGrabNoDelivery(DeviceIntPtr dev, GrabPtr grab, (*grabinfo->ActivateGrab) (dev, grab, ClientTimeToServerTime(event->any.time), TRUE); - if (grabinfo->sync.state == FROZEN_NO_EVENT) - grabinfo->sync.state = FROZEN_WITH_EVENT; + if (grabinfo->sync.state == GRAB_STATE_FROZEN_NO_EVENT) + grabinfo->sync.state = GRAB_STATE_FROZEN_WITH_EVENT; CopyPartialInternalEvent(grabinfo->sync.event, real_event); } @@ -4386,20 +4386,20 @@ FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, InternalEvent *event) DeviceIntPtr dev; switch (grabinfo->sync.state) { - case FREEZE_BOTH_NEXT_EVENT: + case GRAB_STATE_FREEZE_BOTH_NEXT_EVENT: dev = GetPairedDevice(thisDev); if (dev) { FreezeThaw(dev, TRUE); - if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && + if ((dev->deviceGrab.sync.state == GRAB_STATE_FREEZE_BOTH_NEXT_EVENT) && (CLIENT_BITS(grab->resource) == CLIENT_BITS(dev->deviceGrab.grab->resource))) - dev->deviceGrab.sync.state = FROZEN_NO_EVENT; + dev->deviceGrab.sync.state = GRAB_STATE_FROZEN_NO_EVENT; else dev->deviceGrab.sync.other = grab; } /* fall through */ - case FREEZE_NEXT_EVENT: - grabinfo->sync.state = FROZEN_WITH_EVENT; + case GRAB_STATE_FREEZE_NEXT_EVENT: + grabinfo->sync.state = GRAB_STATE_FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); CopyPartialInternalEvent(grabinfo->sync.event, event); break; diff --git a/dix/input_priv.h b/dix/input_priv.h index 1694bd1af..65766dc52 100644 --- a/dix/input_priv.h +++ b/dix/input_priv.h @@ -296,15 +296,15 @@ void ActivateGrabNoDelivery(DeviceIntPtr dev, /* states for device grabs */ -#define NOT_GRABBED 0 -#define THAWED 1 -#define THAWED_BOTH 2 /* not a real state */ -#define FREEZE_NEXT_EVENT 3 -#define FREEZE_BOTH_NEXT_EVENT 4 -#define FROZEN 5 /* any state >= has device frozen */ -#define FROZEN_NO_EVENT 5 -#define FROZEN_WITH_EVENT 6 -#define THAW_OTHERS 7 +#define GRAB_STATE_NOT_GRABBED 0 +#define GRAB_STATE_THAWED 1 +#define GRAB_STATE_THAWED_BOTH 2 /* not a real state */ +#define GRAB_STATE_FREEZE_NEXT_EVENT 3 +#define GRAB_STATE_FREEZE_BOTH_NEXT_EVENT 4 +#define GRAB_STATE_FROZEN 5 /* any state >= has device frozen */ +#define GRAB_STATE_FROZEN_NO_EVENT 5 +#define GRAB_STATE_FROZEN_WITH_EVENT 6 +#define GRAB_STATE_THAW_OTHERS 7 /** * Masks specifying the type of event to deliver for an InternalEvent; used