()
| 242 | |
| 243 | |
| 244 | protected void initWindow() { |
| 245 | window = GLWindow.create(screen, pgl.getCaps()); |
| 246 | |
| 247 | // Make sure that we pass the window close through to exit(), otherwise |
| 248 | // we're likely to have OpenGL try to shut down halfway through rendering |
| 249 | // a frame. Particularly problematic for complex/slow apps. |
| 250 | // https://github.com/processing/processing/issues/4690 |
| 251 | window.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE); |
| 252 | |
| 253 | // if (displayDevice == null) { |
| 254 | // |
| 255 | // |
| 256 | // } else { |
| 257 | // window = GLWindow.create(displayDevice.getScreen(), pgl.getCaps()); |
| 258 | // } |
| 259 | |
| 260 | windowScaleFactor = PApplet.platform == PConstants.MACOSX ? |
| 261 | 1 : sketch.pixelDensity; |
| 262 | |
| 263 | boolean spanDisplays = sketch.sketchDisplay() == PConstants.SPAN; |
| 264 | screenRect = spanDisplays ? |
| 265 | new Rectangle(screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight()) : |
| 266 | new Rectangle((int) displayRect.getX(), (int) displayRect.getY(), |
| 267 | (int) displayRect.getWidth(), |
| 268 | (int) displayRect.getHeight()); |
| 269 | |
| 270 | // Set the displayWidth/Height variables inside PApplet, so that they're |
| 271 | // usable and can even be returned by the sketchWidth()/Height() methods. |
| 272 | sketch.displayWidth = screenRect.width; |
| 273 | sketch.displayHeight = screenRect.height; |
| 274 | |
| 275 | sketchWidth0 = sketch.sketchWidth(); |
| 276 | sketchHeight0 = sketch.sketchHeight(); |
| 277 | |
| 278 | /* |
| 279 | // Trying to fix |
| 280 | // https://github.com/processing/processing/issues/3401 |
| 281 | if (sketch.displayWidth < sketch.width || |
| 282 | sketch.displayHeight < sketch.height) { |
| 283 | int w = sketch.width; |
| 284 | int h = sketch.height; |
| 285 | if (sketch.displayWidth < w) { |
| 286 | w = sketch.displayWidth; |
| 287 | } |
| 288 | if (sketch.displayHeight < h) { |
| 289 | h = sketch.displayHeight; |
| 290 | } |
| 291 | // sketch.setSize(w, h - 22 - 22); |
| 292 | // graphics.setSize(w, h - 22 - 22); |
| 293 | System.err.println("setting width/height to " + w + " " + h); |
| 294 | } |
| 295 | */ |
| 296 | |
| 297 | sketchWidth = sketch.sketchWidth(); |
| 298 | sketchHeight = sketch.sketchHeight(); |
| 299 | // System.out.println("init: " + sketchWidth + " " + sketchHeight); |
| 300 | |
| 301 | boolean fullScreen = sketch.sketchFullScreen(); |
no test coverage detected