[Piglit] [PATCH 04/23] tests, util: Wrap glutKeyboardFunc with piglit_set_keyboard_func
Chad Versace
chad.versace at linux.intel.com
Fri Sep 28 10:44:50 PDT 2012
I'm trying to transition Piglit from using GLUT to using Waffle. This
requires killing all uses of GLUT functions, one-by-one.
This patch replaces all-but-one instance of glutKeyboardFunc with a new
wrapper, piglit_set_keyboard_func. The one remaining test that uses
glutKeyboardFunc is windowoverlap; but that tests doesn't use
piglit-framework, anyway.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/fbo/fbo-formats.h | 2 +-
tests/fbo/fbo-generatemipmap-formats.c | 2 +-
tests/general/texgen.c | 2 +-
tests/shaders/glsl-arb-fragment-coord-conventions.c | 2 +-
tests/texturing/lodbias.c | 2 +-
tests/texturing/texdepth.c | 2 +-
tests/texturing/texwrap.c | 2 +-
tests/util/piglit-framework.c | 7 +++++++
tests/util/piglit-framework.h | 1 +
9 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
index fdc586f..03c96a2 100644
--- a/tests/fbo/fbo-formats.h
+++ b/tests/fbo/fbo-formats.h
@@ -583,7 +583,7 @@ static void
fbo_formats_init_test_set(int test_set_index, GLboolean print_options)
{
if (!piglit_automatic)
- glutKeyboardFunc(fbo_formats_key_func);
+ piglit_set_keyboard_func(fbo_formats_key_func);
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_texture_env_combine");
diff --git a/tests/fbo/fbo-generatemipmap-formats.c b/tests/fbo/fbo-generatemipmap-formats.c
index 3a5163d..a04cb6a 100644
--- a/tests/fbo/fbo-generatemipmap-formats.c
+++ b/tests/fbo/fbo-generatemipmap-formats.c
@@ -481,7 +481,7 @@ void piglit_init(int argc, char **argv)
fbo_formats_init(argc, argv, GL_FALSE);
if (!piglit_automatic) {
- glutKeyboardFunc(key_func);
+ piglit_set_keyboard_func(key_func);
printf(" -n Next test set.\n"
" -N Previous test set.\n"
" -m Next format in the set.\n"
diff --git a/tests/general/texgen.c b/tests/general/texgen.c
index 7ba5d74..7514491 100644
--- a/tests/general/texgen.c
+++ b/tests/general/texgen.c
@@ -213,7 +213,7 @@ void piglit_init(int argc, char *argv[])
if (!piglit_automatic) {
printf("Press 't' to switch tests; Escape to quit\n");
- glutKeyboardFunc(Key);
+ piglit_set_keyboard_func(Key);
}
if (piglit_use_fragment_program()) {
diff --git a/tests/shaders/glsl-arb-fragment-coord-conventions.c b/tests/shaders/glsl-arb-fragment-coord-conventions.c
index fd1a683..b7550ef 100644
--- a/tests/shaders/glsl-arb-fragment-coord-conventions.c
+++ b/tests/shaders/glsl-arb-fragment-coord-conventions.c
@@ -225,6 +225,6 @@ void piglit_init(int argc, char **argv)
if (!piglit_automatic) {
printf("Press t to switch between subtests.\n");
- glutKeyboardFunc(key_func);
+ piglit_set_keyboard_func(key_func);
}
}
diff --git a/tests/texturing/lodbias.c b/tests/texturing/lodbias.c
index 838c075..9d39ab7 100644
--- a/tests/texturing/lodbias.c
+++ b/tests/texturing/lodbias.c
@@ -311,7 +311,7 @@ piglit_init(int argc, char **argv)
"Press 'b'/'B' to change primary LOD bias\n"
"Press 'n'/'N' to change secondary LOD bias\n"
"Press 'Escape' to quit\n");
- glutKeyboardFunc(Key);
+ piglit_set_keyboard_func(Key);
}
glGenTextures(2, Textures);
diff --git a/tests/texturing/texdepth.c b/tests/texturing/texdepth.c
index 9111b35..d6edcbc 100644
--- a/tests/texturing/texdepth.c
+++ b/tests/texturing/texdepth.c
@@ -374,7 +374,7 @@ piglit_init(int argc, char **argv)
GLfloat texbuf[4];
if (!piglit_automatic) {
- glutKeyboardFunc(Key);
+ piglit_set_keyboard_func(Key);
printf("Press 't' to cycle through test images\n");
}
diff --git a/tests/texturing/texwrap.c b/tests/texturing/texwrap.c
index 8e86d52..34813d6 100644
--- a/tests/texturing/texwrap.c
+++ b/tests/texturing/texwrap.c
@@ -1454,7 +1454,7 @@ void piglit_init(int argc, char **argv)
init_textures();
if (!piglit_automatic) {
- glutKeyboardFunc(key_func);
+ piglit_set_keyboard_func(key_func);
printf("Hotkeys in the interactive mode:\n"
" b - use 1-pixel texture border (deprecated in GL3)\n"
" p - use projective texturing\n"
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index d252452..ac951ae 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -147,3 +147,10 @@ piglit_post_redisplay(void)
if (!piglit_use_fbo && !piglit_automatic)
glutPostRedisplay();
}
+
+void
+piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y))
+{
+ if (!piglit_automatic && !piglit_use_fbo)
+ glutKeyboardFunc(func);
+}
diff --git a/tests/util/piglit-framework.h b/tests/util/piglit-framework.h
index d11e04f..68af5ee 100644
--- a/tests/util/piglit-framework.h
+++ b/tests/util/piglit-framework.h
@@ -130,5 +130,6 @@ extern unsigned int piglit_winsys_fbo;
extern void piglit_present_results();
void piglit_post_redisplay(void);
+void piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y));
#endif /* PIGLIT_FRAMEWORK_H */
--
1.7.12.1
More information about the Piglit
mailing list