summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-02-26 16:20:08 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-03-11 17:43:34 +1000
commit45fb3a934dc0db51584aba37c2f9d73deff9191d (patch)
tree4f79790f2247c7ec67dedb864322e40c497416c6 /xkb
parent656841798c99bcd79da47c03ec666a48b855541f (diff)
xkb: push locked modifier state down to attached slave devices
Whenever the master changes, push the locked modifier state to the attached slave devices, then update the indicators. This way, when NumLock or CapsLock are hit on any device, the LED will light up on all devices. Likewise, a new keyboard attached to a master device will light up with the correct indicators. The indicators are handled per-keyboard, depending on the layout, i.e. if one keyboard has grp_led:num set, the NumLock LED won't light up on that keyboard. 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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 7e5512c1e..c44f44bc1 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1174,6 +1174,25 @@ _XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key)
}
void
+XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key)
+{
+ DeviceIntPtr dev;
+ Bool genStateNotify;
+
+ nt_list_for_each_entry(dev, inputInfo.devices, next) {
+ if (!dev->key || GetMaster(dev, MASTER_KEYBOARD) != master)
+ continue;
+
+ genStateNotify = _XkbEnsureStateChange(dev->key->xkbInfo);
+
+ dev->key->xkbInfo->state.locked_mods =
+ master->key->xkbInfo->state.locked_mods;
+
+ _XkbApplyState(dev, genStateNotify, evtype, key);
+ }
+}
+
+void
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
{
int key, bit, i;
@@ -1327,6 +1346,7 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
}
_XkbApplyState(dev, genStateNotify, event->type, key);
+ XkbPushLockedStateToSlaves(dev, event->type, key);
}
int