-
Notifications
You must be signed in to change notification settings - Fork 343
xdg-shell: introduce wlr_xdg_surface_state #3106
Conversation
Ah, I added it myself already :D |
Yeah :P this PR is a way to get this initial change merged sooner.
Yeah, but not to be confused with the existing We actually have a buggy |
9486e26
to
9833eb3
Compare
Could you please update this to have |
struct wlr_xdg_surface_state is introduced to hold the geometry and configure serial to be applied on next wl_surface.commit. This commit fixes our handling for ack_configure: instead of making the request mutate our current state, it mutates the pending state only. Co-authored-by: Simon Ser <contact@emersion.fr>
9833eb3
to
224db66
Compare
Done! |
See [1]. [1]: swaywm/wlroots#3106
types/xdg_shell/wlr_xdg_surface.c
Outdated
@@ -81,14 +81,13 @@ void unmap_xdg_surface(struct wlr_xdg_surface *surface) { | |||
} | |||
|
|||
surface->configured = surface->mapped = false; | |||
surface->configure_serial = 0; | |||
if (surface->configure_idle) { | |||
wl_event_source_remove(surface->configure_idle); | |||
surface->configure_idle = NULL; | |||
} | |||
surface->configure_next_serial = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With surface->configure_serial = 0
removed, this should be removed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure. surface->configure_serial = 0
is removed because the memset
below takes care of resetting it in current
.
types/xdg_shell/wlr_xdg_surface.c
Outdated
if (surface->configure_idle) { | ||
wl_event_source_remove(surface->configure_idle); | ||
surface->configure_idle = NULL; | ||
} | ||
surface->configure_next_serial = 0; | ||
|
||
memset(&surface->geometry, 0, sizeof(struct wlr_box)); | ||
surface->current = surface->pending; | ||
memset(&surface->pending, 0, sizeof(struct wlr_xdg_surface_state)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the window geometry of the surface is set, it is not possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached.
I don't think the state should be cleared here. Not sure why was this done in the first place though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, wait, I think I mixed things up. This is the unmap handler, it needs to reset all of the state.
Fixed.
This holds the current state, and avoids having ad-hoc fields in wlr_xdg_surface.
Rename it to scheduled_serial for consistency with the rest of wlroots.
b76816e
to
c283ab3
Compare
The protocol doesn't say we should, so let's not. Also it's pointless to reset scheduled_serial, since 0 is a valid serial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This iteration LGTM.
Thanks!
See [1]. [1]: swaywm/wlroots#3106
See [1]. [1]: swaywm/wlroots#3106
This is preliminary work for properly handling cached state in
xdg-shell.
cc @vyivel