Add support for closing windows

This commit is contained in:
project-repo 2020-08-25 15:15:31 +02:00
commit 73e8db1fa3
6 changed files with 29 additions and 0 deletions

View file

@ -214,6 +214,15 @@ activate(struct cg_view *view, bool activate) {
wlr_xdg_toplevel_set_activated(xdg_shell_view->xdg_surface, activate);
}
static void
close(struct cg_view *view) {
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
struct wlr_xdg_surface *surface=xdg_shell_view->xdg_surface;
if(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
wlr_xdg_toplevel_send_close(surface);
}
}
static void
maximize(struct cg_view *view, int width, int height) {
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
@ -317,6 +326,7 @@ static const struct cg_view_impl xdg_shell_view_impl = {
.get_geometry = get_geometry,
.is_primary = is_primary,
.activate = activate,
.close = close,
.maximize = maximize,
.destroy = destroy,
.for_each_surface = for_each_surface,