diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-08 14:59:06 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-13 13:24:08 +1000 |
commit | cd56bd7b3ee34a4b10eb3a57a6e94cac7512167a (patch) | |
tree | ac0416985e6dfae06440bb454cd474333487bd80 | |
parent | 47734b2ba2e1f9246fd1a3b7059ca60b0e15acb2 (diff) |
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>
-rw-r--r-- | Xi/exevents.c | 8 | ||||
-rw-r--r-- | dix/grabs.c | 17 | ||||
-rw-r--r-- | include/dixgrabs.h | 2 |
3 files changed, 21 insertions, 6 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 874759959..405a8b1a0 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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; diff --git a/dix/grabs.c b/dix/grabs.c index aced130a7..0157b785a 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -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); +} diff --git a/include/dixgrabs.h b/include/dixgrabs.h index 65ff45d1d..ea8877072 100644 --- a/include/dixgrabs.h +++ b/include/dixgrabs.h @@ -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 */ |