[Piglit] [PATCH] util/x11: Propagate window resize events to piglit_width/height
Chad Versace
chad.versace at linux.intel.com
Fri Oct 18 20:12:37 CEST 2013
When I switched Piglit from GLUT to Waffle, I broke detection of X11
window resizes. When the user resized the window, Piglit called
piglit_display() but neglected to update piglit_width/height.
This patch ensures that Piglit updates piglit_width/height correctly.
(It's amazing that it took this long for anyone to fix it. People must
rarely resize Piglit windows).
CC: Jordan Justen <jordan.l.justen at intel.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/util/piglit-framework-gl/piglit_x11_framework.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/util/piglit-framework-gl/piglit_x11_framework.c b/tests/util/piglit-framework-gl/piglit_x11_framework.c
index 95c46c4..8b3d3d7 100644
--- a/tests/util/piglit-framework-gl/piglit_x11_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_x11_framework.c
@@ -72,6 +72,23 @@ piglit_x11_framework(struct piglit_gl_framework *gl_fw)
}
static void
+get_window_size(struct piglit_x11_framework *x11_fw)
+{
+ unsigned width, height;
+
+ Window wjunk;
+ int ijunk;
+ unsigned ujunk;
+
+ XGetGeometry(x11_fw->display, x11_fw->window,
+ &wjunk, &ijunk, &ijunk,
+ &width, &height, &ujunk, &ujunk);
+
+ piglit_width = width;
+ piglit_height = height;
+}
+
+static void
process_next_event(struct piglit_x11_framework *x11_fw)
{
struct piglit_winsys_framework *winsys_fw = &x11_fw->winsys_fw;
@@ -84,9 +101,11 @@ process_next_event(struct piglit_x11_framework *x11_fw)
switch (event.type) {
case Expose:
+ get_window_size(x11_fw);
winsys_fw->need_redisplay = true;
break;
case ConfigureNotify:
+ get_window_size(x11_fw);
if (winsys_fw->user_reshape_func)
winsys_fw->user_reshape_func(event.xconfigure.width,
event.xconfigure.height);
--
1.8.3.1
More information about the Piglit
mailing list