From 4df86f8b048a977fed51891849859b8171e1a18b Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 14 Sep 2020 19:56:41 +0200 Subject: [PATCH] Only display the Windows toggle console option if it can actually be used --- editor/editor_node.cpp | 4 +++- platform/uwp/detect.py | 2 ++ platform/windows/detect.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4835b4beab2..3a526578629 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6198,7 +6198,9 @@ EditorNode::EditorNode() { #else p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); #endif -#ifdef WINDOWS_ENABLED +#if defined(WINDOWS_ENABLED) && defined(WINDOWS_SUBSYSTEM_CONSOLE) + // The console can only be toggled if the application was built for the console subsystem, + // not the GUI subsystem. p->add_item(TTR("Toggle System Console"), SETTINGS_TOGGLE_CONSOLE); #endif p->add_separator(); diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 04b743f2c84..a7ca26c16c3 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -65,12 +65,14 @@ def configure(env): env.Append(CCFLAGS=["/MD"]) env.Append(CPPDEFINES=["DEBUG_ENABLED"]) env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"]) elif env["target"] == "debug": env.Append(CCFLAGS=["/Zi"]) env.Append(CCFLAGS=["/MDd"]) env.Append(CPPDEFINES=["DEBUG_ENABLED"]) env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"]) env.Append(LINKFLAGS=["/DEBUG"]) ## Compiler configuration diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 4e1da22bb0a..c380142c72d 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -210,6 +210,7 @@ def configure_msvc(env, manual_msvc_config): env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"]) else: env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"]) ## Compile/link flags @@ -347,6 +348,7 @@ def configure_mingw(env): env.Append(LINKFLAGS=["-Wl,--subsystem,windows"]) else: env.Append(LINKFLAGS=["-Wl,--subsystem,console"]) + env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"]) ## Compiler configuration