From 8cc08598146b2780ae127713f58b182ed8b11f7c Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Fri, 26 Apr 2019 17:10:21 +0200 Subject: [PATCH] rootston: add support for foreign-toplevel fullscreening --- include/rootston/view.h | 1 + rootston/view.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/rootston/view.h b/include/rootston/view.h index 1a56de4b8..1c5dcaff4 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -67,6 +67,7 @@ struct roots_view { struct wlr_foreign_toplevel_handle_v1 *toplevel_handle; struct wl_listener toplevel_handle_request_maximize; struct wl_listener toplevel_handle_request_activate; + struct wl_listener toplevel_handle_request_fullscreen; struct wl_listener toplevel_handle_request_close; struct wl_listener new_subsurface; diff --git a/rootston/view.c b/rootston/view.c index a5bc3aff9..6619743ae 100644 --- a/rootston/view.c +++ b/rootston/view.c @@ -273,6 +273,11 @@ void view_set_fullscreen(struct roots_view *view, bool fullscreen, view->impl->set_fullscreen(view, fullscreen); } + if (view->toplevel_handle) { + wlr_foreign_toplevel_handle_v1_set_fullscreen(view->toplevel_handle, + fullscreen); + } + if (!was_fullscreen && fullscreen) { if (output == NULL) { output = view_get_output(view); @@ -641,6 +646,14 @@ static void handle_toplevel_handle_request_activate(struct wl_listener *listener } } +static void handle_toplevel_handle_request_fullscreen(struct wl_listener *listener, + void *data) { + struct roots_view *view = + wl_container_of(listener, view, toplevel_handle_request_fullscreen); + struct wlr_foreign_toplevel_handle_v1_fullscreen_event *event = data; + view_set_fullscreen(view, event->fullscreen, event->output); +} + static void handle_toplevel_handle_request_close(struct wl_listener *listener, void *data) { struct roots_view *view = @@ -661,6 +674,10 @@ void view_create_foreign_toplevel_handle(struct roots_view *view) { handle_toplevel_handle_request_activate; wl_signal_add(&view->toplevel_handle->events.request_activate, &view->toplevel_handle_request_activate); + view->toplevel_handle_request_fullscreen.notify = + handle_toplevel_handle_request_fullscreen; + wl_signal_add(&view->toplevel_handle->events.request_fullscreen, + &view->toplevel_handle_request_fullscreen); view->toplevel_handle_request_close.notify = handle_toplevel_handle_request_close; wl_signal_add(&view->toplevel_handle->events.request_close,