view: implement subsurfaces

This commit is contained in:
Jente Hidskes 2019-02-13 18:14:03 +01:00
parent 667667505a
commit 36670f02f3
2 changed files with 130 additions and 0 deletions

24
view.h
View file

@ -24,11 +24,14 @@ enum cg_view_type {
struct cg_view {
struct cg_server *server;
struct wl_list link; // server::views
struct wl_list children; // cg_view_child::link
struct wlr_surface *wlr_surface;
int x, y;
enum cg_view_type type;
const struct cg_view_impl *impl;
struct wl_listener new_subsurface;
};
struct cg_view_impl {
@ -45,6 +48,24 @@ struct cg_view_impl {
double *sub_x, double *sub_y);
};
struct cg_view_child {
struct cg_view *view;
struct wlr_surface *wlr_surface;
struct wl_list link;
struct wl_listener commit;
struct wl_listener new_subsurface;
void (*destroy)(struct cg_view_child *child);
};
struct cg_subsurface {
struct cg_view_child view_child;
struct wlr_subsurface *wlr_subsurface;
struct wl_listener destroy;
};
char *view_get_title(struct cg_view *view);
bool view_is_primary(struct cg_view *view);
bool view_is_transient_for(struct cg_view *child, struct cg_view *parent);
@ -62,4 +83,7 @@ struct cg_view *view_from_wlr_surface(struct cg_server *server, struct wlr_surfa
struct wlr_surface *view_wlr_surface_at(struct cg_view *view, double sx, double sy,
double *sub_x, double *sub_y);
void view_child_finish(struct cg_view_child *child);
void view_child_init(struct cg_view_child *child, struct cg_view *view, struct wlr_surface *wlr_surface);
#endif