summaryrefslogtreecommitdiffstats
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/detect.py24
-rw-r--r--platform/windows/display_server_windows.cpp4
-rw-r--r--platform/windows/os_windows.cpp6
-rw-r--r--platform/windows/os_windows.h6
4 files changed, 22 insertions, 18 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 0619e62563..f536c1ac27 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -7,7 +7,7 @@ from platform_methods import detect_arch
from typing import TYPE_CHECKING
if TYPE_CHECKING:
- from SCons import Environment
+ from SCons.Script.SConscript import SConsEnvironment
# To match other platforms
STACK_SIZE = 8388608
@@ -251,7 +251,7 @@ def get_flags():
]
-def build_res_file(target, source, env):
+def build_res_file(target, source, env: "SConsEnvironment"):
arch_aliases = {
"x86_32": "pe-i386",
"x86_64": "pe-x86-64",
@@ -286,7 +286,7 @@ def build_res_file(target, source, env):
return 0
-def setup_msvc_manual(env):
+def setup_msvc_manual(env: "SConsEnvironment"):
"""Running from VCVARS environment"""
env_arch = detect_build_env_arch()
@@ -303,7 +303,7 @@ def setup_msvc_manual(env):
print("Found MSVC, arch %s" % (env_arch))
-def setup_msvc_auto(env):
+def setup_msvc_auto(env: "SConsEnvironment"):
"""Set up MSVC using SCons's auto-detection logic"""
# If MSVC_VERSION is set by SCons, we know MSVC is installed.
@@ -339,7 +339,7 @@ def setup_msvc_auto(env):
print("Found MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"]))
-def setup_mingw(env):
+def setup_mingw(env: "SConsEnvironment"):
"""Set up env for use with mingw"""
env_arch = detect_build_env_arch()
@@ -374,7 +374,7 @@ def setup_mingw(env):
print("Using MinGW, arch %s" % (env["arch"]))
-def configure_msvc(env, vcvars_msvc_config):
+def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
"""Configure env to work with MSVC"""
## Build type
@@ -417,7 +417,7 @@ def configure_msvc(env, vcvars_msvc_config):
if vcvars_msvc_config: # should be automatic if SCons found it
if os.getenv("WindowsSdkDir") is not None:
- env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
+ env.Prepend(CPPPATH=[str(os.getenv("WindowsSdkDir")) + "/Include"])
else:
print("Missing environment variable: WindowsSdkDir")
@@ -522,7 +522,7 @@ def configure_msvc(env, vcvars_msvc_config):
if vcvars_msvc_config:
if os.getenv("WindowsSdkDir") is not None:
- env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
+ env.Append(LIBPATH=[str(os.getenv("WindowsSdkDir")) + "/Lib"])
else:
print("Missing environment variable: WindowsSdkDir")
@@ -543,8 +543,8 @@ def configure_msvc(env, vcvars_msvc_config):
env.AppendUnique(LINKFLAGS=["/LTCG"])
if vcvars_msvc_config:
- env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
- env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
+ env.Prepend(CPPPATH=[p for p in str(os.getenv("INCLUDE")).split(";")])
+ env.Append(LIBPATH=[p for p in str(os.getenv("LIB")).split(";")])
# Sanitizers
if env["use_asan"]:
@@ -560,7 +560,7 @@ def configure_msvc(env, vcvars_msvc_config):
env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
-def configure_mingw(env):
+def configure_mingw(env: "SConsEnvironment"):
# Workaround for MinGW. See:
# https://www.scons.org/wiki/LongCmdLinesOnWin32
env.use_windows_spawn_fix()
@@ -747,7 +747,7 @@ def configure_mingw(env):
env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})
-def configure(env: "Environment"):
+def configure(env: "SConsEnvironment"):
# Validate arch.
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
if env["arch"] not in supported_arches:
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 7d96bded14..72c07c3337 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -3452,6 +3452,10 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
if (wParam != WA_INACTIVE) {
track_mouse_leave_event(hWnd);
+
+ if (!IsIconic(hWnd)) {
+ SetFocus(hWnd);
+ }
}
return 0; // Return to the message loop.
} break;
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6ad616da85..93d1ffeac1 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -352,7 +352,7 @@ void debug_dynamic_library_check_dependencies(const String &p_root_path, const S
}
#endif
-Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
+Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String path = p_path.replace("/", "\\");
if (!FileAccess::exists(path)) {
@@ -418,7 +418,7 @@ Error OS_Windows::close_dynamic_library(void *p_library_handle) {
return OK;
}
-Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
+Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String &p_name, void *&p_symbol_handle, bool p_optional) {
p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
if (!p_symbol_handle) {
if (!p_optional) {
@@ -1333,7 +1333,7 @@ String OS_Windows::get_stdin_string() {
return String();
}
-Error OS_Windows::shell_open(String p_uri) {
+Error OS_Windows::shell_open(const String &p_uri) {
INT_PTR ret = (INT_PTR)ShellExecuteW(nullptr, nullptr, (LPCWSTR)(p_uri.utf16().get_data()), nullptr, nullptr, SW_SHOWNORMAL);
if (ret > 32) {
return OK;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 056696ae2f..7e7d23a2a8 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -155,9 +155,9 @@ public:
virtual Error get_entropy(uint8_t *r_buffer, int p_bytes) override;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
+ virtual Error open_dynamic_library(const String &p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual Error close_dynamic_library(void *p_library_handle) override;
- virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override;
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String &p_name, void *&p_symbol_handle, bool p_optional = false) override;
virtual MainLoop *get_main_loop() const override;
@@ -213,7 +213,7 @@ public:
virtual String get_unique_id() const override;
- virtual Error shell_open(String p_uri) override;
+ virtual Error shell_open(const String &p_uri) override;
virtual Error shell_show_in_file_manager(String p_path, bool p_open_folder) override;
void run();