summaryrefslogtreecommitdiff
path: root/src/glut_waffle
diff options
context:
space:
mode:
Diffstat (limited to 'src/glut_waffle')
-rw-r--r--src/glut_waffle/CMakeLists.no_api.txt11
-rw-r--r--src/glut_waffle/CMakeLists.txt3
-rw-r--r--src/glut_waffle/README.txt5
-rw-r--r--src/glut_waffle/TODO.txt2
-rw-r--r--src/glut_waffle/glut_waffle.c352
-rw-r--r--src/glut_waffle/glut_waffle.h72
-rw-r--r--src/glut_waffle/priv/common.c66
-rw-r--r--src/glut_waffle/priv/common.h81
-rw-r--r--src/glut_waffle/priv/x11.c89
-rw-r--r--src/glut_waffle/priv/x11.h31
10 files changed, 0 insertions, 712 deletions
diff --git a/src/glut_waffle/CMakeLists.no_api.txt b/src/glut_waffle/CMakeLists.no_api.txt
deleted file mode 100644
index 780f01a3a..000000000
--- a/src/glut_waffle/CMakeLists.no_api.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-link_libraries(
- ${WAFFLE_LIBRARIES}
- X11
- )
-
-add_library(glut_waffle SHARED
- glut_waffle.c
-
- priv/common.c
- priv/x11.c
- )
diff --git a/src/glut_waffle/CMakeLists.txt b/src/glut_waffle/CMakeLists.txt
deleted file mode 100644
index c88d07279..000000000
--- a/src/glut_waffle/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-include_directories(.)
-
-piglit_include_target_api()
diff --git a/src/glut_waffle/README.txt b/src/glut_waffle/README.txt
deleted file mode 100644
index a8fe20e37..000000000
--- a/src/glut_waffle/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-glut_waffle is transitionary only and not intended to be a permanent
-addition to Piglit. Its purpose is to make Piglit's transition from GLUT
-to Waffle go smoothly. Once the transition is complete, piglit-framework.c
-will be updated to use Waffle directly, and libglut_waffle will be
-removed.
diff --git a/src/glut_waffle/TODO.txt b/src/glut_waffle/TODO.txt
deleted file mode 100644
index 866382575..000000000
--- a/src/glut_waffle/TODO.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Support basic input.
-* Support multiple windows.
diff --git a/src/glut_waffle/glut_waffle.c b/src/glut_waffle/glut_waffle.c
deleted file mode 100644
index 5496edb0b..000000000
--- a/src/glut_waffle/glut_waffle.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright 2012 Intel Corporation
- * Copyright 2010 LunarG Inc.
- *
- * 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 <assert.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <waffle_glx.h>
-#include <waffle_x11_egl.h>
-
-#include "priv/common.h"
-
-#ifdef PIGLIT_HAS_X11
-# include "priv/x11.h"
-#endif
-
-void
-glutInitAPIMask(int mask)
-{
- switch (mask) {
- case GLUT_OPENGL_BIT:
- _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL;
- break;
- case GLUT_OPENGL_ES1_BIT:
- _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES1;
- break;
- case GLUT_OPENGL_ES2_BIT:
- _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES2;
- break;
- default:
- glutFatal("api_mask has bad value %#x", mask);
- break;
- }
-}
-
-void
-glutInit(int *argcp, char **argv)
-{
- const char *piglit_platform;
- const char *display_name = NULL;
- bool ok = true;
- int i;
-
- int32_t waffle_init_attrib_list[] = {
- WAFFLE_PLATFORM, 0x31415925,
- 0,
- };
-
- for (i = 1; i < *argcp; i++) {
- if (strcmp(argv[i], "-display") == 0)
- display_name = argv[++i];
- else if (strcmp(argv[i], "-info") == 0) {
- printf("waffle_glut: ignoring -info\n");
- }
- }
-
- _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL;
-
- piglit_platform = getenv("PIGLIT_PLATFORM");
- if (piglit_platform == NULL) {
- _glut->waffle_platform = WAFFLE_PLATFORM_GLX;
- } else if (!strcmp(piglit_platform, "glx")) {
- _glut->waffle_platform = WAFFLE_PLATFORM_GLX;
- } else if (!strcmp(piglit_platform, "x11_egl")) {
- _glut->waffle_platform = WAFFLE_PLATFORM_X11_EGL;
- } else if (!strcmp(piglit_platform, "wayland")) {
- _glut->waffle_platform = WAFFLE_PLATFORM_WAYLAND;
- } else {
- glutFatal("environment var PIGLIT_PLATFORM has bad "
- "value \"%s\"", piglit_platform);
- }
-
-#ifndef PIGLIT_HAS_X11
- if (_glut->waffle_platform == WAFFLE_PLATFORM_GLX ||
- _glut->waffle_platform == WAFFLE_PLATFORM_X11_EGL)
- glutFatal("piglit was built without x11 support");
-#endif
-
- waffle_init_attrib_list[1] = _glut->waffle_platform;
- ok = waffle_init(waffle_init_attrib_list);
- if (!ok)
- glutFatalWaffleError("waffle_init");
-
- _glut->display = waffle_display_connect(display_name);
- if (!_glut->display)
- glutFatalWaffleError("waffle_display_connect");
-}
-
-void
-glutInitDisplayMode(unsigned int mode)
-{
- _glut->display_mode = mode;
-}
-
-void
-glutInitWindowPosition(int x, int y)
-{
- // empty
-}
-
-void
-glutInitWindowSize(int width, int height)
-{
- _glut->window_width = width;
- _glut->window_height = height;
-}
-
-static struct waffle_config*
-glutChooseConfig(void)
-{
- struct waffle_config *config = NULL;
- int32_t attrib_list[64];
- int i = 0;
-
- #define ADD_ATTR(name, value) \
- do { \
- attrib_list[i++] = name; \
- attrib_list[i++] = value; \
- } while (0)
-
- ADD_ATTR(WAFFLE_CONTEXT_API, _glut->waffle_context_api);
-
- /* It is impossible to not request RGBA because GLUT_RGB and
- * GLUT_RGBA are both 0. That is, (display_mode & (GLUT_RGB
- * | GLUT_RGBA)) is unconditonally true.
- */
- ADD_ATTR(WAFFLE_RED_SIZE, 1);
- ADD_ATTR(WAFFLE_GREEN_SIZE, 1);
- ADD_ATTR(WAFFLE_BLUE_SIZE, 1);
- ADD_ATTR(WAFFLE_ALPHA_SIZE, 1);
-
- if (_glut->display_mode & GLUT_DEPTH) {
- ADD_ATTR(WAFFLE_DEPTH_SIZE, 1);
- }
-
- if (_glut->display_mode & GLUT_STENCIL) {
- ADD_ATTR(WAFFLE_STENCIL_SIZE, 1);
- }
-
- if (!(_glut->display_mode & GLUT_DOUBLE)) {
- ADD_ATTR(WAFFLE_DOUBLE_BUFFERED, false);
- }
-
- if (_glut->display_mode & GLUT_ACCUM) {
- ADD_ATTR(WAFFLE_ACCUM_BUFFER, true);
- }
-
- attrib_list[i++] = WAFFLE_NONE;
-
- config = waffle_config_choose(_glut->display, attrib_list);
- if (!config)
- glutFatalWaffleError("waffle_config_choose");
- return config;
-}
-
-void
-glutPostRedisplay(void)
-{
- _glut->redisplay = 1;
-}
-
-static void
-_glutDefaultKeyboard(unsigned char key, int x, int y)
-{
- if (key == 27)
- exit(0);
-}
-
-int
-glutCreateWindow(const char *title)
-{
- bool ok = true;
- struct waffle_config *config = NULL;
- union waffle_native_window *n_window = NULL;
-
- if (_glut->window)
- glutFatal("cannot create window; one already exists");
-
- config = glutChooseConfig();
-
- _glut->context = waffle_context_create(config, NULL);
- if (!_glut->context)
- glutFatalWaffleError("waffle_context_create");
-
- _glut->window = calloc(1, sizeof(*_glut->window));
- if (!_glut->window)
- glutFatal("out of memory");
-
- _glut->window->waffle = waffle_window_create(config,
- _glut->window_width,
- _glut->window_height);
- if (!_glut->window->waffle)
- glutFatalWaffleError("waffle_window_create");
-
- n_window = waffle_window_get_native(_glut->window->waffle);
- if (!n_window)
- glutFatalWaffleError("waffle_window_get_native");
-
- switch (_glut->waffle_platform) {
-#ifdef PIGLIT_HAS_X11
- case WAFFLE_PLATFORM_GLX:
- _glut->window->x11.display = n_window->glx->xlib_display;
- _glut->window->x11.window = n_window->glx->xlib_window;
- break;
- case WAFFLE_PLATFORM_X11_EGL:
- _glut->window->x11.display = n_window->x11_egl->display.xlib_display;
- _glut->window->x11.window = n_window->x11_egl->xlib_window;
- break;
-#endif
- case WAFFLE_PLATFORM_WAYLAND:
- printf("glut_waffle: warning: input is not yet "
- "implemented for Wayland\n");
- break;
- default:
- assert(0);
- break;
- }
-
- ok = waffle_make_current(_glut->display, _glut->window->waffle,
- _glut->context);
- if (!ok)
- glutFatalWaffleError("waffle_make_current");
-
- _glut->window->id = ++_glut->window_id_pool;
- _glut->window->keyboard_cb = _glutDefaultKeyboard;
-
- return _glut->window->id;
-}
-
-void
-glutDestroyWindow(int win)
-{
- bool ok = true;
-
- if (!_glut->window || _glut->window->id != win)
- glutFatal("bad window id");
-
- ok = waffle_window_destroy(_glut->window->waffle);
- if (!ok)
- glutFatalWaffleError("waffle_window_destroy");
-
- free(_glut->window);
- _glut->window = NULL;
-}
-
-void
-glutShowWindow(int win)
-{
- bool ok = true;
-
- if (!_glut->window || _glut->window->id != win)
- glutFatal("bad window id");
-
- ok = waffle_window_show(_glut->window->waffle);
- if (!ok)
- glutFatalWaffleError("waffle_window_show");
-}
-
-void
-glutDisplayFunc(GLUT_EGLdisplayCB func)
-{
- _glut->window->display_cb = func;
-}
-
-void
-glutReshapeFunc(GLUT_EGLreshapeCB func)
-{
- _glut->window->reshape_cb = func;
-}
-
-void
-glutKeyboardFunc(GLUT_EGLkeyboardCB func)
-{
- _glut->window->keyboard_cb = func;
-}
-
-void
-glutMainLoop(void)
-{
- bool ok = true;
-
- if (!_glut->window)
- glutFatal("no window is created");
-
- ok = waffle_window_show(_glut->window->waffle);
- if (!ok)
- glutFatalWaffleError("waffle_window_show");
-
- if (_glut->window->reshape_cb)
- _glut->window->reshape_cb(_glut->window_width,
- _glut->window_height);
-
- if (_glut->window->display_cb)
- _glut->window->display_cb();
-
- switch (_glut->waffle_platform) {
-#ifdef PIGLIT_HAS_X11
- case WAFFLE_PLATFORM_GLX:
- case WAFFLE_PLATFORM_X11_EGL:
- x11_event_loop();
- break;
-#endif
- case WAFFLE_PLATFORM_WAYLAND:
- /* The Wayland window fails to appear on the first call to
- * swapBuffers (which occured in display_cb above). This is
- * likely due to swapBuffers being called before receiving an
- * expose event. Until piglit has proper Wayland support,
- * call swapBuffers again as a workaround.
- */
- if (_glut->window->display_cb)
- _glut->window->display_cb();
-
- /* FINISHME: Write event loop for Wayland. */
- sleep(20);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-void
-glutSwapBuffers(void)
-{
- bool ok = waffle_window_swap_buffers(_glut->window->waffle);
- if (!ok)
- glutFatalWaffleError("waffle_window_swap_buffers() failed");
-}
diff --git a/src/glut_waffle/glut_waffle.h b/src/glut_waffle/glut_waffle.h
deleted file mode 100644
index aa33c58da..000000000
--- a/src/glut_waffle/glut_waffle.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 LunarG Inc.
- *
- * 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.
- *
- * Authors:
- * Chia-I Wu <olv@lunarg.com>
- */
-
-#pragma once
-
-enum glut_display_mode {
- GLUT_RGB = 0,
- GLUT_RGBA = 0,
- GLUT_INDEX = 1,
- GLUT_SINGLE = 0,
- GLUT_DOUBLE = 2,
- GLUT_ACCUM = 4,
- GLUT_ALPHA = 8,
- GLUT_DEPTH = 16,
- GLUT_STENCIL = 32,
-};
-
-/* used by glutInitAPIMask */
-enum glut_api {
- GLUT_OPENGL_BIT = 0x1,
- GLUT_OPENGL_ES1_BIT = 0x2,
- GLUT_OPENGL_ES2_BIT = 0x4,
-};
-
-typedef void (*GLUT_EGLreshapeCB)(int, int);
-typedef void (*GLUT_EGLdisplayCB)(void);
-typedef void (*GLUT_EGLkeyboardCB)(unsigned char, int, int);
-
-void glutInitAPIMask(int mask);
-void glutInitDisplayMode(unsigned int mode);
-void glutInitWindowPosition(int x, int y);
-void glutInitWindowSize(int width, int height);
-void glutInit(int *argcp, char **argv);
-
-void glutPostRedisplay(void);
-
-void glutMainLoop(void);
-
-/**
- * Create the window, but do not show it.
- */
-int glutCreateWindow(const char *title);
-
-void glutDestroyWindow(int win);
-void glutShowWindow(int win);
-
-void glutDisplayFunc(GLUT_EGLdisplayCB func);
-void glutReshapeFunc(GLUT_EGLreshapeCB func);
-void glutKeyboardFunc(GLUT_EGLkeyboardCB func);
-void glutSwapBuffers(void);
diff --git a/src/glut_waffle/priv/common.c b/src/glut_waffle/priv/common.c
deleted file mode 100644
index 0020e46f1..000000000
--- a/src/glut_waffle/priv/common.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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: error: ");
- vfprintf(stderr, format, args);
- va_end(args);
- putc('\n', stderr);
-
- exit(1);
-}
-
-void
-glutFatalWaffleError(const char *waffle_func)
-{
- const struct waffle_error_info *info = waffle_error_get_info();
- const char *code = waffle_error_to_string(info->code);
-
- if (info->message_length > 0)
- glutFatal("%s() failed: %s: %s",
- waffle_func, code, info->message);
- else
- glutFatal("%s() failed: %s",
- waffle_func, code);
-}
diff --git a/src/glut_waffle/priv/common.h b/src/glut_waffle/priv/common.h
deleted file mode 100644
index e7775b68d..000000000
--- a/src/glut_waffle/priv/common.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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>
-
-#ifdef PIGLIT_HAS_X11
-# include <X11/Xlib.h>
-#endif
-
-#include "glut_waffle.h"
-
-struct glut_window {
- struct waffle_window *waffle;
-
-#ifdef PIGLIT_HAS_X11
- struct {
- Display *display;
- Window window;
- } x11;
-#endif
-
- 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, ...);
-
-void
-glutFatalWaffleError(const char *waffle_func);
diff --git a/src/glut_waffle/priv/x11.c b/src/glut_waffle/priv/x11.c
deleted file mode 100644
index 1ffe066eb..000000000
--- a/src/glut_waffle/priv/x11.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 <stdbool.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-
-#include "common.h"
-
-static void
-x11_process_next_event(void)
-{
- struct glut_window *gwin = _glut->window;
- Display *xdpy = gwin->x11.display;
-
- bool redraw = false;
- XEvent event;
-
- if (!XPending(xdpy))
- return;
-
- XNextEvent(xdpy, &event);
-
- switch (event.type) {
- case Expose:
- redraw = true;
- break;
- case ConfigureNotify:
- if (gwin->reshape_cb)
- gwin->reshape_cb(event.xconfigure.width,
- event.xconfigure.height);
- break;
- case KeyPress: {
- char buffer[1];
- KeySym sym;
- int n;
-
- redraw = true;
- n = XLookupString(&event.xkey,
- buffer,
- sizeof(buffer), &sym, NULL);
-
- if (n > 0 && gwin->keyboard_cb)
- gwin->keyboard_cb(buffer[0],
- event.xkey.x, event.xkey.y);
- break;
- }
- default:
- break;
- }
-
- _glut->redisplay = redraw;
-}
-
-void
-x11_event_loop(void)
-{
- while (true) {
- x11_process_next_event();
-
- if (_glut->redisplay) {
- _glut->redisplay = 0;
-
- if (_glut->window->display_cb)
- _glut->window->display_cb();
- }
- }
-}
diff --git a/src/glut_waffle/priv/x11.h b/src/glut_waffle/priv/x11.h
deleted file mode 100644
index 9efa2b91c..000000000
--- a/src/glut_waffle/priv/x11.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 "common.h"
-
-struct glut_window*
-x11_window_create(void);
-
-void
-x11_event_loop(void);