aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-10-18 15:18:41 +0200
committerGitHub <noreply@github.com>2018-10-18 15:18:41 +0200
commitd88b7a63f487587d9507164de31d6e8508b32801 (patch)
treedbf14c684b7802c2f2876fc8b11636bec26abc3d /sway/input
parent103b7bc47d656e91406f5493a3e1317cb9ce5c02 (diff)
parent24a90e5d86441fc345356eb3767e5a6880dcedbd (diff)
Merge pull request #2871 from RyanDwyer/untangle-cursor-warp
Remove cursor warping from seat_set_focus
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c6
-rw-r--r--sway/input/seat.c29
2 files changed, 7 insertions, 28 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 925190d6..688fc230 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -597,7 +597,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
struct sway_output *focused_output = node_get_output(focus);
struct sway_output *output = node_get_output(node);
if (output != focused_output) {
- seat_set_focus_warp(seat, node, false);
+ seat_set_focus(seat, node);
}
} else if (node->type == N_CONTAINER && node->sway_container->view) {
// Focus node if the following are true:
@@ -607,14 +607,14 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
if (!wlr_seat_keyboard_has_grab(cursor->seat->wlr_seat) &&
node != prev_node &&
view_is_visible(node->sway_container->view)) {
- seat_set_focus_warp(seat, node, false);
+ seat_set_focus(seat, node);
} else {
struct sway_node *next_focus =
seat_get_focus_inactive(seat, &root->node);
if (next_focus && next_focus->type == N_CONTAINER &&
next_focus->sway_container->view &&
view_is_visible(next_focus->sway_container->view)) {
- seat_set_focus_warp(seat, next_focus, false);
+ seat_set_focus(seat, next_focus);
}
}
}
diff --git a/sway/input/seat.c b/sway/input/seat.c
index d8d2f3a4..60ee27d0 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -640,13 +640,13 @@ void seat_set_raw_focus(struct sway_seat *seat, struct sway_node *node) {
node_set_dirty(node_get_parent(node));
}
-void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
- bool warp) {
+void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
if (seat->focused_layer) {
return;
}
struct sway_node *last_focus = seat_get_focus(seat);
+ seat->prev_focus = last_focus;
if (last_focus == node) {
return;
}
@@ -678,8 +678,6 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
}
}
- struct sway_output *last_output = last_workspace ?
- last_workspace->output : NULL;
struct sway_output *new_output = new_workspace->output;
if (last_workspace != new_workspace && new_output) {
@@ -774,21 +772,6 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
workspace_consider_destroy(last_workspace);
}
- if (last_focus && warp) {
- if (container && config->mouse_warping == WARP_CONTAINER) {
- cursor_warp_to_container(seat->cursor, container);
- cursor_send_pointer_motion(seat->cursor, 0, true);
- } else if (new_output != last_output &&
- config->mouse_warping >= WARP_OUTPUT) {
- if (container) {
- cursor_warp_to_container(seat->cursor, container);
- } else {
- cursor_warp_to_workspace(seat->cursor, new_workspace);
- }
- cursor_send_pointer_motion(seat->cursor, 0, true);
- }
- }
-
seat->has_focus = true;
if (config->smart_gaps) {
@@ -800,18 +783,14 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
update_debug_tree();
}
-void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
- seat_set_focus_warp(seat, node, true);
-}
-
void seat_set_focus_container(struct sway_seat *seat,
struct sway_container *con) {
- seat_set_focus_warp(seat, con ? &con->node : NULL, true);
+ seat_set_focus(seat, con ? &con->node : NULL);
}
void seat_set_focus_workspace(struct sway_seat *seat,
struct sway_workspace *ws) {
- seat_set_focus_warp(seat, ws ? &ws->node : NULL, true);
+ seat_set_focus(seat, ws ? &ws->node : NULL);
}
void seat_set_focus_surface(struct sway_seat *seat,