On Mon, Mar 03, 2014 at 02:18:29PM +0000, Daniel Stone wrote: > Hi, > > On 3 March 2014 05:44, Peter Hutterer <[email protected]> wrote: > > 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. > > This and 3/4 look fine to me, but the consting of StateNotify is > pretty incongruous. Any reason why that was done?
an earlier version of this fix re-used the event struct for all devices, that was before I factored everything out into functions. I'm fine to drop it, it doesn't hurt either way IMO. Cheers, Peter > > > Signed-off-by: Peter Hutterer <[email protected]> > > --- > > dix/devices.c | 3 +++ > > include/xkbsrv.h | 4 ++++ > > xkb/xkbActions.c | 20 ++++++++++++++++++++ > > 3 files changed, 27 insertions(+) > > > > diff --git a/dix/devices.c b/dix/devices.c > > index 1c86d52..ab923d5 100644 > > --- a/dix/devices.c > > +++ b/dix/devices.c > > @@ -416,6 +416,8 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) > > XISendDeviceHierarchyEvent(flags); > > } > > > > + if (!IsMaster(dev)) > > + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); > > RecalculateMasterButtons(dev); > > > > /* initialise an idle timer for this device*/ > > @@ -2649,6 +2651,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, > > DeviceIntPtr master) > > dev->spriteInfo->paired = master; > > dev->spriteInfo->spriteOwner = FALSE; > > > > + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); > > RecalculateMasterButtons(master); > > } > > > > diff --git a/include/xkbsrv.h b/include/xkbsrv.h > > index 0299327..5c5459f 100644 > > --- a/include/xkbsrv.h > > +++ b/include/xkbsrv.h > > @@ -638,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* > > dev */ , > > DeviceEvent * /* event */ > > ); > > > > +extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */, > > + int /* evtype */, > > + int /* key */); > > + > > extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ , > > unsigned long /* change */ , > > unsigned long /* newValues > > */ , > > diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c > > index 9a257f5..17f2807 100644 > > --- a/xkb/xkbActions.c > > +++ b/xkb/xkbActions.c > > @@ -1176,6 +1176,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 = _XkbWantStateNotify(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; > > @@ -1329,6 +1348,7 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, > > DeviceEvent *event) > > } > > > > _XkbApplyState(dev, genStateNotify, event->type, key); > > + XkbPushLockedStateToSlaves(dev, event->type, key); > > } > > > > int > > -- > > 1.8.4.2 > > > > _______________________________________________ > > [email protected]: X.Org development > > Archives: http://lists.x.org/archives/xorg-devel > > Info: http://lists.x.org/mailman/listinfo/xorg-devel _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
