diff options
-rw-r--r-- | src/internal.c | 12 | ||||
-rw-r--r-- | src/internal.h | 5 | ||||
-rw-r--r-- | src/x11.c | 23 |
3 files changed, 15 insertions, 25 deletions
diff --git a/src/internal.c b/src/internal.c index ca705a3..d9f034e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -1,4 +1,4 @@ -// Copyright 2012-2022 David Robillard <d@drobilla.net> +// Copyright 2012-2023 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC #include "internal.h" @@ -170,14 +170,6 @@ puglConfigure(PuglView* view, const PuglEvent* event) } PuglStatus -puglExpose(PuglView* view, const PuglEvent* event) -{ - return (event->expose.width > 0.0 && event->expose.height > 0.0) - ? view->eventFunc(view, event) - : PUGL_SUCCESS; -} - -PuglStatus puglDispatchEvent(PuglView* view, const PuglEvent* event) { PuglStatus st0 = PUGL_SUCCESS; @@ -220,7 +212,7 @@ puglDispatchEvent(PuglView* view, const PuglEvent* event) case PUGL_EXPOSE: assert(view->stage == PUGL_VIEW_STAGE_CONFIGURED); if (!(st0 = view->backend->enter(view, &event->expose))) { - st0 = puglExpose(view, event); + st0 = view->eventFunc(view, event); st1 = view->backend->leave(view, &event->expose); } break; diff --git a/src/internal.h b/src/internal.h index f30532b..0c6f448 100644 --- a/src/internal.h +++ b/src/internal.h @@ -51,11 +51,6 @@ PUGL_WARN_UNUSED_RESULT PuglStatus puglConfigure(PuglView* view, const PuglEvent* event); -/// Process expose event while already in the graphics context -PUGL_WARN_UNUSED_RESULT -PuglStatus -puglExpose(PuglView* view, const PuglEvent* event); - /// Dispatch `event` to `view`, entering graphics context if necessary PuglStatus puglDispatchEvent(PuglView* view, const PuglEvent* event); @@ -1514,7 +1514,9 @@ static void mergeExposeEvents(PuglExposeEvent* const dst, const PuglExposeEvent* const src) { if (!dst->type) { - *dst = *src; + if (src->width > 0.0 && src->height > 0.0) { + *dst = *src; + } } else { const int dst_r = dst->x + dst->width; const int src_r = src->x + src->width; @@ -1689,20 +1691,21 @@ flushExposures(PuglWorld* const world) view->impl->pendingConfigure.type = PUGL_NOTHING; view->impl->pendingExpose.type = PUGL_NOTHING; - if (expose.type) { - if (!(st0 = view->backend->enter(view, &expose.expose))) { + if (expose.type || configure.type) { + const PuglExposeEvent* const exposeEvent = + expose.type ? &expose.expose : NULL; + + if (!(st0 = view->backend->enter(view, exposeEvent))) { if (configure.type) { st0 = puglConfigure(view, &configure); } - st1 = puglExpose(view, &expose); - st2 = view->backend->leave(view, &expose.expose); - } - } else if (configure.type) { - if (!(st0 = view->backend->enter(view, NULL))) { - st0 = puglConfigure(view, &configure); - st1 = view->backend->leave(view, NULL); + if (expose.type) { + st1 = view->eventFunc(view, &expose); + } } + + st2 = view->backend->leave(view, exposeEvent); } } |