From a797fe0ee82c4d171aa3065625b53127847e2625 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 25 Nov 2014 10:29:38 -0500 Subject: [PATCH] resize working, but flickering --- core/src/processing/core/PSurfaceAWT.java | 26 +++++++++++------------ core/todo.txt | 5 ++++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/src/processing/core/PSurfaceAWT.java b/core/src/processing/core/PSurfaceAWT.java index d40e2bda3..6e1fd6f97 100644 --- a/core/src/processing/core/PSurfaceAWT.java +++ b/core/src/processing/core/PSurfaceAWT.java @@ -835,9 +835,9 @@ public class PSurfaceAWT implements PSurface { setFrameSize(); //wide, high); } setCanvasSize(); - if (frame != null) { - frame.setLocationRelativeTo(null); - } +// if (frame != null) { +// frame.setLocationRelativeTo(null); +// } GraphicsConfiguration gc = canvas.getGraphicsConfiguration(); // If not realized (off-screen, i.e the Color Selector Tool), gc will be null. @@ -1003,15 +1003,24 @@ public class PSurfaceAWT implements PSurface { if (farm.isVisible()) { Insets insets = farm.getInsets(); Dimension windowSize = farm.getSize(); + // JFrame (unlike java.awt.Frame) doesn't include the left/top // insets for placement (though it does seem to need them for // overall size of the window. Perhaps JFrame sets its coord // system so that (0, 0) is always the upper-left of the content // area. Which seems nice, but breaks any f*ing AWT-based code. + setSize(windowSize.width - insets.left - insets.right, + windowSize.height - insets.top - insets.bottom); + + /* Rectangle newBounds = new Rectangle(0, 0, //insets.left, insets.top, windowSize.width - insets.left - insets.right, windowSize.height - insets.top - insets.bottom); + + System.out.println(e); + System.out.println(newBounds); + Rectangle oldBounds = canvas.getBounds(); if (!newBounds.equals(oldBounds)) { // the ComponentListener in PApplet will handle calling size() @@ -1023,17 +1032,8 @@ public class PSurfaceAWT implements PSurface { // are still a little wonky on 1.7, especially on OS X. // This gives us a way to at least test against older VMs. canvas.revalidate(); // let the layout manager do its work - /* - if (revalidateMethod != null) { - try { - revalidateMethod.invoke(PApplet.this); - } catch (Exception ex) { - ex.printStackTrace(); - revalidateMethod = null; - } - } - */ } + */ } } } diff --git a/core/todo.txt b/core/todo.txt index 4c229ec4b..68ea16724 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,4 @@ -0233 (3.0a6) +s0233 (3.0a6) X remove Applet as base class X how to name the retina pixel stuff X hint(ENABLE_RETINA_PIXELS) or hint(ENABLE_HIDPI_PIXELS) @@ -59,6 +59,9 @@ _ https://github.com/processing/processing/issues/2963 _ assign this to DXF as well? _ createGraphics() currently broken in Java2D _ size() command not working to do a resize +_ fix flicker when resizing window +_ running through PSurfaceAWT.setSize() is probably overkill +_ setLocationRelativeTo(null) was removed, will it be missed? _ deal with applySettings() change (maybe not a problem?)