Skip to content
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

Feature Request: Keyboard Shortcut for Forwarding Clicks #5055

Closed
rom1v opened this issue Jul 4, 2024 · 3 comments · Fixed by #5076
Closed

Feature Request: Keyboard Shortcut for Forwarding Clicks #5055

rom1v opened this issue Jul 4, 2024 · 3 comments · Fixed by #5076

Comments

@rom1v
Copy link
Collaborator

rom1v commented Jul 4, 2024

A feature request posted on reddit:

So with the recent Scrcpy release, the forwarding clicks behavior changed. So I added this:

--mouse-bind=bhsn

to get

-KM --no-video --no-audio --mouse-bind=bhsn

So that I get the old behavior back, with right click for BACK and middle click for HOME.

But I realized that a keyboard shortcut that could forward clicks would be very useful. This way, we can get use mouse click shortcuts when needed, and use a modifier key to forward the click for apps that make use of it. Like Alt + right click = forward right click.

Or can implement the inverse; clicks are forwarded by default, and act as shortcuts when using the modifier key. Idk the best method, but I feel this would be useful, so please check :)

Thanks!

@rom1v
Copy link
Collaborator Author

rom1v commented Jul 4, 2024

My first comment:

I like the idea. However, Alt is already used to capture/uncapture the mouse when video mirroring is disabled, and Alt+right and Alt+middle clicks are often captured by the window manager (e.g. to resize the window). Ctrl+click and Shift+click are used to simulate several fingers (but only for left click, so Ctrl could be used for additional shortcuts in theory).

So I keep the idea in mind, but for now I don't know how to expose it properly.

@rom1v
Copy link
Collaborator Author

rom1v commented Jul 4, 2024

One unexpected difficulty is related to the injection of either finger or mouse: c7b1d0e and #3568.

If there is a possibility of secondary click, then we must use a mouse even for left click for consistency. But that prevents multi-fingers to work on some devices (but not all), for example for pinch-to-zoom, rotate and tilt simulation.

The workaround was: use mouse if --forward-all-clicks (now if there is at least one click forwarded in --mouse-bind=xxxx), finger otherwise.

But if we add key+click, forwarding secondary clicks will always be possible (either with key pressed or unpressed), so it won't use "finger" by default anymore, breaking the behavior on some devices.

rom1v added a commit that referenced this issue Jul 8, 2024
The tool type (MOUSE or FINGER) to use depended on whether a secondary
click was possible via mouse bindings.

As a first step, always use a mouse tool type 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 tool type in some specific use
cases, but independent of secondary clicks.

Refs #5055 <#5055>
Refs #5067 <#5067>
rom1v added a commit that referenced this issue 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>
Refs #5067 <#5067>
rom1v added a commit that referenced this issue Jul 9, 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 #5055 <#5055>
@rom1v
Copy link
Collaborator Author

rom1v commented Jul 9, 2024

Implemented by #5076.

rom1v added a commit that referenced this issue Jul 11, 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>
@rom1v rom1v closed this as completed in 9989668 Aug 1, 2024
FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this issue 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 issue 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 issue 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 issue 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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant