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
+1 -1
View File
@@ -52,7 +52,7 @@ func mustLoadDLL(dll *syscall.LazyDLL, name string) {
if loadErr == nil {
return
}
pmsg := syscall.StringToUTF16Ptr("Failed to load " + name+ ". Gio requires the ANGLE OpenGL ES driver to run. A prebuilt version can be downloaded from https://gioui.org/doc/install.")
pmsg := syscall.StringToUTF16Ptr("Failed to load " + name + ". Gio requires the ANGLE OpenGL ES driver to run. A prebuilt version can be downloaded from https://gioui.org/doc/install.")
ptitle := syscall.StringToUTF16Ptr("Error")
syscall.MessageBox(0 /* HWND */, pmsg, ptitle, syscall.MB_ICONERROR|syscall.MB_SYSTEMMODAL)
os.Exit(1)
+3 -3
View File
@@ -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)
}