@@ -200,7 +200,6 @@ static protected Rectangle getDisplayBounds(int displayNum) {
200200 awtDisplayDevice = ge .getDefaultScreenDevice ();
201201 }
202202
203- System .out .println ("transform is " + awtDisplayDevice .getDefaultConfiguration ().getNormalizingTransform ());
204203 return awtDisplayDevice .getDefaultConfiguration ().getBounds ();
205204 }
206205
@@ -303,14 +302,19 @@ protected void initWindow() {
303302 windowScaleFactor =
304303 (PApplet .platform == PConstants .MACOS ) ? 1 : sketch .pixelDensity ;
305304
305+ float uiScale =
306+ Float .parseFloat (System .getProperty ("sun.java2d.uiScale" , "1.0" ));
307+
306308 boolean spanDisplays = sketch .sketchDisplay () == PConstants .SPAN ;
309+
307310 screenRect = spanDisplays ?
311+ // TODO probably need to apply this to the spanning version [fry 230218]
308312 new Rectangle (screen .getX (), screen .getY (),
309313 screen .getWidth (), screen .getHeight ()) :
310- new Rectangle ((int ) displayRect .getX (),
311- (int ) displayRect .getY (),
312- (int ) displayRect .getWidth (),
313- (int ) displayRect .getHeight ());
314+ new Rectangle ((int ) ( uiScale * displayRect .getX () ),
315+ (int ) ( uiScale * displayRect .getY () ),
316+ (int ) ( uiScale * displayRect .getWidth () ),
317+ (int ) ( uiScale * displayRect .getHeight () ));
314318
315319 // Set the displayWidth/Height variables inside PApplet, so that they're
316320 // usable and can even be returned by the sketchWidth()/Height() methods.
0 commit comments