diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index ec16e4291..24c0d5d39 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -9663,7 +9663,7 @@ public void frameResized(int w, int h) { // WINDOW METHODS - Map windowEventQueue = new ConcurrentHashMap<>(); + Map windowEventQueue = new ConcurrentHashMap<>(); public void windowTitle(String title) { @@ -9683,8 +9683,7 @@ public void windowResize(int newWidth, int newHeight) { * only the notification that the resize has happened. */ public void postWindowResized(int newWidth, int newHeight) { - windowEventQueue.put("w", newWidth); - windowEventQueue.put("h", newHeight); + windowEventQueue.put("wh", new WindowEventValuePairs(newWidth, newHeight)); } @@ -9724,8 +9723,7 @@ public void postWindowMoved(int newX, int newY) { frameMoved(newX, newY); } - windowEventQueue.put("x", newX); - windowEventQueue.put("y", newY); + windowEventQueue.put("xy", new WindowEventValuePairs(newX, newY)); } @@ -9734,21 +9732,28 @@ public void windowMoved() { } private void dequeueWindowEvents() { - if (windowEventQueue.containsKey("x")) { - windowX = windowEventQueue.remove("x"); - windowY = windowEventQueue.remove("y"); + if (windowEventQueue.containsKey("xy")) { + WindowEventValuePairs xy = windowEventQueue.remove("xy"); + windowX = xy.num1; + windowY = xy.num2; windowMoved(); } - if (windowEventQueue.containsKey("w")) { - // these should already match width/height - //windowResized(windowEventQueue.remove("w"), - // windowEventQueue.remove("h")); - windowEventQueue.remove("w"); - windowEventQueue.remove("h"); + if (windowEventQueue.containsKey("wh")) { + WindowEventValuePairs wh = windowEventQueue.remove("wh"); windowResized(); } } + protected class WindowEventValuePairs { + + public int num1; + public int num2; + + public WindowEventValuePairs(int num1, int num2) { + this.num1 = num1; + this.num2 = num2; + } + } /** * Scale the sketch as if it fits this specific width and height.