Romain Vimont
bfb86ca2c2
Simplify cleanup
...
The cleanup is not linear: for example, the server must be stopped and
its sockets must be shutdown after the stream and controller are stopped
(so that they don't continue processing garbage), but before they are
joined, to avoid a deadlock if they are blocked on a socket read.
Simplify the spaghetti-cleanup by keeping trace of initialization at
runtime.
5 years ago
Romain Vimont
0dee9b04b2
Use net_recv() to read only one byte
...
Partial read is impossible for 1 byte, so net_recv_all() is useless.
5 years ago
Romain Vimont
8fc58bde75
Simplify server_connect_to()
...
Only use 2 branches, using either forward or remote tunnel.
5 years ago
Romain Vimont
5a431cdf9b
Make server_connect_to() return a bool
...
The resulting socket is accessible from the server instance, there is no
need to return it.
This paves the way to use several sockets in parallel.
5 years ago
Romain Vimont
6edb1294f0
Add missing return 0 in unit test
5 years ago
Romain Vimont
073181b294
Use cbuf for file handler request queue
...
Replace the file_handler_request_queue implementation by cbuf.
5 years ago
Romain Vimont
241a3dcba5
Use cbuf for control event queue
...
Replace the control_event_queue implementation by cbuf.
5 years ago
Romain Vimont
b38292cd69
Add generic circular buffer
...
Add a circular buffer implementation, to factorize multiple specific
queues implementation.
5 years ago
Romain Vimont
7475550ae8
Add buffer_read16be()
...
Add a function to read 16 bits in big-endian to a uint16_t.
5 years ago
Romain Vimont
7fc8793d5b
Make buffer util functions accept const buffers
...
So that they can be used both on const and non-const input buffers.
5 years ago
Romain Vimont
bf5e54b2e9
Make control_event_serialize() return size_t
...
control_event_serialize() returns the number of bytes written, so the
type should be size_t.
5 years ago
Romain Vimont
507b0bcccf
Fix memory leak on error
...
The variable condition was not destroyed on strdup() failure.
5 years ago
Romain Vimont
e1afd9f8b0
Fix event ownership comment
5 years ago
Romain Vimont
b08dada6c1
Prefix control event constants by namespace
...
This will avoid conflicts with future device events.
5 years ago
Romain Vimont
999c964689
Make macro expansion-safe
...
Use parentheses to avoid unexpected results.
For example, make:
2 * SERIALIZED_EVENT_MAX_SIZE
expand to:
2 * (3 + TEXT_MAX_LENGTH)
instead of:
2 * 3 + TEXT_MAX_LENGTH
5 years ago
Romain Vimont
befe455e44
Remove unused includes
...
The struct control_event does not use mutexes, and net.h does not need
SDL_platform.h.
5 years ago
Romain Vimont
d2504f974c
Fix indentation
...
Previous refactorings broke indentation.
5 years ago
Romain Vimont
0fbab42f8c
Format meson.build for readability
5 years ago
Romain Vimont
08f506b24f
Replace SDL_bool by bool in tests
...
Commit dfed1b250e
replaced SDL types by
standard types in sources, but tests were not updated.
5 years ago
Romain Vimont
3bc1c51b91
Always use SDL_malloc() and SDL_free()
...
To avoid mixing SDL_malloc()/SDL_strdup() with free(), or malloc() with
SDL_free(), always use the SDL version.
5 years ago
Romain Vimont
7ed976967f
Fix checkstyle warning
...
Checkstyle wants a specific order of imports.
5 years ago
Romain Vimont
b75f0e9427
Merge branch 'master' into dev
5 years ago
Romain Vimont
5d473efeb5
Bind Home key to MOVE_HOME
...
On pressing Home key on the computer, move the cursor to the beginning
of the line instead of going back to the home screen.
<https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_HOME >
<https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MOVE_HOME >
Fixes (part of) <https://github.com/Genymobile/scrcpy/issues/555 >.
5 years ago
Romain Vimont
a41dd6c79f
Make owned filename a pointer-to-non-const
...
The file handler owns the filename string, so it needs to free it.
Therefore, it should not be a pointer-to-const.
5 years ago
Romain Vimont
c3779d8513
Make owned serial a pointer-to-non-const
...
The file handler owns the serial, so it needs to free it. Therefore, it
should not be a pointer-to-const.
5 years ago
Romain Vimont
b3bd5f1b80
Remove useless casts to (void *)
5 years ago
Romain Vimont
a920ba6471
Explain how to customize path in README
5 years ago
Romain Vimont
3133d5d1c7
Continue on icon loading failure
...
If loading the icon from xpm fails, launch scrcpy without window icon.
<https://github.com/Genymobile/scrcpy/issues/539 >
5 years ago
Romain Vimont
2dc1a59471
Check surface returned for icon
...
SDL_CreateRGBSurfaceFrom() may return NULL, causing a segfault.
<https://github.com/Genymobile/scrcpy/issues/539 >
5 years ago
Romain Vimont
3068457b90
Log characters failed to be injected
...
Some characters may not be injected (e.g. '\r`). Log them instead of
ignoring them silently.
5 years ago
Romain Vimont
56f8e78f58
Merge pull request #542 from npes87184/dev
...
Return success count in injectText
5 years ago
Yu-Chen Lin
1630f923ef
Return success count in injectText
...
It will insert as many text as possible now.
Fix #509 , tested on Windows 10 and Arch Linux.
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
5 years ago
Romain Vimont
e443518ed9
Print adb command on error
...
When the execution of an adb command fails, print the command. This will
help to understand what went wrong.
See <https://github.com/Genymobile/scrcpy/issues/530 >.
5 years ago
Romain Vimont
eeb8e8420f
Use size_t for command length
...
The size of an array should have type size_t.
5 years ago
Romain Vimont
39b5893c42
Merge pull request #522 from dos1/compositor
...
Disable X11 compositor bypass
5 years ago
Sebastian Krzyszkowiak
b941854c73
Disable X11 compositor bypass
...
Compositor bypass is meant for fullscreen games consuming lots of GPU
resources. For a light app that will usually be windowed, this only
causes unnecessary compositor suspends, especially visible (and
annoying) with complying window manager like KWin.
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Sebastian Krzyszkowiak
068253a3a2
Fix mouse focus clickthrough
...
Mouse focus clickthrough didn't work due to compat.h header not being
included in scrcpy.c.
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
c8338b2918
Recover if expand/collapse panels is not available
...
Some devices don't have the required method. Recover gracefully without
crashing the server.
Fixes <https://github.com/Genymobile/scrcpy/issues/506 >.
5 years ago
Romain Vimont
2837c6eaab
Add method to log error without throwable
...
Add Ln.e(message) in addition to Ln.e(message, error).
5 years ago
Romain Vimont
668e54fd4b
Upgrade gradle
5 years ago
Romain Vimont
01664777c8
Merge branch 'master' into dev
5 years ago
Gerdal
ffa8c66979
Fix link error on Windows Subsystem for Linux
...
Build failed on WSL because of lack of reference to WinMain@16 during
linking.
Fixes <https://github.com/Genymobile/scrcpy/issues/316 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
6 years ago
Romain Vimont
5254e585c6
Run server tests on release
6 years ago
Romain Vimont
66baf0f95b
Run tests with ASAN enabled
...
This may capture more errors (like
e2ef39fae5
).
6 years ago
Romain Vimont
f11b0ec204
Fix server checkstyle errors
...
Fix errors reported by:
gradle -p server check
6 years ago
Romain Vimont
e2ef39fae5
Fix overflow in test
...
The serialized text is not nul-terminated (its size is explicitely
provided), but the input text in the event is a nul-terminated string.
The test was failing with ASAN enabled.
6 years ago
Romain Vimont
3eda38e5fc
Do not call codec.stop() on exception
...
On exception, the codec is not in a state were .stop() can be called.
6 years ago
Andrew Rabert
a16cf95b8e
Remove deprecated Arch Linux package
...
The `scrcpy-prebuiltserver` has been deprecated in favor of the `scrcpy`
package.
<https://aur.archlinux.org/cgit/aur.git/commit/?h=scrcpy-prebuiltserver&id=2ef4359b2e45fc278a191fae014d381b486ffcfe >
Signed-off-by: Romain Vimont <rom@rom1v.com>
6 years ago
Romain Vimont
71fd238b0a
Update developer documentation for v1.8
6 years ago
Romain Vimont
d795144a36
Add note about Ctrl+C on Windows while recording
...
Ctrl+C kills the app on Windows, so the recorded file is broken.
6 years ago