Move "show window" call on first frame
Show the window only after the actual frame size is known (and if no error has occurred). This will allow to properly position and size the window when the size of the first frame is different from the size initially announced by the server. PR #2947 <https://github.com/Genymobile/scrcpy/pull/2947>
This commit is contained in:
parent
4fb61ac83d
commit
fa30f9806a
1 changed files with 8 additions and 6 deletions
|
@ -693,6 +693,12 @@ sc_screen_update_frame(struct sc_screen *screen) {
|
|||
}
|
||||
update_texture(screen, frame);
|
||||
|
||||
if (!screen->has_frame) {
|
||||
screen->has_frame = true;
|
||||
// this is the very first frame, show the window
|
||||
sc_screen_show_window(screen);
|
||||
}
|
||||
|
||||
sc_screen_render(screen, false);
|
||||
return true;
|
||||
}
|
||||
|
@ -763,17 +769,13 @@ sc_screen_is_mouse_capture_key(SDL_Keycode key) {
|
|||
bool
|
||||
sc_screen_handle_event(struct sc_screen *screen, SDL_Event *event) {
|
||||
switch (event->type) {
|
||||
case EVENT_NEW_FRAME:
|
||||
if (!screen->has_frame) {
|
||||
screen->has_frame = true;
|
||||
// this is the very first frame, show the window
|
||||
sc_screen_show_window(screen);
|
||||
}
|
||||
case EVENT_NEW_FRAME: {
|
||||
bool ok = sc_screen_update_frame(screen);
|
||||
if (!ok) {
|
||||
LOGW("Frame update failed\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case SDL_WINDOWEVENT:
|
||||
if (!screen->has_frame) {
|
||||
// Do nothing
|
||||
|
|
Loading…
Reference in a new issue