From 8ee970143b2ad1dd4d265bca0aef18aae643d305 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Jul 2019 23:38:37 +0200 Subject: Windows: Improve live resize smoothness --- pugl/pugl_win.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'pugl') diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index 3f5a293..a75a259 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -661,15 +661,13 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_SHOWWINDOW: rect = handleConfigure(view, &event); - InvalidateRect(view->impl->hwnd, &rect, FALSE); - UpdateWindow(view->impl->hwnd); puglPostRedisplay(view); break; case WM_SIZE: - handleConfigure(view, &event); - if (!view->impl->resizing) { - puglPostRedisplay(view); - } + rect = handleConfigure(view, &event); + RedrawWindow(view->impl->hwnd, NULL, NULL, + RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT| + RDW_UPDATENOW); break; case WM_ENTERSIZEMOVE: view->impl->resizing = true; @@ -680,7 +678,8 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_TIMER: if (wParam == PUGL_RESIZE_TIMER_ID) { - puglPostRedisplay(view); + RedrawWindow(view->impl->hwnd, NULL, NULL, + RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT); } else if (wParam == PUGL_URGENT_TIMER_ID) { FlashWindow(view->impl->hwnd, TRUE); } @@ -688,6 +687,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) case WM_EXITSIZEMOVE: KillTimer(view->impl->hwnd, PUGL_RESIZE_TIMER_ID); view->impl->resizing = false; + puglPostRedisplay(view); break; case WM_GETMINMAXINFO: mmi = (MINMAXINFO*)lParam; @@ -887,7 +887,8 @@ void puglPostRedisplay(PuglView* view) { RedrawWindow(view->impl->hwnd, NULL, NULL, - RDW_INVALIDATE|RDW_INTERNALPAINT); + RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT); + UpdateWindow(view->impl->hwnd); } PuglNativeWindow -- cgit v1.2.1