Raise the view on the desktop even if already focused in the seat

This commit is contained in:
emersion 2017-11-19 19:30:48 +01:00
parent 97ddd2d1df
commit 9687950de1
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 8 additions and 4 deletions

View File

@ -539,6 +539,13 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
} }
void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
// Make sure the view will be rendered on top of others, even if it's
// already focused in this seat
if (view != NULL) {
wl_list_remove(&view->link);
wl_list_insert(&seat->input->server->desktop->views, &view->link);
}
struct roots_view *prev_focus = roots_seat_get_focus(seat); struct roots_view *prev_focus = roots_seat_get_focus(seat);
if (view == prev_focus) { if (view == prev_focus) {
return; return;
@ -569,7 +576,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
seat->has_focus = false; seat->has_focus = false;
// deactivate the old view if it is not focused by some other seat // Deactivate the old view if it is not focused by some other seat
if (prev_focus != NULL && !input_view_has_focus(seat->input, prev_focus)) { if (prev_focus != NULL && !input_view_has_focus(seat->input, prev_focus)) {
view_activate(prev_focus, false); view_activate(prev_focus, false);
} }
@ -580,9 +587,6 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
} }
view_activate(view, true); view_activate(view, true);
wl_list_remove(&seat_view->view->link);
wl_list_insert(&seat->input->server->desktop->views,
&seat_view->view->link);
seat->has_focus = true; seat->has_focus = true;
wl_list_remove(&seat_view->link); wl_list_remove(&seat_view->link);