summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-09 11:13:39 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-11 21:38:40 +0200
commit50f7827f48cd8b16415667d040486d40bf6778cb (patch)
tree907fbb79dd8c03e4b0c986c85487a7c073eb0fca
parent8060a2de98c31ed8bf76cb2db1e8983ef38488bb (diff)
Fix missing redraw after initialisation on Win32.
-rw-r--r--plugingui/nativewindow_win32.cc11
-rw-r--r--plugingui/window.cc12
2 files changed, 14 insertions, 9 deletions
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>();
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>();
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