-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scaling Factor detection on Windows 10 #95
Comments
From what I know there are two ways to scale a display on Windows, which compound with each other. One which controls the actual size of the display on the desktop canvas (which DefOS tracks) and one which controls the size of UI elements for windows on a particular screen (shell scaling). The values that I'm not that sure about the value in |
I just found out that |
@aglitchman Does |
I recently upgraded my monitor to 27 inches, so scaling_factor is now 1.5 (150%). pprint(defos.get_current_display_id())
pprint(defos.get_displays()) High Dpi is off DEBUG:SCRIPT: \\.\DISPLAY1
DEBUG:SCRIPT:
{ --[[000000003ED84720]]
1 = { --[[000000003ED84750]]
bounds = { --[[000000003ED84810]]
y = 0,
x = 0,
height = 1440,
width = 2560
},
name = "BenQ PD2700U",
mode = { --[[000000003ED84840]]
reflect_y = false,
width = 3840,
scaling_factor = 1.5,
refresh_rate = 60,
reflect_x = false,
orientation = 0,
height = 2160,
bits_per_pixel = 32
},
id = "\\.\DISPLAY1"
},
\\.\DISPLAY1 = { --[[000000003ED84750]]
bounds = { --[[000000003ED84810]]
y = 0,
x = 0,
height = 1440,
width = 2560
},
name = "BenQ PD2700U",
mode = { --[[000000003ED84840]]
reflect_y = false,
width = 3840,
scaling_factor = 1.5,
refresh_rate = 60,
reflect_x = false,
orientation = 0,
height = 2160,
bits_per_pixel = 32
},
id = "\\.\DISPLAY1"
}
} High Dpi is on DEBUG:SCRIPT: \\.\DISPLAY1
DEBUG:SCRIPT:
{ --[[0000000030374720]]
1 = { --[[0000000030374750]]
bounds = { --[[0000000030374810]]
y = 0,
x = 0,
height = 2160,
width = 3840
},
name = "BenQ PD2700U",
mode = { --[[0000000030374840]]
reflect_y = false,
width = 3840,
scaling_factor = 1,
refresh_rate = 60,
reflect_x = false,
orientation = 0,
height = 2160,
bits_per_pixel = 32
},
id = "\\.\DISPLAY1"
},
\\.\DISPLAY1 = { --[[0000000030374750]]
bounds = { --[[0000000030374810]]
y = 0,
x = 0,
height = 2160,
width = 3840
},
name = "BenQ PD2700U",
mode = { --[[0000000030374840]]
reflect_y = false,
width = 3840,
scaling_factor = 1,
refresh_rate = 60,
reflect_x = false,
orientation = 0,
height = 2160,
bits_per_pixel = 32
},
id = "\\.\DISPLAY1"
}
} |
Yeah. This is the intended behaviour. Window coordinates map 1:1 to the display pixels, so |
I use DefOS on Windows to scale the window down to the desktop height after starting and move the window to the center of the screen. Very useful in the development process. When high dpi is off, my code works fine. When high dpi is on, it works incorrectly because the real height of the taskbar and the window borders are unknown because of incorrect Adding |
For the window borders, you can query them. |
Yeah, that's what I do. But without |
I have a 24' 3840x2160 monitor that I use with Windows 10 at a scale of 200%. So virtually it's 1920x1080 with PPI, like Apple Retina.
DefOS failed to determine the correct
scaling_factor
(must be 2):Seems that on Windows 10 you should to use this API to determine the correct
scaling_factor
:https://docs.microsoft.com/en-us/windows/desktop/api/shellscalingapi/nf-shellscalingapi-getscalefactorformonitor
https://docs.microsoft.com/en-us/windows/desktop/api/shtypes/ne-shtypes-device_scale_factor
Also, width/height in
bounds
ormode
should be half the size, right?The text was updated successfully, but these errors were encountered: