diff options
author | David Robillard <d@drobilla.net> | 2022-06-06 22:41:41 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-06-08 22:04:49 -0400 |
commit | 3cc5539d1c85e5044e6f893b3173cd1392bd8fc8 (patch) | |
tree | c0706a7c80a391e86b913ce165ef0f70f3de17f8 | |
parent | 96ca7a5a2ae976c587c676baf87446a55961e507 (diff) | |
download | pugl-3cc5539d1c85e5044e6f893b3173cd1392bd8fc8.tar.gz pugl-3cc5539d1c85e5044e6f893b3173cd1392bd8fc8.tar.bz2 pugl-3cc5539d1c85e5044e6f893b3173cd1392bd8fc8.zip |
Use consistent terminology for native views
On MacOS in particular, views and windows are entirely different concepts, so
confusing them... confuses things. This was the last holdover in the API that
used the old "native window".
-rw-r--r-- | bindings/cpp/include/pugl/pugl.hpp | 4 | ||||
-rw-r--r-- | doc/c/view.rst | 4 | ||||
-rw-r--r-- | examples/pugl_embed_demo.c | 2 | ||||
-rw-r--r-- | examples/pugl_window_demo.c | 2 | ||||
-rw-r--r-- | include/pugl/pugl.h | 13 | ||||
-rw-r--r-- | src/mac.m | 2 | ||||
-rw-r--r-- | src/win.c | 2 | ||||
-rw-r--r-- | src/x11.c | 2 | ||||
-rw-r--r-- | test/test_view.c | 4 |
9 files changed, 22 insertions, 13 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index 6dd5042..e80408c 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -518,8 +518,8 @@ public: /// @copydoc puglGetVisible bool visible() const noexcept { return puglGetVisible(cobj()); } - /// @copydoc puglGetNativeWindow - NativeView nativeWindow() noexcept { return puglGetNativeWindow(cobj()); } + /// @copydoc puglGetNativeView + NativeView nativeView() noexcept { return puglGetNativeView(cobj()); } /** @} diff --git a/doc/c/view.rst b/doc/c/view.rst index 016c4e3..634b736 100644 --- a/doc/c/view.rst +++ b/doc/c/view.rst @@ -52,12 +52,12 @@ To embed the view in another window, you will need to somehow get the :type:`native view handle <PuglNativeView>` for the parent, then set it with :func:`puglSetParentWindow`. If the parent is a Pugl view, -the native handle can be accessed with :func:`puglGetNativeWindow`. +the native handle can be accessed with :func:`puglGetNativeView`. For example: .. code-block:: c - puglSetParentWindow(view, puglGetNativeWindow(parent)); + puglSetParentWindow(view, puglGetNativeView(parent)); ************************ Setting an Event Handler diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index f7e4676..9f93287 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -289,7 +289,7 @@ main(int argc, char** argv) } puglSetFrame(app.child, getChildFrame(parentFrame)); - puglSetParentWindow(app.child, puglGetNativeWindow(app.parent)); + puglSetParentWindow(app.child, puglGetNativeView(app.parent)); puglSetViewHint(app.child, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking); puglSetViewHint(app.child, PUGL_SAMPLES, opts.samples); diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 3b8da31..b3deb0d 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -206,7 +206,7 @@ main(int argc, char** argv) if (i == 1) { puglSetTransientParent(app.cubes[1].view, - puglGetNativeWindow(app.cubes[0].view)); + puglGetNativeView(app.cubes[0].view)); } if ((st = puglRealize(view))) { diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index dc9c010..397d25e 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1157,7 +1157,7 @@ puglGetTransientParent(const PuglView* view); Realize a view by creating a corresponding system view or window. After this call, the (initially invisible) underlying system view exists and - can be accessed with puglGetNativeWindow(). There is currently no + can be accessed with puglGetNativeView(). There is currently no corresponding unrealize function, the system view will be destroyed along with the view when puglFreeView() is called. @@ -1194,7 +1194,7 @@ puglGetVisible(const PuglView* view); /// Return the native window handle PUGL_API PuglNativeView -puglGetNativeWindow(PuglView* view); +puglGetNativeView(PuglView* view); /** @} @@ -1536,6 +1536,7 @@ typedef PuglLoopLeaveEvent PuglEventLoopLeave; Windows: This is a `HWND`. */ +PUGL_DEPRECATED_BY("PuglNativeView") typedef uintptr_t PuglNativeWindow; /** @@ -1914,6 +1915,14 @@ puglSetAspectRatio(PuglView* view, int minX, int minY, int maxX, int maxY) return st0 ? st0 : st1; } +/// Return the native window handle +static inline PUGL_DEPRECATED_BY("puglGetNativeView") +PuglNativeView +puglGetNativeWindow(PuglView* view) +{ + return puglGetNativeView(view); +} + #endif // PUGL_DISABLE_DEPRECATED /** @@ -1421,7 +1421,7 @@ puglPostRedisplayRect(PuglView* view, const PuglRect rect) } PuglNativeView -puglGetNativeWindow(PuglView* view) +puglGetNativeView(PuglView* view) { return (PuglNativeView)view->impl->wrapperView; } @@ -1002,7 +1002,7 @@ puglPostRedisplayRect(PuglView* view, const PuglRect rect) } PuglNativeView -puglGetNativeWindow(PuglView* view) +puglGetNativeView(PuglView* view) { return (PuglNativeView)view->impl->hwnd; } @@ -1547,7 +1547,7 @@ puglPostRedisplayRect(PuglView* const view, const PuglRect rect) } PuglNativeView -puglGetNativeWindow(PuglView* const view) +puglGetNativeView(PuglView* const view) { return (PuglNativeView)view->impl->win; } diff --git a/test/test_view.c b/test/test_view.c index e9a954c..f8b0cb5 100644 --- a/test/test_view.c +++ b/test/test_view.c @@ -79,8 +79,8 @@ main(int argc, char** argv) assert(!puglUpdate(test.world, -1.0)); } - // Check that puglGetNativeWindow() returns something - assert(puglGetNativeWindow(test.view)); + // Check that puglGetNativeView() returns something + assert(puglGetNativeView(test.view)); // Tear down puglFreeView(test.view); |