xdg-surface: fix window geometry handling

It was completely wrong: according to the protocol, the effective
geometry is only updated on commit time if there pending state has
new state from xdg_surface.set_window_geometry or
xdg_surface.set_window_geometry has never been sent at all.

This commit adds wlr_xdg_surface.geometry which correctly matches the
effective window geometry and removes now-useless
wlr_xdg_surface_get_geometry().
This commit is contained in:
Kirill Primak 2024-08-14 18:25:03 +03:00 committed by Alexander Orzechowski
parent a1298580cc
commit 5c98d1a04a
6 changed files with 62 additions and 52 deletions

View file

@ -228,9 +228,16 @@ struct wlr_xdg_surface_configure {
};
};
enum wlr_xdg_surface_state_field {
WLR_XDG_SURFACE_STATE_WINDOW_GEOMETRY = 1 << 0,
};
struct wlr_xdg_surface_state {
uint32_t configure_serial;
uint32_t committed; // enum wlr_xdg_surface_state_field
struct wlr_box geometry;
uint32_t configure_serial;
};
/**
@ -274,6 +281,8 @@ struct wlr_xdg_surface {
// Whether the latest commit is an initial commit
bool initial_commit;
struct wlr_box geometry;
struct {
struct wl_signal destroy;
struct wl_signal ping_timeout;
@ -523,17 +532,6 @@ struct wlr_xdg_toplevel *wlr_xdg_toplevel_try_from_wlr_surface(struct wlr_surfac
*/
struct wlr_xdg_popup *wlr_xdg_popup_try_from_wlr_surface(struct wlr_surface *surface);
/**
* Get the surface geometry.
*
* This is either the geometry as set by the client, or defaulted to the bounds
* of the surface + the subsurfaces (as specified by the protocol).
*
* The x and y value can be < 0.
*/
void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface,
struct wlr_box *box);
/**
* Call `iterator` on each mapped surface and popup in the xdg-surface tree
* (whether or not this xdg-surface is mapped), with the surface's position