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

René J.V. Bertin rjvbertin at gmail.com
Sun Feb 19 11:17:29 UTC 2017


On Sunday February 19 2017 11:21:18 David Faure wrote:

> 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. 

Indeed, I noticed it after hitting send. It's new in KF5 though, at least I'm not seeing it in the kglobalaccel4 config pages.
CC Milian.

> 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).

Any shortcut for raising or lowering windows would be a good example too.

> 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.

IIRC that's exactly what I'm seeing. I presume this is because shortcuts are typically handled at KeyPress, not KeyRelease. There are situations where that practice is debatable but most of the time it's what you'd expect, and if shortcuts are handled at KeyPress only the propagated KeyRelease "echo event" shouldn't trigger anything in the application having the focus window. Right?

I'll check KDevelop for handling KeyRelease events (if Milian doesn't beat me to it).

R.


More information about the Kde-frameworks-devel mailing list