diff options
author | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-06 20:58:08 +0000 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-11-06 21:58:08 +0100 |
commit | 4a21981855a340c549db99d286590c369895da87 (patch) | |
tree | 76c83b88d97471f871454e828b403f27043a6876 /sway/input/cursor.c | |
parent | Merge pull request #3046 from tokyovigilante/relative-transform (diff) | |
download | sway-4a21981855a340c549db99d286590c369895da87.tar.gz sway-4a21981855a340c549db99d286590c369895da87.tar.zst sway-4a21981855a340c549db99d286590c369895da87.zip |
Add focus_follows_mouse always. (#3081)
* Add focus_follows_mouse_mode.
* Fail if focus_follows_mouse is invalid.
* Fix indentation.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index c539df40..62cdba37 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -637,7 +637,8 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, | |||
637 | cursor->previous.y = cursor->cursor->y; | 637 | cursor->previous.y = cursor->cursor->y; |
638 | cursor->previous.node = node; | 638 | cursor->previous.node = node; |
639 | 639 | ||
640 | if (node && config->focus_follows_mouse) { | 640 | if (node && (config->focus_follows_mouse == FOLLOWS_YES || |
641 | config->focus_follows_mouse == FOLLOWS_ALWAYS)) { | ||
641 | struct sway_node *focus = seat_get_focus(seat); | 642 | struct sway_node *focus = seat_get_focus(seat); |
642 | if (focus && node->type == N_WORKSPACE) { | 643 | if (focus && node->type == N_WORKSPACE) { |
643 | // Only follow the mouse if it would move to a new output | 644 | // Only follow the mouse if it would move to a new output |
@@ -652,9 +653,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, | |||
652 | // - cursor is over a new view, i.e. entered a new window; and | 653 | // - cursor is over a new view, i.e. entered a new window; and |
653 | // - the new view is visible, i.e. not hidden in a stack or tab; and | 654 | // - the new view is visible, i.e. not hidden in a stack or tab; and |
654 | // - the seat does not have a keyboard grab | 655 | // - the seat does not have a keyboard grab |
655 | if (!wlr_seat_keyboard_has_grab(cursor->seat->wlr_seat) && | 656 | if ((!wlr_seat_keyboard_has_grab(cursor->seat->wlr_seat) && |
656 | node != prev_node && | 657 | node != prev_node && |
657 | view_is_visible(node->sway_container->view)) { | 658 | view_is_visible(node->sway_container->view)) || |
659 | config->focus_follows_mouse == FOLLOWS_ALWAYS) { | ||
658 | seat_set_focus(seat, node); | 660 | seat_set_focus(seat, node); |
659 | } else { | 661 | } else { |
660 | struct sway_node *next_focus = | 662 | struct sway_node *next_focus = |