Implement tab cycling using mouse wheel

Firstly, a change had to be made to the container_at functions. If you
create layout `T[view H[view view]]` and hover the second tab, the
container_at functions would return the focus_inactive child. They now
return the split container itself. To compensate for this,
dispatch_cursor_button has been adjusted to find the focus_inactive
child before focusing it.

The actual implementation of wheel scrolling is pretty straightforward.
This uses handle_cursor_axis, so I took a similar approach to
handle_cursor_button (ie. creating a dispatch_cursor_axis function).
This commit is contained in:
Ryan Dwyer 2018-09-22 10:42:59 +10:00
parent d2a0a3cc0a
commit bf5933c501
2 changed files with 47 additions and 8 deletions

View file

@ -215,8 +215,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent,
child_index = children->length - 1;
}
struct sway_container *child = children->items[child_index];
struct sway_node *node = seat_get_focus_inactive(seat, &child->node);
return node->sway_container;
return child;
}
// Surfaces
@ -243,8 +242,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent,
int child_index = (ly - box.y) / title_height;
if (child_index < children->length) {
struct sway_container *child = children->items[child_index];
struct sway_node *node = seat_get_focus_inactive(seat, &child->node);
return node->sway_container;
return child;
}
// Surfaces