app/internal/window: correct baseline DPI on Windows, iOS

Updates gio#53

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-04 19:23:19 +01:00
parent 615840352e
commit 4adaea3396
4 changed files with 3 additions and 4 deletions
+1
View File
@@ -309,6 +309,7 @@ func (w *window) draw(sync bool) {
if width == 0 || height == 0 { if width == 0 || height == 0 {
return return
} }
const inchPrDp = 1.0 / 160
ppdp := float32(w.dpi) * inchPrDp ppdp := float32(w.dpi) * inchPrDp
w.callbacks.Event(FrameEvent{ w.callbacks.Event(FrameEvent{
FrameEvent: system.FrameEvent{ FrameEvent: system.FrameEvent{
+1
View File
@@ -81,6 +81,7 @@ func onDraw(view C.CFTypeRef, dpi, sdpi, width, height C.CGFloat, sync C.int, to
if sync != 0 { if sync != 0 {
isSync = true isSync = true
} }
const inchPrDp = 1.0 / 163
w.w.Event(FrameEvent{ w.w.Event(FrameEvent{
FrameEvent: system.FrameEvent{ FrameEvent: system.FrameEvent{
Size: image.Point{ Size: image.Point{
+1
View File
@@ -486,6 +486,7 @@ func convertKeyCode(code uintptr) (rune, bool) {
func configForDC(hdc syscall.Handle) config { func configForDC(hdc syscall.Handle) config {
hmon := monitorFromPoint(point{}, _MONITOR_DEFAULTTOPRIMARY) hmon := monitorFromPoint(point{}, _MONITOR_DEFAULTTOPRIMARY)
dpi := getDpiForMonitor(hmon, _MDT_EFFECTIVE_DPI) dpi := getDpiForMonitor(hmon, _MDT_EFFECTIVE_DPI)
const inchPrDp = 1.0 / 96.0
ppdp := float32(dpi) * inchPrDp ppdp := float32(dpi) * inchPrDp
return config{ return config{
pxPerDp: ppdp, pxPerDp: ppdp,
-4
View File
@@ -106,7 +106,3 @@ func newWindowRendezvous() *windowRendezvous {
}() }()
return wr return wr
} }
const (
inchPrDp = 1.0 / 160
)