diff options
author | David Robillard <d@drobilla.net> | 2020-03-09 21:50:00 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-09 22:17:44 +0100 |
commit | 0444a408dd6667fb69fd6395b9b911bf61d21f76 (patch) | |
tree | 34b833941ffd6ea7005b3a783cf7fdbe615f5bc9 /examples/pugl_window_demo.c | |
parent | d949a78a774b7abe274b2d04a92d424a51e0698c (diff) | |
download | pugl-0444a408dd6667fb69fd6395b9b911bf61d21f76.tar.gz pugl-0444a408dd6667fb69fd6395b9b911bf61d21f76.tar.bz2 pugl-0444a408dd6667fb69fd6395b9b911bf61d21f76.zip |
Window Demo: Fix updating when not runnning continuously
Diffstat (limited to 'examples/pugl_window_demo.c')
-rw-r--r-- | examples/pugl_window_demo.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index a3d87e6..49ceee0 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -108,6 +108,14 @@ onKeyPress(PuglView* view, const PuglEventKey* event) } } +static void +redisplayView(PuglTestApp* app, PuglView* view) +{ + if (!app->continuous) { + puglPostRedisplay(view); + } +} + static PuglStatus onEvent(PuglView* view, const PuglEvent* event) { @@ -136,21 +144,23 @@ onEvent(PuglView* view, const PuglEvent* event) cube->yAngle += event->motion.y - cube->lastMouseY; cube->lastMouseX = event->motion.x; cube->lastMouseY = event->motion.y; - if (!app->continuous) { - puglPostRedisplay(view); - } + redisplayView(app, view); break; case PUGL_SCROLL: cube->dist = fmaxf(10.0f, cube->dist + (float)event->scroll.dy); - if (!app->continuous) { - puglPostRedisplay(view); - } + redisplayView(app, view); break; case PUGL_ENTER_NOTIFY: cube->entered = true; + redisplayView(app, view); break; case PUGL_LEAVE_NOTIFY: cube->entered = false; + redisplayView(app, view); + break; + case PUGL_FOCUS_IN: + case PUGL_FOCUS_OUT: + redisplayView(app, view); break; default: break; |