[Piglit] [PATCH] util/x11: Propagate window resize events to piglit_width/height

2013-10-18 Thread Chad Versace
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.jus...@intel.com
Signed-off-by: Chad Versace chad.vers...@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

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] util/x11: Propagate window resize events to piglit_width/height

2013-10-18 Thread Chad Versace

On 10/18/2013 11:21 AM, Jordan Justen wrote:

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On Fri, 2013-10-18 at 11:12 -0700, Chad Versace wrote:

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.jus...@intel.com
Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
  tests/util/piglit-framework-gl/piglit_x11_framework.c | 19 +++
  1 file changed, 19 insertions(+)


Committed to master. Jordan confirmed that this patch fixed his bug.

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] util/x11: Propagate window resize events to piglit_width/height

2013-10-18 Thread Eric Anholt
Chad Versace chad.vers...@linux.intel.com writes:

 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).

ConfigureNotify tells you the new size.  And I'm not clear why you'd
need to update the size at Expose time.


pgpsURY4HoUGV.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit