bugfix: Fix length of returned buffer on x11 when using the wire-transferred buffer

total_len() computes the number of bytes, while the wire Vec holds u32.
This commit is contained in:
Simon Hausmann 2023-09-06 17:05:17 +02:00 committed by GitHub
parent 53ae12a637
commit 9b44f2eaea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,7 @@
# UNRELEASED
* On X11, fix the length of the returned buffer when using the wire-transferred buffer.
# 0.3.0
* On MacOS, the contents scale is updated when set_buffer() is called, to adapt when the window is on a new screen (#68).

View file

@ -486,7 +486,7 @@ impl Buffer {
match self {
Buffer::Shm(ref mut shm) => shm.alloc_segment(conn, total_len(width, height)),
Buffer::Wire(wire) => {
wire.resize(total_len(width, height), 0);
wire.resize(total_len(width, height) / 4, 0);
Ok(())
}
}