https://bugs.kde.org/show_bug.cgi?id=407395
--- Comment #11 from David Redondo <k...@david-redondo.de> --- Git commit dca78412606f1ea0e66bcafe14dbd2ebf9836674 by David Redondo. Committed on 12/11/2020 at 15:52. Pushed by davidre into branch 'master'. Add KeySequenceRecorder as base for KKeySequenceWidget and KeySequenceItem 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. M +13 -2 CMakeLists.txt M +1 -0 autotests/CMakeLists.txt A +168 -0 autotests/keysequencerecordertest.cpp [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] A +27 -0 autotests/keysequencerecordertest.h [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] M +22 -0 src/CMakeLists.txt A +143 -0 src/recorder/keyboard-shortcuts-inhibit-unstable-v1.xml A +42 -0 src/recorder/keyboardgrabber.cpp [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] A +24 -0 src/recorder/keyboardgrabber_p.h [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] A +491 -0 src/recorder/keysequencerecorder.cpp [License: LGPL(v2.0+)] A +132 -0 src/recorder/keysequencerecorder.h [License: LGPL(v2.0+)] A +19 -0 src/recorder/shortcutinhibition_p.h [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] A +99 -0 src/recorder/waylandinhibition.cpp [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] A +31 -0 src/recorder/waylandinhibition_p.h [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)] https://invent.kde.org/frameworks/kguiaddons/commit/dca78412606f1ea0e66bcafe14dbd2ebf9836674 -- You are receiving this mail because: You are watching all bug changes.