From 8f56441dcb1805a2ecec7c97ee547f241e1dcf11 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Mar 2020 16:13:51 +0100 Subject: 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. --- pugl/detail/implementation.c | 7 ++----- 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; }; -- cgit v1.2.1