aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pugl/detail/implementation.c41
-rw-r--r--pugl/pugl.h56
2 files changed, 44 insertions, 53 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index ac3f527..d6e4b86 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -44,21 +44,6 @@ puglSetDefaultHints(PuglHints hints)
hints[PUGL_IGNORE_KEY_REPEAT] = PUGL_FALSE;
}
-PuglView*
-puglInit(int* PUGL_UNUSED(pargc), char** PUGL_UNUSED(argv))
-{
- return puglNewView(puglNewWorld());
-}
-
-void
-puglDestroy(PuglView* const view)
-{
- PuglWorld* const world = view->world;
-
- puglFreeView(view);
- puglFreeWorld(world);
-}
-
PuglWorld*
puglNewWorld(void)
{
@@ -143,13 +128,6 @@ puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value)
}
void
-puglInitWindowSize(PuglView* view, int width, int height)
-{
- view->frame.width = width;
- view->frame.height = height;
-}
-
-void
puglInitWindowMinSize(PuglView* view, int width, int height)
{
view->minWidth = width;
@@ -186,12 +164,6 @@ puglInitWindowParent(PuglView* view, PuglNativeWindow parent)
}
void
-puglInitResizable(PuglView* view, bool resizable)
-{
- view->hints[PUGL_RESIZABLE] = resizable;
-}
-
-void
puglInitTransientFor(PuglView* view, uintptr_t parent)
{
view->transientParent = parent;
@@ -222,13 +194,6 @@ puglGetVisible(PuglView* view)
return view->visible;
}
-void
-puglGetSize(PuglView* view, int* width, int* height)
-{
- *width = (int)view->frame.width;
- *height = (int)view->frame.height;
-}
-
PuglRect
puglGetFrame(const PuglView* view)
{
@@ -254,12 +219,6 @@ puglLeaveContext(PuglView* view, bool drawing)
}
void
-puglIgnoreKeyRepeat(PuglView* view, bool ignore)
-{
- puglInitWindowHint(view, PUGL_IGNORE_KEY_REPEAT, ignore);
-}
-
-void
puglSetEventFunc(PuglView* view, PuglEventFunc eventFunc)
{
view->eventFunc = eventFunc;
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.