dix: Extract FreezeThisEventIfNeededForSyncGrab()
This commit is contained in:
parent
36f8dacc06
commit
f5220117e9
49
dix/events.c
49
dix/events.c
|
@ -4256,7 +4256,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
GrabPtr grab;
|
GrabPtr grab;
|
||||||
GrabInfoPtr grabinfo;
|
GrabInfoPtr grabinfo;
|
||||||
int deliveries = 0;
|
int deliveries = 0;
|
||||||
DeviceIntPtr dev;
|
|
||||||
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
||||||
BOOL sendCore = FALSE;
|
BOOL sendCore = FALSE;
|
||||||
|
|
||||||
|
@ -4304,30 +4303,40 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
event->any.type == ET_KeyRelease ||
|
event->any.type == ET_KeyRelease ||
|
||||||
event->any.type == ET_ButtonPress ||
|
event->any.type == ET_ButtonPress ||
|
||||||
event->any.type == ET_ButtonRelease)) {
|
event->any.type == ET_ButtonRelease)) {
|
||||||
switch (grabinfo->sync.state) {
|
FreezeThisEventIfNeededForSyncGrab(thisDev, event);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return deliveries;
|
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 function is used to set the key pressed or key released state -
|
||||||
this is only used when the pressing of keys does not cause
|
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.
|
the device's processInputProc to be called, as in for example Mouse Keys.
|
||||||
|
|
|
@ -449,6 +449,10 @@ DeliverGrabbedEvent(InternalEvent * /* event */ ,
|
||||||
DeviceIntPtr /* thisDev */ ,
|
DeviceIntPtr /* thisDev */ ,
|
||||||
Bool /* deactivateGrab */ );
|
Bool /* deactivateGrab */ );
|
||||||
|
|
||||||
|
extern void
|
||||||
|
FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev,
|
||||||
|
InternalEvent *event);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
FixKeyState(DeviceEvent * /* event */ ,
|
FixKeyState(DeviceEvent * /* event */ ,
|
||||||
DeviceIntPtr /* keybd */ );
|
DeviceIntPtr /* keybd */ );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user