Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
layer-shell: ignore all requests if surface is closed
Browse files Browse the repository at this point in the history
The protocol specifies that all requests (aside from destroy) are
ignored after the compositor sends the closed event. This change
simplifies proper layer shell implementation for compositors by moving
this logic inside wlroots.
  • Loading branch information
ifreund committed Aug 12, 2021
1 parent ad7651a commit adf3020
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions types/wlr_layer_shell_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void layer_surface_handle_set_size(struct wl_client *client,
struct wl_resource *resource, uint32_t width, uint32_t height) {
struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);

if (!surface) {
if (!surface || surface->closed) {
return;
}
surface->client_pending.desired_width = width;
Expand All @@ -120,7 +120,7 @@ static void layer_surface_handle_set_anchor(struct wl_client *client,
}
struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);

if (!surface) {
if (!surface || surface->closed) {
return;
}
surface->client_pending.anchor = anchor;
Expand All @@ -130,7 +130,7 @@ static void layer_surface_handle_set_exclusive_zone(struct wl_client *client,
struct wl_resource *resource, int32_t zone) {
struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);

if (!surface) {
if (!surface || surface->closed) {
return;
}
surface->client_pending.exclusive_zone = zone;
Expand All @@ -141,7 +141,7 @@ static void layer_surface_handle_set_margin(
int32_t top, int32_t right, int32_t bottom, int32_t left) {
struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);

if (!surface) {
if (!surface || surface->closed) {
return;
}
surface->client_pending.margin.top = top;
Expand All @@ -155,7 +155,7 @@ static void layer_surface_handle_set_keyboard_interactivity(
uint32_t interactive) {
struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);

if (!surface) {
if (!surface || surface->closed) {
return;
}

Expand All @@ -180,7 +180,7 @@ static void layer_surface_handle_get_popup(struct wl_client *client,
struct wlr_xdg_surface *popup_surface =
wlr_xdg_surface_from_popup_resource(popup_resource);

if (!parent) {
if (!parent || parent->closed) {
return;
}
assert(popup_surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
Expand All @@ -194,7 +194,7 @@ static void layer_surface_set_layer(struct wl_client *client,
struct wl_resource *surface_resource, uint32_t layer) {
struct wlr_layer_surface_v1 *surface =
layer_surface_from_resource(surface_resource);
if (!surface) {
if (!surface || surface->closed) {
return;
}
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
Expand Down

0 comments on commit adf3020

Please sign in to comment.