mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 14:50:04 -04:00
wayland: don't send set_buffer_scale on wl_surface below version 3
wl_surface::set_buffer_scale is available since version 3. Sending it on an older surface is a protocol error that terminates the connection. This could happen when setting a custom cursor on a compositor without wp_viewporter. The neighboring damage call already checks the version.
This commit is contained in:
@@ -814,10 +814,12 @@ impl WindowState {
|
||||
let size = PhysicalSize::new(cursor.w, cursor.h).to_logical(scale);
|
||||
viewport.set_destination(size.width, size.height);
|
||||
scale
|
||||
} else {
|
||||
} else if surface.version() >= 3 {
|
||||
let scale = surface.data::<SurfaceData>().unwrap().surface_data().scale_factor();
|
||||
surface.set_buffer_scale(scale);
|
||||
scale as f64
|
||||
} else {
|
||||
1.
|
||||
};
|
||||
|
||||
surface.attach(Some(cursor.buffer.wl_buffer()), 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user