From 94bc40168014b50c4f72e7e0224d959296749e70 Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Sat, 5 May 2018 13:30:48 +0300 Subject: [PATCH] Activate the focused child when scrolling over tab/stack decorations fbce834b introduced a bug where scrolling over the decoration while another container is focused would not focus the tabbed/stacked container itself, but would instead move focus through the currently focused container. --- src/click.c | 1 + testcases/t/297-scroll-tabbed.t | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/click.c b/src/click.c index c2b38d4d..81e95dfa 100644 --- a/src/click.c +++ b/src/click.c @@ -235,6 +235,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod * container the user scrolled on. */ Con *focused = con->parent; focused = TAILQ_FIRST(&(focused->focus_head)); + con_activate(con_descend_focused(focused)); /* To prevent scrolling from going outside the container (see ticket * #557), we first check if scrolling is possible at all. */ bool scroll_prev_possible = (TAILQ_PREV(focused, nodes_head, nodes) != NULL); diff --git a/testcases/t/297-scroll-tabbed.t b/testcases/t/297-scroll-tabbed.t index 6deeaf65..b535d0cd 100644 --- a/testcases/t/297-scroll-tabbed.t +++ b/testcases/t/297-scroll-tabbed.t @@ -53,7 +53,7 @@ open_window; cmd 'splitv'; my $last = open_window; # Second child of the outer horizontal split, next to the tabbed one. -open_window; +my $outside = open_window; cmd 'move right, move right'; cmd '[id=' . $first->id . '] focus'; @@ -76,4 +76,9 @@ is($x->input_focus, $first->id, 'First window focused through scrolling'); scroll_up; is($x->input_focus, $first->id, 'Scrolling again doesn\'t focus the whole sibling'); +# Try scrolling with another window focused +cmd '[id=' . $outside->id . '] focus'; +scroll_up; +is($x->input_focus, $first->id, 'Scrolling from outside the tabbed container works'); + done_testing; -- 2.39.5