From 50f7827f48cd8b16415667d040486d40bf6778cb Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 9 Apr 2017 11:13:39 +0200 Subject: Fix missing redraw after initialisation on Win32. --- plugingui/nativewindow_win32.cc | 11 ++++++++--- plugingui/window.cc | 12 ++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'plugingui') diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc index d897c25..c166d04 100644 --- a/plugingui/nativewindow_win32.cc +++ b/plugingui/nativewindow_win32.cc @@ -56,7 +56,6 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg, resizeEvent->width = LOWORD(lp); resizeEvent->height = HIWORD(lp); native->event_queue.push_back(resizeEvent); - //native->window.resized(resizeEvent->width, resizeEvent->height); } break; @@ -227,6 +226,12 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg, RECT rect; GetUpdateRect(hwnd, &rect, FALSE); + // Bypass partial update, which is apparrently broken. + rect.left = 0; + rect.top = 0; + rect.right = window.wpixbuf.width; + rect.bottom = window.wpixbuf.height; + auto repaintEvent = std::make_shared(); repaintEvent->x = rect.left; repaintEvent->y = rect.top; @@ -320,6 +325,7 @@ LRESULT CALLBACK NativeWindowWin32::subClassProc(HWND hwnd, UINT msg, int w = width - rect.right; int h = height - rect.bottom; SetWindowPos(native->m_hwnd, nullptr, -1, -1, width + w, height + h, SWP_NOMOVE); + native->window.resized(w, h); } break; } @@ -381,8 +387,7 @@ NativeWindowWin32::NativeWindowWin32(void* native_window, Window& window) auto resizeEvent = std::make_shared(); resizeEvent->width = rect.right - rect.left; resizeEvent->height = rect.bottom - rect.top; - //event_queue.push_back(resizeEvent); - window.resized(resizeEvent->width, resizeEvent->height); + event_queue.push_back(resizeEvent); } } diff --git a/plugingui/window.cc b/plugingui/window.cc index 66b7337..2d5f282 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -201,14 +201,14 @@ std::size_t Window::translateToWindowY() void Window::resized(std::size_t width, std::size_t height) { auto size = native->getSize(); - if((wpixbuf.width == size.first) && - (wpixbuf.height == size.second)) + if((wpixbuf.width != size.first) || + (wpixbuf.height != size.second)) { - return; + wpixbuf.realloc(size.first, size.second); + Widget::resize(size.first, size.second); } - wpixbuf.realloc(size.first, size.second); - Widget::resize(size.first, size.second); - //updateBuffer(); + + updateBuffer(); } //! Called by event handler when an windowmanager/OS window move event has -- cgit v1.2.3