summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glut_waffle/CMakeLists.no_api.txt2
-rw-r--r--src/glut_waffle/CMakeLists.txt2
-rw-r--r--src/glut_waffle/glut_waffle.c66
-rw-r--r--src/glut_waffle/priv/common.c52
-rw-r--r--src/glut_waffle/priv/common.h67
5 files changed, 124 insertions, 65 deletions
diff --git a/src/glut_waffle/CMakeLists.no_api.txt b/src/glut_waffle/CMakeLists.no_api.txt
index 70bd193f4..63a2e19f2 100644
--- a/src/glut_waffle/CMakeLists.no_api.txt
+++ b/src/glut_waffle/CMakeLists.no_api.txt
@@ -2,4 +2,6 @@ link_libraries(${WAFFLE_LIBRARIES})
add_library(glut_waffle SHARED
glut_waffle.c
+
+ priv/common.c
)
diff --git a/src/glut_waffle/CMakeLists.txt b/src/glut_waffle/CMakeLists.txt
index 144a306f4..c88d07279 100644
--- a/src/glut_waffle/CMakeLists.txt
+++ b/src/glut_waffle/CMakeLists.txt
@@ -1 +1,3 @@
+include_directories(.)
+
piglit_include_target_api()
diff --git a/src/glut_waffle/glut_waffle.c b/src/glut_waffle/glut_waffle.c
index 3381a2ea7..1c3b8127a 100644
--- a/src/glut_waffle/glut_waffle.c
+++ b/src/glut_waffle/glut_waffle.c
@@ -21,8 +21,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "glut_waffle.h"
-
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -30,69 +28,7 @@
#include <string.h>
#include <unistd.h>
-#include <waffle.h>
-
-struct glut_waffle_window;
-
-struct glut_waffle_state {
- /** \brief One of `WAFFLE_PLATFORM_*`. */
- int waffle_platform;
-
- /** \brief One of `WAFFLE_CONTEXT_OPENGL*`.
- *
- * The default value is `WAFFLE_CONTEXT_OPENGL`. To change the value,
- * call glutInitAPIMask().
- */
- int waffle_context_api;
-
- /** \brief A bitmask of enum glut_display_mode`. */
- int display_mode;
-
- int window_width;
- int window_height;
-
- struct waffle_display *display;
- struct waffle_context *context;
- struct glut_window *window;
-
- int redisplay;
- int window_id_pool;
-};
-
-static struct glut_waffle_state _glut_waffle_state = {
- .display_mode = GLUT_RGB,
- .window_width = 300,
- .window_height = 300,
- .window_id_pool = 0,
-};
-
-static struct glut_waffle_state *const _glut = &_glut_waffle_state;
-
-struct glut_window {
- struct waffle_window *waffle;
-
- int id;
-
- GLUT_EGLreshapeCB reshape_cb;
- GLUT_EGLdisplayCB display_cb;
- GLUT_EGLkeyboardCB keyboard_cb;
-};
-
-static void
-glutFatal(char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
-
- fflush(stdout);
- fprintf(stderr, "glut_waffle: ");
- vfprintf(stderr, format, args);
- va_end(args);
- putc('\n', stderr);
-
- exit(1);
-}
+#include "priv/common.h"
void
glutInitAPIMask(int mask)
diff --git a/src/glut_waffle/priv/common.c b/src/glut_waffle/priv/common.c
new file mode 100644
index 000000000..71e979e63
--- /dev/null
+++ b/src/glut_waffle/priv/common.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "common.h"
+
+struct glut_waffle_state _glut_waffle_state = {
+ .display_mode = GLUT_RGB,
+ .window_width = 300,
+ .window_height = 300,
+ .window_id_pool = 0,
+};
+
+struct glut_waffle_state *const _glut = &_glut_waffle_state;
+
+void
+glutFatal(char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ fflush(stdout);
+ fprintf(stderr, "glut_waffle: ");
+ vfprintf(stderr, format, args);
+ va_end(args);
+ putc('\n', stderr);
+
+ exit(1);
+}
diff --git a/src/glut_waffle/priv/common.h b/src/glut_waffle/priv/common.h
new file mode 100644
index 000000000..2b3ebca2a
--- /dev/null
+++ b/src/glut_waffle/priv/common.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include <waffle.h>
+
+#include "glut_waffle.h"
+
+struct glut_window {
+ struct waffle_window *waffle;
+
+ int id;
+
+ GLUT_EGLreshapeCB reshape_cb;
+ GLUT_EGLdisplayCB display_cb;
+ GLUT_EGLkeyboardCB keyboard_cb;
+};
+
+struct glut_waffle_state {
+ /** \brief One of `WAFFLE_PLATFORM_*`. */
+ int waffle_platform;
+
+ /** \brief One of `WAFFLE_CONTEXT_OPENGL*`.
+ *
+ * The default value is `WAFFLE_CONTEXT_OPENGL`. To change the value,
+ * call glutInitAPIMask().
+ */
+ int waffle_context_api;
+
+ /** \brief A bitmask of enum glut_display_mode`. */
+ int display_mode;
+
+ int window_width;
+ int window_height;
+
+ struct waffle_display *display;
+ struct waffle_context *context;
+ struct glut_window *window;
+
+ int redisplay;
+ int window_id_pool;
+};
+
+extern struct glut_waffle_state *const _glut;
+
+void
+glutFatal(char *format, ...);