-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring session 2 #233
base: master
Are you sure you want to change the base?
Conversation
@palinek Would you help with testing this again? I plan on implementing the full At this point it's still refactoring. Also I haven't touched the "grabber" code path yet - because it works. I plan on this in the last step after everything works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as expected. Even assigning the "plain" Meta to an action and Meta + <something> to another is working. The only difference now is that Meta +<something> is triggered upon the <something> keypress and the plain Meta is triggered upon keyrelease.
I plan on implementing the full Super/Meta behaviour now.
Do you just intend to unify the behavior to trigger "everything" on keyrelease?
daemon/core.h
Outdated
@@ -146,6 +146,7 @@ class Core : public QThread, public LogTarget | |||
void grabShortcut(const uint &timeout, QString &shortcut, bool &failed, bool &cancelled, bool &timedout, const QDBusMessage &message); | |||
void cancelShortcutGrab(); | |||
|
|||
void on_shortcut(const Ids& ids) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for not following the naming style here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Qt vs STL signal/slot cardinality. 😺 (Actually onShortcutGrabbed
signal is the "black sheep" in this context.)
However it doesn't matter, just feels weird seeing a Qt signal named "onXYZ".
EDIT: See 68e4f73 (that's maybe another reason)
case MULTIPLE_ACTIONS_BEHAVIOUR_FIRST: | ||
{ | ||
auto lastIds = ids.end(); | ||
for (auto idi = ids.begin(); idi != lastIds; ++idi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use range loop in this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the MULTIPLE_ACTIONS_BEHAVIOUR_LAST
case below (reverse iteration). Just thought it being better to understand this way.
@palinek Added more dbugging output -> makes it actually visible now why |
@palinek I have rewritten the PR description (the assumption was wrong -> the log messages show what is happening). Could you please re-read? Why is no XEvent generated? |
@tsujan Would you have an idea how we could "pass through" XEvents when unhandled by globalkeysd? Background: |
Not being an expert in XEvents, I think it's logical to expect that, if pressing of a modifier key is treated as a shortcut, that key couldn't be used as a modifier anywhere. However, there may be a different story about releasing it. |
Exactly: Super_L/R should not trigger a KeyPress event - but it does. What is unclear to me is why do we only get this event, when an action is registered? (If you like to see it for yourself please enable the |
Since I don't have time to read the code for now, ignore my comment if it isn't relevant but shortcuts work everywhere when the last key is pressed, not when it's released. That's why a modifier can't be a usual shortcut. To make a global shortcut out of a modifying key forcefully, one may need to trigger the action only when it's released. Even that might have side effects, I think. |
@tsujan Actually no need to read the code. Just change the Similar to what you state: |
Will do when I become a little less busy. Keep up the good work! |
Still refactoring! Note that the "continue" is no longer needed and replaced by the update function's "return" (aka "early exit").
1. When debugging we do not want filtered information in the output. 2. Also logs the key state on release before any filter is applied.
Refactoring notes: - "signal" parameter is passed by reference (-> instead of char*) - the "return;" line replaces the "while-break" (throw instead?)
Actually the pointer is unused in XyzAction classes.
Makes it easier to follow the code flow.
Description
Registering a shortcut action on one of the "Super" keys (aka "Windows" or "Cmd") does not completely work and th lxqt-globalkeys the
KeyPress
event is not "forwarded" to the window manager.For example:
Super+D
to the window manager (e.g. openbox, kwin,… or other non-LXQt globalkeys handler)Super_L
orSuper_R
to anlxqt-globalkeys
action (e.g. "show/hide main menu")Result:
The third-party key handler (openbox, kwin,…) no longer gets a
KeyPress
event and does not trigger.Debugging/Fix
For debugging this it is important to understand:
As long as no
BaseAction
is registered on the "Super" keys no XEvent is generated at all. (Why?)Notes
To make the code maintable this PR also implies refactoring (Session 2):