|
|
|
@ -259,6 +259,13 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) {
|
|
|
|
|
(void) res; // any error already logged
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sc_screen_render_novideo(struct sc_screen *screen) {
|
|
|
|
|
enum sc_display_result res =
|
|
|
|
|
sc_display_render(&screen->display, NULL, SC_ORIENTATION_0);
|
|
|
|
|
(void) res; // any error already logged
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) || defined(__WINDOWS__)
|
|
|
|
|
# define CONTINUOUS_RESIZING_WORKAROUND
|
|
|
|
|
#endif
|
|
|
|
@ -371,6 +378,7 @@ sc_screen_init(struct sc_screen *screen,
|
|
|
|
|
screen->mouse_capture_key_pressed = 0;
|
|
|
|
|
screen->paused = false;
|
|
|
|
|
screen->resume_frame = NULL;
|
|
|
|
|
screen->orientation = SC_ORIENTATION_0;
|
|
|
|
|
|
|
|
|
|
screen->video = params->video;
|
|
|
|
|
|
|
|
|
@ -390,10 +398,12 @@ sc_screen_init(struct sc_screen *screen,
|
|
|
|
|
goto error_destroy_frame_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
screen->orientation = params->orientation;
|
|
|
|
|
if (screen->orientation != SC_ORIENTATION_0) {
|
|
|
|
|
LOGI("Initial display orientation set to %s",
|
|
|
|
|
sc_orientation_get_name(screen->orientation));
|
|
|
|
|
if (screen->video) {
|
|
|
|
|
screen->orientation = params->orientation;
|
|
|
|
|
if (screen->orientation != SC_ORIENTATION_0) {
|
|
|
|
|
LOGI("Initial display orientation set to %s",
|
|
|
|
|
sc_orientation_get_name(screen->orientation));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t window_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
|
|
|
@ -403,6 +413,11 @@ sc_screen_init(struct sc_screen *screen,
|
|
|
|
|
if (params->window_borderless) {
|
|
|
|
|
window_flags |= SDL_WINDOW_BORDERLESS;
|
|
|
|
|
}
|
|
|
|
|
if (params->video) {
|
|
|
|
|
// The window will be shown on first frame
|
|
|
|
|
window_flags |= SDL_WINDOW_HIDDEN
|
|
|
|
|
| SDL_WINDOW_RESIZABLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *title = params->window_title;
|
|
|
|
|
assert(title);
|
|
|
|
@ -411,22 +426,17 @@ sc_screen_init(struct sc_screen *screen,
|
|
|
|
|
int y = SDL_WINDOWPOS_UNDEFINED;
|
|
|
|
|
int width = 256;
|
|
|
|
|
int height = 256;
|
|
|
|
|
if (params->video) {
|
|
|
|
|
// The window will be shown on first frame
|
|
|
|
|
window_flags |= SDL_WINDOW_HIDDEN
|
|
|
|
|
| SDL_WINDOW_RESIZABLE;
|
|
|
|
|
if (params->window_x != SC_WINDOW_POSITION_UNDEFINED) {
|
|
|
|
|
x = params->window_x;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_y != SC_WINDOW_POSITION_UNDEFINED) {
|
|
|
|
|
y = params->window_y;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_width) {
|
|
|
|
|
width = params->window_width;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_height) {
|
|
|
|
|
height = params->window_height;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_x != SC_WINDOW_POSITION_UNDEFINED) {
|
|
|
|
|
x = params->window_x;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_y != SC_WINDOW_POSITION_UNDEFINED) {
|
|
|
|
|
y = params->window_y;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_width) {
|
|
|
|
|
width = params->window_width;
|
|
|
|
|
}
|
|
|
|
|
if (params->window_height) {
|
|
|
|
|
height = params->window_height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The window will be positioned and sized on first video frame
|
|
|
|
@ -449,8 +459,9 @@ sc_screen_init(struct sc_screen *screen,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SDL_Surface *icon_novideo = params->video ? NULL : icon;
|
|
|
|
|
bool mipmaps = params->video && params->mipmaps;
|
|
|
|
|
ok = sc_display_init(&screen->display, screen->window, icon_novideo,
|
|
|
|
|
params->mipmaps);
|
|
|
|
|
mipmaps);
|
|
|
|
|
if (icon) {
|
|
|
|
|
scrcpy_icon_destroy(icon);
|
|
|
|
|
}
|
|
|
|
@ -857,6 +868,11 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case SDL_WINDOWEVENT:
|
|
|
|
|
if (!screen->video
|
|
|
|
|
&& event->window.event == SDL_WINDOWEVENT_EXPOSED) {
|
|
|
|
|
sc_screen_render_novideo(screen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// !video implies !has_frame
|
|
|
|
|
assert(screen->video || !screen->has_frame);
|
|
|
|
|
if (!screen->has_frame) {
|
|
|
|
|