diff --git a/CHANGELOG.md b/CHANGELOG.md index 846c68f..2d91573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/api/window.rs b/src/api/window.rs index 533b882..8fdd095 100644 --- a/src/api/window.rs +++ b/src/api/window.rs @@ -18,7 +18,8 @@ pub fn get_screen_size(l: &Lua, _: ()) -> LuaResult<(u32, u32)> { pub fn get_screen_scale(l: &Lua, _: ()) -> LuaResult { 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<()> { diff --git a/src/window.rs b/src/window.rs index 470af38..a8a218c 100644 --- a/src/window.rs +++ b/src/window.rs @@ -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); }