mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 02:45:38 +00:00
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:
@@ -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{
|
||||||
|
|||||||
@@ -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{
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -106,7 +106,3 @@ func newWindowRendezvous() *windowRendezvous {
|
|||||||
}()
|
}()
|
||||||
return wr
|
return wr
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
inchPrDp = 1.0 / 160
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user