Skip to content

Commit d0fed09

Browse files
committed
wayland: temporary horrible fix for damage
1 parent 08883d7 commit d0fed09

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wayland.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ impl GraphicsContextImpl for WaylandImpl {
6464
self.tempfile.write_at(std::slice::from_raw_parts(buffer.as_ptr() as *const u8, buffer.len()*4), 0).expect("Failed to write buffer to temporary file.");
6565
self.tempfile.flush().expect("Failed to flush buffer to temporary file.");
6666
self.surface.attach(Some(&wayland_buffer.buffer), 0, 0);
67+
68+
// FIXME: Proper damaging mechanism.
69+
//
70+
// In order to propagate changes on compositors which track damage, for now damage the entire surface.
71+
if self.surface.as_ref().version() < 4 {
72+
// FIXME: Accommodate scale factor since wl_surface::damage is in terms of surface coordinates while
73+
// wl_surface::damage_buffer is in buffer coordinates.
74+
//
75+
// i32::MAX is a valid damage box (most compositors interpret the damage box as "the entire surface")
76+
self.surface.damage(0, 0, i32::MAX, i32::MAX);
77+
} else {
78+
// Introduced in version 4, it is an error to use this request in version 3 or lower.
79+
self.surface.damage_buffer(0, 0, width as i32, height as i32);
80+
}
81+
6782
self.surface.commit();
6883
}
6984
}

0 commit comments

Comments
 (0)