diff options
author | Quantum <quantum2048@gmail.com> | 2021-08-01 18:10:25 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-08-02 09:08:03 +0200 |
commit | 456c6e227972dd1be26fbedd77b0784bb1879a26 (patch) | |
tree | 06e321eb08d9c8c3f36661859e4aaa5dafa3e39c | |
parent | f5df956c18634e501d878531858ed75391fec644 (diff) |
viewporter: remove crop and scale state upon destruction
According to the viewport protocol, upon wp_viewport::destroy():
> The associated wl_surface's crop and scale state is removed.
> The change is applied on the next wl_surface.commit.
Therefore, wp_viewport_destroy(viewport) should remove all viewport state.
Currently, wlroots does not remove the crop and scale state. Instead, a
client must do:
wl_fixed_t clear = wl_fixed_from_int(-1);
wp_viewport_set_source(viewport, clear, clear, clear, clear);
wp_viewport_set_destination(viewport, -1, -1);
wp_viewport_destroy(viewport);
This commit adds the necessary logic into viewport_destroy and makes
wlroots comply with the protocol.
-rw-r--r-- | types/wlr_viewporter.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/types/wlr_viewporter.c b/types/wlr_viewporter.c index 9b7e1099..34e8d78d 100644 --- a/types/wlr_viewporter.c +++ b/types/wlr_viewporter.c @@ -95,6 +95,12 @@ static void viewport_destroy(struct wlr_viewport *viewport) { if (viewport == NULL) { return; } + + struct wlr_surface_state *pending = &viewport->surface->pending; + pending->viewport.has_src = false; + pending->viewport.has_dst = false; + pending->committed |= WLR_SURFACE_STATE_VIEWPORT; + wl_resource_set_user_data(viewport->resource, NULL); wl_list_remove(&viewport->surface_destroy.link); wl_list_remove(&viewport->surface_commit.link); |