aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-26 23:46:29 +0200
committerDavid Robillard <d@drobilla.net>2019-07-28 19:06:39 +0200
commit6a77f96642b201f614ce7eb67f3b6ec4e1e8c181 (patch)
tree051a02fcd8ffd6ec0a6c6fb8c1331a4a1592d99b /pugl/pugl_x11.c
parent6a3159df3e41cfef6d94ff52f2cf9c5375254243 (diff)
downloadpugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.tar.gz
pugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.tar.bz2
pugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.zip
Make enterContext take a drawing parameter like leaveContext
These need to be symmetric because sometimes different things need to happen in either situation when entering the context as well.
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index ff44aef..3a0f4c2 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -68,15 +68,15 @@ puglInitInternals(void)
}
void
-puglEnterContext(PuglView* view)
+puglEnterContext(PuglView* view, bool drawing)
{
- view->impl->backend->enter(view);
+ view->impl->backend->enter(view, drawing);
}
void
-puglLeaveContext(PuglView* view, bool flush)
+puglLeaveContext(PuglView* view, bool drawing)
{
- view->impl->backend->leave(view, flush);
+ view->impl->backend->leave(view, drawing);
}
int
@@ -559,7 +559,9 @@ puglProcessEvents(PuglView* view)
}
if (config_event.type || expose_event.type) {
- puglEnterContext(view);
+ const bool draw = expose_event.type && expose_event.expose.count == 0;
+
+ puglEnterContext(view, draw);
if (config_event.type) {
view->width = (int)config_event.configure.width;
@@ -568,12 +570,11 @@ puglProcessEvents(PuglView* view)
view->eventFunc(view, (const PuglEvent*)&config_event);
}
- if (expose_event.type && expose_event.expose.count == 0) {
+ if (draw) {
view->eventFunc(view, (const PuglEvent*)&expose_event);
- puglLeaveContext(view, true);
- } else {
- puglLeaveContext(view, false);
}
+
+ puglLeaveContext(view, draw);
}
return PUGL_SUCCESS;