ui/app: tweak monitor scale

Don't apply monitor scale to wayland font sizes, since it detects
the user scale itself.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-11 14:55:51 +02:00
parent 478d56102a
commit f4461721e3
4 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.12 go 1.12
require ( require (
gioui.org/ui v0.0.0-20190710205516-4fadf71992ff gioui.org/ui v0.0.0-20190711123338-478d56102a83
github.com/google/go-github/v24 v24.0.1 github.com/google/go-github/v24 v24.0.1
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9 golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
+1 -1
View File
@@ -69,7 +69,7 @@ const (
// monitorScale is the extra scale applied to // monitorScale is the extra scale applied to
// monitor outputs to compensate for the extra // monitor outputs to compensate for the extra
// viewing distance compared to phone and tables. // viewing distance compared to phone and tables.
monitorScale = 1.50 monitorScale = 1.20
// minDensity is the minimum pixels per dp to // minDensity is the minimum pixels per dp to
// ensure font and ui legibility on low-dpi // ensure font and ui legibility on low-dpi
// screens. // screens.
+7 -2
View File
@@ -198,17 +198,22 @@ func createNativeWindow(opts *WindowOptions) (*window, error) {
scale = s scale = s
} }
} }
ppdp := ppmm * mmPrDp * monitorScale ppdp := ppmm * mmPrDp
ppsp := ppdp * fontScale
ppdp *= monitorScale
if ppdp < minDensity { if ppdp < minDensity {
ppdp = minDensity ppdp = minDensity
} }
if ppsp < minDensity {
ppsp = minDensity
}
w := &window{ w := &window{
disp: conn.disp, disp: conn.disp,
scale: scale, scale: scale,
newScale: scale != 1, newScale: scale != 1,
ppdp: ppdp, ppdp: ppdp,
ppsp: ppdp * fontScale, ppsp: ppsp,
notRead: pipe[0], notRead: pipe[0],
notWrite: pipe[1], notWrite: pipe[1],
} }