diff options
author | David Robillard <d@drobilla.net> | 2020-03-16 16:13:51 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-16 16:13:51 +0100 |
commit | 8f56441dcb1805a2ecec7c97ee547f241e1dcf11 (patch) | |
tree | 0f618737b3cc61a1a175361c8a2c277dbad9b26b | |
parent | 67b7970697011bbd26fbf4175eb2e5ebd1b00939 (diff) | |
download | pugl-8f56441dcb1805a2ecec7c97ee547f241e1dcf11.tar.gz pugl-8f56441dcb1805a2ecec7c97ee547f241e1dcf11.tar.bz2 pugl-8f56441dcb1805a2ecec7c97ee547f241e1dcf11.zip |
Separate cached configuration from frame
This was a bad idea and a never-ending source of problems. The frame
represents what the "current" frame is from a Pugl perspective, but with the
asynchronicity of X11 and other issues this cant be used to filter configure
events.
Instead, simply cache the last configure event that was sent and compare with
that.
-rw-r--r-- | pugl/detail/implementation.c | 7 | ||||
-rw-r--r-- | pugl/detail/types.h | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 4e1b3de..d7f1413 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -371,10 +371,7 @@ puglDecodeUTF8(const uint8_t* buf) static inline bool puglMustConfigure(PuglView* view, const PuglEventConfigure* configure) { - return !view->configured || configure->x != view->frame.x || - configure->y != view->frame.y || - configure->width != view->frame.width || - configure->height != view->frame.height; + return memcmp(configure, &view->lastConfigure, sizeof(PuglEventConfigure)); } void @@ -398,7 +395,7 @@ puglDispatchEventInContext(PuglView* view, const PuglEvent* event) if (puglMustConfigure(view, &event->configure)) { view->eventFunc(view, event); - view->configured = true; + view->lastConfigure = event->configure; } } else { view->eventFunc(view, event); diff --git a/pugl/detail/types.h b/pugl/detail/types.h index 71cfda0..e750ca1 100644 --- a/pugl/detail/types.h +++ b/pugl/detail/types.h @@ -64,13 +64,13 @@ struct PuglViewImpl { uintptr_t transientParent; PuglHints hints; PuglRect frame; + PuglEventConfigure lastConfigure; int minWidth; int minHeight; int minAspectX; int minAspectY; int maxAspectX; int maxAspectY; - bool configured; bool visible; }; |