summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/context_gl_windows.cpp8
-rw-r--r--platform/windows/context_gl_windows.h2
-rw-r--r--platform/windows/godot_res.rc4
-rw-r--r--platform/windows/joypad_windows.cpp5
-rwxr-xr-xplatform/windows/os_windows.cpp13
-rw-r--r--platform/windows/os_windows.h2
6 files changed, 29 insertions, 5 deletions
diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp
index 21d954a736..ad62e3a306 100644
--- a/platform/windows/context_gl_windows.cpp
+++ b/platform/windows/context_gl_windows.cpp
@@ -43,6 +43,11 @@
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#if defined(__GNUC__)
+// Workaround GCC warning from -Wcast-function-type.
+#define wglGetProcAddress (void *)wglGetProcAddress
+#endif
+
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *);
void ContextGL_Windows::release_current() {
@@ -89,7 +94,7 @@ void ContextGL_Windows::swap_buffers() {
if (use_vsync) {
bool vsync_via_compositor_now = should_vsync_via_compositor();
- if (vsync_via_compositor_now) {
+ if (vsync_via_compositor_now && wglGetSwapIntervalEXT() == 0) {
DwmFlush();
}
@@ -205,6 +210,7 @@ Error ContextGL_Windows::initialize() {
}
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
+ wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)wglGetProcAddress("wglGetSwapIntervalEXT");
//glWrapperInit(wrapper_get_proc_address);
return OK;
diff --git a/platform/windows/context_gl_windows.h b/platform/windows/context_gl_windows.h
index 0c6a6d1814..280c5a1e3c 100644
--- a/platform/windows/context_gl_windows.h
+++ b/platform/windows/context_gl_windows.h
@@ -41,6 +41,7 @@
#include <windows.h>
typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval);
+typedef int(APIENTRY *PFNWGLGETSWAPINTERVALEXTPROC)(void);
class ContextGL_Windows {
@@ -53,6 +54,7 @@ class ContextGL_Windows {
bool vsync_via_compositor;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
+ PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT;
static bool should_vsync_via_compositor();
diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc
index 1fa8957f15..0593c8b069 100644
--- a/platform/windows/godot_res.rc
+++ b/platform/windows/godot_res.rc
@@ -4,10 +4,6 @@
#define _MKSTR(m_x) _STR(m_x)
#endif
-#ifndef VERSION_PATCH
-#define VERSION_PATCH 0
-#endif
-
GODOT_ICON ICON platform/windows/godot.ico
1 VERSIONINFO
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp
index c82a90bf7d..49432435b9 100644
--- a/platform/windows/joypad_windows.cpp
+++ b/platform/windows/joypad_windows.cpp
@@ -37,6 +37,11 @@
#define __builtin_bswap32 _byteswap_ulong
#endif
+#if defined(__GNUC__)
+// Workaround GCC warning from -Wcast-function-type.
+#define GetProcAddress (void *)GetProcAddress
+#endif
+
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE *pState) {
return ERROR_DEVICE_NOT_CONNECTED;
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index cee848f270..a6977a7a86 100755
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -74,6 +74,11 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#define WM_POINTERUPDATE 0x0245
#endif
+#if defined(__GNUC__)
+// Workaround GCC warning from -Wcast-function-type.
+#define GetProcAddress (void *)GetProcAddress
+#endif
+
typedef struct {
int count;
int screen;
@@ -352,12 +357,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) {
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
+ window_focused = true;
alt_mem = false;
control_mem = false;
shift_mem = false;
} else { // WM_INACTIVE
input->release_pressed_events();
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+ window_focused = false;
alt_mem = false;
};
@@ -2095,6 +2102,11 @@ bool OS_Windows::is_window_always_on_top() const {
return video_mode.always_on_top;
}
+bool OS_Windows::is_window_focused() const {
+
+ return window_focused;
+}
+
void OS_Windows::set_console_visible(bool p_enabled) {
if (console_visible == p_enabled)
return;
@@ -3372,6 +3384,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
meta_mem = false;
minimized = false;
was_maximized = false;
+ window_focused = true;
console_visible = IsWindowVisible(GetConsoleWindow());
//Note: Functions for pen input, available on Windows 8+
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 20b61e3dbe..65d08f5d36 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -274,6 +274,7 @@ protected:
bool maximized;
bool minimized;
bool borderless;
+ bool window_focused;
bool console_visible;
bool was_maximized;
@@ -322,6 +323,7 @@ public:
virtual bool is_window_maximized() const;
virtual void set_window_always_on_top(bool p_enabled);
virtual bool is_window_always_on_top() const;
+ virtual bool is_window_focused() const;
virtual void set_console_visible(bool p_enabled);
virtual bool is_console_visible() const;
virtual void request_attention();