diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-02-15 15:28:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-15 15:28:00 +0100 |
commit | 8b203c28f81f5f1f2c02042df72277e22e645372 (patch) | |
tree | 562af8cf2ff16df98ccb3f9e72d7c5f9e6a87d23 | |
parent | b59370088e3290e2354ea01e30746a3711eea28f (diff) | |
parent | d238cc9f56d44061db1a92373d71f4c1f503b3e4 (diff) |
Merge pull request #1548 from emersion/error-invalid-transform
surface: error out on invalid transform
-rw-r--r-- | types/wlr_surface.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 148b434d..de63bdae 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -450,15 +450,20 @@ static void surface_commit(struct wl_client *client, } static void surface_set_buffer_transform(struct wl_client *client, - struct wl_resource *resource, int transform) { + struct wl_resource *resource, int32_t transform) { + if (transform < WL_OUTPUT_TRANSFORM_NORMAL || + transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) { + wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_TRANSFORM, + "Specified transform value (%d) is invalid", transform); + return; + } struct wlr_surface *surface = wlr_surface_from_resource(resource); surface->pending.committed |= WLR_SURFACE_STATE_TRANSFORM; surface->pending.transform = transform; } static void surface_set_buffer_scale(struct wl_client *client, - struct wl_resource *resource, - int32_t scale) { + struct wl_resource *resource, int32_t scale) { if (scale <= 0) { wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_SCALE, "Specified scale value (%d) is not positive", scale); |