From a02dd604ff43264757460ca4d87a2dde6ed7bbf0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 10 Jan 2023 21:21:59 -0500 Subject: Remove cached frame from view This was just a source of ambiguity and bugs, since it represented different things at different times and could become stale. Redundant data is always trouble, so eliminate it, leaving just two positions/sizes: the defaults (used when the view is not yet realized), and the last configuration. --- src/internal.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/internal.c') diff --git a/src/internal.c b/src/internal.c index cfb444e..2da5e9e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -122,15 +122,10 @@ puglPreRealize(PuglView* const view) return PUGL_BAD_CONFIGURATION; } - // Set the size to the default if it hasn't already been set - if (!isValidSize(view->frame.width, view->frame.height)) { - const PuglViewSize defaultSize = view->sizeHints[PUGL_DEFAULT_SIZE]; - if (!isValidSize(defaultSize.width, defaultSize.height)) { - return PUGL_BAD_CONFIGURATION; - } - - view->frame.width = defaultSize.width; - view->frame.height = defaultSize.height; + // Ensure that the default size is set to a valid size + const PuglViewSize defaultSize = view->sizeHints[PUGL_DEFAULT_SIZE]; + if (!isValidSize(defaultSize.width, defaultSize.height)) { + return PUGL_BAD_CONFIGURATION; } return PUGL_SUCCESS; @@ -159,12 +154,6 @@ puglConfigure(PuglView* view, const PuglEvent* event) PuglStatus st = PUGL_SUCCESS; assert(event->type == PUGL_CONFIGURE); - - view->frame.x = event->configure.x; - view->frame.y = event->configure.y; - view->frame.width = event->configure.width; - view->frame.height = event->configure.height; - if (puglMustConfigure(view, &event->configure)) { st = view->eventFunc(view, event); view->lastConfigure = event->configure; -- cgit v1.2.1