mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-28 08:56:32 -05:00
basic decorations
This commit is contained in:
parent
3751a17321
commit
61bd79200c
7 changed files with 141 additions and 20 deletions
|
|
@ -580,7 +580,7 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
|
|||
seat_view->seat = seat;
|
||||
seat_view->view = view;
|
||||
|
||||
wl_list_insert(&seat->views, &seat_view->link);
|
||||
wl_list_insert(seat->views.prev, &seat_view->link);
|
||||
|
||||
seat_view->view_destroy.notify = seat_view_handle_destroy;
|
||||
wl_signal_add(&view->events.destroy, &seat_view->view_destroy);
|
||||
|
|
@ -588,6 +588,31 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
|
|||
return seat_view;
|
||||
}
|
||||
|
||||
struct roots_seat_view *roots_seat_view_from_view(
|
||||
struct roots_seat *seat, struct roots_view *view) {
|
||||
if (view == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
struct roots_seat_view *seat_view = NULL;
|
||||
wl_list_for_each(seat_view, &seat->views, link) {
|
||||
if (seat_view->view == view) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
seat_view = seat_add_view(seat, view);
|
||||
if (seat_view == NULL) {
|
||||
wlr_log(L_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return seat_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
|
||||
|
|
@ -605,22 +630,11 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
view->xwayland_surface->override_redirect) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct roots_seat_view *seat_view = NULL;
|
||||
if (view != NULL) {
|
||||
bool found = false;
|
||||
wl_list_for_each(seat_view, &seat->views, link) {
|
||||
if (seat_view->view == view) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
seat_view = seat_add_view(seat, view);
|
||||
if (seat_view == NULL) {
|
||||
wlr_log(L_ERROR, "Allocation failed");
|
||||
return;
|
||||
}
|
||||
seat_view = roots_seat_view_from_view(seat, view);
|
||||
if (seat_view == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue