diff options
author | Wei Guo <me@imkira.com> | 2022-10-23 18:34:41 +0800 |
---|---|---|
committer | kiraweiguo <kiraweiguo@tencent.com> | 2022-10-24 13:50:25 +0800 |
commit | d7e39e313b1f44d122be89a356dab8e4028a2043 (patch) | |
tree | e6f612b44d61a871720f099999db3da71b04fa56 /main | |
parent | 0d04e7ec914ff609dfbdfff3dca04ed12a21e600 (diff) |
Make window creation with custom position do not flash
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp index bb6ab11362..dbaf42b3e4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1956,9 +1956,15 @@ Error Main::setup2(Thread::ID p_main_tid_override) { { String display_driver = DisplayServer::get_create_function_name(display_driver_idx); + Vector2i *window_position = nullptr; + Vector2i position = init_custom_pos; + if (init_use_custom_pos) { + window_position = &position; + } + // rendering_driver now held in static global String in main and initialized in setup() Error err; - display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_size, err); + display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, err); if (err != OK || display_server == nullptr) { // We can't use this display server, try other ones as fallback. // Skip headless (always last registered) because that's not what users @@ -1967,7 +1973,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { if (i == display_driver_idx) { continue; // Don't try the same twice. } - display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_size, err); + display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, err); if (err == OK && display_server != nullptr) { break; } |