Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfix(window): apply dpi aware viewport #20522
Conversation
highfive
commented
Apr 4, 2018
|
Heads up! This PR modifies the following files:
|
|
According to your fix, get_inner_size returns Device pixels. Wondering why it works on Mac then. |
I agree, there seems some different behavior between platform. (So far when I tried on macOS, this didn't happen). What would be legit way in servo side with current winit's behavior? |
|
First we need to figure out if |
|
what about part servo stores
guess cause |
|
looking through, there is upstream PR on stale rust-windowing/winit#332 to get better DPI support on win32 - the situation may get better (or could improve based on those) once it's checked in. I don't think this PR is acceptable to be checked in as-is, and per suggestion it may better to investigate upstream behavior first before think about servo side workaround - I'm closing PR for now, and leave issue as opened for further tracking. @paulrouget appreciate for feedback. |
|
If we use There's also this suspicious behavior where layout is wrong, but click are right. |
Yes, this seems only affect for layout viewport, while input coordinates are correctly calculated. |
kwonoj commentedApr 4, 2018
•
edited by SimonSapin
Closes #20505.
This PR is mostly open for discussion, I feel PR may need to be shaped with better organization.
In PR #20228,
window::get_coordinates()migrates coordinate calculation includes inner frame viewporthttps://github.com/servo/servo/blob/master/ports/servo/glutin_app/window.rs#L700-L701
which was located here previously
servo/ports/servo/glutin_app/window.rs
Lines 891 to 893 in 28c92db
It have one differences between, while previous logic was using
window::inner_sizeproperty while current logic asks to get inner size viaget_inner_size(). Those 2 value can be different when dpi_factor is not 1, cause when setting value toinner_sizeproperty it calculates back using dpi_factor.https://github.com/servo/servo/blob/master/ports/servo/glutin_app/window.rs#L546
So previous logic scale via dpi_factor was get correct viewport size, while current logic doubles up its scale. Currently this PR simply looks for places where it asks for
get_inner_size()and doesn't apply dpi factor.Still, it feels somewhat confusing / inconsistent between stored property is differ to what window reports back. Maybe either rename
inner_sizefor more clear (likevirtual_inner?), or just store inner_size from get_inner_size() as is and calculate where it's needed, or even could just get rid of inner_size and rely onget_coordinatesonly../mach build -ddoes not report any errors./mach build-geckolibdoes not report any errors./mach test-tidydoes not report any errorsThis change is