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
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
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
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
// monitor outputs to compensate for the extra
// viewing distance compared to phone and tables.
monitorScale = 1.50
monitorScale = 1.20
// minDensity is the minimum pixels per dp to
// ensure font and ui legibility on low-dpi
// screens.
+3 -3
View File
@@ -202,10 +202,10 @@ func onFocusChange(env *C.JNIEnv, class C.jclass, view C.jlong, focus C.jboolean
func onWindowInsets(env *C.JNIEnv, class C.jclass, view C.jlong, top, right, bottom, left C.jint) {
w := views[view]
w.insets = Insets{
Top: ui.Px(float32(top)),
Right: ui.Px(float32(right)),
Top: ui.Px(float32(top)),
Right: ui.Px(float32(right)),
Bottom: ui.Px(float32(bottom)),
Left: ui.Px(float32(left)),
Left: ui.Px(float32(left)),
}
if w.stage >= StageRunning {
w.draw(true)
+7 -2
View File
@@ -198,17 +198,22 @@ func createNativeWindow(opts *WindowOptions) (*window, error) {
scale = s
}
}
ppdp := ppmm * mmPrDp * monitorScale
ppdp := ppmm * mmPrDp
ppsp := ppdp * fontScale
ppdp *= monitorScale
if ppdp < minDensity {
ppdp = minDensity
}
if ppsp < minDensity {
ppsp = minDensity
}
w := &window{
disp: conn.disp,
scale: scale,
newScale: scale != 1,
ppdp: ppdp,
ppsp: ppdp * fontScale,
ppsp: ppsp,
notRead: pipe[0],
notWrite: pipe[1],
}