Support enabling numlock on startup
ClosedPublic

Authored by graesslin on Oct 25 2018, 5:53 PM.

Details

Summary

This change brings improved num lock support to KWin. The modifier state
is read and also mapped to Qt::KeyboardModifiers. Furthermore the input
config is read and the NumLock key is evaluated. If the requested state
does not match the current num lock state the state is swapped.

BUG: 375708
FIXED-IN: 5.15

Test Plan

New unit test added, no manual test due to lack of hardware

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Oct 25 2018, 5:53 PM
Restricted Application added a project: KWin. · View Herald TranscriptOct 25 2018, 5:53 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
graesslin requested review of this revision.Oct 25 2018, 5:53 PM
stikonas accepted this revision.EditedOct 25 2018, 6:03 PM
stikonas added a subscriber: stikonas.

I tested this patch and it works for me.

Code looks good too.

This revision is now accepted and ready to land.Oct 25 2018, 6:03 PM
davidedmundson added inline comments.
xkb.cpp
259

The documentation in the UI says this will be "on plasma startup"

This code seems to set it whenever there's a reconfigure, which is subtly different.

I don't mess with keyboards enough to be able to say whether this is a good feature or a change that will be annoying.

graesslin added inline comments.Oct 26 2018, 4:43 PM
xkb.cpp
259

I don't mess with keyboards enough to be able to say whether this is a good feature or a change that will be annoying.

Me neither. I was aware of the difference. My first code for this was also with a tracker whether it's first run or not. I didn't really like the code and it would have required some nasty env variables to make it testable. In the end I decided against it as only a reconfigure from the kcm can trigger this code path. Given that I thought it was acceptable that it turns the num lock on.

I would vote for if we get bug reports for it we do the ugly code.

stikonas added a comment.EditedOct 26 2018, 7:36 PM

I don't mess with keyboards enough to be able to say whether this is a good feature or a change that will be annoying.

I doubt that we can call it a good feature. Numlock turns on when I press turn off numlock on startup in the system settings. But at least it's an improvement over what we had before when numlock setting was ignored during the startup.

graesslin updated this revision to Diff 44317.Oct 27 2018, 4:38 PM

Only evaluate on startup

romangg accepted this revision.Oct 29 2018, 9:19 AM
davidedmundson accepted this revision.Oct 31 2018, 4:05 PM
This revision was automatically updated to reflect the committed changes.