mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-03-01 01:40:36 -05:00
Properly track mapping and unmapping
We shouldn't render a window before it is mapped (obviously), but we render all windows in the view list. Hence, only insert the window once it is mapped. We could run into the case where a window is destroyed without being in the window list, so we now track unmapping again and remove windows from the list when they get unmapped.
This commit is contained in:
parent
a9818c0df1
commit
786e28bdac
3 changed files with 19 additions and 6 deletions
10
view.c
10
view.c
|
|
@ -56,6 +56,13 @@ view_is_primary(struct cg_view *view)
|
|||
return view->is_primary(view);
|
||||
}
|
||||
|
||||
void
|
||||
view_unmap(struct cg_view *view)
|
||||
{
|
||||
wl_list_remove(&view->link);
|
||||
view->wlr_surface = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
view_map(struct cg_view *view, struct wlr_surface *surface)
|
||||
{
|
||||
|
|
@ -67,6 +74,7 @@ view_map(struct cg_view *view, struct wlr_surface *surface)
|
|||
view_center(view);
|
||||
}
|
||||
|
||||
wl_list_insert(&view->server->views, &view->link);
|
||||
seat_set_focus(view->server->seat, view);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +84,6 @@ view_destroy(struct cg_view *view)
|
|||
struct cg_server *server = view->server;
|
||||
bool terminate = view_is_primary(view);
|
||||
|
||||
wl_list_remove(&view->link);
|
||||
free(view);
|
||||
|
||||
/* If this was our primary view, exit. */
|
||||
|
|
@ -91,7 +98,6 @@ cg_view_create(struct cg_server *server)
|
|||
struct cg_view *view = calloc(1, sizeof(struct cg_view));
|
||||
|
||||
view->server = server;
|
||||
wl_list_insert(&server->views, &view->link);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue