From 98f8d255a8aeece754dcda389aafb75572e8edb8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 5 Jul 2020 15:01:14 +0200 Subject: Move stub backend function implementations to a detail header --- pugl/detail/mac_cairo.m | 2 +- pugl/detail/mac_gl.m | 2 +- pugl/detail/mac_stub.m | 1 + pugl/detail/stub.h | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ pugl/detail/win.c | 1 + pugl/detail/win_cairo.c | 2 +- pugl/detail/win_gl.c | 2 +- pugl/detail/x11.c | 1 + pugl/detail/x11_gl.c | 2 +- 9 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 pugl/detail/stub.h (limited to 'pugl/detail') diff --git a/pugl/detail/mac_cairo.m b/pugl/detail/mac_cairo.m index dd7f0b9..18209d9 100644 --- a/pugl/detail/mac_cairo.m +++ b/pugl/detail/mac_cairo.m @@ -21,8 +21,8 @@ #include "pugl/detail/implementation.h" #include "pugl/detail/mac.h" +#include "pugl/detail/stub.h" #include "pugl/pugl_cairo.h" -#include "pugl/pugl_stub.h" #include diff --git a/pugl/detail/mac_gl.m b/pugl/detail/mac_gl.m index d1461ec..4bf6fc1 100644 --- a/pugl/detail/mac_gl.m +++ b/pugl/detail/mac_gl.m @@ -21,8 +21,8 @@ #include "pugl/detail/implementation.h" #include "pugl/detail/mac.h" +#include "pugl/detail/stub.h" #include "pugl/pugl_gl.h" -#include "pugl/pugl_stub.h" #ifndef __MAC_10_10 # define NSOpenGLProfileVersion4_1Core NSOpenGLProfileVersion3_2Core diff --git a/pugl/detail/mac_stub.m b/pugl/detail/mac_stub.m index 2c81357..8271735 100644 --- a/pugl/detail/mac_stub.m +++ b/pugl/detail/mac_stub.m @@ -21,6 +21,7 @@ #include "pugl/detail/implementation.h" #include "pugl/detail/mac.h" +#include "pugl/detail/stub.h" #include "pugl/pugl_stub.h" #import diff --git a/pugl/detail/stub.h b/pugl/detail/stub.h new file mode 100644 index 0000000..acd3181 --- /dev/null +++ b/pugl/detail/stub.h @@ -0,0 +1,75 @@ +/* + Copyright 2012-2020 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file stub.h + @brief Definition of generic stub backend functions. +*/ + +#ifndef PUGL_DETAIL_STUB_H +#define PUGL_DETAIL_STUB_H + +#include "pugl/pugl.h" + +PUGL_BEGIN_DECLS + +static inline PuglStatus +puglStubConfigure(PuglView* view) +{ + (void)view; + return PUGL_SUCCESS; +} + +static inline PuglStatus +puglStubCreate(PuglView* view) +{ + (void)view; + return PUGL_SUCCESS; +} + +static inline PuglStatus +puglStubDestroy(PuglView* view) +{ + (void)view; + return PUGL_SUCCESS; +} + +static inline PuglStatus +puglStubEnter(PuglView* view, const PuglEventExpose* expose) +{ + (void)view; + (void)expose; + return PUGL_SUCCESS; +} + +static inline PuglStatus +puglStubLeave(PuglView* view, const PuglEventExpose* expose) +{ + (void)view; + (void)expose; + return PUGL_SUCCESS; +} + +static inline void* +puglStubGetContext(PuglView* view) +{ + (void)view; + return NULL; +} + +PUGL_END_DECLS + +#endif // PUGL_DETAIL_STUB_H diff --git a/pugl/detail/win.c b/pugl/detail/win.c index 7ec02ab..4f7afee 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -22,6 +22,7 @@ #include "pugl/detail/win.h" #include "pugl/detail/implementation.h" +#include "pugl/detail/stub.h" #include "pugl/pugl.h" #include "pugl/pugl_stub.h" diff --git a/pugl/detail/win_cairo.c b/pugl/detail/win_cairo.c index 9d7b4a3..1b9afb9 100644 --- a/pugl/detail/win_cairo.c +++ b/pugl/detail/win_cairo.c @@ -19,10 +19,10 @@ @brief Cairo graphics backend for Windows. */ +#include "pugl/detail/stub.h" #include "pugl/detail/types.h" #include "pugl/detail/win.h" #include "pugl/pugl_cairo.h" -#include "pugl/pugl_stub.h" #include #include diff --git a/pugl/detail/win_gl.c b/pugl/detail/win_gl.c index 23c5d83..8cdad76 100644 --- a/pugl/detail/win_gl.c +++ b/pugl/detail/win_gl.c @@ -19,10 +19,10 @@ @brief OpenGL graphics backend for Windows. */ +#include "pugl/detail/stub.h" #include "pugl/detail/types.h" #include "pugl/detail/win.h" #include "pugl/pugl_gl.h" -#include "pugl/pugl_stub.h" #include diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index c2e7f6a..7b8daf2 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -26,6 +26,7 @@ #include "pugl/detail/x11.h" #include "pugl/detail/implementation.h" +#include "pugl/detail/stub.h" #include "pugl/detail/types.h" #include "pugl/pugl.h" #include "pugl/pugl_stub.h" diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index afb8346..f78dbf3 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -19,11 +19,11 @@ @brief OpenGL graphics backend for X11. */ +#include "pugl/detail/stub.h" #include "pugl/detail/types.h" #include "pugl/detail/x11.h" #include "pugl/pugl.h" #include "pugl/pugl_gl.h" -#include "pugl/pugl_stub.h" #include #include -- cgit v1.2.1