Add support to keyboard shortcuts inhibitor
ClosedPublic

Authored by bport on Apr 29 2020, 8:50 AM.

Details

Summary
  • Disable all global shortcuts
  • For now don't disable spies (So opening menu with meta key is not disabled for now)

Depends on D29231

Test Plan

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bport created this revision.Apr 29 2020, 8:50 AM
Restricted Application added a project: KWin. · View Herald TranscriptApr 29 2020, 8:50 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
bport requested review of this revision.Apr 29 2020, 8:50 AM
"The Wayland compositor is however under no obligation to disable
 all of its shortcuts, and may keep some special key combo for its own
 use, including but not limited to one allowing the user to forcibly
 restore normal keyboard events routing in the case of an unwilling
 client. The compositor may also use the same key combo to reactivate
 an existing shortcut inhibitor that was previously deactivated on
 user request."

Do we think it's important to have this when this lands or just deal with it if it becomes an issue?

I think it should be relatively easy, just an earlier filter that calls:
waylandServer()->keyboardShortcutsInhibitManager()->getShortcutsInhibitor(surface, seat)->setActive(false);

input.cpp
792

Surface can be null

"The Wayland compositor is however under no obligation to disable
 all of its shortcuts, and may keep some special key combo for its own
 use, including but not limited to one allowing the user to forcibly
 restore normal keyboard events routing in the case of an unwilling
 client. The compositor may also use the same key combo to reactivate
 an existing shortcut inhibitor that was previously deactivated on
 user request."

Do we think it's important to have this when this lands or just deal with it if it becomes an issue?

I think it should be relatively easy, just an earlier filter that calls:
waylandServer()->keyboardShortcutsInhibitManager()->getShortcutsInhibitor(surface, seat)->setActive(false);

Yes harder part will be to find the shortcut

Are we ok to let Meta key opening menu even if inhibitor is active ?

apol added a subscriber: apol.Apr 29 2020, 10:21 AM

Are we ok to let Meta key opening menu even if inhibitor is active ?

Wouldn't this do exactly what this patch is trying to prevent?

Are we ok to let Meta key opening menu even if inhibitor is active ?

I think we really do not want this to happen during e.g. gameplay

In D29272#659619, @apol wrote:

Are we ok to let Meta key opening menu even if inhibitor is active ?

Wouldn't this do exactly what this patch is trying to prevent?

Since shortcut inhibition is often used for VMs, nested sessions and alike: definitely. What poses the question how the compositor is supposed to override a client's request to inhibit shortcuts when its shortcuts got inhibited (and likely its pointer is constrained). And how it advertises that to the user.

There was in the past a mechanism to override client's pointer constraint when pressing ESC for few seconds. For pointer constraints that was a broken design but for shortcuts inhibition it could be just right. @bport: For the code check out D15234, where the mechanism was removed for pointer constraints.

I think we really do not want this to happen during e.g. gameplay

Games normally don't inhibit Alt+Tab and similar compositor shortcuts. At least I wouldn't want my games to do that by default.

I will fix that and allow meta inhibition

By the way I guess for now we can let client manage inhibition, advertising and delete it when not needed anymore. In the future if we have problem with that we can add a KDE shortcut that will allow to deactivate all inhibitors or current one and also advertise user with an OSD or something like that explaining keyboard input are captured by the client, and they can use a shortcut to uncapture it

bport updated this revision to Diff 81843.May 4 2020, 8:29 AM

Inhibit only modifier shortcut too

davidedmundson accepted this revision.May 11 2020, 1:32 PM
This revision is now accepted and ready to land.May 11 2020, 1:32 PM
bport updated this revision to Diff 82654.May 12 2020, 1:11 PM

Adapt to method rename on wayland server

zzag added inline comments.May 25 2020, 10:02 AM
modifier_only_shortcuts.cpp
31–33

Do we really need these?

wayland_server.cpp
846–847

Can be simplified to just seat()->focusedKeyboardSurface() and no snake case.

849

Please drop waylandServer(), it's already an instance of WaylandServer.

zzag added inline comments.May 25 2020, 10:04 AM
input.cpp
61

It seems like we don't need this one too.

bport updated this revision to Diff 83152.May 26 2020, 8:04 AM

Remove unused include

This revision was automatically updated to reflect the committed changes.