Skip to content

Commit a966803

Browse files
committed
fix for #918
1 parent 628b69d commit a966803

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

core/src/processing/core/PApplet.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9663,7 +9663,7 @@ public void frameResized(int w, int h) {
96639663

96649664
// WINDOW METHODS
96659665

9666-
Map<String, Integer> windowEventQueue = new ConcurrentHashMap<>();
9666+
Map<String, WindowEventValuePairs> windowEventQueue = new ConcurrentHashMap<>();
96679667

96689668

96699669
public void windowTitle(String title) {
@@ -9683,8 +9683,7 @@ public void windowResize(int newWidth, int newHeight) {
96839683
* only the notification that the resize has happened.
96849684
*/
96859685
public void postWindowResized(int newWidth, int newHeight) {
9686-
windowEventQueue.put("w", newWidth);
9687-
windowEventQueue.put("h", newHeight);
9686+
windowEventQueue.put("wh", new WindowEventValuePairs(newWidth, newHeight));
96889687
}
96899688

96909689

@@ -9724,8 +9723,7 @@ public void postWindowMoved(int newX, int newY) {
97249723
frameMoved(newX, newY);
97259724
}
97269725

9727-
windowEventQueue.put("x", newX);
9728-
windowEventQueue.put("y", newY);
9726+
windowEventQueue.put("xy", new WindowEventValuePairs(newX, newY));
97299727
}
97309728

97319729

@@ -9734,21 +9732,28 @@ public void windowMoved() { }
97349732

97359733

97369734
private void dequeueWindowEvents() {
9737-
if (windowEventQueue.containsKey("x")) {
9738-
windowX = windowEventQueue.remove("x");
9739-
windowY = windowEventQueue.remove("y");
9735+
if (windowEventQueue.containsKey("xy")) {
9736+
WindowEventValuePairs xy = windowEventQueue.remove("xy");
9737+
windowX = xy.num1;
9738+
windowY = xy.num2;
97409739
windowMoved();
97419740
}
9742-
if (windowEventQueue.containsKey("w")) {
9743-
// these should already match width/height
9744-
//windowResized(windowEventQueue.remove("w"),
9745-
// windowEventQueue.remove("h"));
9746-
windowEventQueue.remove("w");
9747-
windowEventQueue.remove("h");
9741+
if (windowEventQueue.containsKey("wh")) {
9742+
WindowEventValuePairs wh = windowEventQueue.remove("wh");
97489743
windowResized();
97499744
}
97509745
}
97519746

9747+
protected class WindowEventValuePairs {
9748+
9749+
public int num1;
9750+
public int num2;
9751+
9752+
public WindowEventValuePairs(int num1, int num2) {
9753+
this.num1 = num1;
9754+
this.num2 = num2;
9755+
}
9756+
}
97529757

97539758
/**
97549759
* Scale the sketch as if it fits this specific width and height.

0 commit comments

Comments
 (0)