Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f1478af6 |
@@ -115,12 +115,13 @@ _scrcpy() {
|
|||||||
COMPREPLY=($(compgen -W 'front back external' -- "$cur"))
|
COMPREPLY=($(compgen -W 'front back external' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--orientation|--display-orientation)
|
--orientation
|
||||||
COMPREPLY=($(compgen -W '0 90 180 270 flip0 flip90 flip180 flip270' -- "$cur"))
|
--display-orientation)
|
||||||
|
COMPREPLY=($(compgen -> '0 90 180 270 flip0 flip90 flip180 flip270' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--record-orientation)
|
--record-orientation)
|
||||||
COMPREPLY=($(compgen -W '0 90 180 270' -- "$cur"))
|
COMPREPLY=($(compgen -> '0 90 180 270' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--lock-video-orientation)
|
--lock-video-orientation)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ Use USB device (if there is exactly one, like adb -d).
|
|||||||
Also see \fB\-e\fR (\fB\-\-select\-tcpip\fR).
|
Also see \fB\-e\fR (\fB\-\-select\-tcpip\fR).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-disable\-screensaver"
|
.BI "\-\-disable-screensaver"
|
||||||
Disable screensaver while scrcpy is running.
|
Disable screensaver while scrcpy is running.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@@ -642,11 +642,7 @@ Enable/disable FPS counter (print frames/second in logs)
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+click-and-move
|
.B Ctrl+click-and-move
|
||||||
Pinch-to-zoom and rotate from the center of the screen
|
Pinch-to-zoom from the center of the screen
|
||||||
|
|
||||||
.TP
|
|
||||||
.B Shift+click-and-move
|
|
||||||
Tilt (slide vertically with two fingers)
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Drag & drop APK file
|
.B Drag & drop APK file
|
||||||
|
|||||||
@@ -947,11 +947,7 @@ static const struct sc_shortcut shortcuts[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortcuts = { "Ctrl+click-and-move" },
|
.shortcuts = { "Ctrl+click-and-move" },
|
||||||
.text = "Pinch-to-zoom and rotate from the center of the screen",
|
.text = "Pinch-to-zoom from the center of the screen",
|
||||||
},
|
|
||||||
{
|
|
||||||
.shortcuts = { "Shift+click-and-move" },
|
|
||||||
.text = "Tilt (slide vertically with two fingers)",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortcuts = { "Drag & drop APK file" },
|
.shortcuts = { "Drag & drop APK file" },
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ sc_input_manager_init(struct sc_input_manager *im,
|
|||||||
im->sdl_shortcut_mods.count = shortcut_mods->count;
|
im->sdl_shortcut_mods.count = shortcut_mods->count;
|
||||||
|
|
||||||
im->vfinger_down = false;
|
im->vfinger_down = false;
|
||||||
im->vfinger_invert_x = false;
|
|
||||||
im->vfinger_invert_y = false;
|
|
||||||
|
|
||||||
im->last_keycode = SDLK_UNKNOWN;
|
im->last_keycode = SDLK_UNKNOWN;
|
||||||
im->last_mod = 0;
|
im->last_mod = 0;
|
||||||
@@ -349,14 +347,9 @@ simulate_virtual_finger(struct sc_input_manager *im,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sc_point
|
static struct sc_point
|
||||||
inverse_point(struct sc_point point, struct sc_size size,
|
inverse_point(struct sc_point point, struct sc_size size) {
|
||||||
bool invert_x, bool invert_y) {
|
point.x = size.width - point.x;
|
||||||
if (invert_x) {
|
point.y = size.height - point.y;
|
||||||
point.x = size.width - point.x;
|
|
||||||
}
|
|
||||||
if (invert_y) {
|
|
||||||
point.y = size.height - point.y;
|
|
||||||
}
|
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,9 +605,7 @@ sc_input_manager_process_mouse_motion(struct sc_input_manager *im,
|
|||||||
struct sc_point mouse =
|
struct sc_point mouse =
|
||||||
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
|
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
|
||||||
event->y);
|
event->y);
|
||||||
struct sc_point vfinger = inverse_point(mouse, im->screen->frame_size,
|
struct sc_point vfinger = inverse_point(mouse, im->screen->frame_size);
|
||||||
im->vfinger_invert_x,
|
|
||||||
im->vfinger_invert_y);
|
|
||||||
simulate_virtual_finger(im, AMOTION_EVENT_ACTION_MOVE, vfinger);
|
simulate_virtual_finger(im, AMOTION_EVENT_ACTION_MOVE, vfinger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,7 +726,7 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pinch-to-zoom, rotate and tilt simulation.
|
// Pinch-to-zoom simulation.
|
||||||
//
|
//
|
||||||
// If Ctrl is hold when the left-click button is pressed, then
|
// If Ctrl is hold when the left-click button is pressed, then
|
||||||
// pinch-to-zoom mode is enabled: on every mouse event until the left-click
|
// pinch-to-zoom mode is enabled: on every mouse event until the left-click
|
||||||
@@ -744,29 +735,14 @@ 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
|
// In other words, the center of the rotation/scaling is the center of the
|
||||||
// screen.
|
// screen.
|
||||||
//
|
#define CTRL_PRESSED (SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL))
|
||||||
// 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;
|
|
||||||
if (event->button == SDL_BUTTON_LEFT &&
|
if (event->button == SDL_BUTTON_LEFT &&
|
||||||
((down && !im->vfinger_down &&
|
((down && !im->vfinger_down && CTRL_PRESSED) ||
|
||||||
((ctrl_pressed && !shift_pressed) ||
|
|
||||||
(!ctrl_pressed && shift_pressed))) ||
|
|
||||||
(!down && im->vfinger_down))) {
|
(!down && im->vfinger_down))) {
|
||||||
struct sc_point mouse =
|
struct sc_point mouse =
|
||||||
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
|
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
|
||||||
event->y);
|
event->y);
|
||||||
if (down) {
|
struct sc_point vfinger = inverse_point(mouse, im->screen->frame_size);
|
||||||
im->vfinger_invert_x = ctrl_pressed || shift_pressed;
|
|
||||||
im->vfinger_invert_y = ctrl_pressed;
|
|
||||||
}
|
|
||||||
struct sc_point vfinger = inverse_point(mouse, im->screen->frame_size,
|
|
||||||
im->vfinger_invert_x,
|
|
||||||
im->vfinger_invert_y);
|
|
||||||
enum android_motionevent_action action = down
|
enum android_motionevent_action action = down
|
||||||
? AMOTION_EVENT_ACTION_DOWN
|
? AMOTION_EVENT_ACTION_DOWN
|
||||||
: AMOTION_EVENT_ACTION_UP;
|
: AMOTION_EVENT_ACTION_UP;
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ struct sc_input_manager {
|
|||||||
} sdl_shortcut_mods;
|
} sdl_shortcut_mods;
|
||||||
|
|
||||||
bool vfinger_down;
|
bool vfinger_down;
|
||||||
bool vfinger_invert_x;
|
|
||||||
bool vfinger_invert_y;
|
|
||||||
|
|
||||||
// Tracks the number of identical consecutive shortcut key down events.
|
// Tracks the number of identical consecutive shortcut key down events.
|
||||||
// Not to be confused with event->repeat, which counts the number of
|
// Not to be confused with event->repeat, which counts the number of
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ way as <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>).
|
|||||||
To disable automatic clipboard synchronization, use
|
To disable automatic clipboard synchronization, use
|
||||||
`--no-clipboard-autosync`.
|
`--no-clipboard-autosync`.
|
||||||
|
|
||||||
## Pinch-to-zoom, rotate and tilt simulation
|
## Pinch-to-zoom
|
||||||
|
|
||||||
To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_.
|
To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_.
|
||||||
|
|
||||||
@@ -93,12 +93,8 @@ More precisely, hold down <kbd>Ctrl</kbd> while pressing the left-click button.
|
|||||||
Until the left-click button is released, all mouse movements scale and rotate
|
Until the left-click button is released, all mouse movements scale and rotate
|
||||||
the content (if supported by the app) relative to the center of the screen.
|
the content (if supported by the app) relative to the center of the screen.
|
||||||
|
|
||||||
To simulate a tilt gesture: <kbd>Shift</kbd>+_click-and-move-up-or-down_.
|
|
||||||
|
|
||||||
Technically, _scrcpy_ generates additional touch events from a "virtual finger"
|
Technically, _scrcpy_ generates additional touch events from a "virtual finger"
|
||||||
at a location inverted through the center of the screen. When pressing
|
at a location inverted through the center of the screen.
|
||||||
<kbd>Ctrl</kbd> the x and y coordinates are inverted. Using <kbd>Shift</kbd>
|
|
||||||
only inverts x.
|
|
||||||
|
|
||||||
|
|
||||||
## Key repeat
|
## Key repeat
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
|||||||
| Synchronize clipboards and paste⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
| Synchronize clipboards and paste⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
||||||
| Inject computer clipboard text | <kbd>MOD</kbd>+<kbd>Shift</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>
|
| Enable/disable FPS counter (on stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
||||||
| Pinch-to-zoom/rotate | <kbd>Ctrl</kbd>+_click-and-move_
|
| Pinch-to-zoom | <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 APK file | Install APK from computer
|
||||||
| Drag & drop non-APK file | [Push file to device](control.md#push-file-to-device)
|
| Drag & drop non-APK file | [Push file to device](control.md#push-file-to-device)
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,5 @@ public final class CleanUp {
|
|||||||
Device.setScreenPowerMode(Device.POWER_MODE_NORMAL);
|
Device.setScreenPowerMode(Device.POWER_MODE_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ public final class Device {
|
|||||||
void onClipboardTextChanged(String text);
|
void onClipboardTextChanged(String text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Size deviceSize;
|
||||||
private final Rect crop;
|
private final Rect crop;
|
||||||
private int maxSize;
|
private int maxSize;
|
||||||
private final int lockVideoOrientation;
|
private final int lockVideoOrientation;
|
||||||
|
|
||||||
private Size deviceSize;
|
|
||||||
private ScreenInfo screenInfo;
|
private ScreenInfo screenInfo;
|
||||||
private RotationListener rotationListener;
|
private RotationListener rotationListener;
|
||||||
private FoldListener foldListener;
|
private FoldListener foldListener;
|
||||||
@@ -116,8 +116,8 @@ public final class Device {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceSize = displayInfo.getSize();
|
screenInfo = ScreenInfo.computeScreenInfo(displayInfo.getRotation(), displayInfo.getSize(), options.getCrop(),
|
||||||
screenInfo = ScreenInfo.computeScreenInfo(displayInfo.getRotation(), deviceSize, crop, maxSize, lockVideoOrientation);
|
options.getMaxSize(), options.getLockVideoOrientation());
|
||||||
// notify
|
// notify
|
||||||
if (foldListener != null) {
|
if (foldListener != null) {
|
||||||
foldListener.onFoldChanged(displayId, folded);
|
foldListener.onFoldChanged(displayId, folded);
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ public final class ClipboardManager {
|
|||||||
case 3:
|
case 3:
|
||||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, FakeContext.ROOT_UID, null);
|
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, FakeContext.ROOT_UID, null);
|
||||||
default:
|
default:
|
||||||
// The last boolean parameter is "userOperate"
|
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, false);
|
||||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user