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:
Jente Hidskes 2018-12-31 19:52:47 +01:00
parent a9818c0df1
commit 786e28bdac
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA
3 changed files with 19 additions and 6 deletions

2
view.h
View file

@ -25,6 +25,7 @@ struct cg_view {
};
struct wl_listener destroy;
struct wl_listener unmap;
struct wl_listener map;
// TODO: allow applications to go to fullscreen from maximized?
// struct wl_listener request_fullscreen;
@ -39,6 +40,7 @@ void view_activate(struct cg_view *view, bool activate);
void view_maximize(struct cg_view *view);
void view_center(struct cg_view *view);
bool view_is_primary(struct cg_view *view);
void view_unmap(struct cg_view *view);
void view_map(struct cg_view *view, struct wlr_surface *surface);
void view_destroy(struct cg_view *view);
struct cg_view *cg_view_create(struct cg_server *server);