Add roots_seat_cycle_focus

This commit is contained in:
emersion 2017-11-19 19:21:18 +01:00
parent bf41e7a794
commit 97ddd2d1df
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 18 additions and 11 deletions

View file

@ -510,7 +510,7 @@ static void seat_view_destroy(struct roots_seat_view *seat_view) {
if (!wl_list_empty(&seat->views)) {
struct roots_seat_view *first_seat_view = wl_container_of(
seat->views.next, first_seat_view, link);
roots_seat_focus_view(seat, first_seat_view->view);
roots_seat_set_focus(seat, first_seat_view->view);
}
}
@ -538,7 +538,7 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
return seat_view;
}
void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
struct roots_view *prev_focus = roots_seat_get_focus(seat);
if (view == prev_focus) {
return;
@ -590,6 +590,15 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface);
}
void roots_seat_cycle_focus(struct roots_seat *seat) {
if (wl_list_empty(&seat->views)) {
return;
}
struct roots_seat_view *last_seat_view = wl_container_of(
seat->views.prev, last_seat_view, link);
roots_seat_set_focus(seat, last_seat_view->view);
}
void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
struct roots_cursor *cursor = seat->cursor;
cursor->mode = ROOTS_CURSOR_MOVE;