Compare commits

..

9 Commits

Author SHA1 Message Date
Romain Vimont
1f237a4950 Display disconnected icon before closing
When the connection to the device is lost while mirroring, the window
closed immediately, suggesting scrcpy had crashed.

To make it clear that a disconnection occurred, display a disconnected
icon for 2 seconds before closing the window.
2026-02-24 23:03:33 +01:00
Romain Vimont
d36322c841 Track window shown state
Use a flag to determine whether the window is currently shown.

This replaces the old has_video_window flag, which was true only when
the window was shown and video was enabled.

This will simplify displaying a "disconnected" icon on device
disconnection when the window is currently shown.
2026-02-24 00:25:54 +01:00
Romain Vimont
a7ff2ff6c7 Only reject RUN_ON_MAIN_THREAD events on quit
Use SDL_PeepEvents() to consume only SC_EVENT_RUN_ON_MAIN_THREAD events.
Other events are not dropped and can still be processed later.
2026-02-24 00:25:52 +01:00
Romain Vimont
2bdefc7663 Add utility to push an SDL event with data 2026-02-22 10:00:40 +01:00
Romain Vimont
9a079a716d Add function to delete current texture 2026-02-22 10:00:40 +01:00
Romain Vimont
cb6eee82cc Add filename parameter to icon loading
Replace scrcpy_icon_load(), which loaded the unique scrcpy app icon,
with sc_icon_load(filename), which can load any icon from the icons
directory.
2026-02-22 10:00:40 +01:00
Romain Vimont
ced45d0ec4 Replace SCRCPY_ICON_PATH with SCRCPY_ICON_DIR
SCRCPY_ICON_PATH defined the path of the scrcpy app icon.
SCRCPY_ICON_DIR defines the directory where scrcpy icons reside.

This change prepares for the addition of other icons.
2026-02-22 10:00:40 +01:00
Romain Vimont
7958b297ec Extract function to build file paths
Add a utility function to create a full path from a directory and a
filename.
2026-02-22 10:00:40 +01:00
Romain Vimont
b4711a5904 Rename icon.png to scrcpy.png
This makes the icon name consistent everywhere.
2026-02-22 10:00:40 +01:00
2 changed files with 1 additions and 4 deletions

View File

@@ -1006,9 +1006,6 @@ sc_screen_handle_disconnection(struct sc_screen *screen) {
sc_icon_destroy(icon_disconnected);
break;
}
case SDL_EVENT_WINDOW_EXPOSED:
sc_screen_render(screen, true);
break;
case SC_EVENT_DISCONNECTED_TIMEOUT:
LOGD("Closing after device disconnection");
return;

View File

@@ -93,4 +93,4 @@ Then just double-click on that file to run it.
To start scrcpy without opening a terminal, double-click `scrcpy-noconsole.vbs`
(note that errors won't be shown). To pass arguments, edit (a copy of)
`scrcpy-noconsole.vbs` and add the desired arguments.
`scrcpy-noconsole.vbs` add and the desired arguments.