1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Add new window setting: always on top

Implemented for Windows and Linux.
This commit is contained in:
Pedro J. Estébanez
2018-01-05 20:19:27 +01:00
parent a84cb60994
commit 554ffdcde7
8 changed files with 108 additions and 3 deletions

View File

@@ -93,6 +93,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;
@@ -153,6 +154,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print("\t-f : Request fullscreen.\n");
OS::get_singleton()->print("\t-mx : Request maximized.\n");
OS::get_singleton()->print("\t-w : Request windowed.\n");
OS::get_singleton()->print("\t-t : Request always-on-top.\n");
OS::get_singleton()->print("\t-vd <driver> : Video driver (");
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
@@ -425,8 +427,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-f") { // fullscreen
//video_mode.fullscreen=false;
init_fullscreen = true;
} else if (I->get() == "-t") { // always-on-top
init_always_on_top = true;
} else if (I->get() == "-e" || I->get() == "-editor") { // fonud editor
editor = true;
@@ -690,6 +694,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
video_mode.resizable = globals->get("display/resizable");
if (use_custom_res && globals->has("display/borderless_window"))
video_mode.borderless_window = globals->get("display/borderless_window");
if (use_custom_res && globals->has("display/always_on_top"))
video_mode.always_on_top = globals->get("display/always_on_top");
if (!force_res && use_custom_res && globals->has("display/test_width") && globals->has("display/test_height")) {
int tw = globals->get("display/test_width");
@@ -706,6 +712,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("display/fullscreen", video_mode.fullscreen);
GLOBAL_DEF("display/resizable", video_mode.resizable);
GLOBAL_DEF("display/borderless_window", video_mode.borderless_window);
GLOBAL_DEF("display/always_on_top", video_mode.always_on_top);
use_vsync = GLOBAL_DEF("display/use_vsync", use_vsync);
GLOBAL_DEF("display/test_width", 0);
GLOBAL_DEF("display/test_height", 0);
@@ -882,6 +889,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);
}
MAIN_PRINT("Main: Load Remaps");
path_remap->load_remaps();