From aa7fb0aad574531765bc18aeb78a034f499435d4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Jul 2019 11:36:17 +0200 Subject: Fix initial window display on Windows --- pugl/pugl_win.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index 5f9d555..08b7611 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -602,7 +602,6 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) } switch (message) { - case WM_CREATE: case WM_SHOWWINDOW: case WM_SIZE: GetWindowRect(view->impl->hwnd, &rect); @@ -613,8 +612,9 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) view->height = rect.bottom - rect.top; event.configure.width = view->width; event.configure.height = view->height; - InvalidateRect(view->impl->hwnd, NULL, FALSE); + InvalidateRect(view->impl->hwnd, &rect, FALSE); UpdateWindow(view->impl->hwnd); + puglPostRedisplay(view); break; case WM_GETMINMAXINFO: mmi = (MINMAXINFO*)lParam; @@ -630,6 +630,8 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) event.expose.height = rect.bottom - rect.top; event.expose.count = 0; break; + case WM_ERASEBKGND: + return true; case WM_MOUSEMOVE: pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); @@ -702,8 +704,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) event.close.type = PUGL_CLOSE; break; default: - return DefWindowProc( - view->impl->hwnd, message, wParam, lParam); + return DefWindowProc(view->impl->hwnd, message, wParam, lParam); } puglDispatchEvent(view, &event); @@ -779,7 +780,8 @@ puglGetTime(PuglView* view) void puglPostRedisplay(PuglView* view) { - RedrawWindow(view->impl->hwnd, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(view->impl->hwnd, NULL, NULL, + RDW_INVALIDATE|RDW_INTERNALPAINT); } PuglNativeWindow -- cgit v1.2.1