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 <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1837>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-25 19:43:28 +01:00 committed by Marge Bot
parent 5f6cb45ac3
commit a7401945c4
4 changed files with 56 additions and 56 deletions

View File

@ -101,22 +101,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) { switch (stuff->mode) {
case ReplayThisDevice: case ReplayThisDevice:
AllowSome(client, time, thisdev, NOT_GRABBED); AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
break; break;
case SyncThisDevice: case SyncThisDevice:
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT); AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
break; break;
case AsyncThisDevice: case AsyncThisDevice:
AllowSome(client, time, thisdev, THAWED); AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
break; break;
case AsyncOtherDevices: case AsyncOtherDevices:
AllowSome(client, time, thisdev, THAW_OTHERS); AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
break; break;
case SyncAll: case SyncAll:
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT); AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
break; break;
case AsyncAll: case AsyncAll:
AllowSome(client, time, thisdev, THAWED_BOTH); AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
break; break;
default: default:
client->errorValue = stuff->mode; client->errorValue = stuff->mode;

View File

@ -95,25 +95,25 @@ ProcXIAllowEvents(ClientPtr client)
switch (stuff->mode) { switch (stuff->mode) {
case XIReplayDevice: case XIReplayDevice:
AllowSome(client, time, dev, NOT_GRABBED); AllowSome(client, time, dev, GRAB_STATE_NOT_GRABBED);
break; break;
case XISyncDevice: case XISyncDevice:
AllowSome(client, time, dev, FREEZE_NEXT_EVENT); AllowSome(client, time, dev, GRAB_STATE_FREEZE_NEXT_EVENT);
break; break;
case XIAsyncDevice: case XIAsyncDevice:
AllowSome(client, time, dev, THAWED); AllowSome(client, time, dev, GRAB_STATE_THAWED);
break; break;
case XIAsyncPairedDevice: case XIAsyncPairedDevice:
if (IsMaster(dev)) if (IsMaster(dev))
AllowSome(client, time, dev, THAW_OTHERS); AllowSome(client, time, dev, GRAB_STATE_THAW_OTHERS);
break; break;
case XISyncPair: case XISyncPair:
if (IsMaster(dev)) if (IsMaster(dev))
AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT); AllowSome(client, time, dev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
break; break;
case XIAsyncPair: case XIAsyncPair:
if (IsMaster(dev)) if (IsMaster(dev))
AllowSome(client, time, dev, THAWED_BOTH); AllowSome(client, time, dev, GRAB_STATE_THAWED_BOTH);
break; break;
case XIRejectTouch: case XIRejectTouch:
case XIAcceptTouch: case XIAcceptTouch:

View File

@ -1318,7 +1318,7 @@ ComputeFreezes(void)
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
FreezeThaw(dev, dev->deviceGrab.sync.other || FreezeThaw(dev, dev->deviceGrab.sync.other ||
(dev->deviceGrab.sync.state >= FROZEN)); (dev->deviceGrab.sync.state >= GRAB_STATE_FROZEN));
if (syncEvents.playingEvents || if (syncEvents.playingEvents ||
(!replayDev && xorg_list_is_empty(&syncEvents.pending))) (!replayDev && xorg_list_is_empty(&syncEvents.pending)))
return; return;
@ -1420,9 +1420,9 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
DeviceIntPtr dev; DeviceIntPtr dev;
if (thisMode == GrabModeSync) 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 */ 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 && if (thisDev->deviceGrab.sync.other &&
(CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource))) CLIENT_BITS(grab->resource)))
@ -1660,7 +1660,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
mouse->valuator->motionHintWindow = NullWindow; mouse->valuator->motionHintWindow = NullWindow;
mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.grab = NullGrab;
mouse->deviceGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.sync.state = GRAB_STATE_NOT_GRABBED;
mouse->deviceGrab.fromPassiveGrab = FALSE; mouse->deviceGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
@ -1752,7 +1752,7 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
if (keybd->valuator) if (keybd->valuator)
keybd->valuator->motionHintWindow = NullWindow; keybd->valuator->motionHintWindow = NullWindow;
keybd->deviceGrab.grab = NullGrab; keybd->deviceGrab.grab = NullGrab;
keybd->deviceGrab.sync.state = NOT_GRABBED; keybd->deviceGrab.sync.state = GRAB_STATE_NOT_GRABBED;
keybd->deviceGrab.fromPassiveGrab = FALSE; keybd->deviceGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
@ -1805,37 +1805,37 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
otherGrabbed = TRUE; otherGrabbed = TRUE;
if (grabinfo->sync.other == devgrabinfo->grab) if (grabinfo->sync.other == devgrabinfo->grab)
thisSynced = TRUE; thisSynced = TRUE;
if (devgrabinfo->sync.state >= FROZEN) if (devgrabinfo->sync.state >= GRAB_STATE_FROZEN)
othersFrozen = TRUE; othersFrozen = TRUE;
} }
} }
if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) if (!((thisGrabbed && grabinfo->sync.state >= GRAB_STATE_FROZEN) || thisSynced))
return; return;
if ((CompareTimeStamps(time, currentTime) == LATER) || if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, grabTime) == EARLIER)) (CompareTimeStamps(time, grabTime) == EARLIER))
return; return;
switch (newState) { switch (newState) {
case THAWED: /* Async */ case GRAB_STATE_THAWED: /* Async */
if (thisGrabbed) if (thisGrabbed)
grabinfo->sync.state = THAWED; grabinfo->sync.state = GRAB_STATE_THAWED;
if (thisSynced) if (thisSynced)
grabinfo->sync.other = NullGrab; grabinfo->sync.other = NullGrab;
ComputeFreezes(); ComputeFreezes();
break; break;
case FREEZE_NEXT_EVENT: /* Sync */ case GRAB_STATE_FREEZE_NEXT_EVENT: /* Sync */
if (thisGrabbed) { if (thisGrabbed) {
grabinfo->sync.state = FREEZE_NEXT_EVENT; grabinfo->sync.state = GRAB_STATE_FREEZE_NEXT_EVENT;
if (thisSynced) if (thisSynced)
grabinfo->sync.other = NullGrab; grabinfo->sync.other = NullGrab;
ComputeFreezes(); ComputeFreezes();
} }
break; break;
case THAWED_BOTH: /* AsyncBoth */ case GRAB_STATE_THAWED_BOTH: /* AsyncBoth */
if (othersFrozen) { if (othersFrozen) {
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
devgrabinfo = &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = THAWED; devgrabinfo->sync.state = GRAB_STATE_THAWED;
if (devgrabinfo->sync.other && if (devgrabinfo->sync.other &&
SameClient(devgrabinfo->sync.other, client)) SameClient(devgrabinfo->sync.other, client))
devgrabinfo->sync.other = NullGrab; devgrabinfo->sync.other = NullGrab;
@ -1843,12 +1843,12 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
ComputeFreezes(); ComputeFreezes();
} }
break; break;
case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ case GRAB_STATE_FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */
if (othersFrozen) { if (othersFrozen) {
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
devgrabinfo = &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) 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 if (devgrabinfo->sync.other
&& SameClient(devgrabinfo->sync.other, client)) && SameClient(devgrabinfo->sync.other, client))
devgrabinfo->sync.other = NullGrab; devgrabinfo->sync.other = NullGrab;
@ -1856,8 +1856,8 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
ComputeFreezes(); ComputeFreezes();
} }
break; break;
case NOT_GRABBED: /* Replay */ case GRAB_STATE_NOT_GRABBED: /* Replay */
if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) { if (thisGrabbed && grabinfo->sync.state == GRAB_STATE_FROZEN_WITH_EVENT) {
if (thisSynced) if (thisSynced)
grabinfo->sync.other = NullGrab; grabinfo->sync.other = NullGrab;
syncEvents.replayDev = thisDev; syncEvents.replayDev = thisDev;
@ -1866,14 +1866,14 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
syncEvents.replayDev = (DeviceIntPtr) NULL; syncEvents.replayDev = (DeviceIntPtr) NULL;
} }
break; break;
case THAW_OTHERS: /* AsyncOthers */ case GRAB_STATE_THAW_OTHERS: /* AsyncOthers */
if (othersFrozen) { if (othersFrozen) {
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev == thisDev) if (dev == thisDev)
continue; continue;
devgrabinfo = &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = THAWED; devgrabinfo->sync.state = GRAB_STATE_THAWED;
if (devgrabinfo->sync.other if (devgrabinfo->sync.other
&& SameClient(devgrabinfo->sync.other, client)) && SameClient(devgrabinfo->sync.other, client))
devgrabinfo->sync.other = NullGrab; 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, * we've handled in ComputeFreezes() (during DeactivateGrab) above,
* anything else is accept. * anything else is accept.
*/ */
if (newState != NOT_GRABBED /* Replay */ && if (newState != GRAB_STATE_NOT_GRABBED /* Replay */ &&
IsTouchEvent(grabinfo->sync.event)) { IsTouchEvent(grabinfo->sync.event)) {
TouchAcceptAndEnd(thisDev, grabinfo->sync.event->device_event.touchid); TouchAcceptAndEnd(thisDev, grabinfo->sync.event->device_event.touchid);
} }
@ -1917,28 +1917,28 @@ ProcAllowEvents(ClientPtr client)
switch (stuff->mode) { switch (stuff->mode) {
case ReplayPointer: case ReplayPointer:
AllowSome(client, time, mouse, NOT_GRABBED); AllowSome(client, time, mouse, GRAB_STATE_NOT_GRABBED);
break; break;
case SyncPointer: case SyncPointer:
AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); AllowSome(client, time, mouse, GRAB_STATE_FREEZE_NEXT_EVENT);
break; break;
case AsyncPointer: case AsyncPointer:
AllowSome(client, time, mouse, THAWED); AllowSome(client, time, mouse, GRAB_STATE_THAWED);
break; break;
case ReplayKeyboard: case ReplayKeyboard:
AllowSome(client, time, keybd, NOT_GRABBED); AllowSome(client, time, keybd, GRAB_STATE_NOT_GRABBED);
break; break;
case SyncKeyboard: case SyncKeyboard:
AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); AllowSome(client, time, keybd, GRAB_STATE_FREEZE_NEXT_EVENT);
break; break;
case AsyncKeyboard: case AsyncKeyboard:
AllowSome(client, time, keybd, THAWED); AllowSome(client, time, keybd, GRAB_STATE_THAWED);
break; break;
case SyncBoth: case SyncBoth:
AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); AllowSome(client, time, keybd, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
break; break;
case AsyncBoth: case AsyncBoth:
AllowSome(client, time, keybd, THAWED_BOTH); AllowSome(client, time, keybd, GRAB_STATE_THAWED_BOTH);
break; break;
default: default:
client->errorValue = stuff->mode; client->errorValue = stuff->mode;
@ -3819,8 +3819,8 @@ void ActivateGrabNoDelivery(DeviceIntPtr dev, GrabPtr grab,
(*grabinfo->ActivateGrab) (dev, grab, (*grabinfo->ActivateGrab) (dev, grab,
ClientTimeToServerTime(event->any.time), TRUE); ClientTimeToServerTime(event->any.time), TRUE);
if (grabinfo->sync.state == FROZEN_NO_EVENT) if (grabinfo->sync.state == GRAB_STATE_FROZEN_NO_EVENT)
grabinfo->sync.state = FROZEN_WITH_EVENT; grabinfo->sync.state = GRAB_STATE_FROZEN_WITH_EVENT;
CopyPartialInternalEvent(grabinfo->sync.event, real_event); CopyPartialInternalEvent(grabinfo->sync.event, real_event);
} }
@ -4386,20 +4386,20 @@ FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, InternalEvent *event)
DeviceIntPtr dev; DeviceIntPtr dev;
switch (grabinfo->sync.state) { switch (grabinfo->sync.state) {
case FREEZE_BOTH_NEXT_EVENT: case GRAB_STATE_FREEZE_BOTH_NEXT_EVENT:
dev = GetPairedDevice(thisDev); dev = GetPairedDevice(thisDev);
if (dev) { if (dev) {
FreezeThaw(dev, TRUE); 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(grab->resource) ==
CLIENT_BITS(dev->deviceGrab.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 else
dev->deviceGrab.sync.other = grab; dev->deviceGrab.sync.other = grab;
} }
/* fall through */ /* fall through */
case FREEZE_NEXT_EVENT: case GRAB_STATE_FREEZE_NEXT_EVENT:
grabinfo->sync.state = FROZEN_WITH_EVENT; grabinfo->sync.state = GRAB_STATE_FROZEN_WITH_EVENT;
FreezeThaw(thisDev, TRUE); FreezeThaw(thisDev, TRUE);
CopyPartialInternalEvent(grabinfo->sync.event, event); CopyPartialInternalEvent(grabinfo->sync.event, event);
break; break;

View File

@ -296,15 +296,15 @@ void ActivateGrabNoDelivery(DeviceIntPtr dev,
/* states for device grabs */ /* states for device grabs */
#define NOT_GRABBED 0 #define GRAB_STATE_NOT_GRABBED 0
#define THAWED 1 #define GRAB_STATE_THAWED 1
#define THAWED_BOTH 2 /* not a real state */ #define GRAB_STATE_THAWED_BOTH 2 /* not a real state */
#define FREEZE_NEXT_EVENT 3 #define GRAB_STATE_FREEZE_NEXT_EVENT 3
#define FREEZE_BOTH_NEXT_EVENT 4 #define GRAB_STATE_FREEZE_BOTH_NEXT_EVENT 4
#define FROZEN 5 /* any state >= has device frozen */ #define GRAB_STATE_FROZEN 5 /* any state >= has device frozen */
#define FROZEN_NO_EVENT 5 #define GRAB_STATE_FROZEN_NO_EVENT 5
#define FROZEN_WITH_EVENT 6 #define GRAB_STATE_FROZEN_WITH_EVENT 6
#define THAW_OTHERS 7 #define GRAB_STATE_THAW_OTHERS 7
/** /**
* Masks specifying the type of event to deliver for an InternalEvent; used * Masks specifying the type of event to deliver for an InternalEvent; used