Question/feedback regarding Windows Hi DPI support and how it will affect applications

Mike Hearn mike at plan99.net
Wed Feb 18 11:23:29 UTC 2015


>
> Finally, it would be nice to get information about the actual screen DPI.
> In my tests Screen.getDpi always returns 96, regardless of what it actually
> is...


You can reflectively access Screen.getPixelScale() to learn if you're on
Retina. Of course, don't expect to swap out the JRE for a newer one
automatically if you do this (I bundle so it's not so problematic).

WRT Jim's questions:

- Would seeing non-integer event coordinates break your code?

No.

- Would seeing non-integer window sizes and positions break your code?

No. I serialize window co-ordinates to disk so the main window appears in
the same place and size across app restarts, but I just checked and I'm
saving them as doubles so it would just work.

- Would non-integer screen sizes break your code?

No.

- If we provide a flag or scale factor on the screens to indicate that the
dimensions provided are in pixels and you must convert your desired window
sizes by the indicated scale factor in order to know how big to make your
window - how much impact would that have?

You mean like Screen.getPixelScale()?

Honestly I find this stuff confusing. Re-defining "pixel" to mean something
other than dot on a screen matrix breaks my entire lifetime's mental model
of how screens work. I'd almost prefer to just specify everything in terms
of some abstract unit like an 'em' and then not think about pixels at all,
though I realise that isn't compatible with how the JavaFX API works. The
notion of screen vs stage pixels is likely to be especially confusing.


More information about the openjfx-dev mailing list