Commit Graph

2902 Commits

Author SHA1 Message Date
Romain Vimont
170b7a02e7 Disable "resize to pixel-perfect" when maximized
This improves consistency and will simplify further refactors.

PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-08 20:40:51 +01:00
Romain Vimont
9f1aac41a6 Check programming errors reported by SDL3
Refs #6216 comment <https://github.com/Genymobile/scrcpy/pull/6216#issuecomment-3399353701>
Refs SDL/#14223 <https://github.com/libsdl-org/SDL/issues/14223>
PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-08 20:40:48 +01:00
Romain Vimont
02989249f6 Migrate from SDL2 to SDL3
Refs <https://wiki.libsdl.org/SDL3/README-migration>
PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-06 16:22:48 +01:00
Romain Vimont
f8e0b9be4b Improve color space conversion
Use both the color space and color range from FFmpeg to determine the
appropriate SDL YUV conversion mode.

PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-04 14:14:33 +01:00
Romain Vimont
ed62ca124c Set color range during texture creation
This prepares for the migration to SDL3, where the color range can only
be specified at the time of texture creation.

PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-04 14:14:18 +01:00
Romain Vimont
3571fe62ed Create texture on first frame
The texture was created as soon as the initial video size was known,
even before the first frame arrived.

However, texture creation will require other data, such as the color
range, which is only available once the first frame is received.

Therefore, delay texture creation until the first frame.

PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-04 14:13:33 +01:00
Romain Vimont
bca98133d1 Remove prepare_for_frame()
Inline the function body into its only caller to simplify further
refactors.

PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-04 14:12:12 +01:00
Romain Vimont
881c71b2e8 Handle mouse integer scrolling locally
Do not rely on SDL to expose integer scroll values, as they are not
available in all versions.

It was reimplemented in SDL 3.2.12 by this commit:
<0447c2f3c3>

Refs #6156 <https://github.com/Genymobile/scrcpy/issues/6156>
PR #6216 <https://github.com/Genymobile/scrcpy/pull/6216>
2026-01-04 14:11:51 +01:00
Romain Vimont
09eed565fc Remove unnecessary dependencies for Windows builds
The GitHub Actions script installed unnecessary packages when
cross-building for Windows.
2026-01-04 14:04:57 +01:00
Romain Vimont
b0da401e6d Fix documentation of input_events.h
Add missing reference to sc_gamepad_processor.

Refs #6216 comment <https://github.com/Genymobile/scrcpy/pull/6216#pullrequestreview-3616928335>
2026-01-04 14:04:34 +01:00
Romain Vimont
dba2a3778f Include USB header only if HAVE_USB 2026-01-02 14:59:10 +01:00
Romain Vimont
cda4387058 Add missing break statement
Refs #6439 comment <https://github.com/Genymobile/scrcpy/pull/6439#issuecomment-3705283406>
2026-01-02 14:47:28 +01:00
Romain Vimont
42632d3f53 Drop root privileges on startup
On rooted devices, switch to user 2000 during startup.

Copy-paste does not work as root (user 0), so switching to 2000 fixes
the issue.

Fixes #6224 <https://github.com/Genymobile/scrcpy/issues/6224>

Suggested-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2025-12-30 14:40:53 +01:00
Romain Vimont
db2f72a58a Merge branch 'master' into dev 2025-12-17 20:27:11 +01:00
Romain Vimont
fb6381f5b9 Upgrade links to 3.3.4 v3.3.4 2025-12-17 20:21:05 +01:00
Romain Vimont
06fd3b4786 Bump version to 3.3.4 2025-12-17 19:57:50 +01:00
Romain Vimont
1d1a4103cc Replace macos-13 runner with macos-15-intel
Refs <https://github.com/actions/runner-images/issues/13046>
Refs #5526 <https://github.com/Genymobile/scrcpy/pull/5526>
2025-12-17 19:57:50 +01:00
Romain Vimont
5b51396a8c Fix permission denial error after Android upgrade
Assign the FakeContext instance to ActivityManager.mContext to avoid a
permission error:

    Permission Denial: package=android does not belong to uid=2000

Fixes #6523 <https://github.com/Genymobile/scrcpy/issues/6523>
2025-12-09 20:24:42 +01:00
Romain Vimont
7e66062086 Extract function to execute code on a handler
Extract function to synchronously execute code on a handler, waiting for
the execution to complete.
2025-11-28 22:42:17 +01:00
Romain Vimont
6f9eb31d52 Add missing test for START_APP serialization
A test for Java deserialization of the START_APP control message was
already present, but the corresponding C-side serialization test was
missing.

Refs 13ce277e1f
2025-11-25 00:13:13 +01:00
Romain Vimont
9cfa5b197a Create Application instance via instrumentation
This fixes an issue on certain Meizu devices.

Fixes #6480 <https://github.com/Genymobile/scrcpy/issues/6480>
2025-11-23 15:56:31 +01:00
paradoxskin
b08093d1c0 Fix incorrect icon filename in build documentation
The installed icon was listed as `icon.png`, but the actual
filename is `scrcpy.png`.

PR #6490 <https://github.com/Genymobile/scrcpy/pull/6490>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-11-19 17:13:40 +01:00
valord577
7dd9bcaf60 Prevent error log interleaving
Between the calls to CONSOLE_ERR.print() and
printStackTrace(CONSOLE_ERR), logs from other threads may be inserted.

Synchronizing access to CONSOLE_ERR ensures that logs from different
threads do not mix.

PR #6487 <https://github.com/Genymobile/scrcpy/pull/6487>

Signed-off-by: valord577 <valord577@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-11-18 11:17:17 +01:00
Romain Vimont
3530851071 Fix uncaught exception handler
The default handler was mistakenly retrieved after our custom handler
was set, causing it to reference itself. As a result, this led to
infinite recursion.

Bug introduced by eee3f24739.
2025-11-04 20:35:39 +01:00
Romain Vimont
d0047b2110 Do not fail when uniqueId field is missing
On some devices, DisplayInfo does not have a "uniqueId" field. This
field is only used for correct UHID behavior on virtual displays, so its
absence should not prevent scrcpy from working.

Refs #6009 <https://github.com/Genymobile/scrcpy/pull/6009>
Fixes #6461 <https://github.com/Genymobile/scrcpy/issues/6461>
2025-11-01 00:34:20 +01:00
Romain Vimont
3281fda6ef Set URL explicitly in dependency build scripts
Explicitly set the URL of each dependency at the beginning of its
script.

PROJECT_DIR and FILENAME are internal details.
2025-10-30 22:31:16 +01:00
Romain Vimont
925949d54a Refactor dependency build scripts initialization
Rename "common" to "_init" because it not only exposes common functions
but also initializes environment variables.

Call _init in a single line in all dependency build scripts.
2025-10-30 22:27:17 +01:00
Yan
f3d4fde15b Fix handling of non-integer ANDROID_PLATFORM
ANDROID_PLATFORM is not always an integer; it can also be a value like
"36.1". Handle such cases properly.

This fixes the following error:

    server/build_without_gradle.sh: line 89:
    [[: 36.1: syntax error: invalid arithmetic operator (error token is ".1")

PR #6408 <https://github.com/Genymobile/scrcpy/pull/6408>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-10-19 21:00:05 +02:00
Romain Vimont
eee3f24739 Upgrade Gradle and use Android SDK 36 2025-10-19 21:00:05 +02:00
Romain Vimont
3e40b24737 Fix UHID_OUTPUT message parsing
The bounds check was incorrect.

Fixes #6415 <https://github.com/Genymobile/scrcpy/issues/6415>
2025-10-09 09:35:14 +02:00
Romain Vimont
9d7a4c88e0 Apply workarounds in the cleanup process
Accessing settings may require workarounds on certain devices.

Fixes #6405 <https://github.com/Genymobile/scrcpy/issues/6405>
2025-10-05 21:36:10 +02:00
Romain Vimont
e5e58b1b30 Upgrade links to 3.3.3 v3.3.3 2025-09-27 16:10:10 +02:00
Romain Vimont
10a0974f43 Bump version to 3.3.3 2025-09-23 21:18:45 +02:00
Romain Vimont
be21e43be5 Fix frame leak on pending frame update
The previous pending frame was not unreferenced before referencing the
new one, causing frames to leak whenever a texture update failed
(typically on Windows when the window is minimized with D3D9).

Refs 6298ef095f
Fixes #4297 <https://github.com/Genymobile/scrcpy/issues/4297>
Fixes #6357 <https://github.com/Genymobile/scrcpy/issues/6357>
2025-09-23 21:18:45 +02:00
Romain Vimont
bfb0872493 Avoid resetting pending frame
The function update_texture() calls update_texture_internal() and falls
back to set_pending_frame() if it fails.

When the frame passed is the pending frame, call only the _internal()
version instead.

This will prevent issues with frame reference counts by ensuring the
source and destination frames are never the same.

Refs 6298ef095f
Refs #6357 <https://github.com/Genymobile/scrcpy/issues/6357>
2025-09-23 21:18:08 +02:00
Romain Vimont
e11399aff0 Ignore unknown methods in IDisplayWindowListener
New Android versions may add methods to IDisplayWindowListener.aidl.
When these methods are called by the system, they result in an
AbstractMethodError because they are not implemented on the scrcpy side.

To avoid releasing a new version for each newly added method, ignore
them at the Binder level.

Refs afaca80b37
Fixes #6362 <https://github.com/Genymobile/scrcpy/issues/6362>
2025-09-18 10:29:42 +02:00
David Griswold
9d56d26d45 Make virtual display presentable
With this flag, apps with baked in two-screen support can see the
virtual display as an external display they can present to.

PR #6344 <https://github.com/Genymobile/scrcpy/pull/6344>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-09-11 21:02:13 +02:00
Romain Vimont
f663bbec12 Update links to 3.3.2 v3.3.2 2025-09-06 14:54:36 +02:00
Romain Vimont
2506d1768b Bump version to 3.3.2 2025-09-06 14:36:37 +02:00
Romain Vimont
4ee94cb845 Workaround clipboard issue on Samsung devices
Fixes #6224 <https://github.com/Genymobile/scrcpy/issues/6224>

Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2025-09-06 14:36:33 +02:00
Romain Vimont
afaca80b37 Fix virtual display after Android 16 upgrade
Several methods have been added upstream to IDisplayWindowListener.aidl,
causing an AbstractMethodError when they are called on the listener
instance implemented by scrcpy.

Fixes #6234 <https://github.com/Genymobile/scrcpy/issues/6234>
Fixes #6331 <https://github.com/Genymobile/scrcpy/issues/6331>
2025-09-06 14:19:43 +02:00
Filip Buda
8057835a0d Catch CTRL_BREAK_EVENT signal on Windows
This ensures the process can terminate properly when a CTRL_BREAK_EVENT
signal is sent programmatically.

PR #6244 <https://github.com/Genymobile/scrcpy/pull/6244>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-08-12 18:17:32 +02:00
Yan
e47529ab9c Fix gl_context declared type
The field gl_context is initialized from SDL_GL_CreateContext(), which
returns a raw SDL_GLContext, not a pointer.

The type mismatch was silently ignored by SDL2 because SDL_GLContext
was defined as an alias to `void *` (in SDL3, it is instead an alias to
`struct SDL_GLContextState *`, so compilation fails).

Refs #3895 <https://github.com/Genymobile/scrcpy/pull/3895>
PR #6259 <https://github.com/Genymobile/scrcpy/pull/6259>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-08-12 18:08:22 +02:00
Romain Vimont
939c8e7f68 Simplify settings access
For Android >= 12, scrcpy executed "settings" commands (in a new
process) rather than using the ContentProvider directly, due to
permission issues [1].

However, these permission issues were resolved by introducing
FakeContext.getContentResolver() [2].

Therefore, remove the use of "settings" commands and use the
ContentProvider directly in all cases.

Refs [1] cc0902b13c
Refs [2] 91373d906b
Refs #6224 comment <https://github.com/Genymobile/scrcpy/issues/6224#issuecomment-3078418268>
2025-07-17 18:27:21 +02:00
Romain Vimont
eb576c44f8 Replace __WINDOWS__ by _WIN32
Replace the SDL2-specific preprocessor macro __WINDOWS__ by the
"standard" _WIN32 macro.
2025-07-17 18:23:25 +02:00
Romain Vimont
0522d02d40 Add missing includes
The headers were implicitly included recursively, but include them
explicitly.
2025-07-17 18:23:12 +02:00
Romain Vimont
30bfc80f9b Fix style for 80-char limit 2025-07-17 13:20:45 +02:00
Romain Vimont
c3d2ef1b1f Remove redundant ninja install for GA macOS runner
The ninja package is already installed, so this triggered a warning:

> ninja 1.13.0 is already installed and up-to-date. To reinstall 1.13.0,
> run: brew reinstall ninja
2025-07-17 13:20:45 +02:00
Romain Vimont
a79ddc35a7 Update platform-tools checksums
The release binaries of platform-tools_r36.0.0 have changed upstream.

Both releases versions are referenced from
<https://dl.google.com/android/repository/repository2-2.xml>

Refs #6214 <https://github.com/Genymobile/scrcpy/issues/6214>
Refs <https://issuetracker.google.com/issues/431119334>
2025-07-17 13:20:45 +02:00
Romain Vimont
04542a9f58 Fix window leak on icon error 2025-07-17 13:19:15 +02:00