Bug 368989 - Alt+F4 shortcut works only with XWayland windows
Summary: Alt+F4 shortcut works only with XWayland windows
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.7.95
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D2945
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-18 11:27 UTC by Igor Poboiko
Modified: 2016-10-06 11:29 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.8.1
mgraesslin: ReviewRequest+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Poboiko 2016-09-18 11:27:55 UTC
The summary speaks for itself. Dolphin/Okular/Systemsettings (which, I assume, work natively with Wayland now) ignore Alt+F4 shortcut; while LyX (Qt4 version) and Chromium does work.

Funny thing, GTK applications (I checked GIMP and Inkscape) ignore it too. Does it mean that they run natively now?

Reproducible: Always
Comment 1 Tony 2016-09-21 08:47:08 UTC
Yep can confirm this one.
Comment 2 Stefano 2016-09-21 09:12:21 UTC
I think, more generally, all the shortcuts are ignored. Ctrl+T does not open a new tab, Ctrl+A does not select all the files, etc.
Comment 3 Stefano 2016-09-21 09:13:00 UTC
(In reply to Stefano from comment #2)
> I think, more generally, all the shortcuts are ignored. Ctrl+T does not open
> a new tab, Ctrl+A does not select all the files, etc.

Sorry, I was talking about Dolphin.
Comment 4 Martin Flöser 2016-10-04 07:29:02 UTC
@Stefano: your problem is in QtWayland 5.7.0 which will be fixed in 5.7.1

(In reply to Igor Poboiko from comment #0)
> The summary speaks for itself. Dolphin/Okular/Systemsettings (which, I
> assume, work natively with Wayland now) ignore Alt+F4 shortcut; while LyX
> (Qt4 version) and Chromium does work.
> 
> Funny thing, GTK applications (I checked GIMP and Inkscape) ignore it too.
> Does it mean that they run natively now?

Yes.

Can you close the windows through the user actions menu (e.g. Alt+F3 or right clicking window decoration)?
Comment 5 Igor Poboiko 2016-10-04 10:12:49 UTC
(In reply to Martin Gräßlin from comment #4)
> @Stefano: your problem is in QtWayland 5.7.0 which will be fixed in 5.7.1
> 
> (In reply to Igor Poboiko from comment #0)
> > The summary speaks for itself. Dolphin/Okular/Systemsettings (which, I
> > assume, work natively with Wayland now) ignore Alt+F4 shortcut; while LyX
> > (Qt4 version) and Chromium does work.
> > 
> > Funny thing, GTK applications (I checked GIMP and Inkscape) ignore it too.
> > Does it mean that they run natively now?
> 
> Yes.
> 
> Can you close the windows through the user actions menu (e.g. Alt+F3 or
> right clicking window decoration)?

Alt+F3 doesn't work either. But right-clicking on the decorations and using "Close" works fine.

Not all the shortcuts are being ignored. For Dolphin those are all the shortcuts involving modifier keys (Ctrl, Alt); for example, F1 shortcut works. However, the shortcuts that allow to navigate through the menubar (e.g Alt+F for "File") works! 
On the other hand, in Okular or Gwenview the Ctrl+O (for Open), Ctrl+Q (for Quit) shortcuts work; but not Alt+F3 or Alt+F4.
Comment 6 Martin Flöser 2016-10-04 10:55:14 UTC
> Alt+F3 doesn't work either. But right-clicking on the decorations and using "Close" works fine.

That's what I expected. I'll investigate. Unfortunately my kwin global shortcuts are currently completely broken, so I don't have them working for neither X11 nor Wayland windows...
Comment 7 Martin Flöser 2016-10-05 12:42:39 UTC
This is caused by the way how xkbcommon calculates the consumed modifiers. The Fx keys are part of the keysyms for vt switching (e.g. Ctrl+Alt+F4) thus just pressing F4 already consumes the modifiers Ctrl+Alt. For shortcut matching KWin now removes the consumed modifiers as it's documented in xkbcommon. So pressing Alt+F4 with consumed modifiers removed results in F4 which obviously doesn't trigger.

For more information on the issue (we are not the first one to hit it): https://bugs.freedesktop.org/show_bug.cgi?id=92818 and https://github.com/xkbcommon/libxkbcommon/issues/17

Apparently there is new API available, but no new xkbcommon released yet. Will have to try to workaround.
Comment 8 Martin Flöser 2016-10-05 12:47:55 UTC
Git commit 974abbfaef7c8880980a4b8ba2388691612ea71e by Martin Gräßlin.
Committed on 05/10/2016 at 12:43.
Pushed by graesslin into branch 'Plasma/5.8'.

[autotests/integration] Add test case for global shortcuts with Fx

New test which tries to trigger Alt+F3 which does not work due to the
behavior how xkbcommon calculates consumed modifers. The combination
Ctrl+Alt+F3 generates a keysym (vt switching) so just pressing F3
already consumes ctrl and alt modifier.

For more information see:
 * https://github.com/xkbcommon/libxkbcommon/issues/17
 * https://bugs.freedesktop.org/show_bug.cgi?id=92818

M  +33   -0    autotests/integration/globalshortcuts_test.cpp
M  +3    -1    useractions.h

http://commits.kde.org/kwin/974abbfaef7c8880980a4b8ba2388691612ea71e
Comment 9 Martin Flöser 2016-10-05 14:13:18 UTC
Possible workaround in https://phabricator.kde.org/D2945
Comment 10 Martin Flöser 2016-10-06 11:29:01 UTC
Git commit 421824b654a5301fe1c0ed97caded66936c91385 by Martin Gräßlin.
Committed on 06/10/2016 at 11:28.
Pushed by graesslin into branch 'Plasma/5.8'.

Workaround xkbcommon behavior concerning consumed modifiers

Summary:
If a key could be turned into a keysym with a modifier xkbcommon
considers the modifier as consumed even if not pressed.
E.g. Alt+F3 considers alt as consumed as there is a keysym gnerated with
Ctrl+Alt+F3 (vt switching).

This change tries to workaround the problem by ignoring the consumed
modifiers if there are more modifiers consumed than active. It's
possible that this will create regressions for other shortcuts - we need
to test it in the wild. Although this might cause regressions I'm aiming
for Plasma/5.8 branch with the change. It only affects Wayland and fixes
quite important shortcuts from window manager perspective (desktop
switching (ctrl+f1 to ctrl+f4), desktop grid (ctrl+f8), present windows
(ctrl+f9, ctrl+10), cube (ctrl+f11), user actions (alt+f3), close window
(alt+f4)). If it causes regressions they need to be fixed as well in the
Plasma/5.8 branch.

A new API entry point for xkbcommon was proposed, but is not yet merged
and there is no release with it yet. Once that is available the
workaround should get removed and replaced by the new API call.
FIXED-IN: 5.8.1

Test Plan: Going to restart session now with the change

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2945

M  +0    -1    autotests/integration/globalshortcuts_test.cpp
M  +18   -0    keyboard_input.cpp

http://commits.kde.org/kwin/421824b654a5301fe1c0ed97caded66936c91385