Add GrabIsPointerGrab and GrabIsKeyboardGrab helpers

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Peter Hutterer 2011-12-08 14:59:06 +10:00
parent 47734b2ba2
commit cd56bd7b3e
3 changed files with 21 additions and 6 deletions

View File

@ -1001,9 +1001,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
case ET_KeyRelease:
if (grab && device->deviceGrab.fromPassiveGrab &&
(key == device->deviceGrab.activatingKey) &&
(device->deviceGrab.grab->type == KeyPress ||
device->deviceGrab.grab->type == DeviceKeyPress ||
device->deviceGrab.grab->type == XI_KeyPress))
GrabIsKeyboardGrab(device->deviceGrab.grab))
deactivateDeviceGrab = TRUE;
break;
case ET_ButtonPress:
@ -1023,9 +1021,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
event->detail.button = b->map[key];
if (grab && !b->buttonsDown &&
device->deviceGrab.fromPassiveGrab &&
(device->deviceGrab.grab->type == ButtonPress ||
device->deviceGrab.grab->type == DeviceButtonPress ||
device->deviceGrab.grab->type == XI_ButtonPress))
GrabIsPointerGrab(device->deviceGrab.grab))
deactivateDeviceGrab = TRUE;
default:
break;

View File

@ -60,6 +60,7 @@ SOFTWARE.
#include "dixgrabs.h"
#include "xace.h"
#include "exevents.h"
#include "exglobals.h"
#include "inpututils.h"
#define BITMASK(i) (((Mask)1) << ((i) & 31))
@ -737,3 +738,19 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
#undef UPDATE
}
Bool
GrabIsPointerGrab(GrabPtr grab)
{
return (grab->type == ButtonPress ||
grab->type == DeviceButtonPress ||
grab->type == XI_ButtonPress);
}
Bool
GrabIsKeyboardGrab(GrabPtr grab)
{
return (grab->type == KeyPress ||
grab->type == DeviceKeyPress ||
grab->type == XI_KeyPress);
}

View File

@ -64,4 +64,6 @@ extern _X_EXPORT int AddPassiveGrabToList(
extern _X_EXPORT Bool DeletePassiveGrabFromList(
GrabPtr /* pMinuendGrab */);
extern Bool GrabIsPointerGrab(GrabPtr grab);
extern Bool GrabIsKeyboardGrab(GrabPtr grab);
#endif /* DIXGRABS_H */