-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Actions for 4th and 5th mouse buttons #2258
Conversation
Some mouse clicks DOWN are captured for shortcuts, but the matching UP event was still forwarded to the device. Instead, capture both DOWN and UP for shortcuts, and do nothing on UP.
With this change, the actual HOME is handled by Android on UP on the device. This is consistent with the keyboard shortcut (MOD+h) behavior.
The shortcut "back on screen on" is a bit special: the control is requested by the client, but the actual event injection (POWER or BACK) is determined on the device. To properly inject DOWN and UP events for BACK, transmit the action as a control parameter. If the screen is off: - on DOWN, inject POWER (DOWN and UP) (wake up the device immediately) - on UP, do nothing If the screen is on: - on DOWN, inject BACK DOWN - on UP, inject BACK UP A corner case is when the screen turns off between the DOWN and UP event. In that case, a BACK UP event will be injected, so it's harmless. With this change, the actual BACK is handled by Android on UP on the device (instead of DOWN). This is consistent with the keyboard shortcut (Mod+b) behavior.
👍 It's better to bind them to something. I made some changes on That way, you could properly propagate them in your
Yes, I guess.
Why not. But it's maybe odd to bind "open navigation panel" but not "close navigation panel". I'd like other opinions on that (and my mouse has 3 buttons). (In the future, I would like to implement some kind of shortcut customization. But it's not a priority.) |
Sure. I will be able to in about 1h.
No need. Just right click (back button) and it closes. No need for a button to close when the back button does that already. I wanted to have a shortcut key to open towards the 2nd menu, when sliding the finger the 2nd time. Maybe I will end up implementing it as a finger slide... Unsure...
Mine has 7. Unexpected behaviors happen when I try them all.
Great. Want me to try that? |
842ca67
to
fd9a218
Compare
Your branch looks good. I rebased this one on the one you did. |
The shortcut "back on screen on" is a bit special: the control is requested by the client, but the actual event injection (POWER or BACK) is determined on the device. To properly inject DOWN and UP events for BACK, transmit the action as a control parameter. If the screen is off: - on DOWN, inject POWER (DOWN and UP) (wake up the device immediately) - on UP, do nothing If the screen is on: - on DOWN, inject BACK DOWN - on UP, inject BACK UP A corner case is when the screen turns off between the DOWN and UP event. In that case, a BACK UP event will be injected, so it's harmless. As a consequence of this change, the BACK button is now handled by Android on mouse released. This is consistent with the keyboard shortcut (Mod+b) behavior. PR #2259 <#2259> Refs #2258 <#2258>
Merged into Thank you. |
Bind APP_SWITCH to button 4 and expand notification panel on button 5. PR Genymobile#2258 <Genymobile#2258> Signed-off-by: Romain Vimont <rom@rom1v.com>
The shortcut "back on screen on" is a bit special: the control is requested by the client, but the actual event injection (POWER or BACK) is determined on the device. To properly inject DOWN and UP events for BACK, transmit the action as a control parameter. If the screen is off: - on DOWN, inject POWER (DOWN and UP) (wake up the device immediately) - on UP, do nothing If the screen is on: - on DOWN, inject BACK DOWN - on UP, inject BACK UP A corner case is when the screen turns off between the DOWN and UP event. In that case, a BACK UP event will be injected, so it's harmless. As a consequence of this change, the BACK button is now handled by Android on mouse released. This is consistent with the keyboard shortcut (Mod+b) behavior. PR #2259 <#2259> Refs #2258 <#2258>
The 4th button is typically interpreted as "Back" by regular PC applications... Can we at least have a setting for that normalish behaviour? |
Because we already have that function assigned to the right click mouse button. |
Wouldn't it make more sense to support standard behaviours, and have people who want non-standard behaviours reassign things? :/ Switching between right-click and back-click between applications has been a bit confusing since I started using scrcpy. |
The reason is that BACK is very useful even if you have a 2-button mouse. Yes, designing a "reassing buttons" feature could be useful, but it's not done. |
How can I customize the 4th and 5th mouse button clicks? I'm not a programmer, but I think this shouldn't be too difficult to do. If anyone can guide me through the process, that would be great. |
What do you want them to do? The process is different depending on what you want them to mean. |
As a habit, I use mouse buttons 4 and 5 to go back and forward. I would like to set button 4 (the one that is used to go back) as the back button, and I don't care what the forward button is set to as I don't use it much. |
In that case, you edit here: Replace that line's code with:
|
Thanks a lot, but as I mentioned, I sadly don't know anything about coding. I think for this, I should fork this repository, make the change you mentioned, then release it and use it? Or is there an easier way to do this without having to create a fork? |
@123SONIC321 Please read #4877 (comment) |
Add a new option --mouse-bind=xxxx. The argument must be exactly 4 characters, one for each secondary click: --mouse-bind=xxxx ^^^^ |||| ||| `- 5th click || `-- 4th click | `--- middle click `---- right click Each character must be one of the following: - `+`: forward the click to the device - `-`: ignore the click - `b`: trigger shortcut BACK (or turn screen on if off) - `h`: trigger shortcut HOME - `s`: trigger shortcut APP_SWITCH - `n`: trigger shortcut "expand notification panel" This deprecates --forward-all-clicks (use --mouse-bind=++++ instead). Refs <#2258 (comment)> PR #5022 <#5022>
Add a new option --mouse-bind=xxxx. The argument must be exactly 4 characters, one for each secondary click: --mouse-bind=xxxx ^^^^ |||| ||| `- 5th click || `-- 4th click | `--- middle click `---- right click Each character must be one of the following: - `+`: forward the click to the device - `-`: ignore the click - `b`: trigger shortcut BACK (or turn screen on if off) - `h`: trigger shortcut HOME - `s`: trigger shortcut APP_SWITCH - `n`: trigger shortcut "expand notification panel" This deprecates --forward-all-clicks (use --mouse-bind=++++ instead). Refs <Genymobile#2258 (comment)> PR Genymobile#5022 <Genymobile#5022>
Add a new option --mouse-bind=xxxx. The argument must be exactly 4 characters, one for each secondary click: --mouse-bind=xxxx ^^^^ |||| ||| `- 5th click || `-- 4th click | `--- middle click `---- right click Each character must be one of the following: - `+`: forward the click to the device - `-`: ignore the click - `b`: trigger shortcut BACK (or turn screen on if off) - `h`: trigger shortcut HOME - `s`: trigger shortcut APP_SWITCH - `n`: trigger shortcut "expand notification panel" This deprecates --forward-all-clicks (use --mouse-bind=++++ instead). Refs <Genymobile#2258 (comment)> PR Genymobile#5022 <Genymobile#5022>
For now, the 4th and 5th mouse buttons have erratic behavior from misinterpretation as being either 1st or 3rd buttons.
Nowadays, non-basic mice have, at least, 4 buttons, so, for me, makes most sense that those buttons are assigned. In this case, they are assigned based on my perceived difficulty in activating the feature using the mouse and how often used.
Given such, I decided that app switch to be the 4th button and notifications panel to be the 5th button.
These are what I believe to be the best use for these two. The 4th button being the app switch should be close to the no-brainer.
As for the notifications being the 5th, that one is more open for discussion. IMO, the major competitors being:
No more buttons are assigned because SDL doesn't support them.
For now, I would present this way, as a way to start a discussion