From adc925180be3a8b4a970c70c58ef6c3de6993458 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 23 Nov 2020 17:14:21 +0100 Subject: Rename puglShowWindow and puglHideWindow to puglShow an puglHide These names were confusing because a view is not necessarily a window. Since there's no room for ambiguity here, simply drop the superfluous word. --- bindings/cxx/include/pugl/pugl.hpp | 12 ++++++------ doc/mainpage.md | 2 +- examples/pugl_cairo_demo.c | 2 +- examples/pugl_cursor_demo.c | 2 +- examples/pugl_cxx_demo.cpp | 2 +- examples/pugl_embed_demo.c | 4 ++-- examples/pugl_print_events.c | 2 +- examples/pugl_shader_demo.c | 2 +- examples/pugl_vulkan_cxx_demo.cpp | 2 +- examples/pugl_vulkan_demo.c | 4 ++-- examples/pugl_window_demo.c | 2 +- include/pugl/pugl.h | 10 ++++++++-- src/implementation.c | 12 ++++++++++++ src/mac.m | 4 ++-- src/win.c | 4 ++-- src/x11.c | 4 ++-- test/test_redisplay.c | 2 +- test/test_show_hide.c | 4 ++-- test/test_timer.c | 2 +- test/test_update.c | 2 +- 20 files changed, 49 insertions(+), 31 deletions(-) diff --git a/bindings/cxx/include/pugl/pugl.hpp b/bindings/cxx/include/pugl/pugl.hpp index d6ec711..e71f5a6 100644 --- a/bindings/cxx/include/pugl/pugl.hpp +++ b/bindings/cxx/include/pugl/pugl.hpp @@ -507,16 +507,16 @@ public: return static_cast(puglRealize(cobj())); } - /// @copydoc puglShowWindow - Status showWindow() noexcept + /// @copydoc puglShow + Status show() noexcept { - return static_cast(puglShowWindow(cobj())); + return static_cast(puglShow(cobj())); } - /// @copydoc puglHideWindow - Status hideWindow() noexcept + /// @copydoc puglHide + Status hide() noexcept { - return static_cast(puglHideWindow(cobj())); + return static_cast(puglHide(cobj())); } /// @copydoc puglGetVisible diff --git a/doc/mainpage.md b/doc/mainpage.md index 84f4722..92f7409 100644 --- a/doc/mainpage.md +++ b/doc/mainpage.md @@ -38,7 +38,7 @@ Pugl includes [Cairo](@ref cairo), [OpenGL](@ref gl), and [Vulkan](@ref vulkan) as well as a [stub](@ref stub) backend that creates a native window with no portable drawing context. Once the view is configured, -it can be [realized](@ref puglRealize) and [shown](@ref puglShowWindow). +it can be [realized](@ref puglRealize) and [shown](@ref puglShow). By default a view will correspond to a top-level system window. To create a view within another window, it must have a [parent window set](@ref puglSetParentWindow) before being created. diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c index d8a1b08..c143c3c 100644 --- a/examples/pugl_cairo_demo.c +++ b/examples/pugl_cairo_demo.c @@ -252,7 +252,7 @@ main(int argc, char** argv) return logError("Failed to create window (%s)\n", puglStrerror(st)); } - puglShowWindow(view); + puglShow(view); PuglFpsPrinter fpsPrinter = { puglGetTime(app.world) }; const double timeout = app.opts.continuous ? (1 / 60.0) : -1.0; diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c index de6b6f2..916460a 100644 --- a/examples/pugl_cursor_demo.c +++ b/examples/pugl_cursor_demo.c @@ -160,7 +160,7 @@ main(int argc, char** argv) return logError("Failed to create window (%s)\n", puglStrerror(st)); } - puglShowWindow(view); + puglShow(view); while (!app.quit) { puglUpdate(app.world, -1.0); diff --git a/examples/pugl_cxx_demo.cpp b/examples/pugl_cxx_demo.cpp index 9767345..482f67f 100644 --- a/examples/pugl_cxx_demo.cpp +++ b/examples/pugl_cxx_demo.cpp @@ -134,7 +134,7 @@ main(int argc, char** argv) view.setHint(pugl::ViewHint::swapInterval, opts.sync); view.setHint(pugl::ViewHint::ignoreKeyRepeat, opts.ignoreKeyRepeat); view.realize(); - view.showWindow(); + view.show(); unsigned framesDrawn = 0; while (!view.quit()) { diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index db4a141..5acef73 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -335,8 +335,8 @@ main(int argc, char** argv) puglStrerror(st)); } - puglShowWindow(app.parent); - puglShowWindow(app.child); + puglShow(app.parent); + puglShow(app.child); puglStartTimer(app.child, reverseTimerId, 3.6); diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c index 816086d..3f6bb06 100644 --- a/examples/pugl_print_events.c +++ b/examples/pugl_print_events.c @@ -69,7 +69,7 @@ main(void) return logError("Failed to create window (%s)\n", puglStrerror(st)); } - puglShowWindow(app.view); + puglShow(app.view); while (!app.quit) { puglUpdate(app.world, -1.0); diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index 476489d..3f5e7f3 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -426,7 +426,7 @@ main(int argc, char** argv) // Show window printViewHints(app.view); - puglShowWindow(app.view); + puglShow(app.view); // Calculate ideal frame duration to drive the main loop at a good rate const int refreshRate = puglGetViewHint(app.view, PUGL_REFRESH_RATE); diff --git a/examples/pugl_vulkan_cxx_demo.cpp b/examples/pugl_vulkan_cxx_demo.cpp index 6da5e5a..b4e04ef 100644 --- a/examples/pugl_vulkan_cxx_demo.cpp +++ b/examples/pugl_vulkan_cxx_demo.cpp @@ -1804,7 +1804,7 @@ run(const PuglTestOptions opts, const size_t numRects) const double timeout = app.opts.sync ? frameDuration : 0.0; PuglFpsPrinter fpsPrinter = {app.world.time()}; - app.view.showWindow(); + app.view.show(); while (!app.quit) { app.world.update(timeout); puglPrintFps(app.world.cobj(), &fpsPrinter, &app.framesDrawn); diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c index 3f684fe..c609d10 100644 --- a/examples/pugl_vulkan_demo.c +++ b/examples/pugl_vulkan_demo.c @@ -893,7 +893,7 @@ destroyWorld(VulkanApp* const app) closeDevice(vk); if (app->view) { - puglHideWindow(app->view); + puglHide(app->view); puglFreeView(app->view); app->view = NULL; } @@ -1123,7 +1123,7 @@ main(int argc, char** argv) printf("Swapchain images: %u\n", app.vk.swapchain->nImages); PuglFpsPrinter fpsPrinter = {puglGetTime(app.world)}; - puglShowWindow(app.view); + puglShow(app.view); while (!app.quit) { puglUpdate(app.world, -1.0); diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 9b7795c..080d23b 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -236,7 +236,7 @@ main(int argc, char** argv) return logError("Failed to create window (%s)\n", puglStrerror(st)); } - puglShowWindow(view); + puglShow(view); } PuglFpsPrinter fpsPrinter = {puglGetTime(app.world)}; diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index 30d92c6..61820e5 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1042,11 +1042,11 @@ puglRealize(PuglView* view); top depending on the platform. */ PUGL_API PuglStatus -puglShowWindow(PuglView* view); +puglShow(PuglView* view); /// Hide the current window PUGL_API PuglStatus -puglHideWindow(PuglView* view); +puglHide(PuglView* view); /// Return true iff the view is currently visible PUGL_API bool @@ -1515,6 +1515,12 @@ puglPollEvents(PuglWorld* world, double timeout); PUGL_API PUGL_DEPRECATED_BY("puglUpdate") PuglStatus puglDispatchEvents(PuglWorld* world); +PUGL_API PUGL_DEPRECATED_BY("puglShow") PuglStatus +puglShowWindow(PuglView* view); + +PUGL_API PUGL_DEPRECATED_BY("puglHide") PuglStatus +puglHideWindow(PuglView* view); + #endif // PUGL_DISABLE_DEPRECATED /** diff --git a/src/implementation.c b/src/implementation.c index 35c4c26..23bfbde 100644 --- a/src/implementation.c +++ b/src/implementation.c @@ -289,6 +289,18 @@ puglDispatchEvents(PuglWorld* world) return puglUpdate(world, 0.0); } +PuglStatus +puglShowWindow(PuglView* view) +{ + return puglShow(view); +} + +PuglStatus +puglHideWindow(PuglView* view) +{ + return puglHide(view); +} + #endif PuglStatus diff --git a/src/mac.m b/src/mac.m index 3d1fba2..6b8761f 100644 --- a/src/mac.m +++ b/src/mac.m @@ -1007,7 +1007,7 @@ puglRealize(PuglView* view) } PuglStatus -puglShowWindow(PuglView* view) +puglShow(PuglView* view) { if (![view->impl->window isVisible]) { [view->impl->window setIsVisible:YES]; @@ -1019,7 +1019,7 @@ puglShowWindow(PuglView* view) } PuglStatus -puglHideWindow(PuglView* view) +puglHide(PuglView* view) { [view->impl->window setIsVisible:NO]; return PUGL_SUCCESS; diff --git a/src/win.c b/src/win.c index d7c0d57..3189220 100644 --- a/src/win.c +++ b/src/win.c @@ -218,7 +218,7 @@ puglRealize(PuglView* view) } PuglStatus -puglShowWindow(PuglView* view) +puglShow(PuglView* view) { PuglInternals* impl = view->impl; @@ -228,7 +228,7 @@ puglShowWindow(PuglView* view) } PuglStatus -puglHideWindow(PuglView* view) +puglHide(PuglView* view) { PuglInternals* impl = view->impl; diff --git a/src/x11.c b/src/x11.c index 79a0fba..bf9331c 100644 --- a/src/x11.c +++ b/src/x11.c @@ -394,7 +394,7 @@ puglRealize(PuglView* view) } PuglStatus -puglShowWindow(PuglView* view) +puglShow(PuglView* view) { PuglStatus st = PUGL_SUCCESS; @@ -411,7 +411,7 @@ puglShowWindow(PuglView* view) } PuglStatus -puglHideWindow(PuglView* view) +puglHide(PuglView* view) { XUnmapWindow(view->impl->display, view->impl->win); return PUGL_SUCCESS; diff --git a/test/test_redisplay.c b/test/test_redisplay.c index 66b9168..1d5b084 100644 --- a/test/test_redisplay.c +++ b/test/test_redisplay.c @@ -115,7 +115,7 @@ main(int argc, char** argv) // Create and show window assert(!puglRealize(app.view)); - assert(!puglShowWindow(app.view)); + assert(!puglShow(app.view)); while (app.state != EXPOSED) { assert(!puglUpdate(app.world, timeout)); } diff --git a/test/test_show_hide.c b/test/test_show_hide.c index 6252c28..4280408 100644 --- a/test/test_show_hide.c +++ b/test/test_show_hide.c @@ -126,13 +126,13 @@ main(int argc, char** argv) // Show and hide window a couple of times for (unsigned i = 0u; i < 2u; ++i) { - assert(!puglShowWindow(test.view)); + assert(!puglShow(test.view)); while (test.state != EXPOSED) { tick(test.world); } assert(puglGetVisible(test.view)); - assert(!puglHideWindow(test.view)); + assert(!puglHide(test.view)); while (test.state != UNMAPPED) { tick(test.world); } diff --git a/test/test_timer.c b/test/test_timer.c index 219fa59..0b77396 100644 --- a/test/test_timer.c +++ b/test/test_timer.c @@ -113,7 +113,7 @@ main(int argc, char** argv) // Create and show window assert(!puglRealize(app.view)); - assert(!puglShowWindow(app.view)); + assert(!puglShow(app.view)); while (app.state != EXPOSED) { assert(!puglUpdate(app.world, timeout)); } diff --git a/test/test_update.c b/test/test_update.c index 02b72a3..b35e96e 100644 --- a/test/test_update.c +++ b/test/test_update.c @@ -105,7 +105,7 @@ main(int argc, char** argv) // Create and show window assert(!puglRealize(app.view)); - assert(!puglShowWindow(app.view)); + assert(!puglShow(app.view)); // Tick until an expose happens while (app.state < EXPOSED1) { -- cgit v1.2.1