Global shortcuts should not send keyrelease event to app with focus (Re: KStandardAction::rename ?)

David Faure faure at kde.org
Sun Feb 19 10:21:18 UTC 2017


On dimanche 19 février 2017 10:33:31 CET René J.V. Bertin wrote:
> Hello,
> 
> A while back I ran into a situation where a custom shortcut (F2 for lowering
> the window having focus) also triggered a rename action in KDevelop:
> https://phabricator.kde.org/D1523
> 
> The idea came up on that ticket to provide a central definition for
> shortcuts like that, e.g. KStandardAction::rename . Has such an idea ever
> be considered?

KStandardAction::renameFile(), with default shortcut F2, already exists.
Apparently the naming is a bit too file-manager oriented, but this is the 
standard rename action. This is however totally unrelated to the "also 
triggers" problem you're mentioning. Retitling ;)

> The underlying issue here is probably that the custom KWin shortcut is
> defined through kglobalaccel (on a Plasma4 desktop) and that the keystroke
> isn't eaten but propagated to the (KF5) application having focus. Shouldn't
> it be configurable whether a custom keystroke is propagated or not?

I don't see why this should be "configurable".

I would expect global shortcuts to never propagate to the window with focus.

Let's test.
I ran the test application attached, then typed Ctrl+Alt+K (global shortcut 
for changing the keyboard layout) (this is a better example than Alt+F2 to pop 
up krunner because that steals focus anyway).

Result: the test app shows the keypress events for Ctrl and Alt (obviously),
it does not show the keypress for K (good, this matches my expectation),
BUT when I release K, the app receives a key *RELEASE* event for Key_K.

Martin, is this a bug and is it fixable?

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qapp_keyboardmodifiers.cpp
Type: text/x-c++src
Size: 792 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170219/8e661ab5/attachment.cpp>


More information about the Kde-frameworks-devel mailing list