rootston: add support for foreign-toplevel fullscreening

This commit is contained in:
Ilia Bozhinov 2019-04-26 17:10:21 +02:00 committed by Simon Ser
parent 4e6c17a7c9
commit 8cc0859814
2 changed files with 18 additions and 0 deletions

View file

@ -67,6 +67,7 @@ struct roots_view {
struct wlr_foreign_toplevel_handle_v1 *toplevel_handle; struct wlr_foreign_toplevel_handle_v1 *toplevel_handle;
struct wl_listener toplevel_handle_request_maximize; struct wl_listener toplevel_handle_request_maximize;
struct wl_listener toplevel_handle_request_activate; struct wl_listener toplevel_handle_request_activate;
struct wl_listener toplevel_handle_request_fullscreen;
struct wl_listener toplevel_handle_request_close; struct wl_listener toplevel_handle_request_close;
struct wl_listener new_subsurface; struct wl_listener new_subsurface;

View file

@ -273,6 +273,11 @@ void view_set_fullscreen(struct roots_view *view, bool fullscreen,
view->impl->set_fullscreen(view, 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 (!was_fullscreen && fullscreen) {
if (output == NULL) { if (output == NULL) {
output = view_get_output(view); 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, static void handle_toplevel_handle_request_close(struct wl_listener *listener,
void *data) { void *data) {
struct roots_view *view = struct roots_view *view =
@ -661,6 +674,10 @@ void view_create_foreign_toplevel_handle(struct roots_view *view) {
handle_toplevel_handle_request_activate; handle_toplevel_handle_request_activate;
wl_signal_add(&view->toplevel_handle->events.request_activate, wl_signal_add(&view->toplevel_handle->events.request_activate,
&view->toplevel_handle_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 = view->toplevel_handle_request_close.notify =
handle_toplevel_handle_request_close; handle_toplevel_handle_request_close;
wl_signal_add(&view->toplevel_handle->events.request_close, wl_signal_add(&view->toplevel_handle->events.request_close,