aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/types.h1
-rw-r--r--pugl/detail/win.c17
2 files changed, 13 insertions, 5 deletions
diff --git a/pugl/detail/types.h b/pugl/detail/types.h
index 5254f01..fa120f0 100644
--- a/pugl/detail/types.h
+++ b/pugl/detail/types.h
@@ -64,6 +64,7 @@ struct PuglViewImpl {
int max_aspect_x;
int max_aspect_y;
bool visible;
+ bool redisplay;
};
/** Cross-platform world definition. */
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index edc8447..1203bca 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -511,7 +511,8 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_SHOWWINDOW:
rect = handleConfigure(view, &event);
- puglPostRedisplay(view);
+ RedrawWindow(view->impl->hwnd, NULL, NULL,
+ RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT);
break;
case WM_SIZE:
rect = handleConfigure(view, &event);
@@ -688,8 +689,15 @@ puglWaitForEvent(PuglView* PUGL_UNUSED(view))
}
PUGL_API PuglStatus
-puglDispatchEvents(PuglWorld* PUGL_UNUSED(world))
+puglDispatchEvents(PuglWorld* world)
{
+ for (size_t i = 0; i < world->numViews; ++i) {
+ if (world->views[i]->redisplay) {
+ UpdateWindow(world->views[i]->impl->hwnd);
+ world->views[i]->redisplay = false;
+ }
+ }
+
/* Windows has no facility to process only currently queued messages, which
causes the event loop to run forever in cases like mouse movement where
the queue is constantly being filled with new messages. To work around
@@ -756,9 +764,8 @@ puglGetTime(const PuglWorld* world)
void
puglPostRedisplay(PuglView* view)
{
- RedrawWindow(view->impl->hwnd, NULL, NULL,
- RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT);
- UpdateWindow(view->impl->hwnd);
+ InvalidateRect(view->impl->hwnd, NULL, false);
+ view->redisplay = true;
}
PuglNativeWindow