diff options
author | David Robillard <d@drobilla.net> | 2019-07-20 20:51:11 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-07-20 21:44:20 +0200 |
commit | 5ba0ea7cd8cfec3f374f380a03e144e24f43a12c (patch) | |
tree | be12e2309a90cbba75c86c8cb629a913e50ff623 | |
parent | 4d0704bae2d4eb2a292caabda91d654a17104501 (diff) | |
download | pugl-5ba0ea7cd8cfec3f374f380a03e144e24f43a12c.tar.gz pugl-5ba0ea7cd8cfec3f374f380a03e144e24f43a12c.tar.bz2 pugl-5ba0ea7cd8cfec3f374f380a03e144e24f43a12c.zip |
Remove redisplay flag and use system events instead
-rw-r--r-- | pugl/pugl_internal.h | 3 | ||||
-rw-r--r-- | pugl/pugl_internal_types.h | 1 | ||||
-rw-r--r-- | pugl/pugl_osx.m | 1 | ||||
-rw-r--r-- | pugl/pugl_win.c | 7 | ||||
-rw-r--r-- | pugl/pugl_x11.c | 18 | ||||
-rw-r--r-- | pugl/pugl_x11_cairo.c | 2 |
6 files changed, 9 insertions, 23 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 05381fa..2860a7f 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -56,13 +56,12 @@ puglInit(int* pargc, char** argv) return NULL; } - view->hints = puglDefaultHints(); - PuglInternals* impl = puglInitInternals(); if (!impl) { return NULL; } + view->hints = puglDefaultHints(); view->ctx_type = PUGL_GL; view->impl = impl; view->width = 640; diff --git a/pugl/pugl_internal_types.h b/pugl/pugl_internal_types.h index 839084c..19452cd 100644 --- a/pugl/pugl_internal_types.h +++ b/pugl/pugl_internal_types.h @@ -66,7 +66,6 @@ struct PuglViewImpl { int max_aspect_x; int max_aspect_y; bool ignoreKeyRepeat; - bool redisplay; bool visible; }; diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index e226a19..519b7dd 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -749,7 +749,6 @@ puglGetTime(PuglView* view) void puglPostRedisplay(PuglView* view) { - //view->redisplay = true; // unused [view->impl->glview setNeedsDisplay: YES]; } diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index b1fa41a..e751df9 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -733,11 +733,6 @@ puglProcessEvents(PuglView* view) handleMessage(view, msg.message, msg.wParam, msg.lParam); } - if (view->redisplay) { - InvalidateRect(view->impl->hwnd, NULL, FALSE); - view->redisplay = false; - } - return PUGL_SUCCESS; } @@ -781,7 +776,7 @@ puglGetTime(PuglView* view) void puglPostRedisplay(PuglView* view) { - view->redisplay = true; + RedrawWindow(view->impl->hwnd, NULL, NULL, RDW_INVALIDATE); } PuglNativeWindow diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 2d0dd76..d7db801 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -512,16 +512,6 @@ puglProcessEvents(PuglView* view) puglDispatchEvent(view, (const PuglEvent*)&config_event); } - if (view->redisplay) { - expose_event.expose.type = PUGL_EXPOSE; - expose_event.expose.view = view; - expose_event.expose.x = 0; - expose_event.expose.y = 0; - expose_event.expose.width = view->width; - expose_event.expose.height = view->height; - view->redisplay = false; - } - if (expose_event.type) { puglDispatchEvent(view, (const PuglEvent*)&expose_event); } @@ -540,7 +530,13 @@ puglGetTime(PuglView* view) void puglPostRedisplay(PuglView* view) { - view->redisplay = true; + XExposeEvent ev = {Expose, 0, True, + view->impl->display, view->impl->win, + 0, 0, + view->width, view->height, + 0}; + + XSendEvent(view->impl->display, view->impl->win, False, 0, (XEvent*)&ev); } PuglNativeWindow diff --git a/pugl/pugl_x11_cairo.c b/pugl/pugl_x11_cairo.c index db2e262..bd427f8 100644 --- a/pugl/pugl_x11_cairo.c +++ b/pugl/pugl_x11_cairo.c @@ -106,8 +106,6 @@ puglX11CairoResize(PuglView* view, int width, int height) PuglInternals* const impl = view->impl; PuglX11CairoSurface* const surface = (PuglX11CairoSurface*)impl->surface; - view->redisplay = true; - if (view->ctx_type == PUGL_CAIRO) { cairo_xlib_surface_set_size(surface->surface, width, height); } |