diff options
author | David Robillard <d@drobilla.net> | 2025-02-08 16:48:20 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-02-08 18:02:30 -0500 |
commit | 494932c79800698bcd30a506c6abe7f43c59d2bd (patch) | |
tree | 7095aee3fba8a832007a98acad0ea1894aad85fa /examples | |
parent | 1004888ac9ace7cc2c1955c30ac449f8112f90f0 (diff) | |
download | pugl-494932c79800698bcd30a506c6abe7f43c59d2bd.tar.gz pugl-494932c79800698bcd30a506c6abe7f43c59d2bd.tar.bz2 pugl-494932c79800698bcd30a506c6abe7f43c59d2bd.zip |
Remove puglSetFrame()
Towards fully separating position from size.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pugl_embed_demo.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 61adf5c..9f0028a 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -51,18 +51,6 @@ static const float backgroundColorVertices[] = { // clang-format on -static PuglRect -getChildFrame(const PuglRect parentFrame) -{ - const PuglRect childFrame = { - borderWidth, - borderWidth, - (PuglSpan)(parentFrame.width - (2 * borderWidth)), - (PuglSpan)(parentFrame.height - (2 * borderWidth))}; - - return childFrame; -} - static void onDisplay(PuglView* view) { @@ -142,8 +130,9 @@ onParentEvent(PuglView* view, const PuglEvent* event) switch (event->type) { case PUGL_CONFIGURE: reshapeCube((float)event->configure.width, (float)event->configure.height); - - puglSetFrame(app->child, getChildFrame(parentFrame)); + puglSetSize(app->child, + parentFrame.width - (2 * borderWidth), + parentFrame.height - (2 * borderWidth)); break; case PUGL_UPDATE: if (app->continuous) { @@ -289,8 +278,11 @@ main(int argc, char** argv) return logError("Failed to create parent window (%s)\n", puglStrerror(st)); } - puglSetFrame(app.child, getChildFrame(parentFrame)); puglSetParent(app.child, puglGetNativeView(app.parent)); + puglSetPosition(app.child, borderWidth, borderWidth); + puglSetSize(app.child, + parentFrame.width - (2 * borderWidth), + parentFrame.height - (2 * borderWidth)); puglSetViewHint(app.child, PUGL_CONTEXT_DEBUG, opts.errorChecking); puglSetViewHint(app.child, PUGL_SAMPLES, opts.samples); |