X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FAWT.java;h=43168fd97ba0da85d5218b5ba99ec72f6fbb518c;hb=027607da259f292060d80e0ed90d2b0e896acd86;hp=5a0b1201e10d3badc7fca33c815d33cadbcaf744;hpb=55a705adbd2e74b771d6cbd161ee5e6f90bd5dac;p=org.ibex.core.git diff --git a/src/org/xwt/plat/AWT.java b/src/org/xwt/plat/AWT.java index 5a0b120..43168fd 100644 --- a/src/org/xwt/plat/AWT.java +++ b/src/org/xwt/plat/AWT.java @@ -25,6 +25,7 @@ public class AWT extends Platform { protected int _stringWidth(String font, String text) { return getFont(font).metrics.stringWidth(text); } protected int _getMaxAscent(String font) { return getFont(font).metrics.getMaxAscent(); } protected int _getMaxDescent(String font) { return getFont(font).metrics.getMaxDescent(); } + protected boolean _supressDirtyOnResize() { return true; } protected String _getClipBoard() { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -48,6 +49,37 @@ public class AWT extends Platform { return 0; } + static class Open extends FileDialog implements WindowListener, ComponentListener { + Semaphore s; + public Open(String suggestedFileName, Semaphore s, boolean write) { + super(new Frame(), suggestedFileName, write ? FileDialog.SAVE : FileDialog.LOAD); + this.s = s; + } + public void windowActivated(WindowEvent e) { } + public void windowClosed(WindowEvent e) { s.release(); } + public void windowClosing(WindowEvent e) { } + public void windowDeactivated(WindowEvent e) { } + public void windowDeiconified(WindowEvent e) { } + public void windowIconified(WindowEvent e) { } + public void windowOpened(WindowEvent e) { } + public void componentHidden(ComponentEvent e) { s.release(); } + public void componentMoved(ComponentEvent e) { } + public void componentResized(ComponentEvent e) { } + public void componentShown(ComponentEvent e) { } + }; + + protected String _fileDialog(String suggestedFileName, boolean write) { + Semaphore s = new Semaphore(); + Open fd = new Open(suggestedFileName, s, write); + fd.addWindowListener(fd); + fd.addComponentListener(fd); + fd.show(); + s.block(); + return fd.getDirectory() + File.separatorChar + fd.getFile(); + } + + protected void _saveFile(String suggestedFileName, ByteStream data) throws IOException { } + // Inner Classes ///////////////////////////////////////////////////////////////////////////////////// protected static class AWTPicture implements Picture { @@ -171,6 +203,9 @@ public class AWT extends Platform { componentResized(window.getWidth() - insets.left - insets.right, window.getHeight() - insets.top - insets.bottom); Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height); + + // this is safe because AWT's low-level drawing functions are threadsafe + blitDirtyScreenRegions(); } } @@ -180,6 +215,9 @@ public class AWT extends Platform { public void paint(Graphics gr) { Rectangle r = gr.getClipBounds(); Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height); + + // this is safe because AWT's low-level drawing functions are threadsafe + blitDirtyScreenRegions(); } }