From fcddc7933dbff47754b8e4acea7406b77df1bf21 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 1 Apr 2020 19:35:58 +0200 Subject: Replace puglShowWindow() with puglRealize() --- examples/pugl_cairo_demo.c | 5 +++-- examples/pugl_embed_demo.c | 7 +++++-- examples/pugl_gl3_demo.c | 3 ++- examples/pugl_print_events.c | 3 ++- examples/pugl_window_demo.c | 6 +++--- 5 files changed, 15 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c index 6b43cb0..483446f 100644 --- a/examples/pugl_cairo_demo.c +++ b/examples/pugl_cairo_demo.c @@ -237,16 +237,17 @@ main(int argc, char** argv) PuglRect frame = { 0, 0, 512, 512 }; PuglView* view = puglNewView(app.world); + + puglSetWindowTitle(view, "Pugl Cairo Demo"); puglSetFrame(view, frame); puglSetMinSize(view, 256, 256); puglSetViewHint(view, PUGL_RESIZABLE, app.opts.resizable); puglSetHandle(view, &app); puglSetBackend(view, puglCairoBackend()); - puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, app.opts.ignoreKeyRepeat); puglSetEventFunc(view, onEvent); - PuglStatus st = puglCreateWindow(view, "Pugl Test"); + PuglStatus st = puglRealize(view); if (st) { return logError("Failed to create window (%s)\n", puglStrerror(st)); } diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 313a92c..6152648 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -302,7 +302,10 @@ main(int argc, char** argv) PuglStatus st = PUGL_SUCCESS; const uint8_t title[] = { 'P', 'u', 'g', 'l', ' ', 'P', 'r', 0xC3, 0xBC, 'f', 'u', 'n', 'g', 0 }; - if ((st = puglCreateWindow(app.parent, (const char*)title))) { + + puglSetWindowTitle(app.parent, (const char*)title); + + if ((st = puglRealize(app.parent))) { return logError("Failed to create parent window (%s)\n", puglStrerror(st)); } @@ -319,7 +322,7 @@ main(int argc, char** argv) puglSetHandle(app.child, &app); puglSetEventFunc(app.child, onEvent); - if ((st = puglCreateWindow(app.child, NULL))) { + if ((st = puglRealize(app.child))) { return logError("Failed to create child window (%s)\n", puglStrerror(st)); } diff --git a/examples/pugl_gl3_demo.c b/examples/pugl_gl3_demo.c index 210d27f..3a9503c 100644 --- a/examples/pugl_gl3_demo.c +++ b/examples/pugl_gl3_demo.c @@ -271,6 +271,7 @@ setupPugl(PuglTestApp* app, const PuglRect frame) // Set up world and view puglSetClassName(app->world, "PuglGL3Demo"); + puglSetWindowTitle(app->view, "Pugl OpenGL 3"); puglSetFrame(app->view, frame); puglSetMinSize(app->view, defaultWidth / 4, defaultHeight / 4); puglSetAspectRatio(app->view, 1, 1, 16, 9); @@ -405,7 +406,7 @@ main(int argc, char** argv) setupPugl(&app, frame); // Create window (which will send a PUGL_CREATE event) - const PuglStatus st = puglCreateWindow(app.view, "Pugl OpenGL 3"); + const PuglStatus st = puglRealize(app.view); if (st) { return logError("Failed to create window (%s)\n", puglStrerror(st)); } diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c index 9c81033..52b58c4 100644 --- a/examples/pugl_print_events.c +++ b/examples/pugl_print_events.c @@ -57,11 +57,12 @@ main(void) app.view = puglNewView(app.world); puglSetClassName(app.world, "Pugl Print Events"); + puglSetWindowTitle(app.view, "Pugl Event Printer"); puglSetBackend(app.view, puglStubBackend()); puglSetHandle(app.view, &app); puglSetEventFunc(app.view, onEvent); - if (puglCreateWindow(app.view, "Pugl Event Printer")) { + if (puglRealize(app.view)) { return logError("Failed to create window\n"); } diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 7beb330..39f50c8 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -205,6 +205,7 @@ main(int argc, char** argv) cube->dist = 10; + puglSetWindowTitle(view, "Pugl Window Demo"); puglSetFrame(view, frame); puglSetMinSize(view, 128, 128); puglSetBackend(view, puglGlBackend()); @@ -218,9 +219,8 @@ main(int argc, char** argv) puglSetHandle(view, cube); puglSetEventFunc(view, onEvent); - if ((st = puglCreateWindow(view, "Pugl"))) { - return logError("Failed to create window window (%s)\n", - puglStrerror(st)); + if ((st = puglRealize(view))) { + return logError("Failed to create window (%s)\n", puglStrerror(st)); } puglShowWindow(view); -- cgit v1.2.1