static void cmd_resize_floating(I3_CMD, char *way, char *direction, Con *floating_con, int px) {
LOG("floating resize\n");
Rect old_rect = floating_con->rect;
+ Con *focused_con = con_descend_focused(floating_con);
+
+ /* ensure that resize will take place even if pixel increment is smaller than
+ * height increment or width increment.
+ * fixes #1011 */
+ if (strcmp(direction, "up") == 0 || strcmp(direction, "down") == 0 ||
+ strcmp(direction, "height") == 0) {
+ if (px < 0)
+ px = (-px < focused_con->height_increment) ? -focused_con->height_increment : px;
+ else
+ px = (px < focused_con->height_increment) ? focused_con->height_increment : px;
+ } else if (strcmp(direction, "left") == 0 || strcmp(direction, "right") == 0) {
+ if (px < 0)
+ px = (-px < focused_con->width_increment) ? -focused_con->width_increment : px;
+ else
+ px = (px < focused_con->width_increment) ? focused_con->width_increment : px;
+ }
if (strcmp(direction, "up") == 0) {
floating_con->rect.height += px;
return;
if (strcmp(direction, "up") == 0) {
- floating_con->rect.y -= px;
+ floating_con->rect.y -= (floating_con->rect.height - old_rect.height);
} else if (strcmp(direction, "left") == 0) {
- floating_con->rect.x -= px;
+ floating_con->rect.x -= (floating_con->rect.width - old_rect.width);
}
+
+ /* If this is a scratchpad window, don't auto center it from now on. */
+ if (floating_con->scratchpad_state == SCRATCHPAD_FRESH)
+ floating_con->scratchpad_state = SCRATCHPAD_CHANGED;
}
static bool cmd_resize_tiling_direction(I3_CMD, Con *current, char *way, char *direction, int ppt) {
if (strcmp(layout_str, "stacking") == 0)
layout_str = "stacked";
owindow *current;
- int layout;
+ layout_t layout;
/* default is a special case which will be handled in con_set_layout(). */
if (strcmp(layout_str, "default") == 0)
layout = L_DEFAULT;