i3 - improved tiling WM


Ensure that resize will take place even if pixel is smaller than size increments.

Patch status: merged

Patch by oblique

Long description:

fixes #1011

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

b/src/commands.c

15
@@ -569,6 +569,23 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *which) {
16
 static void cmd_resize_floating(I3_CMD, char *way, char *direction, Con *floating_con, int px) {
17
     LOG("floating resize\n");
18
     Rect old_rect = floating_con->rect;
19
+    Con *focused_con = con_descend_focused(floating_con);
20
+
21
+    /* ensure that resize will take place even if pixel increment is smaller than
22
+     * height increment or width increment.
23
+     * fixes #1011 */
24
+    if (strcmp(direction, "up") == 0 || strcmp(direction, "down") == 0 ||
25
+        strcmp(direction, "height") == 0) {
26
+        if (px < 0)
27
+            px = (-px < focused_con->height_increment) ? -focused_con->height_increment : px;
28
+        else
29
+            px = (px < focused_con->height_increment) ? focused_con->height_increment : px;
30
+    } else if (strcmp(direction, "left") == 0 || strcmp(direction, "right") == 0) {
31
+        if (px < 0)
32
+            px = (-px < focused_con->width_increment) ? -focused_con->width_increment : px;
33
+        else
34
+            px = (px < focused_con->width_increment) ? focused_con->width_increment : px;
35
+    }
36
 
37
     if (strcmp(direction, "up") == 0) {
38
         floating_con->rect.height += px;