summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/app.cpp b/app.cpp
index 6628e0e..cb90f63 100644
--- a/app.cpp
+++ b/app.cpp
@@ -419,7 +419,23 @@ struct App_Internal {
}
};
+static void win32_on_resize(HWND window, UINT msg, UINT_PTR timer, DWORD time) {
+ RECT rect;
+ int nw, nh;
+ App* app = (App*)GetWindowLongPtr(window, GWLP_USERDATA);
+ if (!app) return;
+ GetClientRect(window, &rect);
+ nw = rect.right - rect.left;
+ nh = rect.bottom - rect.top;
+ if (nw != app->w && nh != app->h)
+ app->on_resize();
+ app->end();
+ app->begin();
+ app->on_update();
+}
+
static LRESULT CALLBACK win32_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
+ RECT rect;
App* app = (App*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!app) return DefWindowProc(hwnd, msg, wparam, lparam);
switch (msg) {
@@ -431,6 +447,13 @@ static LRESULT CALLBACK win32_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
app->h = (lparam >> 16) & 0xffff;
app->on_resize();
return 0;
+ case WM_ENTERSIZEMOVE:
+ SetTimer(hwnd, 0, 10, win32_on_resize);
+ return 0;
+ case WM_EXITSIZEMOVE:
+ KillTimer(hwnd, 0);
+ app->end();
+ return 0;
case WM_MOUSEMOVE:
app->mx = lparam & 0xffff;
app->my = (lparam >> 16) & 0xffff;