aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-04 20:28:28 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:39 +0200
commit89af2b1e3910196c4cad47c3748c1a2920b3faf9 (patch)
tree1b9ffadabf823426ce62b7d8b77a303e3d6950f7 /pugl/pugl.h
parentb0ac6dcb492b68404d800fe8ed0c7393d487fa4b (diff)
downloadpugl-89af2b1e3910196c4cad47c3748c1a2920b3faf9.tar.gz
pugl-89af2b1e3910196c4cad47c3748c1a2920b3faf9.tar.bz2
pugl-89af2b1e3910196c4cad47c3748c1a2920b3faf9.zip
Rename remaining init functions
This finishes the removal of the init/set split. While these ones are superficial, the general idea here is to provide general functions that work before or after window creation where possible. This prevents the situation where ever more dynamic counterparts to existing init functions get added over time.
Diffstat (limited to 'pugl/pugl.h')
-rw-r--r--pugl/pugl.h68
1 files changed, 53 insertions, 15 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 112b11b..e8de39b 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -107,7 +107,7 @@ typedef enum {
PUGL_IGNORE_KEY_REPEAT, /**< True if key repeat events are ignored */
PUGL_NUM_WINDOW_HINTS
-} PuglWindowHint;
+} PuglViewHint;
/**
Special window hint value.
@@ -116,7 +116,7 @@ typedef enum {
PUGL_DONT_CARE = -1, /**< Use best available value */
PUGL_FALSE = 0, /**< Explicitly false */
PUGL_TRUE = 1 /**< Explicitly true */
-} PuglWindowHintValue;
+} PuglViewHintValue;
/**
A rectangle.
@@ -529,16 +529,21 @@ PUGL_API PuglWorld*
puglGetWorld(PuglView* view);
/**
- Set a hint before creating a window.
+ Set a hint to configure window properties.
+
+ This only has an effect when called before puglCreateWindow().
*/
-PUGL_API void
-puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value);
+PUGL_API PuglStatus
+puglSetViewHint(PuglView* view, PuglViewHint hint, int value);
/**
Set the parent window before creating a window (for embedding).
+
+ This only works when called before creating the window with
+ puglCreateWindow(), reparenting is not supported.
*/
-PUGL_API void
-puglInitWindowParent(PuglView* view, PuglNativeWindow parent);
+PUGL_API PuglStatus
+puglSetParentWindow(PuglView* view, PuglNativeWindow parent);
/**
Set the graphics backend to use.
@@ -548,8 +553,8 @@ puglInitWindowParent(PuglView* view, PuglNativeWindow parent);
puglGlBackend() and puglCairoBackend(), declared in pugl_gl_backend.h and
pugl_cairo_backend.h, respectively.
*/
-PUGL_API int
-puglInitBackend(PuglView* view, const PuglBackend* backend);
+PUGL_API PuglStatus
+puglSetBackend(PuglView* view, const PuglBackend* backend);
/**
@}
@@ -871,12 +876,12 @@ puglInitTransientFor(PuglView* view, uintptr_t parent)
/**
Enable or disable resizing before creating a window.
- @deprecated Use puglInitWindowHint() with @ref PUGL_RESIZABLE.
+ @deprecated Use puglSetViewHint() with @ref PUGL_RESIZABLE.
*/
-static inline PUGL_DEPRECATED_BY("puglInitWindowHint") void
+static inline PUGL_DEPRECATED_BY("puglSetViewHint") void
puglInitResizable(PuglView* view, bool resizable)
{
- puglInitWindowHint(view, PUGL_RESIZABLE, resizable);
+ puglSetViewHint(view, PUGL_RESIZABLE, resizable);
}
/**
@@ -897,12 +902,45 @@ puglGetSize(PuglView* view, int* width, int* height)
/**
Ignore synthetic repeated key events.
- @deprecated Use puglInitWindowHint() with @ref PUGL_IGNORE_KEY_REPEAT.
+ @deprecated Use puglSetViewHint() with @ref PUGL_IGNORE_KEY_REPEAT.
*/
-static inline PUGL_DEPRECATED_BY("puglInitWindowHint") void
+static inline PUGL_DEPRECATED_BY("puglSetViewHint") void
puglIgnoreKeyRepeat(PuglView* view, bool ignore)
{
- puglInitWindowHint(view, PUGL_IGNORE_KEY_REPEAT, ignore);
+ puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, ignore);
+}
+
+/**
+ Set a hint before creating a window.
+
+ @deprecated Use puglSetWindowHint().
+*/
+static inline PUGL_DEPRECATED_BY("puglSetViewHint") void
+puglInitWindowHint(PuglView* view, PuglViewHint hint, int value)
+{
+ puglSetViewHint(view, hint, value);
+}
+
+/**
+ Set the parent window before creating a window (for embedding).
+
+ @deprecated Use puglSetWindowParent().
+*/
+static inline PUGL_DEPRECATED_BY("puglSetParentWindow") void
+puglInitWindowParent(PuglView* view, PuglNativeWindow parent)
+{
+ puglSetParentWindow(view, parent);
+}
+
+/**
+ Set the graphics backend to use.
+
+ @deprecated Use puglSetBackend().
+*/
+static inline PUGL_DEPRECATED_BY("puglSetBackend") int
+puglInitBackend(PuglView* view, const PuglBackend* backend)
+{
+ return puglSetBackend(view, backend);
}
/**