mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
compositor: send WL_SURFACE_ERROR_INVALID_SIZE for non-cursor surfaces
See the discussion at [1]: there's no easy way to fix libwayland-cursor without a new API. Sending the error for other roles will prevent the same client bug from appearing elsewhere. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
This commit is contained in:
parent
1284f85da4
commit
18595000f3
1 changed files with 14 additions and 5 deletions
|
@ -176,12 +176,21 @@ static void surface_finalize_pending(struct wlr_surface *surface) {
|
||||||
if (!pending->viewport.has_src &&
|
if (!pending->viewport.has_src &&
|
||||||
(pending->buffer_width % pending->scale != 0 ||
|
(pending->buffer_width % pending->scale != 0 ||
|
||||||
pending->buffer_height % pending->scale != 0)) {
|
pending->buffer_height % pending->scale != 0)) {
|
||||||
// TODO: send WL_SURFACE_ERROR_INVALID_SIZE error once this issue is
|
// TODO: send WL_SURFACE_ERROR_INVALID_SIZE error to cursor surfaces
|
||||||
// resolved:
|
// once this issue is resolved:
|
||||||
// https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
|
// https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
|
||||||
wlr_log(WLR_DEBUG, "Client bug: submitted a buffer whose size (%dx%d) "
|
if (!surface->role
|
||||||
"is not divisible by scale (%d)", pending->buffer_width,
|
|| strcmp(surface->role->name, "wl_pointer-cursor") == 0
|
||||||
pending->buffer_height, pending->scale);
|
|| strcmp(surface->role->name, "wp_tablet_tool-cursor") == 0) {
|
||||||
|
wlr_log(WLR_DEBUG, "Client bug: submitted a buffer whose size (%dx%d) "
|
||||||
|
"is not divisible by scale (%d)", pending->buffer_width,
|
||||||
|
pending->buffer_height, pending->scale);
|
||||||
|
} else {
|
||||||
|
wl_resource_post_error(surface->resource,
|
||||||
|
WL_SURFACE_ERROR_INVALID_SIZE,
|
||||||
|
"Buffer size (%dx%d) is not divisible by scale (%d)",
|
||||||
|
pending->buffer_width, pending->buffer_height, pending->scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pending->viewport.has_dst) {
|
if (pending->viewport.has_dst) {
|
||||||
|
|
Loading…
Reference in a new issue