mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
Merge pull request #1314 from mitchellh/xft-dpi-round
apprt/gtk: xft-dpi can be fractional, do not expect exact division
This commit is contained in:
@ -676,8 +676,10 @@ pub fn getContentScale(self: *const Surface) !apprt.ContentScale {
|
||||
const gtk_xft_dpi = c.g_value_get_int(&value);
|
||||
|
||||
// As noted above Xft.dpi is multiplied by 1024, so we divide by 1024,
|
||||
// then divide by the default value of Xft.dpi (96) to derive a scale
|
||||
const xft_dpi: f32 = @floatFromInt(@divExact(gtk_xft_dpi, 1024));
|
||||
// then divide by the default value of Xft.dpi (96) to derive a scale.
|
||||
// Note that gtk-xft-dpi can be fractional, so we use floating point
|
||||
// math here.
|
||||
const xft_dpi: f32 = @as(f32, @floatFromInt(gtk_xft_dpi)) / 1024;
|
||||
break :xft_scale xft_dpi / 96;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user