Floyd Wang 2025-03-29 11:02:15 +08:00 committed by GitHub
parent f86977e2a7
commit b4254a33e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 111 additions and 2 deletions

View file

@ -797,6 +797,25 @@ impl PlatformWindow for WaylandWindow {
self.borrow().bounds.size
}
fn resize(&mut self, size: Size<Pixels>) {
let state = self.borrow();
let state_ptr = self.0.clone();
let dp_size = size.to_device_pixels(self.scale_factor());
state.xdg_surface.set_window_geometry(
state.bounds.origin.x.0 as i32,
state.bounds.origin.y.0 as i32,
dp_size.width.0,
dp_size.height.0,
);
state
.globals
.executor
.spawn(async move { state_ptr.resize(size) })
.detach();
}
fn scale_factor(&self) -> f32 {
self.borrow().scale
}