mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 02:45:38 +00:00
app/internal/window: apply monitorScale to sp values on Wayland
macOS and Windows already applies monitorScale to sp values. Wayland didn't apply the monitorScale when font scale detection fails. Do that. Run gofmt -s -w . as well. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -1071,17 +1071,17 @@ func (w *window) surface() (*C.struct_wl_surface, int, int) {
|
|||||||
|
|
||||||
func (w *window) ShowTextInput(show bool) {}
|
func (w *window) ShowTextInput(show bool) {}
|
||||||
|
|
||||||
// detectFontScale reports current font scale, or 1.0
|
// detectFontScale reports the system font scale, or monitorScale
|
||||||
// if it fails.
|
// if it fails.
|
||||||
func detectFontScale() float32 {
|
func detectFontScale() float32 {
|
||||||
// TODO: What about other window environments?
|
// TODO: What about other window environments?
|
||||||
out, err := exec.Command("gsettings", "get", "org.gnome.desktop.interface", "text-scaling-factor").Output()
|
out, err := exec.Command("gsettings", "get", "org.gnome.desktop.interface", "text-scaling-factor").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 1.0
|
return monitorScale
|
||||||
}
|
}
|
||||||
scale, err := strconv.ParseFloat(string(bytes.TrimSpace(out)), 32)
|
scale, err := strconv.ParseFloat(string(bytes.TrimSpace(out)), 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 1.0
|
return monitorScale
|
||||||
}
|
}
|
||||||
return float32(scale)
|
return float32(scale)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user