aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Haas2016-07-01 15:31:37 +0200
committerRémi Verschelde2016-07-08 18:56:28 +0200
commit7589307911063d904952d957c8c55ff94e56b96f (patch)
tree72a0996494c1d986efe39a94d4cdd704c35c0b57
parent6199efbc7e56f05dfecc6961a840560b8f83e943 (diff)
downloadgodot-7589307911063d904952d957c8c55ff94e56b96f.tar.gz
godot-7589307911063d904952d957c8c55ff94e56b96f.tar.zst
godot-7589307911063d904952d957c8c55ff94e56b96f.zip
Windows: prevent freeze while moving or resizing the game window.
When moving or resizing the window, Windows spins up a seperate event-loop, effectively blocking the normal one. To work around this, we're starting a timer that will continue sending WM_TIMER messages which we can use to keep the mainloop running. fixes #4695 (cherry picked from commit 6856c5249104d2b69fe297ff7546092e3bb23555)
Diffstat (limited to '')
-rw-r--r--platform/windows/os_windows.cpp16
-rw-r--r--platform/windows/os_windows.h2
2 files changed, 17 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index d657b3fd3..b0bc90613 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -611,6 +611,20 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
//return 0; // Jump Back
} break;
+
+ case WM_ENTERSIZEMOVE: {
+ move_timer_id = SetTimer(hWnd, 1, USER_TIMER_MINIMUM,(TIMERPROC) NULL);
+ } break;
+ case WM_EXITSIZEMOVE: {
+ KillTimer(hWnd, move_timer_id);
+ } break;
+ case WM_TIMER: {
+ if (wParam == move_timer_id) {
+ process_key_events();
+ Main::iteration();
+ }
+ } break;
+
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_KEYUP:
@@ -1019,7 +1033,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
_ensure_data_dir();
-
+ move_timer_id = 1;
}
void OS_Windows::set_clipboard(const String& p_text) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index c19eb4174..e439529e9 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -104,6 +104,8 @@ class OS_Windows : public OS {
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
+ uint32_t move_timer_id;
+
Size2 window_rect;
VideoMode video_mode;