aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-20 09:00:28 -0400
committerDavid Robillard <d@drobilla.net>2016-09-20 09:00:28 -0400
commit9c7a05a0a1ee146edddca8dc6b202db3ea2cd2f9 (patch)
tree83660ccd82bd49f78f6cf1935bcd17c28ad08310 /pugl
parent3e4fc9bacab4e87ac78a331f942c7f9fbd4b3ede (diff)
downloadpugl-9c7a05a0a1ee146edddca8dc6b202db3ea2cd2f9.tar.gz
pugl-9c7a05a0a1ee146edddca8dc6b202db3ea2cd2f9.tar.bz2
pugl-9c7a05a0a1ee146edddca8dc6b202db3ea2cd2f9.zip
Fix resizing
Diffstat (limited to 'pugl')
-rw-r--r--pugl/pugl_internal.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h
index aeb580d..44fe103 100644
--- a/pugl/pugl_internal.h
+++ b/pugl/pugl_internal.h
@@ -219,19 +219,24 @@ puglDecodeUTF8(const uint8_t* buf)
static void
puglDispatchEvent(PuglView* view, const PuglEvent* event)
{
- if (event->type == PUGL_NOTHING) {
- return;
- } else if (event->type == PUGL_EXPOSE && event->expose.count > 0) {
- return;
- } else if (view->eventFunc) {
- const bool is_draw = (event->type == PUGL_CONFIGURE ||
- event->type == PUGL_EXPOSE);
- if (is_draw) {
+ switch (event->type) {
+ case PUGL_NOTHING:
+ break;
+ case PUGL_CONFIGURE:
+ view->width = event->configure.width;
+ view->height = event->configure.height;
+ puglEnterContext(view);
+ view->eventFunc(view, event);
+ puglLeaveContext(view, false);
+ break;
+ case PUGL_EXPOSE:
+ if (event->expose.count == 0) {
puglEnterContext(view);
+ view->eventFunc(view, event);
+ puglLeaveContext(view, true);
}
+ break;
+ default:
view->eventFunc(view, event);
- if (is_draw) {
- puglLeaveContext(view, event->type == PUGL_EXPOSE);
- }
}
}