mirror of
https://github.com/NickHu/sway
synced 2024-12-29 22:23:46 +01:00
seat: use new warping functions for cursor warping during focus warp
This commit is contained in:
parent
0969bf758b
commit
d69cf4c23c
1 changed files with 9 additions and 18 deletions
|
@ -771,27 +771,18 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
|
||||||
workspace_consider_destroy(last_workspace);
|
workspace_consider_destroy(last_workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_focus) {
|
if (last_focus && warp) {
|
||||||
if (config->mouse_warping && warp &&
|
if (container && config->mouse_warping == WARP_CONTAINER) {
|
||||||
(new_output != last_output ||
|
cursor_warp_to_container(seat->cursor, container);
|
||||||
config->mouse_warping == WARP_CONTAINER)) {
|
cursor_send_pointer_motion(seat->cursor, 0, true);
|
||||||
double x = 0;
|
} else if (new_output != last_output &&
|
||||||
double y = 0;
|
config->mouse_warping >= WARP_OUTPUT) {
|
||||||
if (container) {
|
if (container) {
|
||||||
x = container->x + container->width / 2.0;
|
cursor_warp_to_container(seat->cursor, container);
|
||||||
y = container->y + container->height / 2.0;
|
|
||||||
} else {
|
} else {
|
||||||
x = new_workspace->x + new_workspace->width / 2.0;
|
cursor_warp_to_workspace(seat->cursor, new_workspace);
|
||||||
y = new_workspace->y + new_workspace->height / 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wlr_output_layout_contains_point(root->output_layout,
|
|
||||||
new_output->wlr_output, seat->cursor->cursor->x,
|
|
||||||
seat->cursor->cursor->y)
|
|
||||||
|| config->mouse_warping == WARP_CONTAINER) {
|
|
||||||
wlr_cursor_warp(seat->cursor->cursor, NULL, x, y);
|
|
||||||
cursor_send_pointer_motion(seat->cursor, 0, true);
|
|
||||||
}
|
}
|
||||||
|
cursor_send_pointer_motion(seat->cursor, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue