From d36829d6e29a5b6db56b604e3eff86a35afa02e4 Mon Sep 17 00:00:00 2001 From: Albert Safin Date: Fri, 21 Feb 2020 02:07:32 +0000 Subject: [PATCH] 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. --- src/click.c | 10 +++------- src/resize.c | 4 ++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/click.c b/src/click.c index 19076252..ffa6813b 100644 --- a/src/click.c +++ b/src/click.c @@ -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 * 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) { DLOG("floating resize due to floatingmodifier\n"); floating_resize_window(floatingcon, proportional, event); return 1; } - if (!in_stacked && dest == CLICK_DECORATION && + if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) && is_left_or_right_click) { /* try tiling resize, but continue if it doesn’t work */ 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; } @@ -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) && is_left_or_right_click) { 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); } diff --git a/src/resize.c b/src/resize.c index 97a0f946..6ad92cc0 100644 --- a/src/resize.c +++ b/src/resize.c @@ -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}; + /* 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_result_t drag_result = drag_pointer(NULL, event, grabwin, 0, use_threshold, resize_callback, ¶ms);