summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-07-21 12:41:23 -0700
committerEric Anholt <eric@anholt.net>2010-07-21 12:42:37 -0700
commite7e9be5034f582992a5f2ec8df27f3915bdf4312 (patch)
tree5e57b03ba69e55906bcbd41f15e571e6f99f159c
parented6956d79091d1b124209c70008283d2973ea31a (diff)
framework: Set X11 window hint for "doesn't take input" when in auto mode.
This makes the hundreds of short-lived tests not steal input focus.
-rw-r--r--tests/util/CMakeLists.txt21
-rw-r--r--tests/util/piglit-framework.c9
-rw-r--r--tests/util/piglit-glx-framework.c31
-rw-r--r--tests/util/piglit-glx-util.c22
-rw-r--r--tests/util/piglit-glx-util.h1
5 files changed, 77 insertions, 7 deletions
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index acc1dbb43..a7b46c564 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -7,16 +7,27 @@ include_directories(
${GLEW_INCLUDE_DIR}
)
-add_library (piglitutil
- fdo-bitmap.c
- piglit-util.c
- shader-load.c
- piglit-framework.c
+set (UTIL_SOURCES
+ fdo-bitmap.c
+ piglit-util.c
+ shader-load.c
+ piglit-framework.c
)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions ( -DUSE_GLX )
add_library (piglitglxutil
piglit-util.c
+ piglit-glx-framework.c
piglit-glx-util.c
)
+ set (UTIL_SOURCES
+ ${UTIL_SOURCES}
+ piglit-glx-util.c
+ )
+
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+add_library (piglitutil
+ ${UTIL_SOURCES}
+)
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index 8dddcf960..9762af143 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -34,6 +34,9 @@
#include "piglit-util.h"
#include "piglit-framework.h"
+#ifdef USE_GLX
+#include "piglit-glx-util.h"
+#endif
int piglit_automatic = 0;
static int piglit_window;
@@ -83,6 +86,12 @@ int main(int argc, char *argv[])
glutInitWindowSize(piglit_width, piglit_height);
glutInitDisplayMode(piglit_window_mode);
piglit_window = glutCreateWindow(argv[0]);
+
+#ifdef USE_GLX
+ if (piglit_automatic)
+ piglit_glx_set_no_input();
+#endif
+
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(piglit_escape_exit_key);
diff --git a/tests/util/piglit-glx-framework.c b/tests/util/piglit-glx-framework.c
new file mode 100644
index 000000000..ced3a93b4
--- /dev/null
+++ b/tests/util/piglit-glx-framework.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2009 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 (including the next
+ * paragraph) 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:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "piglit-util.h"
+#include "piglit-glx-util.h"
+
+Bool piglit_automatic = GL_FALSE;
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index a2efc4cd0..21db5503a 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -28,8 +28,6 @@
#include "piglit-util.h"
#include "piglit-glx-util.h"
-Bool piglit_automatic = GL_FALSE;
-
XVisualInfo *
piglit_get_glx_visual(Display *dpy)
{
@@ -135,3 +133,23 @@ piglit_glx_event_loop(Display *dpy, enum piglit_result (*draw)(Display *dpy))
}
}
}
+
+
+void
+piglit_glx_set_no_input(void)
+{
+ Display *d;
+ GLXDrawable win;
+ XWMHints *hints;
+
+ d = glXGetCurrentDisplay();
+ win = glXGetCurrentDrawable();
+
+ hints = XAllocWMHints();
+ hints->flags |= InputHint;
+ hints->input = False;
+
+ XSetWMHints(d, win, hints);
+
+ XFree(hints);
+}
diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
index d87891d92..2ad3b07ca 100644
--- a/tests/util/piglit-glx-util.h
+++ b/tests/util/piglit-glx-util.h
@@ -32,3 +32,4 @@ Window piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo);
void piglit_require_glx_extension(Display *dpy, const char *name);
void piglit_glx_event_loop(Display *dpy,
enum piglit_result (*draw)(Display *dpy));
+void piglit_glx_set_no_input(void);