winit/wayland: Apply scale when creating drag surface
This commit is contained in:
parent
b4168e69cc
commit
a1792b681a
4 changed files with 2383 additions and 5 deletions
|
|
@ -151,14 +151,15 @@ impl PlatformSpecific {
|
||||||
surface: &dyn HasWindowHandle,
|
surface: &dyn HasWindowHandle,
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
|
scale: f64,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
offset: Vector,
|
offset: Vector,
|
||||||
) {
|
) {
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||||
{
|
{
|
||||||
return self
|
return self.wayland.update_surface_shm(
|
||||||
.wayland
|
surface, width, height, scale, data, offset,
|
||||||
.update_surface_shm(surface, width, height, data, offset);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,9 @@ impl WaylandSpecific {
|
||||||
let surface =
|
let surface =
|
||||||
WlSurface::from_id(self.conn.as_ref().unwrap(), id)
|
WlSurface::from_id(self.conn.as_ref().unwrap(), id)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
subsurface_state
|
subsurface_state.update_surface_shm(
|
||||||
.update_surface_shm(&surface, width, height, data, offset);
|
&surface, width, height, scale, data, offset,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -378,9 +378,15 @@ impl SubsurfaceState {
|
||||||
surface: &WlSurface,
|
surface: &WlSurface,
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
|
scale: f64,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
offset: Vector,
|
offset: Vector,
|
||||||
) {
|
) {
|
||||||
|
let wp_viewport = self.wp_viewporter.get_viewport(
|
||||||
|
&surface,
|
||||||
|
&self.qh,
|
||||||
|
cctk::sctk::globals::GlobalData,
|
||||||
|
);
|
||||||
let shm = ShmGlobal(&self.wl_shm);
|
let shm = ShmGlobal(&self.wl_shm);
|
||||||
let mut pool =
|
let mut pool =
|
||||||
SlotPool::new(width as usize * height as usize * 4, &shm).unwrap();
|
SlotPool::new(width as usize * height as usize * 4, &shm).unwrap();
|
||||||
|
|
@ -396,7 +402,12 @@ impl SubsurfaceState {
|
||||||
surface.damage_buffer(0, 0, width as i32, height as i32);
|
surface.damage_buffer(0, 0, width as i32, height as i32);
|
||||||
buffer.attach_to(&surface);
|
buffer.attach_to(&surface);
|
||||||
surface.offset(offset.x as i32, offset.y as i32);
|
surface.offset(offset.x as i32, offset.y as i32);
|
||||||
|
wp_viewport.set_destination(
|
||||||
|
(width as f64 / scale) as i32,
|
||||||
|
(height as f64 / scale) as i32,
|
||||||
|
);
|
||||||
surface.commit();
|
surface.commit();
|
||||||
|
wp_viewport.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_subsurface(&self, parent: &WlSurface) -> SubsurfaceInstance {
|
fn create_subsurface(&self, parent: &WlSurface) -> SubsurfaceInstance {
|
||||||
|
|
|
||||||
2365
winit/src/program.rs
Normal file
2365
winit/src/program.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue