[PATCH v2 1/4] xkb: factor out the StateNotify flag check
Peter Hutterer
peter.hutterer at who-t.net
Sun Mar 2 21:44:20 PST 2014
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
xkb/xkbActions.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 1443498..4497c65 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1127,6 +1127,24 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
return send;
}
+static int
+_XkbWantStateNotify(XkbSrvInfoPtr xkbi)
+{
+ Bool genStateNotify;
+
+ /* 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;
+
+ return genStateNotify;
+}
+
void
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
{
@@ -1146,15 +1164,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 = _XkbWantStateNotify(xkbi);
xkbi->clearMods = xkbi->setMods = 0;
xkbi->groupChange = 0;
--
1.8.4.2
More information about the xorg-devel
mailing list