diff options
author | Simon Ser <contact@emersion.fr> | 2020-06-18 09:55:46 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-06-18 07:55:33 -0600 |
commit | d177abecaeebb4fd05d7b2e06b198d71a7baa035 (patch) | |
tree | 983d12a53ab530928d8870e982ab81025346eb8b | |
parent | c18c419b56204dbec63e836101839c6d61cb9365 (diff) |
surface: ignore viewport src rect on NULL buffer
According to the viewporter protocol:
> If the wl_buffer is NULL, the surface has no content and therefore no size.
-rw-r--r-- | types/wlr_surface.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 7011f698..f0a0b1fb 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -147,6 +147,11 @@ static void surface_set_input_region(struct wl_client *client, */ static void surface_state_viewport_src_size(struct wlr_surface_state *state, int *out_width, int *out_height) { + if (state->buffer_width == 0 && state->buffer_height == 0) { + *out_width = *out_height = 0; + return; + } + if (state->viewport.has_src) { *out_width = state->viewport.src.width; *out_height = state->viewport.src.height; |