mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
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:
+1
-1
@@ -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
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user