feat: updated engine version to 4.4
This commit is contained in:
parent
d08586768d
commit
ba58baf432
140 changed files with 108317 additions and 14666 deletions
|
|
@ -83,11 +83,6 @@
|
|||
|
||||
#define WM_INDICATOR_CALLBACK_MESSAGE (WM_USER + 1)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Workaround GCC warning from -Wcast-function-type.
|
||||
#define GetProcAddress (void *)GetProcAddress
|
||||
#endif
|
||||
|
||||
static String format_error_message(DWORD id) {
|
||||
LPWSTR messageBuffer = nullptr;
|
||||
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
|
|
@ -1294,7 +1289,7 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
|
|||
|
||||
if (Shcore == nullptr) {
|
||||
Shcore = LoadLibraryW(L"Shcore.dll");
|
||||
getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : nullptr;
|
||||
getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)(void *)GetProcAddress(Shcore, "GetDpiForMonitor") : nullptr;
|
||||
|
||||
if ((Shcore == nullptr) || (getDPIForMonitor == nullptr)) {
|
||||
if (Shcore) {
|
||||
|
|
@ -1974,7 +1969,10 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
|
|||
return;
|
||||
}
|
||||
const WindowData &wd = windows[p_window];
|
||||
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved to another screen.");
|
||||
if (wd.parent_hwnd) {
|
||||
print_line("Embedded window can't be moved to another screen.");
|
||||
return;
|
||||
}
|
||||
if (wd.fullscreen) {
|
||||
Point2 pos = screen_get_position(p_screen) + _get_screens_origin();
|
||||
Size2 size = screen_get_size(p_screen);
|
||||
|
|
@ -2055,7 +2053,10 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
|
|||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved.");
|
||||
if (wd.parent_hwnd) {
|
||||
print_line("Embedded window can't be moved.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (wd.fullscreen || wd.maximized) {
|
||||
return;
|
||||
|
|
@ -2141,7 +2142,10 @@ void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_w
|
|||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a maximum size.");
|
||||
if (wd.parent_hwnd) {
|
||||
print_line("Embedded windows can't have a maximum size.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((p_size != Size2()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
|
||||
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
|
||||
|
|
@ -2164,7 +2168,10 @@ void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_w
|
|||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a minimum size.");
|
||||
if (wd.parent_hwnd) {
|
||||
print_line("Embedded windows can't have a minimum size.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((p_size != Size2()) && (wd.max_size != Size2()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
|
||||
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
|
||||
|
|
@ -2187,7 +2194,10 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
|
|||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be resized.");
|
||||
if (wd.parent_hwnd) {
|
||||
print_line("Embedded window can't be resized.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (wd.fullscreen || wd.maximized) {
|
||||
return;
|
||||
|
|
@ -2345,7 +2355,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
|
|||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
WindowData &wd = windows[p_window];
|
||||
|
||||
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd, "Embedded window only supports Windowed mode.");
|
||||
if (p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd) {
|
||||
print_line("Embedded window only supports Windowed mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
bool was_fullscreen = wd.fullscreen;
|
||||
wd.was_fullscreen_pre_min = false;
|
||||
|
|
@ -2480,7 +2493,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
|
|||
WindowData &wd = windows[p_window];
|
||||
switch (p_flag) {
|
||||
case WINDOW_FLAG_RESIZE_DISABLED: {
|
||||
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window resize can't be disabled.");
|
||||
if (p_enabled && wd.parent_hwnd) {
|
||||
print_line("Embedded window resize can't be disabled.");
|
||||
return;
|
||||
}
|
||||
wd.resizable = !p_enabled;
|
||||
_update_window_style(p_window);
|
||||
} break;
|
||||
|
|
@ -2492,7 +2508,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
|
|||
} break;
|
||||
case WINDOW_FLAG_ALWAYS_ON_TOP: {
|
||||
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID && p_enabled, "Transient windows can't become on top.");
|
||||
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't become on top.");
|
||||
if (p_enabled && wd.parent_hwnd) {
|
||||
print_line("Embedded window can't become on top.");
|
||||
return;
|
||||
}
|
||||
wd.always_on_top = p_enabled;
|
||||
_update_window_style(p_window);
|
||||
} break;
|
||||
|
|
@ -2552,7 +2571,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
|
|||
case WINDOW_FLAG_POPUP: {
|
||||
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
|
||||
ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
|
||||
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't be popup.");
|
||||
if (p_enabled && wd.parent_hwnd) {
|
||||
print_line("Embedded window can't be popup.");
|
||||
return;
|
||||
}
|
||||
wd.is_popup = p_enabled;
|
||||
} break;
|
||||
default:
|
||||
|
|
@ -3000,6 +3022,7 @@ Error DisplayServerWindows::embed_process(WindowID p_window, OS::ProcessID p_pid
|
|||
}
|
||||
|
||||
if (p_grab_focus) {
|
||||
SetForegroundWindow(ep->window_handle);
|
||||
SetFocus(ep->window_handle);
|
||||
}
|
||||
|
||||
|
|
@ -3136,7 +3159,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
|
|||
if (comctl) {
|
||||
typedef HRESULT(WINAPI * TaskDialogIndirectPtr)(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, int *pnRadioButton, BOOL *pfVerificationFlagChecked);
|
||||
|
||||
TaskDialogIndirectPtr task_dialog_indirect = (TaskDialogIndirectPtr)GetProcAddress(comctl, "TaskDialogIndirect");
|
||||
TaskDialogIndirectPtr task_dialog_indirect = (TaskDialogIndirectPtr)(void *)GetProcAddress(comctl, "TaskDialogIndirect");
|
||||
int button_pressed;
|
||||
|
||||
if (task_dialog_indirect && SUCCEEDED(task_dialog_indirect(&config, &button_pressed, nullptr, nullptr))) {
|
||||
|
|
@ -6591,9 +6614,9 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
|
||||
HMODULE nt_lib = LoadLibraryW(L"ntdll.dll");
|
||||
if (nt_lib) {
|
||||
WineGetVersionPtr wine_get_version = (WineGetVersionPtr)GetProcAddress(nt_lib, "wine_get_version"); // Do not read Windows build number under Wine, it can be set to arbitrary value.
|
||||
WineGetVersionPtr wine_get_version = (WineGetVersionPtr)(void *)GetProcAddress(nt_lib, "wine_get_version"); // Do not read Windows build number under Wine, it can be set to arbitrary value.
|
||||
if (!wine_get_version) {
|
||||
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)GetProcAddress(nt_lib, "RtlGetVersion");
|
||||
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)(void *)GetProcAddress(nt_lib, "RtlGetVersion");
|
||||
if (RtlGetVersion) {
|
||||
RtlGetVersion(&os_ver);
|
||||
}
|
||||
|
|
@ -6604,28 +6627,28 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
// Load Shell API.
|
||||
HMODULE shellapi_lib = LoadLibraryW(L"shlwapi.dll");
|
||||
if (shellapi_lib) {
|
||||
load_indirect_string = (SHLoadIndirectStringPtr)GetProcAddress(shellapi_lib, "SHLoadIndirectString");
|
||||
load_indirect_string = (SHLoadIndirectStringPtr)(void *)GetProcAddress(shellapi_lib, "SHLoadIndirectString");
|
||||
}
|
||||
|
||||
// Load UXTheme, available on Windows 10+ only.
|
||||
if (os_ver.dwBuildNumber >= 10240) {
|
||||
HMODULE ux_theme_lib = LoadLibraryW(L"uxtheme.dll");
|
||||
if (ux_theme_lib) {
|
||||
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
|
||||
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
|
||||
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
|
||||
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
|
||||
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
|
||||
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
|
||||
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
|
||||
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
|
||||
if (os_ver.dwBuildNumber >= 17763) { // Windows 10 Redstone 5 (1809)+ only.
|
||||
AllowDarkModeForAppPtr AllowDarkModeForApp = nullptr;
|
||||
SetPreferredAppModePtr SetPreferredAppMode = nullptr;
|
||||
FlushMenuThemesPtr FlushMenuThemes = nullptr;
|
||||
if (os_ver.dwBuildNumber < 18362) { // Windows 10 Redstone 5 (1809) and 19H1 (1903) only.
|
||||
AllowDarkModeForApp = (AllowDarkModeForAppPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
|
||||
AllowDarkModeForApp = (AllowDarkModeForAppPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
|
||||
} else { // Windows 10 19H2 (1909)+ only.
|
||||
SetPreferredAppMode = (SetPreferredAppModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
|
||||
FlushMenuThemes = (FlushMenuThemesPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(136));
|
||||
SetPreferredAppMode = (SetPreferredAppModePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
|
||||
FlushMenuThemes = (FlushMenuThemesPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(136));
|
||||
}
|
||||
RefreshImmersiveColorPolicyStatePtr RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyStatePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(104));
|
||||
RefreshImmersiveColorPolicyStatePtr RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyStatePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(104));
|
||||
if (ShouldAppsUseDarkMode) {
|
||||
bool dark_mode = ShouldAppsUseDarkMode();
|
||||
if (SetPreferredAppMode) {
|
||||
|
|
@ -6658,10 +6681,10 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
// Note: DPI conversion API, available on Windows 8.1+ only.
|
||||
HMODULE user32_lib = LoadLibraryW(L"user32.dll");
|
||||
if (user32_lib) {
|
||||
win8p_GetPointerType = (GetPointerTypePtr)GetProcAddress(user32_lib, "GetPointerType");
|
||||
win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)GetProcAddress(user32_lib, "GetPointerPenInfo");
|
||||
win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
|
||||
win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
|
||||
win8p_GetPointerType = (GetPointerTypePtr)(void *)GetProcAddress(user32_lib, "GetPointerType");
|
||||
win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)(void *)GetProcAddress(user32_lib, "GetPointerPenInfo");
|
||||
win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)(void *)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
|
||||
win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)(void *)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
|
||||
|
||||
winink_available = win8p_GetPointerType && win8p_GetPointerPenInfo;
|
||||
}
|
||||
|
|
@ -6673,11 +6696,11 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
// Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink.
|
||||
HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll");
|
||||
if (wintab_lib) {
|
||||
wintab_WTOpen = (WTOpenPtr)GetProcAddress(wintab_lib, "WTOpenW");
|
||||
wintab_WTClose = (WTClosePtr)GetProcAddress(wintab_lib, "WTClose");
|
||||
wintab_WTInfo = (WTInfoPtr)GetProcAddress(wintab_lib, "WTInfoW");
|
||||
wintab_WTPacket = (WTPacketPtr)GetProcAddress(wintab_lib, "WTPacket");
|
||||
wintab_WTEnable = (WTEnablePtr)GetProcAddress(wintab_lib, "WTEnable");
|
||||
wintab_WTOpen = (WTOpenPtr)(void *)GetProcAddress(wintab_lib, "WTOpenW");
|
||||
wintab_WTClose = (WTClosePtr)(void *)GetProcAddress(wintab_lib, "WTClose");
|
||||
wintab_WTInfo = (WTInfoPtr)(void *)GetProcAddress(wintab_lib, "WTInfoW");
|
||||
wintab_WTPacket = (WTPacketPtr)(void *)GetProcAddress(wintab_lib, "WTPacket");
|
||||
wintab_WTEnable = (WTEnablePtr)(void *)GetProcAddress(wintab_lib, "WTEnable");
|
||||
|
||||
wintab_available = wintab_WTOpen && wintab_WTClose && wintab_WTInfo && wintab_WTPacket && wintab_WTEnable;
|
||||
}
|
||||
|
|
@ -6715,7 +6738,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
if (Shcore != nullptr) {
|
||||
typedef HRESULT(WINAPI * SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
|
||||
|
||||
SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
|
||||
SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)(void *)GetProcAddress(Shcore, "SetProcessDpiAwareness");
|
||||
|
||||
if (SetProcessDpiAwareness) {
|
||||
SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE);
|
||||
|
|
@ -6726,7 +6749,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
HMODULE comctl32 = LoadLibraryW(L"comctl32.dll");
|
||||
if (comctl32) {
|
||||
typedef BOOL(WINAPI * InitCommonControlsExPtr)(_In_ const INITCOMMONCONTROLSEX *picce);
|
||||
InitCommonControlsExPtr init_common_controls_ex = (InitCommonControlsExPtr)GetProcAddress(comctl32, "InitCommonControlsEx");
|
||||
InitCommonControlsExPtr init_common_controls_ex = (InitCommonControlsExPtr)(void *)GetProcAddress(comctl32, "InitCommonControlsEx");
|
||||
|
||||
// Fails if the incorrect version was loaded. Probably not a big enough deal to print an error about.
|
||||
if (init_common_controls_ex) {
|
||||
|
|
@ -6763,24 +6786,30 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
_register_raw_input_devices(INVALID_WINDOW_ID);
|
||||
|
||||
#if defined(RD_ENABLED)
|
||||
[[maybe_unused]] bool fallback_to_vulkan = GLOBAL_GET("rendering/rendering_device/fallback_to_vulkan");
|
||||
[[maybe_unused]] bool fallback_to_d3d12 = GLOBAL_GET("rendering/rendering_device/fallback_to_d3d12");
|
||||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
if (rendering_driver == "vulkan") {
|
||||
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
||||
tested_drivers.set_flag(DRIVER_ID_RD_VULKAN);
|
||||
}
|
||||
#else
|
||||
fallback_to_d3d12 = true; // Always enable fallback if engine was built w/o other driver support.
|
||||
#endif
|
||||
#if defined(D3D12_ENABLED)
|
||||
if (rendering_driver == "d3d12") {
|
||||
rendering_context = memnew(RenderingContextDriverD3D12);
|
||||
tested_drivers.set_flag(DRIVER_ID_RD_D3D12);
|
||||
}
|
||||
#else
|
||||
fallback_to_vulkan = true; // Always enable fallback if engine was built w/o other driver support.
|
||||
#endif
|
||||
|
||||
if (rendering_context) {
|
||||
if (rendering_context->initialize() != OK) {
|
||||
bool failed = true;
|
||||
#if defined(VULKAN_ENABLED)
|
||||
bool fallback_to_vulkan = GLOBAL_GET("rendering/rendering_device/fallback_to_vulkan");
|
||||
if (failed && fallback_to_vulkan && rendering_driver != "vulkan") {
|
||||
memdelete(rendering_context);
|
||||
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
||||
|
|
@ -6794,7 +6823,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
}
|
||||
#endif
|
||||
#if defined(D3D12_ENABLED)
|
||||
bool fallback_to_d3d12 = GLOBAL_GET("rendering/rendering_device/fallback_to_d3d12");
|
||||
if (failed && fallback_to_d3d12 && rendering_driver != "d3d12") {
|
||||
memdelete(rendering_context);
|
||||
rendering_context = memnew(RenderingContextDriverD3D12);
|
||||
|
|
@ -6843,7 +6871,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
#else
|
||||
typedef BOOL(WINAPI * IsWow64Process2Ptr)(HANDLE, USHORT *, USHORT *);
|
||||
|
||||
IsWow64Process2Ptr IsWow64Process2 = (IsWow64Process2Ptr)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process2");
|
||||
IsWow64Process2Ptr IsWow64Process2 = (IsWow64Process2Ptr)(void *)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process2");
|
||||
if (IsWow64Process2) {
|
||||
USHORT process_arch = 0;
|
||||
USHORT machine_arch = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue