From 5ad0b4a3359826da410ad001b3f789ae19d1e57d Mon Sep 17 00:00:00 2001 From: Peter Clifton Date: Sat, 22 Dec 2012 19:50:10 +0000 Subject: [PATCH] hid/common: Fix extents computation in nm units We still had some fallout from the nm units conversion here, using MAXINT rather than COORD_MAX for some bounds checking. This was completely breaking the lesstif HID pinout preview window. --- src/hid/common/extents.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/hid/common/extents.c b/src/hid/common/extents.c index 665d206a86..432e3742b8 100644 --- a/src/hid/common/extents.c +++ b/src/hid/common/extents.c @@ -19,10 +19,6 @@ #include #endif -#ifndef MAXINT -#define MAXINT (((unsigned int)(~0))>>1) -#endif - static BoxType box; typedef struct hid_gc_struct @@ -198,6 +194,7 @@ hid_extents_init (void) initialised = true; } + BoxType * hid_get_extents (void *item) { @@ -206,15 +203,15 @@ hid_get_extents (void *item) /* As this isn't a real "HID", we need to ensure we are initialised. */ hid_extents_init (); - box.X1 = MAXINT; - box.Y1 = MAXINT; - box.X2 = -MAXINT; - box.Y2 = -MAXINT; + box.X1 = COORD_MAX; + box.Y1 = COORD_MAX; + box.X2 = -COORD_MAX - 1; + box.Y2 = -COORD_MAX - 1; - region.X1 = -MAXINT; - region.Y1 = -MAXINT; - region.X2 = MAXINT; - region.Y2 = MAXINT; + region.X1 = -COORD_MAX - 1; + region.Y1 = -COORD_MAX - 1; + region.X2 = COORD_MAX; + region.Y2 = COORD_MAX; hid_expose_callback (&extents_hid, ®ion, item); return &box; -- 2.11.4.GIT