aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-05 15:01:14 +0200
committerDavid Robillard <d@drobilla.net>2020-07-05 18:47:39 +0200
commit98f8d255a8aeece754dcda389aafb75572e8edb8 (patch)
treee3a2022528949dca70a56c8a50132b8e88f5f794
parent90abfef17294c1b382f43007d984b93c200efa9d (diff)
Move stub backend function implementations to a detail header
-rw-r--r--pugl/detail/mac_cairo.m2
-rw-r--r--pugl/detail/mac_gl.m2
-rw-r--r--pugl/detail/mac_stub.m1
-rw-r--r--pugl/detail/stub.h75
-rw-r--r--pugl/detail/win.c1
-rw-r--r--pugl/detail/win_cairo.c2
-rw-r--r--pugl/detail/win_gl.c2
-rw-r--r--pugl/detail/x11.c1
-rw-r--r--pugl/detail/x11_gl.c2
-rw-r--r--pugl/pugl_stub.h44
10 files changed, 83 insertions, 49 deletions
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 <cairo-quartz.h>
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 <Cocoa/Cocoa.h>
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 <d@drobilla.net>
+
+ 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 <cairo-win32.h>
#include <cairo.h>
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 <windows.h>
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 <GL/glx.h>
#include <X11/X.h>
diff --git a/pugl/pugl_stub.h b/pugl/pugl_stub.h
index ed3e58a..ef48000 100644
--- a/pugl/pugl_stub.h
+++ b/pugl/pugl_stub.h
@@ -51,50 +51,6 @@ PUGL_API
const PuglBackend*
puglStubBackend(void);
-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;
-}
-
/**
@}
*/