i3 - improved tiling WM


bugfix: floating enable overcorrection

Patch status: needinfo

Patch by Tony Crisci

Long description:

When accounting for the decorations for enabling a floating container,
don't set the y-coordinate less than zero, because it is unsigned.

fixes #1270

To apply this patch, use:
curl http://cr.i3wm.org/patch/585/raw.patch | git am

b/src/floating.c

17
@@ -279,10 +279,13 @@ void floating_enable(Con *con, bool automatic) {
18
     DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height);
19
 
20
     /* 5: Subtract the deco_height in order to make the floating window appear
21
-     * at precisely the position it specified in its original geometry (which
22
-     * is what applications might remember). */
23
+     * closer to the position it specified in its original geometry (which is
24
+     * what applications might remember). */
25
     deco_height = (con->border_style == BS_NORMAL ? render_deco_height() : 0);
26
-    nc->rect.y -= deco_height;
27
+
28
+    /* don't overcorrect, because the coordinates are unsigned */
29
+    if ((int)nc->rect.y - deco_height >= 0)
30
+        nc->rect.y -= deco_height;
31
 
32
     DLOG("Corrected y = %d (deco_height = %d)\n", nc->rect.y, deco_height);
33