river: fix viewporter protocol implementation

It turns out that wlroots requires us to do a bit more than just create
the wlr_viewporter. Docs are being added to the wlroots header in
https://github.com/swaywm/wlroots/pull/3171
This commit is contained in:
Isaac Freund
2021-09-06 19:03:17 +02:00
parent 7b97d519b3
commit 98aed8d47e
2 changed files with 27 additions and 12 deletions

View File

@ -76,7 +76,9 @@ const State = struct {
const SavedBuffer = struct {
client_buffer: *wlr.ClientBuffer,
box: Box,
/// x/y relative to the root surface in the surface tree.
surface_box: Box,
source_box: wlr.FBox,
transform: wl.Output.Transform,
};
@ -258,14 +260,17 @@ fn saveBuffersIterator(
saved_buffers: *std.ArrayList(SavedBuffer),
) callconv(.C) void {
if (surface.buffer) |buffer| {
var source_box: wlr.FBox = undefined;
surface.getBufferSourceBox(&source_box);
saved_buffers.append(.{
.client_buffer = buffer,
.box = Box{
.surface_box = .{
.x = surface_x,
.y = surface_y,
.width = @intCast(u32, surface.current.width),
.height = @intCast(u32, surface.current.height),
},
.source_box = source_box,
.transform = surface.current.transform,
}) catch return;
_ = buffer.base.lock();