From 411c7ddbb044d0eae8307858d1254ca830f0a44a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Aug 2019 18:09:55 +0200 Subject: Move deprecated API to a separate section of the header This just makes things easier to read. --- pugl/pugl.h | 165 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 87 insertions(+), 78 deletions(-) (limited to 'pugl') diff --git a/pugl/pugl.h b/pugl/pugl.h index 6b60f69..457b780 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -41,14 +41,6 @@ # define PUGL_API #endif -#if defined(__clang__) -# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("", name))) -#elif defined(__GNUC__) -# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("Use " name))) -#else -# define PUGL_DEPRECATED_BY(name) -#endif - #ifdef __cplusplus extern "C" { #endif @@ -503,21 +495,6 @@ puglDispatchEvents(PuglWorld* world); @{ */ -/** - Create a Pugl application and view. - - To create a window, call the various puglInit* functions as necessary, then - call puglCreateWindow(). - - @deprecated Use puglNewApp() and puglNewView(). - - @param pargc Pointer to argument count (currently unused). - @param argv Arguments (currently unused). - @return A newly created view. -*/ -PUGL_API PUGL_DEPRECATED_BY("puglNewView") PuglView* -puglInit(int* pargc, char** argv); - /** Create a new view. @@ -557,14 +534,6 @@ puglInitWindowClass(PuglView* view, const char* name); PUGL_API void puglInitWindowParent(PuglView* view, PuglNativeWindow parent); -/** - 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); - /** Set the minimum window size before creating a window. */ @@ -588,14 +557,6 @@ puglInitWindowAspectRatio(PuglView* view, int maxX, int maxY); -/** - 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); - /** Set transient parent before creating a window. @@ -674,12 +635,6 @@ puglGetHandle(PuglView* view); PUGL_API bool puglGetVisible(PuglView* view); -/** - Get the current size of the view. -*/ -PUGL_API PUGL_DEPRECATED_BY("puglGetFrame") void -puglGetSize(PuglView* view, int* width, int* height); - /** Get the current position and size of the view. */ @@ -752,14 +707,6 @@ typedef void (*PuglEventFunc)(PuglView* view, const PuglEvent* event); PUGL_API void puglSetEventFunc(PuglView* view, PuglEventFunc eventFunc); -/** - 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); - /** Return true iff `view` has the input focus. */ @@ -782,31 +729,6 @@ puglGrabFocus(PuglView* view); PUGL_API void puglRequestAttention(PuglView* view); -/** - Block and wait for an event to be ready. - - This can be used in a loop to only process events via puglProcessEvents when - necessary. This function will block indefinitely if no events are - available, so is not appropriate for use in programs that need to perform - regular updates (e.g. animation). - - @deprecated Use puglPollEvents(). -*/ -PUGL_API PUGL_DEPRECATED_BY("puglPollEvents") PuglStatus -puglWaitForEvent(PuglView* view); - -/** - Process all pending window events. - - This handles input events as well as rendering, so it should be called - regularly and rapidly enough to keep the UI responsive. This function does - not block if no events are pending. - - @deprecated Use puglDispatchEvents(). -*/ -PUGL_API PUGL_DEPRECATED_BY("puglDispatchEvents") PuglStatus -puglProcessEvents(PuglView* view); - /** @} */ @@ -828,6 +750,34 @@ puglGetProcAddress(const char* name); PUGL_API void puglPostRedisplay(PuglView* view); +/** + @name Deprecated API + @{ +*/ + +#if defined(__clang__) +# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("", name))) +#elif defined(__GNUC__) +# define PUGL_DEPRECATED_BY(name) __attribute__((deprecated("Use " name))) +#else +# define PUGL_DEPRECATED_BY(name) +#endif + +/** + Create a Pugl application and view. + + To create a window, call the various puglInit* functions as necessary, then + call puglCreateWindow(). + + @deprecated Use puglNewApp() and puglNewView(). + + @param pargc Pointer to argument count (currently unused). + @param argv Arguments (currently unused). + @return A newly created view. +*/ +PUGL_API PUGL_DEPRECATED_BY("puglNewView") PuglView* +puglInit(int* pargc, char** argv); + /** Destroy an app and view created with `puglInit()`. @@ -837,6 +787,65 @@ PUGL_API PUGL_DEPRECATED_BY("puglFreeView") void puglDestroy(PuglView* view); /** + 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); + +/** + 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); + +/** + Get the current size of the view. + + @deprecated Use puglGetFrame(). + +*/ +PUGL_API PUGL_DEPRECATED_BY("puglGetFrame") void +puglGetSize(PuglView* view, int* width, int* 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); + +/** + Block and wait for an event to be ready. + + This can be used in a loop to only process events via puglProcessEvents when + necessary. This function will block indefinitely if no events are + available, so is not appropriate for use in programs that need to perform + regular updates (e.g. animation). + + @deprecated Use puglPollEvents(). +*/ +PUGL_API PUGL_DEPRECATED_BY("puglPollEvents") PuglStatus +puglWaitForEvent(PuglView* view); + +/** + Process all pending window events. + + This handles input events as well as rendering, so it should be called + regularly and rapidly enough to keep the UI responsive. This function does + not block if no events are pending. + + @deprecated Use puglDispatchEvents(). +*/ +PUGL_API PUGL_DEPRECATED_BY("puglDispatchEvents") PuglStatus +puglProcessEvents(PuglView* view); + +/** + @} @} */ -- cgit v1.2.1