From 0e94d49203d0609ad4d11b7c874efca2ef870946 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 27 Jan 2020 02:31:47 +0000 Subject: wlroots: hack to fix Wayland backend with Sommelier The correct fix here would be to update Sommelier to implement wl_compositor v4, which I think we'll be able to do at some point, but for right now this is the best we can do. With this change, it's possible to run Sway inside Sommelier. --- ...end-wayland-downgrade-to-wl_compositor-v3.patch | 56 ++++++++++++++++++++++ pkgs/development/libraries/wlroots/default.nix | 4 ++ 2 files changed, 60 insertions(+) create mode 100644 pkgs/development/libraries/wlroots/0001-backend-wayland-downgrade-to-wl_compositor-v3.patch diff --git a/pkgs/development/libraries/wlroots/0001-backend-wayland-downgrade-to-wl_compositor-v3.patch b/pkgs/development/libraries/wlroots/0001-backend-wayland-downgrade-to-wl_compositor-v3.patch new file mode 100644 index 00000000000..bec35f4d20c --- /dev/null +++ b/pkgs/development/libraries/wlroots/0001-backend-wayland-downgrade-to-wl_compositor-v3.patch @@ -0,0 +1,56 @@ +From 3b37c19286b621f266e6d447cd16f1f59a3cc24c Mon Sep 17 00:00:00 2001 +From: Alyssa Ross +Date: Thu, 23 Jan 2020 14:35:41 +0000 +Subject: [PATCH] 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 | 2 +- + backend/wayland/output.c | 14 +------------- + 2 files changed, 2 insertions(+), 14 deletions(-) + +diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c +index e5858158..67f848ba 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, 3); + } else if (strcmp(iface, wl_seat_interface.name) == 0) { + wl->seat = wl_registry_bind(registry, name, + &wl_seat_interface, 5); +diff --git a/backend/wayland/output.c b/backend/wayland/output.c +index 7a3a08d0..f332ad93 100644 +--- a/backend/wayland/output.c ++++ b/backend/wayland/output.c +@@ -248,19 +248,7 @@ static bool output_commit(struct wlr_output *wlr_output) { + wl_surface_attach(output->surface, + output->pending_buffer->wl_buffer, 0, 0); + +- if (damage == NULL) { +- wl_surface_damage_buffer(output->surface, +- 0, 0, INT32_MAX, INT32_MAX); +- } else { +- int rects_len; +- pixman_box32_t *rects = +- pixman_region32_rectangles(damage, &rects_len); +- for (int i = 0; i < rects_len; i++) { +- pixman_box32_t *r = &rects[i]; +- wl_surface_damage_buffer(output->surface, r->x1, r->y1, +- r->x2 - r->x1, r->y2 - r->y1); +- } +- } ++ wl_surface_damage(output->surface, 0, 0, INT32_MAX, INT32_MAX); + wl_surface_commit(output->surface); + + output->pending_buffer = NULL; +-- +2.24.1 + diff --git a/pkgs/development/libraries/wlroots/default.nix b/pkgs/development/libraries/wlroots/default.nix index 9f9c4acb0d8..ef3666f2e1a 100644 --- a/pkgs/development/libraries/wlroots/default.nix +++ b/pkgs/development/libraries/wlroots/default.nix @@ -15,6 +15,10 @@ stdenv.mkDerivation rec { sha256 = "0c0q1p9yss5kx4430ik3n89drqpmm2bvgl8fjlf6prac1a7xzqn8"; }; + patches = [ + ./0001-backend-wayland-downgrade-to-wl_compositor-v3.patch + ]; + # $out for the library and $examples for the example programs (in examples): outputs = [ "out" "examples" ]; -- cgit 1.4.1