forked from joejulian/gio
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) {}
|
||||
|
||||
// detectFontScale reports current font scale, or 1.0
|
||||
// detectFontScale reports the system font scale, or monitorScale
|
||||
// if it fails.
|
||||
func detectFontScale() float32 {
|
||||
// TODO: What about other window environments?
|
||||
out, err := exec.Command("gsettings", "get", "org.gnome.desktop.interface", "text-scaling-factor").Output()
|
||||
if err != nil {
|
||||
return 1.0
|
||||
return monitorScale
|
||||
}
|
||||
scale, err := strconv.ParseFloat(string(bytes.TrimSpace(out)), 32)
|
||||
if err != nil {
|
||||
return 1.0
|
||||
return monitorScale
|
||||
}
|
||||
return float32(scale)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user