-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Simulate tilt multitouch event by pressing Shift #4529
Conversation
Thank you. I like the idea. However, Alt + mouse move is captured by my window manager (to move the window), so I can't use it. Since there are 2 axis, we can use for example:
One drawback is that it causes a change in the shortcut for an existing action, but the result seems more logical to me. What do you think? |
Ah, good point.
So, what to do? Your proposal or one of these alternatives? |
I like this one 👍 Indeed I think that horizontal sliding with 2 fingers is not common. If Ctrl+Shift are pressed, either:
(choose the one with the simplest implementation) EDIT: in fact, for simplicity and consistency with the current behavior, just consider the Ctrl or Shift key when the click is pressed, and keep its behavior until the click is released (even if the modifier is released/changed meanwhile). (Ctrl+Shift could be reserved for the less common horizontal sliding for later if necessary, but not for now, let's keep it simple) |
663eeab
to
2480ea9
Compare
Alright, let's do that! |
👌 I just reformulated a bit because technically it's an axial symmetry: diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index 13f5a4908..76cfbd928 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -745,9 +745,10 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
// In other words, the center of the rotation/scaling is the center of the
// screen.
//
- // To simulate a tilt gesture Shift can be used instead of Ctrl. The "virtual
- // finger" has the x coordinate inverted through the center of the screen
- // while the y coordinate is unchanged.
+ // To simulate a tilt gesture (a vertical slide with two fingers), Shift
+ // can be used instead of Ctrl. The "virtual finger" has a position
+ // inverted with respect to the vertical axis of symmetry in the middle of
+ // the screen.
const SDL_Keymod keymod = SDL_GetModState();
const bool ctrl_pressed = keymod & KMOD_CTRL;
const bool shift_pressed = keymod & KMOD_SHIFT; (Please do not hesitate to suggest a reformulation if my English is incorrect.) I also updated some more documentation: diff --git a/app/scrcpy.1 b/app/scrcpy.1
index 8ca4a7730..beaa99ab4 100644
--- a/app/scrcpy.1
+++ b/app/scrcpy.1
@@ -642,7 +642,11 @@ Enable/disable FPS counter (print frames/second in logs)
.TP
.B Ctrl+click-and-move
-Pinch-to-zoom from the center of the screen
+Pinch-to-zoom and rotate from the center of the screen
+
+.TP
+.B Shift+click-and-move
+Tilt (slide vertically with two fingers)
.TP
.B Drag & drop APK file
diff --git a/app/src/cli.c b/app/src/cli.c
index fd4525f55..c580c9597 100644
--- a/app/src/cli.c
+++ b/app/src/cli.c
@@ -947,7 +947,11 @@ static const struct sc_shortcut shortcuts[] = {
},
{
.shortcuts = { "Ctrl+click-and-move" },
- .text = "Pinch-to-zoom from the center of the screen",
+ .text = "Pinch-to-zoom and rotate from the center of the screen",
+ },
+ {
+ .shortcuts = { "Shift+click-and-move" },
+ .text = "Tilt (slide vertically with two fingers)",
},
{
.shortcuts = { "Drag & drop APK file" },
diff --git a/doc/shortcuts.md b/doc/shortcuts.md
index c0fc28421..21bccbd95 100644
--- a/doc/shortcuts.md
+++ b/doc/shortcuts.md
@@ -49,7 +49,8 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
| Synchronize clipboards and paste⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
| Inject computer clipboard text | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
| Enable/disable FPS counter (on stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
- | Pinch-to-zoom | <kbd>Ctrl</kbd>+_click-and-move_
+ | Pinch-to-zoom/rotate | <kbd>Ctrl</kbd>+_click-and-move_
+ | Tilt (slide vertically with 2 fingers) | <kbd>Shift</kbd>+_click-and-move_
| Drag & drop APK file | Install APK from computer
| Drag & drop non-APK file | [Push file to device](control.md#push-file-to-device)
The resulting commit is here: d2ed451 (not merged yet) |
PR #4529 <#4529> Signed-off-by: Romain Vimont <[email protected]>
Looks fine! 👍 |
Merged into |
scrcpy v2.4 Changes since v2.3.1: - Add UHID keyboard and mouse support (Genymobile#4473) - Simulate tilt multitouch by pressing Shift (Genymobile#4529) - Add rotation support for non-default display (Genymobile#4698) - Improve audio player (Genymobile#4572) - Adapt to display API changes in Android 15 (Genymobile#4646, Genymobile#4656, Genymobile#4657) - Adapt audio workarounds to Android 14 (Genymobile#4492) - Fix clipboard for IQOO devices on Android 14 (Genymobile#4492, Genymobile#4589, Genymobile#4703) - Fix integer overflow for audio packet duration (Genymobile#4536) - Rework cleanup (Genymobile#4649) - Upgrade FFmpeg to 6.1.1 in Windows releases (Genymobile#4713) - Upgrade libusb to 1.0.27 in Windows releases (Genymobile#4713) - Various technical fixes
Use Ctrl+Shift for horizontal tilt. Refs #4529 comment <#4529 (comment)> Fixes #5317 <#5317>
I missed simulating tilt multitouch events (two fingers moving up or down) for map apps.
Here is an implementation for that.