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:
Elias Naur
2019-11-01 21:09:09 +01:00
parent c646827c0f
commit 835714d44e
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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)
} }