mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Add new window setting: always on top
Implemented for Windows and Linux.
(cherry picked from commit ee2c31d306)
This commit is contained in:
parent
74e72c995d
commit
1c25e50490
8 changed files with 105 additions and 1 deletions
|
|
@ -106,6 +106,7 @@ static OS::VideoMode video_mode;
|
|||
static bool init_maximized = false;
|
||||
static bool init_windowed = false;
|
||||
static bool init_fullscreen = false;
|
||||
static bool init_always_on_top = false;
|
||||
static bool init_use_custom_pos = false;
|
||||
#ifdef DEBUG_ENABLED
|
||||
static bool debug_collisions = false;
|
||||
|
|
@ -233,6 +234,7 @@ void Main::print_help(const char *p_binary) {
|
|||
OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
|
||||
OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
|
||||
OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n");
|
||||
OS::get_singleton()->print(" -t, --always-on-top Request an always-on-top window.\n");
|
||||
OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
|
||||
OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
|
||||
OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n");
|
||||
|
|
@ -441,6 +443,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
} else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
|
||||
|
||||
init_windowed = true;
|
||||
} else if (I->get() == "-t" || I->get() == "--always-on-top") { // force always-on-top window
|
||||
|
||||
init_always_on_top = true;
|
||||
} else if (I->get() == "--profiling") { // enable profiling
|
||||
|
||||
use_debug_profiler = true;
|
||||
|
|
@ -851,6 +856,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
GLOBAL_DEF("display/window/size/resizable", true);
|
||||
GLOBAL_DEF("display/window/size/borderless", false);
|
||||
GLOBAL_DEF("display/window/size/fullscreen", false);
|
||||
GLOBAL_DEF("display/window/size/always_on_top", false);
|
||||
GLOBAL_DEF("display/window/size/test_width", 0);
|
||||
GLOBAL_DEF("display/window/size/test_height", 0);
|
||||
|
||||
|
|
@ -873,6 +879,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
video_mode.resizable = GLOBAL_GET("display/window/size/resizable");
|
||||
video_mode.borderless_window = GLOBAL_GET("display/window/size/borderless");
|
||||
video_mode.fullscreen = GLOBAL_GET("display/window/size/fullscreen");
|
||||
video_mode.always_on_top = GLOBAL_GET("display/window/size/always_on_top");
|
||||
}
|
||||
|
||||
if (!force_lowdpi) {
|
||||
|
|
@ -1078,6 +1085,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
} else if (init_fullscreen) {
|
||||
OS::get_singleton()->set_window_fullscreen(true);
|
||||
}
|
||||
if (init_always_on_top) {
|
||||
OS::get_singleton()->set_window_always_on_top(true);
|
||||
}
|
||||
|
||||
register_server_types();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue