aboutsummaryrefslogtreecommitdiff
path: root/rootston/xdg_shell_v6.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/xdg_shell_v6.c')
-rw-r--r--rootston/xdg_shell_v6.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index 9ef4fd3b..a0503ad8 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -117,6 +117,16 @@ static void maximize(struct roots_view *view, bool maximized) {
wlr_xdg_toplevel_v6_set_maximized(surface, maximized);
}
+static void set_fullscreen(struct roots_view *view, bool fullscreen) {
+ assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
+ struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
+ if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ return;
+ }
+
+ wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen);
+}
+
static void close(struct roots_view *view) {
assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
@@ -167,6 +177,21 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
view_maximize(view, surface->toplevel_state->next.maximized);
}
+static void handle_request_fullscreen(struct wl_listener *listener,
+ void *data) {
+ struct roots_xdg_surface_v6 *roots_xdg_surface =
+ wl_container_of(listener, roots_xdg_surface, request_fullscreen);
+ struct roots_view *view = roots_xdg_surface->view;
+ struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
+ struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data;
+
+ if (surface->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ return;
+ }
+
+ view_set_fullscreen(view, e->fullscreen, e->output);
+}
+
static void handle_commit(struct wl_listener *listener, void *data) {
struct roots_xdg_surface_v6 *roots_surface =
wl_container_of(listener, roots_surface, commit);
@@ -239,6 +264,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
roots_surface->request_maximize.notify = handle_request_maximize;
wl_signal_add(&surface->events.request_maximize,
&roots_surface->request_maximize);
+ roots_surface->request_fullscreen.notify = handle_request_fullscreen;
+ wl_signal_add(&surface->events.request_fullscreen,
+ &roots_surface->request_fullscreen);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (!view) {
@@ -254,6 +282,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
view->resize = resize;
view->move_resize = move_resize;
view->maximize = maximize;
+ view->set_fullscreen = set_fullscreen;
view->close = close;
roots_surface->view = view;
view_init(view, desktop);