summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-02-26 16:16:10 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-03-11 17:43:34 +1000
commit656841798c99bcd79da47c03ec666a48b855541f (patch)
tree273d6cb567dbd409b2d841d49627127e5d0da218 /xkb
parentdda2468e579762dbd1fed2c75b5587d98f841e9c (diff)
xkb: factor out state update into a function
No functional changes 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.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 3da57f76e..7e5512c1e 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1143,13 +1143,43 @@ _XkbEnsureStateChange(XkbSrvInfoPtr xkbi)
return genStateNotify;
}
+static void
+_XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key)
+{
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ int changed;
+
+ XkbComputeDerivedState(xkbi);
+
+ changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
+ if (genStateNotify) {
+ if (changed) {
+ xkbStateNotify sn;
+
+ sn.keycode = key;
+ sn.eventType = evtype;
+ sn.requestMajor = sn.requestMinor = 0;
+ sn.changed = changed;
+ XkbSendStateNotify(dev, &sn);
+ }
+ xkbi->flags &= ~_XkbStateNotifyInProgress;
+ }
+
+ changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
+ if (changed) {
+ XkbEventCauseRec cause;
+ XkbSetCauseKey(&cause, key, evtype);
+ XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
+ }
+}
+
void
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
{
int key, bit, i;
XkbSrvInfoPtr xkbi;
KeyClassPtr keyc;
- int changed, sendEvent;
+ int sendEvent;
Bool genStateNotify;
XkbAction act;
XkbFilterPtr filter;
@@ -1296,28 +1326,7 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
FixKeyState(event, dev);
}
- XkbComputeDerivedState(xkbi);
- changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
- if (genStateNotify) {
- if (changed) {
- xkbStateNotify sn;
-
- sn.keycode = key;
- sn.eventType = event->type;
- sn.requestMajor = sn.requestMinor = 0;
- sn.changed = changed;
- XkbSendStateNotify(dev, &sn);
- }
- xkbi->flags &= ~_XkbStateNotifyInProgress;
- }
- changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
- if (changed) {
- XkbEventCauseRec cause;
-
- XkbSetCauseKey(&cause, key, event->type);
- XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
- }
- return;
+ _XkbApplyState(dev, genStateNotify, event->type, key);
}
int