Skip to content

Commit d2ad755

Browse files
committed
simplify screen placement when screen is too small (processing#3913)
1 parent 7a456b8 commit d2ad755

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

build/shared/lib/defaults.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ editor.window.height.min = 500
101101
editor.window.height.min.macosx = 450
102102
# tested to be 515 on Windows XP, this leaves some room
103103
editor.window.height.min.windows = 530
104+
# tested with Raspberry Pi display
105+
editor.window.height.min.linux = 480
104106

105107
# font size for editor
106108
#editor.font = Monospaced,plain,12

core/src/processing/awt/PSurfaceAWT.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,15 +886,19 @@ public void placeWindow(int[] location, int[] editorLocation) {
886886
// if it fits inside the editor window,
887887
// offset slightly from upper lefthand corner
888888
// so that it's plunked inside the text area
889-
locationX = editorLocation[0] + 66;
890-
locationY = editorLocation[1] + 66;
889+
//locationX = editorLocation[0] + 66;
890+
//locationY = editorLocation[1] + 66;
891+
locationX = (sketch.displayWidth - window.width) / 2;
892+
locationY = (sketch.displayHeight - window.height) / 2;
891893

894+
/*
892895
if ((locationX + window.width > sketch.displayWidth - 33) ||
893896
(locationY + window.height > sketch.displayHeight - 33)) {
894897
// otherwise center on screen
895898
locationX = (sketch.displayWidth - window.width) / 2;
896899
locationY = (sketch.displayHeight - window.height) / 2;
897900
}
901+
*/
898902
frame.setLocation(locationX, locationY);
899903
}
900904
} else { // just center on screen

core/src/processing/javafx/PSurfaceFX.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ public void placeWindow(int[] location, int[] editorLocation) {
466466
stage.setY(locationY);
467467

468468
} else { // doesn't fit
469+
/*
469470
// if it fits inside the editor window,
470471
// offset slightly from upper lefthand corner
471472
// so that it's plunked inside the text area
@@ -475,9 +476,12 @@ public void placeWindow(int[] location, int[] editorLocation) {
475476
if ((locationX + stage.getWidth() > sketch.displayWidth - 33) ||
476477
(locationY + stage.getHeight() > sketch.displayHeight - 33)) {
477478
// otherwise center on screen
478-
locationX = (int) ((sketch.displayWidth - stage.getWidth()) / 2);
479-
locationY = (int) ((sketch.displayHeight - stage.getHeight()) / 2);
479+
*/
480+
locationX = (int) ((sketch.displayWidth - stage.getWidth()) / 2);
481+
locationY = (int) ((sketch.displayHeight - stage.getHeight()) / 2);
482+
/*
480483
}
484+
*/
481485
stage.setX(locationX);
482486
stage.setY(locationY);
483487
}
@@ -951,4 +955,4 @@ private char getKeyChar(KeyEvent fxEvent) {
951955
if (ch.startsWith("\r")) return '\n'; // normalize enter key
952956
return ch.charAt(0);
953957
}
954-
}
958+
}

core/src/processing/opengl/PSurfaceJOGL.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ public void placeWindow(int[] location, int[] editorLocation) {
540540
window.setTopLevelPosition(locationX - w, locationY);
541541

542542
} else { // doesn't fit
543+
/*
543544
// if it fits inside the editor window,
544545
// offset slightly from upper lefthand corner
545546
// so that it's plunked inside the text area
@@ -549,9 +550,12 @@ public void placeWindow(int[] location, int[] editorLocation) {
549550
if ((locationX + w > sketch.displayWidth - 33) ||
550551
(locationY + h > sketch.displayHeight - 33)) {
551552
// otherwise center on screen
552-
locationX = (sketch.displayWidth - w) / 2;
553-
locationY = (sketch.displayHeight - h) / 2;
553+
*/
554+
locationX = (sketch.displayWidth - w) / 2;
555+
locationY = (sketch.displayHeight - h) / 2;
556+
/*
554557
}
558+
*/
555559
window.setTopLevelPosition(locationX, locationY);
556560
}
557561
} else { // just center on screen

core/todo.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ X Fix depth sorter ordering when two triangles in a plane share vertices
2020
X https://github.com/processing/processing/pull/4010
2121
X Turn off fixed rate scheduling in OpenGL
2222
X https://github.com/processing/processing/pull/4004
23+
X Fix GLSL preprocessing issues with variable name mangling
24+
X https://github.com/processing/processing/pull/4052
25+
X https://github.com/processing/processing/issues/3961
26+
X https://github.com/processing/processing/issues/3968
2327

2428
andres
2529
X cursor() fails to work as expected with P2D/P3D

0 commit comments

Comments
 (0)