summaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c22
-rw-r--r--sway/input/seat.c7
2 files changed, 23 insertions, 6 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index a07bc53b..3942b64f 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -996,8 +996,9 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor,
if (on_titlebar) {
enum sway_container_layout layout = container_parent_layout(cont);
if (layout == L_TABBED || layout == L_STACKED) {
+ struct sway_node *tabcontainer = node_get_parent(node);
struct sway_node *active =
- seat_get_active_tiling_child(seat, node_get_parent(node));
+ seat_get_active_tiling_child(seat, tabcontainer);
list_t *siblings = container_get_siblings(cont);
int desired = list_find(siblings, active->sway_container) +
event->delta_discrete;
@@ -1006,9 +1007,19 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor,
} else if (desired >= siblings->length) {
desired = siblings->length - 1;
}
- struct sway_container *new_focus = siblings->items[desired];
- node = seat_get_focus_inactive(seat, &new_focus->node);
- seat_set_focus(seat, node);
+ struct sway_node *old_focus = seat_get_focus(seat);
+ struct sway_container *new_sibling_con = siblings->items[desired];
+ struct sway_node *new_sibling = &new_sibling_con->node;
+ struct sway_node *new_focus =
+ seat_get_focus_inactive(seat, new_sibling);
+ if (node_has_ancestor(old_focus, tabcontainer)) {
+ seat_set_focus(seat, new_focus);
+ } else {
+ // Scrolling when focus is not in the tabbed container at all
+ seat_set_raw_focus(seat, new_sibling);
+ seat_set_raw_focus(seat, new_focus);
+ seat_set_raw_focus(seat, old_focus);
+ }
return;
}
}
@@ -1220,6 +1231,9 @@ static void handle_request_set_cursor(struct wl_listener *listener,
void cursor_set_image(struct sway_cursor *cursor, const char *image,
struct wl_client *client) {
+ if (!(cursor->seat->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
+ return;
+ }
if (!image) {
wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
} else if (!cursor->image || strcmp(cursor->image, image) != 0) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 16acc8a5..89d841bb 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -389,12 +389,15 @@ static void seat_update_capabilities(struct sway_seat *seat) {
break;
}
}
- wlr_seat_set_capabilities(seat->wlr_seat, caps);
- // Hide cursor if seat doesn't have pointer capability
+ // Hide cursor if seat doesn't have pointer capability.
+ // We must call cursor_set_image while the wlr_seat has the capabilities
+ // otherwise it's a no op.
if ((caps & WL_SEAT_CAPABILITY_POINTER) == 0) {
cursor_set_image(seat->cursor, NULL, NULL);
+ wlr_seat_set_capabilities(seat->wlr_seat, caps);
} else {
+ wlr_seat_set_capabilities(seat->wlr_seat, caps);
cursor_set_image(seat->cursor, "left_ptr", NULL);
}
}