[PATCH xwininfo] Work around xcb_translate_coordinates sign bug

Julien Cristau jcristau at debian.org
Thu Oct 21 03:59:11 PDT 2010


xcb_translate_coordinates_reply_t has unsigned dst_{x,y}, so explicitly
cast them to int16_t to get the right values.
Reported on irc by frostwork.

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 xwininfo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xwininfo.c b/xwininfo.c
index dfe090d..42a38a0 100644
--- a/xwininfo.c
+++ b/xwininfo.c
@@ -940,8 +940,8 @@ Display_Stats_Info (struct wininfo *w)
     if (!trans_coords)
 	Fatal_Error ("Can't get translated coordinates.");
 
-    rx = trans_coords->dst_x;
-    ry = trans_coords->dst_y;
+    rx = (int16_t)trans_coords->dst_x;
+    ry = (int16_t)trans_coords->dst_y;
     free (trans_coords);
 
     xright = (dw - rx - w->geometry->border_width * 2 -
-- 
1.7.1



More information about the xorg-devel mailing list