From 32c2af6d7091a5964056f2d3006e333d3602bd82 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 25 Aug 2020 17:34:48 +0000 Subject: [PATCH 1/2] backend/wayland: downgrade to wl_compositor v3 Sommelier does not support v4. Rather than calculating exact surface-relative damage regions instead of the previous buffer-relative ones, just damage the whole surface. It'll do for now. --- backend/wayland/backend.c | 6 +++++- backend/wayland/output.c | 4 +++- include/backend/wayland.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 8de63acf..b1fddfc7 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -101,7 +101,7 @@ static void registry_global(void *data, struct wl_registry *registry, if (strcmp(iface, wl_compositor_interface.name) == 0) { wl->compositor = wl_registry_bind(registry, name, - &wl_compositor_interface, 4); + &wl_compositor_interface, wl_compositor_version()); } else if (strcmp(iface, wl_seat_interface.name) == 0) { wl->seat = wl_registry_bind(registry, name, &wl_seat_interface, 5); @@ -244,6 +244,10 @@ bool wlr_backend_is_wl(struct wlr_backend *b) { return b->impl == &backend_impl; } +uint32_t wl_compositor_version(void) { + return getenv("SOMMELIER_VERSION") ? 3 : 4; +} + static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_wl_backend *wl = wl_container_of(listener, wl, local_display_destroy); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index bd17fa20..d91c5cc0 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -262,7 +262,9 @@ static bool output_commit(struct wlr_output *wlr_output) { wl_surface_attach(output->surface, buffer->wl_buffer, 0, 0); - if (damage == NULL) { + if (wl_compositor_version() < 4) { + wl_surface_damage(output->surface, 0, 0, INT32_MAX, INT32_MAX); + } else if (damage == NULL) { wl_surface_damage_buffer(output->surface, 0, 0, INT32_MAX, INT32_MAX); } else { diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 9a8a404b..9d7b5eb4 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -114,6 +114,7 @@ void create_wl_pointer(struct wl_pointer *wl_pointer, struct wlr_wl_output *outp void create_wl_keyboard(struct wl_keyboard *wl_keyboard, struct wlr_wl_backend *wl); struct wlr_wl_input_device *create_wl_input_device( struct wlr_wl_backend *backend, enum wlr_input_device_type type); +uint32_t wl_compositor_version(void); extern const struct wl_seat_listener seat_listener; -- 2.27.0