viewporter: rename state var in viewport_handle_surface_commit()

"current" is misleading, since we are using the pending state here.
This commit is contained in:
Simon Ser 2023-11-24 16:48:34 +01:00 committed by Kirill Primak
parent 87346b3393
commit d1c88a22a3

View file

@ -136,22 +136,22 @@ static void viewport_handle_surface_commit(struct wl_listener *listener,
struct wlr_viewport *viewport = struct wlr_viewport *viewport =
wl_container_of(listener, viewport, surface_commit); wl_container_of(listener, viewport, surface_commit);
struct wlr_surface_state *current = &viewport->surface->pending; struct wlr_surface_state *state = &viewport->surface->pending;
if (!current->viewport.has_dst && if (!state->viewport.has_dst &&
(floor(current->viewport.src.width) != current->viewport.src.width || (floor(state->viewport.src.width) != state->viewport.src.width ||
floor(current->viewport.src.height) != current->viewport.src.height)) { floor(state->viewport.src.height) != state->viewport.src.height)) {
wl_resource_post_error(viewport->resource, WP_VIEWPORT_ERROR_BAD_SIZE, wl_resource_post_error(viewport->resource, WP_VIEWPORT_ERROR_BAD_SIZE,
"wl_viewport.set_source width and height must be integers " "wl_viewport.set_source width and height must be integers "
"when the destination rectangle is unset"); "when the destination rectangle is unset");
return; return;
} }
if (current->viewport.has_src && current->buffer != NULL && if (state->viewport.has_src && state->buffer != NULL &&
(current->viewport.src.x + current->viewport.src.width > (state->viewport.src.x + state->viewport.src.width >
current->buffer_width || state->buffer_width ||
current->viewport.src.y + current->viewport.src.height > state->viewport.src.y + state->viewport.src.height >
current->buffer_height)) { state->buffer_height)) {
wl_resource_post_error(viewport->resource, WP_VIEWPORT_ERROR_OUT_OF_BUFFER, wl_resource_post_error(viewport->resource, WP_VIEWPORT_ERROR_OUT_OF_BUFFER,
"source rectangle out of buffer bounds"); "source rectangle out of buffer bounds");
return; return;