summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-02-26 16:03:19 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-03-11 17:43:34 +1000
commitdda2468e579762dbd1fed2c75b5587d98f841e9c (patch)
tree8b03ee96c5684e4eb70c5ed268a5b1e100730527 /xkb
parentfdb4ec86c29d85c1f68418a26e64bcc05b9c14ae (diff)
xkb: factor out the StateNotify flag check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkbActions.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 1443498f6..3da57f76e 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1127,6 +1127,22 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
return send;
}
+static int
+_XkbEnsureStateChange(XkbSrvInfoPtr xkbi)
+{
+ Bool genStateNotify = FALSE;
+
+ /* The state may change, so if we're not in the middle of sending a state
+ * notify, prepare for it */
+ if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
+ xkbi->prev_state = xkbi->state;
+ xkbi->flags |= _XkbStateNotifyInProgress;
+ genStateNotify = TRUE;
+ }
+
+ return genStateNotify;
+}
+
void
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
{
@@ -1146,15 +1162,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
keyc = kbd->key;
xkbi = keyc->xkbInfo;
key = event->detail.key;
- /* The state may change, so if we're not in the middle of sending a state
- * notify, prepare for it */
- if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
- xkbi->prev_state = xkbi->state;
- xkbi->flags |= _XkbStateNotifyInProgress;
- genStateNotify = TRUE;
- }
- else
- genStateNotify = FALSE;
+
+ genStateNotify = _XkbEnsureStateChange(xkbi);
xkbi->clearMods = xkbi->setMods = 0;
xkbi->groupChange = 0;