Make floating-tiling resize code consistent with plain tiling resize

Now dragging an inner border of a floating split triggers a tiling
resize (as expected) instead of a floating resize.
This commit is contained in:
Albert Safin 2020-02-21 02:07:32 +00:00
parent a376d1e52f
commit d36829d6e2
2 changed files with 7 additions and 7 deletions

View File

@ -238,18 +238,18 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
/* 5: resize (floating) if this was a (left or right) click on the /* 5: resize (floating) if this was a (left or right) click on the
* left/right/bottom border, or a right click on the decoration. * left/right/bottom border, or a right click on the decoration.
* also try resizing (tiling) if it was a click on the top */ * also try resizing (tiling) if possible */
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) { if (mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) {
DLOG("floating resize due to floatingmodifier\n"); DLOG("floating resize due to floatingmodifier\n");
floating_resize_window(floatingcon, proportional, event); floating_resize_window(floatingcon, proportional, event);
return 1; return 1;
} }
if (!in_stacked && dest == CLICK_DECORATION && if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
is_left_or_right_click) { is_left_or_right_click) {
/* try tiling resize, but continue if it doesnt work */ /* try tiling resize, but continue if it doesnt work */
DLOG("tiling resize with fallback\n"); DLOG("tiling resize with fallback\n");
if (tiling_resize(con, event, dest, !was_focused)) if (tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused))
goto done; goto done;
} }
@ -284,10 +284,6 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
else if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) && else if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
is_left_or_right_click) { is_left_or_right_click) {
DLOG("Trying to resize (tiling)\n"); DLOG("Trying to resize (tiling)\n");
/* Since we updated the tree (con_activate() above), we need to
* re-render the tree before returning to the event loop (drag_pointer()
* inside tiling_resize() runs its own event-loop). */
tree_render();
tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused); tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused);
} }

View File

@ -238,6 +238,10 @@ void resize_graphical_handler(Con *first, Con *second, orientation_t orientation
const struct callback_params params = {orientation, output, helpwin, &new_position, &threshold_exceeded}; const struct callback_params params = {orientation, output, helpwin, &new_position, &threshold_exceeded};
/* Re-render the tree before returning to the event loop (drag_pointer()
* runs its own event-loop) in case if there are unrendered updates. */
tree_render();
/* `drag_pointer' blocks until the drag is completed. */ /* `drag_pointer' blocks until the drag is completed. */
drag_result_t drag_result = drag_pointer(NULL, event, grabwin, 0, use_threshold, resize_callback, &params); drag_result_t drag_result = drag_pointer(NULL, event, grabwin, 0, use_threshold, resize_callback, &params);