mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-02-27 08:44:30 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
315f467cc7 | ||
|
|
e98122c110 | ||
|
|
0c5d5b6339 | ||
|
|
fb3d6c319b | ||
|
|
04b8a6dcda | ||
|
|
0c462c1a3f | ||
|
|
570a003c39 | ||
|
|
b62df7ee91 | ||
|
|
30d40f4e78 | ||
|
|
f489f7fcad | ||
|
|
d72c7076f7 | ||
|
|
fc64445555 | ||
|
|
f65c3fde69 |
12
README.md
12
README.md
@@ -582,6 +582,14 @@ scrcpy --turn-screen-off --stay-awake
|
||||
scrcpy -Sw
|
||||
```
|
||||
|
||||
#### Power off on close
|
||||
|
||||
To turn the device screen off when closing scrcpy:
|
||||
|
||||
```bash
|
||||
scrcpy --power-off-on-close
|
||||
```
|
||||
|
||||
|
||||
#### Show touches
|
||||
|
||||
@@ -830,7 +838,7 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
||||
| Turn device screen on | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>
|
||||
| Rotate device screen | <kbd>MOD</kbd>+<kbd>r</kbd>
|
||||
| Expand notification panel | <kbd>MOD</kbd>+<kbd>n</kbd> \| _5th-click³_
|
||||
| Expand settings panel | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Double-5th-click³_
|
||||
| Expand settings panel | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Double-5th-click³_
|
||||
| Collapse panels | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
||||
| Copy to clipboard⁴ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
||||
| Cut to clipboard⁴ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
||||
@@ -838,6 +846,8 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
||||
| 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_
|
||||
| Drag & drop APK file | Install APK from computer
|
||||
| Drag & drop non-APK file | [Push file to device](#push-file-to-device)
|
||||
|
||||
_¹Double-click on black borders to remove them._
|
||||
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
||||
|
||||
@@ -136,6 +136,10 @@ Set the TCP port (range) used by the client to listen.
|
||||
|
||||
Default is 27183:27199.
|
||||
|
||||
.TP
|
||||
.B \-\-power\-off\-on\-close
|
||||
Turn the device screen off when closing scrcpy.
|
||||
|
||||
.TP
|
||||
.B \-\-prefer\-text
|
||||
Inject alpha characters and space as text events instead of key events.
|
||||
@@ -364,6 +368,10 @@ Pinch-to-zoom from the center of the screen
|
||||
.B Drag & drop APK file
|
||||
Install APK from computer
|
||||
|
||||
.TP
|
||||
.B Drag & drop non-APK file
|
||||
Push file to device (see \fB\-\-push\-target\fR)
|
||||
|
||||
|
||||
.SH Environment variables
|
||||
|
||||
|
||||
977
app/src/cli.c
977
app/src/cli.c
File diff suppressed because it is too large
Load Diff
@@ -213,6 +213,8 @@ utf8_from_wide_char(const wchar_t *ws) {
|
||||
#endif
|
||||
|
||||
char *wrap_lines(const char *input, unsigned columns, unsigned indent) {
|
||||
assert(indent < columns);
|
||||
|
||||
struct sc_strbuf buf;
|
||||
|
||||
// The output string should not be a lot longer than the input string (just
|
||||
@@ -224,8 +226,6 @@ char *wrap_lines(const char *input, unsigned columns, unsigned indent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(indent < columns);
|
||||
|
||||
#define APPEND(S,N) if (!sc_strbuf_append(&buf, S, N)) goto error
|
||||
#define APPEND_CHAR(C) if (!sc_strbuf_append_char(&buf, C)) goto error
|
||||
#define APPEND_N(C,N) if (!sc_strbuf_append_n(&buf, C, N)) goto error
|
||||
@@ -241,7 +241,12 @@ char *wrap_lines(const char *input, unsigned columns, unsigned indent) {
|
||||
size_t col = indent;
|
||||
while (*input) {
|
||||
size_t sep_idx = strcspn(input, "\n ");
|
||||
bool wrap = col + sep_idx > columns;
|
||||
size_t new_col = col + sep_idx;
|
||||
if (pending == ' ') {
|
||||
// The pending space counts
|
||||
++new_col;
|
||||
}
|
||||
bool wrap = new_col > columns;
|
||||
|
||||
char sep = input[sep_idx];
|
||||
if (sep == ' ')
|
||||
|
||||
@@ -21,7 +21,6 @@ sc_strbuf_init(struct sc_strbuf *buf, size_t init_cap) {
|
||||
static bool
|
||||
sc_strbuf_reserve(struct sc_strbuf *buf, size_t len) {
|
||||
if (buf->len + len > buf->cap) {
|
||||
fprintf(stderr, "realloc\n");
|
||||
size_t new_cap = buf->cap * 3 / 2 + len;
|
||||
char *s = realloc(buf->s, new_cap + 1); // +1 for '\0'
|
||||
if (!s) {
|
||||
@@ -75,3 +74,14 @@ sc_strbuf_append_n(struct sc_strbuf *buf, const char c, size_t n) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
sc_strbuf_shrink(struct sc_strbuf *buf) {
|
||||
assert(buf->len <= buf->cap);
|
||||
if (buf->len != buf->cap) {
|
||||
char *s = realloc(buf->s, buf->len + 1); // +1 for '\0'
|
||||
assert(s); // decreasing the size may not fail
|
||||
buf->s = s;
|
||||
buf->cap = buf->len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,7 @@ sc_strbuf_append_str(struct sc_strbuf *buf, const char *s) {
|
||||
#define sc_strbuf_append_staticstr(BUF, S) \
|
||||
sc_strbuf_append(BUF, S, sizeof(S) - 1)
|
||||
|
||||
void
|
||||
sc_strbuf_shrink(struct sc_strbuf *buf);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,11 @@ static void test_strbuf_simple(void) {
|
||||
assert(ok);
|
||||
|
||||
assert(!strcmp(buf.s, "Hello world!\nThis is a test..."));
|
||||
|
||||
sc_strbuf_shrink(&buf);
|
||||
assert(buf.len == buf.cap);
|
||||
assert(!strcmp(buf.s, "Hello world!\nThis is a test..."));
|
||||
|
||||
free(buf.s);
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ static void test_strlist_contains(void) {
|
||||
|
||||
static void test_wrap_lines(void) {
|
||||
const char *s = "This is a text to test line wrapping. The lines must be "
|
||||
"wrapped either at a space or a line break.\n"
|
||||
"wrapped at a space or a line break.\n"
|
||||
"\n"
|
||||
"This rectangle must remains a rectangle because it is "
|
||||
"drawn in lines having lengths lower than the specified "
|
||||
@@ -315,9 +315,8 @@ static void test_wrap_lines(void) {
|
||||
const char *expected = " This is a text to\n"
|
||||
" test line wrapping.\n"
|
||||
" The lines must be\n"
|
||||
" wrapped either at a\n"
|
||||
" space or a line\n"
|
||||
" break.\n"
|
||||
" wrapped at a space\n"
|
||||
" or a line break.\n"
|
||||
" \n"
|
||||
" This rectangle must\n"
|
||||
" remains a rectangle\n"
|
||||
|
||||
Reference in New Issue
Block a user