Skip to content

Add KeySequenceRecorder as base for KKeySequenceWidget and KeySequenceItem

David Redondo requested to merge work/davidre/keysequencerecorder into master

Currently we have two copies of the shortcut recording logic: One in KKeySequenceWidget and the other one in the helper of KeySequenceItem. They are mostly straight copies but there are slight differences. This situation is naturally prone to divergence between both. If a bug is fixed in one, the fix needs to be ported to the other one. If a need feature is added it has to be added to both. Facing this situation when wanting to add support for the shortcut inhibit protocol on Wayland, I decided to abstact the recording logic out and make both use it, instead of adding more duplicated code. On X we can grab the keyboard while recording to prevent shortcuts from being triggered but we can't do that on Wayland and the Compositor will trigger shortcuts when the user actually wants to reassign them. Depending on the platform, this new class will either grab the keyboard or inhibit shortcuts on the window that is passsed to it. The recording logic is copied out of KKeySequenceWidget and stays the same but is cleaned up a bit inside the methods for in my opinion better readability. CCBUG:407395

Edited by David Redondo

Merge request reports