xdg-shell: assert that configure events carry positive or zero sizes

Negative values here would indicate a compositor bug. For xdg_popup,
zero values are not allowed.
This commit is contained in:
Simon Ser 2024-01-22 17:19:50 +01:00
parent be1c48cbfb
commit b80337a8f2
2 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,7 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure(
}
struct wlr_box *geometry = &configure->geometry;
assert(geometry->width > 0 && geometry->height > 0);
xdg_popup_send_configure(popup->resource,
geometry->x, geometry->y,
geometry->width, geometry->height);

View File

@ -556,6 +556,7 @@ void wlr_xdg_toplevel_send_close(struct wlr_xdg_toplevel *toplevel) {
uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_toplevel *toplevel,
int32_t width, int32_t height) {
assert(width >= 0 && height >= 0);
toplevel->scheduled.width = width;
toplevel->scheduled.height = height;
return wlr_xdg_surface_schedule_configure(toplevel->base);