-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Improve mouse events and add secondary bindings #5076
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jul 9, 2024
The device source (MOUSE or FINGER) to use depended on whether a secondary click was possible via mouse bindings. As a first step, always use a mouse source to break this dependency. Note that this change might cause regressions in some (unknown) cases (refs f70359f), but hopefully not. Further commits will restore a finger source in some specific use cases, but independent of secondary clicks. Refs #5055 <#5055> Fixes #5067 <#5067> PR #5076 <#5076>
Add secondary bindings (Shift+click) for mouse buttons. In addition to: --mouse-bind=xxxx It is now possible to pass a sequence of secondary bindings: --mouse-bind=xxxx:xxxx <--> <--> primary secondary bindings bindings If the second sequence is omitted, then it is the same as the first one. By default, for SDK mouse, primary bindings trigger shortcuts and secondary bindings forward all clicks. For AOA and UHID, the default bindings are reversed: all clicks are forwarded by default, whereas pressing Shift+click trigger shortcuts. --mouse-bind=bhsn:++++ # default for SDK --mouse-bind=++++:bhsn # default for AOA and UHID Refs 035d60c Refs f5e6b80 Fixes #5055 <#5055> PR #5076 <#5076>
1 task
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
For consistency, never use top-level const for local variables. PR Genymobile#5076 <Genymobile#5076>
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
(A && !B) || (!A && B) <==> A ^ B PR Genymobile#5076 <Genymobile#5076>
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
The device source (MOUSE or FINGER) to use depended on whether a secondary click was possible via mouse bindings. As a first step, always use a mouse source to break this dependency. Note that this change might cause regressions in some (unknown) cases (refs f70359f), but hopefully not. Further commits will restore a finger source in some specific use cases, but independent of secondary clicks. Refs Genymobile#5055 <Genymobile#5055> Fixes Genymobile#5067 <Genymobile#5067> PR Genymobile#5076 <Genymobile#5076>
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
For pinch-to-zoom, rotation and tilt simulation, always use a finger source (instead of a mouse) for both pointers (the real one and the simulated one). A "virtual" mouse does not work on all devices (e.g. on Pixel 8). PR Genymobile#5076 <Genymobile#5076>
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
The buttons state was tracked by SDL_GetMouseState(), and scrcpy applied a mask to ignore buttons used for shortcuts. Instead, track the buttons actually pressed (ignoring shortcuts) manually, to prepare the introduction of more dynamic mouse shortcuts. PR Genymobile#5076 <Genymobile#5076>
FreedomBen
pushed a commit
to FreedomBen/scrcpy
that referenced
this pull request
Aug 2, 2024
Add secondary bindings (Shift+click) for mouse buttons. In addition to: --mouse-bind=xxxx It is now possible to pass a sequence of secondary bindings: --mouse-bind=xxxx:xxxx <--> <--> primary secondary bindings bindings If the second sequence is omitted, then it is the same as the first one. By default, for SDK mouse, primary bindings trigger shortcuts and secondary bindings forward all clicks. For AOA and UHID, the default bindings are reversed: all clicks are forwarded by default, whereas pressing Shift+click trigger shortcuts. --mouse-bind=bhsn:++++ # default for SDK --mouse-bind=++++:bhsn # default for AOA and UHID Refs 035d60c Refs f5e6b80 Fixes Genymobile#5055 <Genymobile#5055> PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
For consistency, never use top-level const for local variables. PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
(A && !B) || (!A && B) <==> A ^ B PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
The device source (MOUSE or FINGER) to use depended on whether a secondary click was possible via mouse bindings. As a first step, always use a mouse source to break this dependency. Note that this change might cause regressions in some (unknown) cases (refs f70359f), but hopefully not. Further commits will restore a finger source in some specific use cases, but independent of secondary clicks. Refs Genymobile#5055 <Genymobile#5055> Fixes Genymobile#5067 <Genymobile#5067> PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
For pinch-to-zoom, rotation and tilt simulation, always use a finger source (instead of a mouse) for both pointers (the real one and the simulated one). A "virtual" mouse does not work on all devices (e.g. on Pixel 8). PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
The buttons state was tracked by SDL_GetMouseState(), and scrcpy applied a mask to ignore buttons used for shortcuts. Instead, track the buttons actually pressed (ignoring shortcuts) manually, to prepare the introduction of more dynamic mouse shortcuts. PR Genymobile#5076 <Genymobile#5076>
Gottox
pushed a commit
to Gottox/scrcpy
that referenced
this pull request
Sep 29, 2024
Add secondary bindings (Shift+click) for mouse buttons. In addition to: --mouse-bind=xxxx It is now possible to pass a sequence of secondary bindings: --mouse-bind=xxxx:xxxx <--> <--> primary secondary bindings bindings If the second sequence is omitted, then it is the same as the first one. By default, for SDK mouse, primary bindings trigger shortcuts and secondary bindings forward all clicks. For AOA and UHID, the default bindings are reversed: all clicks are forwarded by default, whereas pressing Shift+click trigger shortcuts. --mouse-bind=bhsn:++++ # default for SDK --mouse-bind=++++:bhsn # default for AOA and UHID Refs 035d60c Refs f5e6b80 Fixes Genymobile#5055 <Genymobile#5055> PR Genymobile#5076 <Genymobile#5076>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Android, a
MotionEvent
may use either aMOUSE
orFINGER
as source. Since scrcpy 1.0, it used aFINGER
. But when--forward-all-clicks
(now deprecated in favor of--mouse-bind=++++
) was added, this caused a problem: it was not possible to press secondary clicks with aFINGER
, so if this flag was set, it used aMOUSE
(c7b1d0e):scrcpy/server/src/main/java/com/genymobile/scrcpy/Controller.java
Lines 276 to 288 in cc8e613
FINGER
was still useful for simulating pinch-to-zoom, rotate and tilt, because a double mouse pointer does not always work on all devices.The fact that the decision to use either
MOUSE
orFINGER
depends on the specific--mouse-bind
value is weird, and cause issues: #5055 (comment)The introduction of "mouse hover" in scrcpy v2.5 also causes issues on some devices, because in theory a "mouse hover" event should be with a
MOUSE
source: #5067To fix both issues, always use a
MOUSE
source (regardless of the mouse bindings), except when simulating a virtual finger (pinch-to-zoom, rotate and tilt).Fixes #5067
Then, improve
--mouse-bind
to support secondary mouse bindings with Shift+click.It is now possible to pass a sequence of secondary bindings:
If the second sequence is omitted, then it is the same as the first one.
By default, for SDK mouse, primary bindings trigger shortcuts and secondary bindings forward all clicks.
For AOA and UHID, the default bindings are reversed: all clicks are forwarded by default, whereas pressing Shift+click trigger shortcuts.
Fixes #5055
Here is a binary for Windows:
scrcpy-win64-pr5076.zip
SHA-256: ac38d4eb2577137f6846d41a82d8b76f7d1ed83ca5c2e0c499e6ba935bab276
Thank you for your feedback 😉