Browse Source

Fix Clang warnings on Windows

Fixes #37490.
Rémi Verschelde 5 years ago
parent
commit
516b3bb88f

+ 0 - 1
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);
 	void _handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo = false);
 
 
-	bool force_quit;
 	bool minimized;
 	bool minimized;
 	bool window_has_focus;
 	bool window_has_focus;
 	bool do_mouse_warp;
 	bool do_mouse_warp;

+ 11 - 2
platform/windows/display_server_windows.cpp

@@ -1019,7 +1019,8 @@ bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const {
 	_THREAD_SAFE_METHOD_
 	_THREAD_SAFE_METHOD_
 
 
 	ERR_FAIL_COND_V(!windows.has(p_window), false);
 	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
 	return true; //no idea
 }
 }
@@ -1049,14 +1050,17 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
 		} break;
 		} break;
 		case WINDOW_FLAG_TRANSPARENT: {
 		case WINDOW_FLAG_TRANSPARENT: {
 
 
+			// FIXME: Implement.
 		} break;
 		} break;
 		case WINDOW_FLAG_NO_FOCUS: {
 		case WINDOW_FLAG_NO_FOCUS: {
 
 
 			wd.no_focus = p_enabled;
 			wd.no_focus = p_enabled;
 			_update_window_style(p_window);
 			_update_window_style(p_window);
 		} break;
 		} break;
+		case WINDOW_FLAG_MAX: break;
 	}
 	}
 }
 }
+
 bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
 bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
 
 
 	_THREAD_SAFE_METHOD_
 	_THREAD_SAFE_METHOD_
@@ -1078,7 +1082,13 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window
 		} break;
 		} break;
 		case WINDOW_FLAG_TRANSPARENT: {
 		case WINDOW_FLAG_TRANSPARENT: {
 
 
+			// FIXME: Implement.
+		} break;
+		case WINDOW_FLAG_NO_FOCUS: {
+
+			return wd.no_focus;
 		} break;
 		} break;
+		case WINDOW_FLAG_MAX: break;
 	}
 	}
 
 
 	return false;
 	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);
 			_send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST);
 
 
-			//force_quit=true;
 			return 0; // Jump Back
 			return 0; // Jump Back
 		}
 		}
 		case WM_MOUSELEAVE: {
 		case WM_MOUSELEAVE: {

+ 0 - 1
platform/windows/display_server_windows.h

@@ -266,7 +266,6 @@ class DisplayServerWindows : public DisplayServer {
 	bool shift_mem = false;
 	bool shift_mem = false;
 	bool control_mem = false;
 	bool control_mem = false;
 	bool meta_mem = false;
 	bool meta_mem = false;
-	bool force_quit = false;
 	uint32_t last_button_state = 0;
 	uint32_t last_button_state = 0;
 	bool use_raw_input = false;
 	bool use_raw_input = false;
 	bool drop_events = false;
 	bool drop_events = false;

+ 1 - 5
servers/display_server.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 /*************************************************************************/
 
 
 #include "display_server.h"
 #include "display_server.h"
+
 #include "core/input/input_filter.h"
 #include "core/input/input_filter.h"
 #include "scene/resources/texture.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_TRANSPARENT);
 	BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);
 	BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);
 	BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);
 	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_QWERTY);
 	BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ);
 	BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ);

+ 4 - 0
servers/display_server.h

@@ -200,6 +200,10 @@ public:
 		WINDOW_FLAG_TRANSPARENT,
 		WINDOW_FLAG_TRANSPARENT,
 		WINDOW_FLAG_NO_FOCUS,
 		WINDOW_FLAG_NO_FOCUS,
 		WINDOW_FLAG_MAX,
 		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_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED),
 		WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS),
 		WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS),
 		WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP),
 		WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP),

+ 2 - 0
thirdparty/README.md

@@ -574,6 +574,8 @@ Files extracted from upstream source:
 
 
 `vk_enum_string_helper.h` is taken from the matching `Vulkan-ValidationLayers`
 `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
 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
 `vk_mem_alloc.h` is taken from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
 Version: 2.3.0
 Version: 2.3.0

+ 1 - 1
thirdparty/vulkan/vk_enum_string_helper.h

@@ -31,7 +31,7 @@
 
 
 
 
 #pragma once
 #pragma once
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning( disable : 4065 )
 #pragma warning( disable : 4065 )
 #endif
 #endif