aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-12 14:38:49 -0400
committerDavid Robillard <d@drobilla.net>2023-05-12 16:37:54 -0400
commit4cdb95b63f4e357321765c1418ade7f4e9bc0ed3 (patch)
treeff25d0d628628c65cefa702e4ab305fd16b2d728 /src
parent6ec87363a5dc7d6095c9f6423c337bb1ecf777da (diff)
downloadpugl-4cdb95b63f4e357321765c1418ade7f4e9bc0ed3.tar.gz
pugl-4cdb95b63f4e357321765c1418ade7f4e9bc0ed3.tar.bz2
pugl-4cdb95b63f4e357321765c1418ade7f4e9bc0ed3.zip
X11: Avoid deferring empty exposures
Diffstat (limited to 'src')
-rw-r--r--src/internal.c12
-rw-r--r--src/internal.h5
-rw-r--r--src/x11.c23
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);
diff --git a/src/x11.c b/src/x11.c
index 0a2096d..a5b0389 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -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);
}
}