Add view_close
This commit is contained in:
parent
dc6cf64892
commit
9f9370e949
3 changed files with 21 additions and 0 deletions
|
@ -43,6 +43,7 @@ struct kiwmi_view {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kiwmi_view_impl {
|
struct kiwmi_view_impl {
|
||||||
|
void (*close)(struct kiwmi_view *view);
|
||||||
void (*for_each_surface)(
|
void (*for_each_surface)(
|
||||||
struct kiwmi_view *view,
|
struct kiwmi_view *view,
|
||||||
wlr_surface_iterator_func_t iterator,
|
wlr_surface_iterator_func_t iterator,
|
||||||
|
@ -56,6 +57,7 @@ struct kiwmi_view_impl {
|
||||||
double *sub_y);
|
double *sub_y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void view_close(struct kiwmi_view *view);
|
||||||
void view_for_each_surface(
|
void view_for_each_surface(
|
||||||
struct kiwmi_view *view,
|
struct kiwmi_view *view,
|
||||||
wlr_surface_iterator_func_t iterator,
|
wlr_surface_iterator_func_t iterator,
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
#include "desktop/output.h"
|
#include "desktop/output.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
view_close(struct kiwmi_view *view)
|
||||||
|
{
|
||||||
|
if (view->impl->close) {
|
||||||
|
view->impl->close(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_for_each_surface(
|
view_for_each_surface(
|
||||||
struct kiwmi_view *view,
|
struct kiwmi_view *view,
|
||||||
|
|
|
@ -47,6 +47,16 @@ xdg_surface_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||||
free(view);
|
free(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
xdg_shell_view_close(struct kiwmi_view *view)
|
||||||
|
{
|
||||||
|
struct wlr_xdg_surface *surface = view->xdg_surface;
|
||||||
|
|
||||||
|
if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && surface->toplevel) {
|
||||||
|
wlr_xdg_toplevel_send_close(surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_shell_view_for_each_surface(
|
xdg_shell_view_for_each_surface(
|
||||||
struct kiwmi_view *view,
|
struct kiwmi_view *view,
|
||||||
|
@ -74,6 +84,7 @@ xdg_shell_view_surface_at(
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct kiwmi_view_impl xdg_shell_view_impl = {
|
static const struct kiwmi_view_impl xdg_shell_view_impl = {
|
||||||
|
.close = xdg_shell_view_close,
|
||||||
.for_each_surface = xdg_shell_view_for_each_surface,
|
.for_each_surface = xdg_shell_view_for_each_surface,
|
||||||
.set_activated = xdg_shell_view_set_activated,
|
.set_activated = xdg_shell_view_set_activated,
|
||||||
.surface_at = xdg_shell_view_surface_at,
|
.surface_at = xdg_shell_view_surface_at,
|
||||||
|
|
Loading…
Reference in a new issue