Fix DolphinRemoveAction Shift toggling on Wayland
ClosedPublic

Authored by elvisangelaccio on Aug 24 2017, 4:38 PM.

Details

Summary

QGuiApplication::queryKeyboardModifiers() does not work on Wayland.
We don't need it in the first place, since we already know (thanks to
the key events) whether Shift has been pressed or released.
So we can just pass this information to DolphinRemoveAction::update().

BUG: 354301

Test Plan

Shift toggling in context menu now works on Wayland.

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a subscriber: Konqueror. · View Herald TranscriptAug 24 2017, 4:38 PM
dfaure added a subscriber: dfaure.Aug 24 2017, 5:02 PM

Looks ok to me, but it's not documented that QGuiApplication::keyboardModifiers() doesn't work on wayland. Do you know if it will never work (->submit a patch for documentation) or it just hasn't been implemented (-> is there a bug report open?)

Looks ok to me, but it's not documented that QGuiApplication::keyboardModifiers() doesn't work on wayland. Do you know if it will never work (->submit a patch for documentation) or it just hasn't been implemented (-> is there a bug report open?)

QGuiApplication::keyboardModifiers() does work, I meant QGuiApplication::queryKeyboardModifiers(), which is actually QPlatformIntegration::queryKeyboardModifiers().
The default implementation is just QGuiApplication::keyboardModifiers(). I suppose this is a missing re-implementation in some QPA (kwin?), which would explain why bug #354301 reappeared (see 3775ef19eaca). But I'm not aware of bug reports about this.

Looks ok to me, but it's not documented that QGuiApplication::keyboardModifiers() doesn't work on wayland. Do you know if it will never work (->submit a patch for documentation) or it just hasn't been implemented (-> is there a bug report open?)

QGuiApplication::keyboardModifiers() does work, I meant QGuiApplication::queryKeyboardModifiers(), which is actually QPlatformIntegration::queryKeyboardModifiers().
The default implementation is just QGuiApplication::keyboardModifiers(). I suppose this is a missing re-implementation in some QPA (kwin?), which would explain why bug #354301 reappeared (see 3775ef19eaca). But I'm not aware of bug reports about this.

Filed one against kwin https://bugs.kde.org/show_bug.cgi?id=383966

emmanuelp accepted this revision.Sep 6 2017, 9:09 PM

Some nitpicks, looks good otherwise!

src/dolphinremoveaction.cpp
57

I would perform the resolving before the switch (by updating shiftState) to avoid the duplicated state/modifiers<->action mapping and instead add an unreachable assertion to the QueryShiftState case, but this is a matter of taste.

src/dolphinremoveaction.h
43

enum class with Unknown, Pressed, Released maybe? ;)

This revision is now accepted and ready to land.Sep 6 2017, 9:09 PM
  • Emmanuel's comments
elvisangelaccio marked 2 inline comments as done.Sep 6 2017, 9:36 PM
This revision was automatically updated to reflect the committed changes.