aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-12-05 01:10:06 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2020-12-05 01:10:06 +0100
commitdae6c06e0c1135334ef30cae0f5b3522b72b4310 (patch)
treec6fcf5add85325ec4a79a8800c3103b10bd80d40
parent807d4a4212a2cc14203d63376895cc36072ff1a2 (diff)
downloadriver-dae6c06e0c1135334ef30cae0f5b3522b72b4310.tar.gz
river-dae6c06e0c1135334ef30cae0f5b3522b72b4310.tar.xz
screencopy: add workaround for wlroots bug
Currently screencopy's copy_with_damage request is broken for compositors not submitting damage. As a workaround simply damage the whole output each frame.
-rw-r--r--build.zig1
-rw-r--r--river/render.zig13
2 files changed, 14 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 1baf9a9..5105227 100644
--- a/build.zig
+++ b/build.zig
@@ -124,6 +124,7 @@ fn addServerDeps(exe: *std.build.LibExeObjStep) void {
exe.linkSystemLibrary("wayland-server");
exe.linkSystemLibrary("wlroots");
exe.linkSystemLibrary("xkbcommon");
+ exe.linkSystemLibrary("pixman-1");
}
fn addProtocolDeps(exe: *std.build.LibExeObjStep, protocol_step: *std.build.Step) void {
diff --git a/river/render.zig b/river/render.zig
index 22a58c1..0326580 100644
--- a/river/render.zig
+++ b/river/render.zig
@@ -124,6 +124,19 @@ pub fn renderOutput(output: *Output) void {
// Conclude rendering and swap the buffers, showing the final frame
// on-screen.
c.wlr_renderer_end(wlr_renderer);
+
+ // TODO(wlroots): remove this with the next release. It is here due to
+ // a wlroots bug in the screencopy damage implementation
+ {
+ var w: c_int = undefined;
+ var h: c_int = undefined;
+ c.wlr_output_transformed_resolution(output.wlr_output, &w, &h);
+ var damage: c.pixman_region32_t = undefined;
+ c.pixman_region32_init(&damage);
+ _ = c.pixman_region32_union_rect(&damage, &damage, 0, 0, @intCast(c_uint, w), @intCast(c_uint, h));
+ c.wlr_output_set_damage(output.wlr_output, &damage);
+ }
+
// TODO: handle failure
if (!c.wlr_output_commit(output.wlr_output)) {
log.err(.render, "wlr_output_commit failed for {}", .{output.wlr_output.name});