[Piglit] [PATCH 5/9] Add helper for creating full-screen glX windows.

Jamey Sharp jamey at minilop.net
Wed Apr 23 17:27:19 PDT 2014


Signed-off-by: Jamey Sharp <jamey at minilop.net>
Signed-off-by: Theo Hill <Theo0x48 at gmail.com>
---
 tests/util/piglit-glx-util.c | 22 ++++++++++++++++++----
 tests/util/piglit-glx-util.h |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 1faec8f..6ba4a1d 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -93,8 +93,8 @@ piglit_get_glx_context_share(Display *dpy, XVisualInfo *visinfo, GLXContext shar
 	return ctx;
 }
 
-Window
-_piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map)
+static Window
+_piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map, bool fullscreen)
 {
 	XSetWindowAttributes window_attr;
 	unsigned long mask;
@@ -109,6 +109,14 @@ _piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map)
 	window_attr.event_mask = StructureNotifyMask | ExposureMask |
 		KeyPressMask;
 	mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+	if (fullscreen) {
+		window_attr.override_redirect = True;
+		mask |= CWOverrideRedirect;
+		piglit_width = DisplayWidth(dpy, screen);
+		piglit_height = DisplayHeight(dpy, screen);
+	}
+
 	win = XCreateWindow(dpy, root_win, 0, 0,
 			    piglit_width, piglit_height,
 			    0, visinfo->depth, InputOutput,
@@ -126,13 +134,19 @@ _piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map)
 Window
 piglit_get_glx_window_unmapped(Display *dpy, XVisualInfo *visinfo)
 {
-	return _piglit_get_glx_window(dpy, visinfo, false);
+	return _piglit_get_glx_window(dpy, visinfo, false, false);
+}
+
+Window
+piglit_get_glx_window_fullscreen(Display *dpy, XVisualInfo *visinfo)
+{
+	return _piglit_get_glx_window(dpy, visinfo, true, true);
 }
 
 Window
 piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo)
 {
-	return _piglit_get_glx_window(dpy, visinfo, true);
+	return _piglit_get_glx_window(dpy, visinfo, true, false);
 }
 
 bool
diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
index aebed15..70c9838 100644
--- a/tests/util/piglit-glx-util.h
+++ b/tests/util/piglit-glx-util.h
@@ -40,6 +40,7 @@ XVisualInfo * piglit_get_glx_visual(Display *dpy);
 GLXContext piglit_get_glx_context(Display *dpy, XVisualInfo *visinfo);
 GLXContext piglit_get_glx_context_share(Display *dpy, XVisualInfo *visinfo, GLXContext share);
 Window piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo);
+Window piglit_get_glx_window_fullscreen(Display *dpy, XVisualInfo *visinfo);
 Window piglit_get_glx_window_unmapped(Display *dpy, XVisualInfo *visinfo);
 bool piglit_is_glx_extension_supported(Display *dpy, const char *name);
 void piglit_require_glx_extension(Display *dpy, const char *name);
-- 
1.8.5.3



More information about the Piglit mailing list