From 516b3bb88fb05cc7f4d2c1c1736bffffae921b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 1 Apr 2020 15:35:00 +0200 Subject: [PATCH] Fix Clang warnings on Windows Fixes #37490. --- platform/linuxbsd/display_server_x11.h | 1 - platform/windows/display_server_windows.cpp | 13 +++++++++++-- platform/windows/display_server_windows.h | 1 - servers/display_server.cpp | 6 +----- servers/display_server.h | 4 ++++ thirdparty/README.md | 2 ++ thirdparty/vulkan/vk_enum_string_helper.h | 2 +- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index aa10be555c9..113e504e9bc 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -193,7 +193,6 @@ class DisplayServerX11 : public DisplayServer { void _handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo = false); - bool force_quit; bool minimized; bool window_has_focus; bool do_mouse_warp; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 836fa5946af..5744f3506e8 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1019,7 +1019,8 @@ bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const { _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(!windows.has(p_window), false); - const WindowData &wd = windows[p_window]; + + // FIXME: Implement this, or confirm that it should always be true. return true; //no idea } @@ -1049,14 +1050,17 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W } break; case WINDOW_FLAG_TRANSPARENT: { + // FIXME: Implement. } break; case WINDOW_FLAG_NO_FOCUS: { wd.no_focus = p_enabled; _update_window_style(p_window); } break; + case WINDOW_FLAG_MAX: break; } } + bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const { _THREAD_SAFE_METHOD_ @@ -1078,7 +1082,13 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window } break; case WINDOW_FLAG_TRANSPARENT: { + // FIXME: Implement. } break; + case WINDOW_FLAG_NO_FOCUS: { + + return wd.no_focus; + } break; + case WINDOW_FLAG_MAX: break; } return false; @@ -1882,7 +1892,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA _send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST); - //force_quit=true; return 0; // Jump Back } case WM_MOUSELEAVE: { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index e2c2fd72537..470256cee7b 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -266,7 +266,6 @@ class DisplayServerWindows : public DisplayServer { bool shift_mem = false; bool control_mem = false; bool meta_mem = false; - bool force_quit = false; uint32_t last_button_state = 0; bool use_raw_input = false; bool drop_events = false; diff --git a/servers/display_server.cpp b/servers/display_server.cpp index d3e81d5d681..da1a68a179f 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "display_server.h" + #include "core/input/input_filter.h" #include "scene/resources/texture.h" @@ -517,11 +518,6 @@ void DisplayServer::_bind_methods() { BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT); BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS); BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX); - BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS_BIT); BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTY); BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ); diff --git a/servers/display_server.h b/servers/display_server.h index c0e92891a33..1956bcafca8 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -200,6 +200,10 @@ public: WINDOW_FLAG_TRANSPARENT, WINDOW_FLAG_NO_FOCUS, WINDOW_FLAG_MAX, + }; + + // Separate enum otherwise we get warnings in switches not handling all values. + enum WindowFlagsBit { WINDOW_FLAG_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED), WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS), WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP), diff --git a/thirdparty/README.md b/thirdparty/README.md index 3d41c9d1669..95a6902089f 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -574,6 +574,8 @@ Files extracted from upstream source: `vk_enum_string_helper.h` is taken from the matching `Vulkan-ValidationLayers` SDK release: https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/layers/generated/vk_enum_string_helper.h +Includes custom change to disable MSVC pragma, might be upstreamed via: +https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/1666 `vk_mem_alloc.h` is taken from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator Version: 2.3.0 diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h index 00c2b9d1d50..1c99b31270f 100644 --- a/thirdparty/vulkan/vk_enum_string_helper.h +++ b/thirdparty/vulkan/vk_enum_string_helper.h @@ -31,7 +31,7 @@ #pragma once -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning( disable : 4065 ) #endif