From 177b548b156ce4b46ff331d7c10f1bf373bf9cf7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 22 Apr 2018 18:57:45 +0200 Subject: [PATCH] Update layer shell with optional wl_output --- include/wlr/types/wlr_layer_shell.h | 3 +++ protocol/wlr-layer-shell-unstable-v1.xml | 6 +++++- types/wlr_layer_shell.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h index 1312e568..79b3a4ea 100644 --- a/include/wlr/types/wlr_layer_shell.h +++ b/include/wlr/types/wlr_layer_shell.h @@ -27,6 +27,9 @@ struct wlr_layer_shell { struct wl_listener display_destroy; struct { + // struct wlr_layer_surface * + // Note: the output may be NULL. In this case, it is your + // responsibility to assign an output before returning. struct wl_signal new_surface; } events; diff --git a/protocol/wlr-layer-shell-unstable-v1.xml b/protocol/wlr-layer-shell-unstable-v1.xml index 3181c0bb..6a5d5d35 100644 --- a/protocol/wlr-layer-shell-unstable-v1.xml +++ b/protocol/wlr-layer-shell-unstable-v1.xml @@ -47,12 +47,16 @@ or manipulate a buffer prior to the first layer_surface.configure call must also be treated as errors. + You may pass NULL for output to allow the compositor to decide which + output to use. Generally this will be the one that the user most + recently interacted with. + Clients can specify a namespace that defines the purpose of the layer surface. - + diff --git a/types/wlr_layer_shell.c b/types/wlr_layer_shell.c index c4e39a17..78aa2536 100644 --- a/types/wlr_layer_shell.c +++ b/types/wlr_layer_shell.c @@ -319,7 +319,9 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client, surface->shell = shell; surface->surface = wlr_surface; - surface->output = wlr_output_from_resource(output_resource); + if (output_resource) { + surface->output = wlr_output_from_resource(output_resource); + } surface->resource = wl_resource_create(wl_client, &zwlr_layer_surface_v1_interface, wl_resource_get_version(client_resource),