summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/os_windows.cpp38
-rw-r--r--platform/windows/os_windows.h1
3 files changed, 33 insertions, 10 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index dd0042668f..e14db9a201 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -147,9 +147,9 @@ def setup_msvc_auto(env):
# Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015
# Get actual target arch into bits (it may be "default" at this point):
if env['TARGET_ARCH'] in ('amd64', 'x86_64'):
- env['bits'] = 64
+ env['bits'] = '64'
else:
- env['bits'] = 32
+ env['bits'] = '32'
print(" Found MSVC version %s, arch %s, bits=%s" % (env['MSVC_VERSION'], env['TARGET_ARCH'], env['bits']))
if env['TARGET_ARCH'] in ('amd64', 'x86_64'):
env["x86_libtheora_opt_vc"] = False
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index bdf459fd83..55d2bb2153 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -727,16 +727,28 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
} break;
+ case WM_MOVE: {
+ if (!IsIconic(hWnd)) {
+ int x = LOWORD(lParam);
+ int y = HIWORD(lParam);
+ last_pos = Point2(x, y);
+ }
+ } break;
+
case WM_SIZE: {
- int window_w = LOWORD(lParam);
- int window_h = HIWORD(lParam);
- if (window_w > 0 && window_h > 0 && !preserve_window_size) {
- video_mode.width = window_w;
- video_mode.height = window_h;
- } else {
- preserve_window_size = false;
- set_window_size(Size2(video_mode.width, video_mode.height));
+ // Ignore size when a SIZE_MINIMIZED event is triggered
+ if (wParam != SIZE_MINIMIZED) {
+ int window_w = LOWORD(lParam);
+ int window_h = HIWORD(lParam);
+ if (window_w > 0 && window_h > 0 && !preserve_window_size) {
+ video_mode.width = window_w;
+ video_mode.height = window_h;
+ } else {
+ preserve_window_size = false;
+ set_window_size(Size2(video_mode.width, video_mode.height));
+ }
}
+
if (wParam == SIZE_MAXIMIZED) {
maximized = true;
minimized = false;
@@ -1685,6 +1697,10 @@ int OS_Windows::get_screen_dpi(int p_screen) const {
Point2 OS_Windows::get_window_position() const {
+ if (minimized) {
+ return last_pos;
+ }
+
RECT r;
GetWindowRect(hWnd, &r);
return Point2(r.left, r.top);
@@ -1705,9 +1721,15 @@ void OS_Windows::set_window_position(const Point2 &p_position) {
ClientToScreen(hWnd, (POINT *)&rect.right);
ClipCursor(&rect);
}
+
+ last_pos = p_position;
}
Size2 OS_Windows::get_window_size() const {
+ if (minimized) {
+ return Size2(video_mode.width, video_mode.height);
+ }
+
RECT r;
if (GetClientRect(hWnd, &r)) { // Only area inside of window border
return Size2(r.right - r.left, r.bottom - r.top);
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 6aadd6994c..d09ade4daa 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -93,6 +93,7 @@ class OS_Windows : public OS {
HDC hDC; // Private GDI Device Context
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
+ Point2 last_pos;
HBITMAP hBitmap; //DIB section for layered window
uint8_t *dib_data;