Skip to content

Commit ba0fbd6

Browse files
committed
Merge branch 'master' of github.com:processing/processing
2 parents c00cdd5 + 33d6936 commit ba0fbd6

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

core/src/processing/opengl/PSurfaceJOGL.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,21 @@ public void initFrame(PApplet sketch, int backgroundColor,
190190
fullScreen = true;
191191
}
192192

193-
// if (fullScreen || spanDisplays) {
193+
if (fullScreen) {
194+
presentMode = sketchWidth < screenRect.width && sketchHeight < screenRect.height;
195+
}
196+
194197
if (spanDisplays) {
195198
sketchWidth = screenRect.width;
196199
sketchHeight = screenRect.height;
197200
}
198201

199202
// window..setBackground(new Color(backgroundColor, true));
200203
window.setSize(sketchWidth, sketchHeight);
204+
sketch.width = sketch.sketchWidth();
205+
sketch.height = sketch.sketchHeight();
206+
graphics.setSize(sketch.width, sketch.height);
207+
201208

202209
System.out.println("deviceIndex: " + deviceIndex);
203210
System.out.println(displayDevice);
@@ -206,6 +213,7 @@ public void initFrame(PApplet sketch, int backgroundColor,
206213
// This example could be useful:
207214
// com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT
208215
if (fullScreen) {
216+
window.setPosition(sketchX, sketchY);
209217
PApplet.hideMenuBar();
210218
if (spanDisplays) {
211219
window.setFullscreen(monitors);
@@ -238,6 +246,8 @@ public void initFrame(PApplet sketch, int backgroundColor,
238246
DrawListener drawlistener = new DrawListener();
239247
window.addGLEventListener(drawlistener);
240248

249+
250+
241251
System.err.println("1. create animator");
242252
animator = new FPSAnimator(window, 60);
243253
drawException = null;
@@ -402,7 +412,7 @@ public void placeWindow(int[] location, int[] editorLocation) {
402412
float offsetX;
403413
float offsetY;
404414
public void placePresent(int stopColor) {
405-
if (sketchWidth < screenRect.width || sketchHeight < screenRect.height) {
415+
if (presentMode) {
406416
System.err.println("Present mode");
407417
// System.err.println("WILL USE FBO");
408418
presentMode = pgl.presentMode = true;
@@ -460,13 +470,18 @@ public boolean isStopped() {
460470
}
461471

462472
public void setSize(int width, int height) {
463-
// if (frame != null) {
464-
System.err.println("3. set size");
473+
if (animator.isAnimating()) {
474+
System.err.println("3. set size");
465475

466-
sketchWidth = sketch.width = width;
467-
sketchHeight = sketch.height = height;
468-
graphics.setSize(width, height);
469-
// }
476+
if (!presentMode) {
477+
sketch.width = width;
478+
sketch.height = height;
479+
graphics.setSize(width, height);
480+
}
481+
482+
sketchWidth = width;
483+
sketchHeight = height;
484+
}
470485
}
471486

472487
public Component getComponent() {
@@ -683,7 +698,8 @@ protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent,
683698

684699

685700
if (presentMode) {
686-
if (20 < nativeEvent.getX() && nativeEvent.getX() < 20 + 100 &&
701+
if (peAction == KeyEvent.RELEASE &&
702+
20 < nativeEvent.getX() && nativeEvent.getX() < 20 + 100 &&
687703
screenRect.height - 70 < nativeEvent.getY() && nativeEvent.getY() < screenRect.height - 20) {
688704
System.err.println("clicked on exit button");
689705
// if (externalMessages) {

0 commit comments

Comments
 (0)