Fix UI scaling factor not being applied at startup on X11

On wayland an event it dispatched right after window creation.
 This is not the case on X11 so we need to set it manually.
This commit is contained in:
meehl committed 2025-11-02 15:42:53 +01:00
1 parent cc38e31dbb
commit e877b599c1
3 files changed
+6 -1

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
### Fixed
- Fix missing window title during installation step
- Fix UI scaling factor not being applied at startup on X11
## [0.2.6] - 2025-10-31
+2 -1
View File
@@ -18,7 +18,8 @@ pub fn get_screen_size(l: &Lua, _: ()) -> LuaResult<(u32, u32)> {
pub fn get_screen_scale(l: &Lua, _: ()) -> LuaResult<f32> {
let ctx = l.app_data_ref::<&'static Context>().unwrap();
Ok(ctx.window().scale_factor)
let scale_factor = ctx.window().scale_factor;
Ok(scale_factor)
}
pub fn set_window_title(l: &Lua, title: String) -> LuaResult<()> {
+3
View File
@@ -28,6 +28,9 @@ impl WindowState {
window.set_title(&title);
}
let winit::dpi::PhysicalSize { width, height } = window.inner_size();
self.size = PhysicalSize::new(width, height);
self.scale_factor = window.scale_factor() as f32;
self.window = Some(window);
}