aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-04 18:20:35 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:39 +0200
commitf98e804c5f844f2dd78e94f7a1c9db15b7332fbb (patch)
tree1a3a997904eb1b68694799e302841ce980171349 /pugl/pugl.h
parent411c7ddbb044d0eae8307858d1254ca830f0a44a (diff)
downloadpugl-f98e804c5f844f2dd78e94f7a1c9db15b7332fbb.tar.gz
pugl-f98e804c5f844f2dd78e94f7a1c9db15b7332fbb.tar.bz2
pugl-f98e804c5f844f2dd78e94f7a1c9db15b7332fbb.zip
Move trivial deprecated implementations to header
Again just makes non-deprecated things easier to read and review, and also cleans up the symbol table.
Diffstat (limited to 'pugl/pugl.h')
-rw-r--r--pugl/pugl.h56
1 files changed, 44 insertions, 12 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 457b780..6d2d8b1 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -775,32 +775,55 @@ puglPostRedisplay(PuglView* view);
@param argv Arguments (currently unused).
@return A newly created view.
*/
-PUGL_API PUGL_DEPRECATED_BY("puglNewView") PuglView*
-puglInit(int* pargc, char** argv);
+static inline PUGL_DEPRECATED_BY("puglNewView") PuglView*
+puglInit(const int* pargc, char** argv)
+{
+ (void)pargc;
+ (void)argv;
+
+ return puglNewView(puglNewWorld());
+}
/**
Destroy an app and view created with `puglInit()`.
@deprecated Use puglFreeApp() and puglFreeView().
*/
-PUGL_API PUGL_DEPRECATED_BY("puglFreeView") void
-puglDestroy(PuglView* view);
+static inline PUGL_DEPRECATED_BY("puglFreeView") void
+puglDestroy(PuglView* view)
+{
+ PuglWorld* const world = puglGetWorld(view);
+
+ puglFreeView(view);
+ puglFreeWorld(world);
+}
/**
Set the window size before creating a window.
@deprecated Use puglSetFrame().
*/
-PUGL_API PUGL_DEPRECATED_BY("puglSetFrame") void
-puglInitWindowSize(PuglView* view, int width, int height);
+static inline PUGL_DEPRECATED_BY("puglSetFrame") void
+puglInitWindowSize(PuglView* view, int width, int height)
+{
+ PuglRect frame = puglGetFrame(view);
+
+ frame.width = width;
+ frame.height = height;
+
+ puglSetFrame(view, frame);
+}
/**
Enable or disable resizing before creating a window.
@deprecated Use puglInitWindowHint() with @ref PUGL_RESIZABLE.
*/
-PUGL_API PUGL_DEPRECATED_BY("puglInitWindowHint") void
-puglInitResizable(PuglView* view, bool resizable);
+static inline PUGL_DEPRECATED_BY("puglInitWindowHint") void
+puglInitResizable(PuglView* view, bool resizable)
+{
+ puglInitWindowHint(view, PUGL_RESIZABLE, resizable);
+}
/**
Get the current size of the view.
@@ -808,16 +831,25 @@ puglInitResizable(PuglView* view, bool resizable);
@deprecated Use puglGetFrame().
*/
-PUGL_API PUGL_DEPRECATED_BY("puglGetFrame") void
-puglGetSize(PuglView* view, int* width, int* height);
+static inline PUGL_DEPRECATED_BY("puglGetFrame") void
+puglGetSize(PuglView* view, int* width, int* height)
+{
+ const PuglRect frame = puglGetFrame(view);
+
+ *width = (int)frame.width;
+ *height = (int)frame.height;
+}
/**
Ignore synthetic repeated key events.
@deprecated Use puglInitWindowHint() with @ref PUGL_IGNORE_KEY_REPEAT.
*/
-PUGL_API PUGL_DEPRECATED_BY("puglInitWindowHint") void
-puglIgnoreKeyRepeat(PuglView* view, bool ignore);
+static inline PUGL_DEPRECATED_BY("puglInitWindowHint") void
+puglIgnoreKeyRepeat(PuglView* view, bool ignore)
+{
+ puglInitWindowHint(view, PUGL_IGNORE_KEY_REPEAT, ignore);
+}
/**
Block and wait for an event to be ready.