aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-10 21:21:59 -0500
committerDavid Robillard <d@drobilla.net>2023-01-11 03:28:10 -0500
commita02dd604ff43264757460ca4d87a2dde6ed7bbf0 (patch)
tree0af34b601c3bc2790228e1f135c2182d5852dac6 /src/internal.c
parentc33edc9b41ccdd7ec3fe711d3a96002b266106bd (diff)
downloadpugl-a02dd604ff43264757460ca4d87a2dde6ed7bbf0.tar.gz
pugl-a02dd604ff43264757460ca4d87a2dde6ed7bbf0.tar.bz2
pugl-a02dd604ff43264757460ca4d87a2dde6ed7bbf0.zip
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.
Diffstat (limited to 'src/internal.c')
-rw-r--r--src/internal.c19
1 files changed, 4 insertions, 15 deletions
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;