diff options
Diffstat (limited to 'gnu/java/awt/peer/gtk')
47 files changed, 305 insertions, 212 deletions
diff --git a/gnu/java/awt/peer/gtk/GThreadMutex.java b/gnu/java/awt/peer/gtk/GThreadMutex.java index 111c9a801..e73df9e55 100644 --- a/gnu/java/awt/peer/gtk/GThreadMutex.java +++ b/gnu/java/awt/peer/gtk/GThreadMutex.java @@ -18,8 +18,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java b/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java index 753c7cd46..9a1b8e3a3 100644 --- a/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java +++ b/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java @@ -19,8 +19,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/gnu/java/awt/peer/gtk/GdkFontMetrics.java index e871587a4..7a439e83a 100644 --- a/gnu/java/awt/peer/gtk/GdkFontMetrics.java +++ b/gnu/java/awt/peer/gtk/GdkFontMetrics.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkFontPeer.java b/gnu/java/awt/peer/gtk/GdkFontPeer.java index d130c1175..c6d42b372 100644 --- a/gnu/java/awt/peer/gtk/GdkFontPeer.java +++ b/gnu/java/awt/peer/gtk/GdkFontPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkGlyphVector.java b/gnu/java/awt/peer/gtk/GdkGlyphVector.java index 29d38b5e3..f0ddea43a 100644 --- a/gnu/java/awt/peer/gtk/GdkGlyphVector.java +++ b/gnu/java/awt/peer/gtk/GdkGlyphVector.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkGraphics.java b/gnu/java/awt/peer/gtk/GdkGraphics.java index c870dc1d4..65c01b86e 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphics.java +++ b/gnu/java/awt/peer/gtk/GdkGraphics.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -38,6 +38,8 @@ exception statement from your version. */ package gnu.java.awt.peer.gtk; +import gnu.classpath.Configuration; + import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -52,7 +54,17 @@ import java.text.AttributedCharacterIterator; public class GdkGraphics extends Graphics { - private final int native_state = GtkGenericPeer.getUniqueInteger(); + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } + initStaticState (); + } + + static native void initStaticState(); + private final int native_state = GtkGenericPeer.getUniqueInteger (); Color color, xorColor; GtkComponentPeer component; diff --git a/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/gnu/java/awt/peer/gtk/GdkGraphics2D.java index 0ddc1c7a8..b8203179d 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphics2D.java +++ b/gnu/java/awt/peer/gtk/GdkGraphics2D.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -201,7 +201,7 @@ public class GdkGraphics2D extends Graphics2D initState(width, height); setColor(Color.black); - setBackground(Color.black); + setBackground(new Color(0, 0, 0, 0)); setPaint(getColor()); setFont(new Font("SansSerif", Font.PLAIN, 12)); setTransform(new AffineTransform()); @@ -255,7 +255,7 @@ public class GdkGraphics2D extends Graphics2D initState(this.pixelBuffer, bimage.getWidth(), bimage.getHeight()); setColor(Color.black); - setBackground(Color.black); + setBackground(new Color(0, 0, 0, 0)); setPaint(getColor()); setFont(new Font("SansSerif", Font.PLAIN, 12)); setTransform(new AffineTransform()); @@ -290,8 +290,8 @@ public class GdkGraphics2D extends Graphics2D private native void cairoRestore(); private native void cairoSetMatrix(double[] m); private native void cairoSetOperator(int cairoOperator); - private native void cairoSetRGBColor(double red, double green, double blue); - private native void cairoSetAlpha(double alpha); + private native void cairoSetRGBAColor(double red, double green, + double blue, double alpha); private native void cairoSetFillRule(int cairoFillRule); private native void cairoSetLineWidth(double width); private native void cairoSetLineCap(int cairoLineCap); @@ -498,9 +498,10 @@ public class GdkGraphics2D extends Graphics2D { int height = bimage.getHeight(); int width = bimage.getWidth(); + int index = 0; for (int y = 0; y < height; ++y) for (int x = 0; x < width; ++x) - bimage.setRGB(x, y, pixelBuffer[y*width+height]); + bimage.setRGB(x, y, pixelBuffer[index++]); } } @@ -544,7 +545,7 @@ public class GdkGraphics2D extends Graphics2D // draw an image which has actually been loaded // into memory fully BufferedImage b = (BufferedImage) img; - return drawRaster(b.getColorModel(), b.getData(), + return drawRaster(b.getColorModel(), b.getTile(0, 0), invertedXform, bgcolor); } else @@ -807,9 +808,8 @@ public class GdkGraphics2D extends Graphics2D fg = c; paint = c; - cairoSetRGBColor(fg.getRed() / 255.0, fg.getGreen() / 255.0, - fg.getBlue() / 255.0); - cairoSetAlpha((fg.getAlpha() & 255) / 255.0); + cairoSetRGBAColor(fg.getRed() / 255.0, fg.getGreen() / 255.0, + fg.getBlue() / 255.0, fg.getAlpha() / 255.0); } public Color getColor() @@ -914,9 +914,8 @@ public class GdkGraphics2D extends Graphics2D public void clearRect(int x, int y, int width, int height) { - cairoSetRGBColor(bg.getRed() / 255.0, bg.getGreen() / 255.0, - bg.getBlue() / 255.0); - cairoSetAlpha(1.0); + cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0, + bg.getBlue() / 255.0, 1.0); cairoNewPath(); cairoRectangle(x, y, width, height); cairoFill(); diff --git a/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java index 94e1b0f01..bfad87aca 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java +++ b/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java index 3f7b87f45..4f9d1c27a 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java +++ b/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java index ee6c38f3c..57d5a36da 100644 --- a/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java +++ b/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -83,15 +83,18 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static native void initStaticState(); private final int native_state = GtkGenericPeer.getUniqueInteger (); - private boolean initialized = false; + + // initState() has been called, but pumpDone() has not yet been called. + private boolean needsClose = false; // the current set of ImageConsumers for this decoder Vector curr; // interface to GdkPixbuf native void initState (); - native void pumpBytes (byte[] bytes, int len); - native void finish (); + native void pumpBytes (byte[] bytes, int len) throws IOException; + native void pumpDone () throws IOException; + native void finish (boolean needsClose); static native void streamImage(int[] bytes, String format, int width, int height, boolean hasAlpha, DataOutput sink); // gdk-pixbuf provids data in RGBA format @@ -163,8 +166,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder byte bytes[] = new byte[4096]; int len = 0; initState(); + needsClose = true; while ((len = is.read (bytes)) != -1) pumpBytes (bytes, len); + pumpDone(); + needsClose = false; for (int i = 0; i < curr.size (); i++) { @@ -177,7 +183,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public void finalize() { - finish(); + finish(needsClose); } diff --git a/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/gnu/java/awt/peer/gtk/GdkRobotPeer.java index 054e73322..6d0218d05 100644 --- a/gnu/java/awt/peer/gtk/GdkRobotPeer.java +++ b/gnu/java/awt/peer/gtk/GdkRobotPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java index c74fb880f..2bf9d23db 100644 --- a/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java +++ b/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GdkTextLayout.java b/gnu/java/awt/peer/gtk/GdkTextLayout.java index 1a456d12a..ff51745f2 100644 --- a/gnu/java/awt/peer/gtk/GdkTextLayout.java +++ b/gnu/java/awt/peer/gtk/GdkTextLayout.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/gnu/java/awt/peer/gtk/GtkButtonPeer.java index 1ef992f02..ab5df9f46 100644 --- a/gnu/java/awt/peer/gtk/GtkButtonPeer.java +++ b/gnu/java/awt/peer/gtk/GtkButtonPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java index 1a0c4c968..dc2176120 100644 --- a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java b/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java index e387f1287..46b0733d3 100644 --- a/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java b/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java index 83aa98981..01a6e3102 100644 --- a/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java index 4af88f533..851757245 100644 --- a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/gnu/java/awt/peer/gtk/GtkChoicePeer.java index 43e48328d..5028ea779 100644 --- a/gnu/java/awt/peer/gtk/GtkChoicePeer.java +++ b/gnu/java/awt/peer/gtk/GtkChoicePeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -72,6 +72,8 @@ public class GtkChoicePeer extends GtkComponentPeer native void nativeRemove (int index); native void nativeRemoveAll (); + native void connectSignals (); + public native void select (int position); public void add (String item, int index) @@ -118,7 +120,7 @@ public class GtkChoicePeer extends GtkComponentPeer add (item, position); } - protected void choicePostItemEvent (String label, int stateChange) + protected void postChoiceItemEvent (String label, int stateChange) { // Must set our state before notifying listeners if (stateChange == ItemEvent.SELECTED) diff --git a/gnu/java/awt/peer/gtk/GtkClipboard.java b/gnu/java/awt/peer/gtk/GtkClipboard.java index b9cc1613b..c719cddb5 100644 --- a/gnu/java/awt/peer/gtk/GtkClipboard.java +++ b/gnu/java/awt/peer/gtk/GtkClipboard.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java index 3a1bf8b66..a7aea091d 100644 --- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -63,11 +63,15 @@ import java.awt.event.ItemEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.PaintEvent; +import java.awt.event.TextEvent; +import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; +import java.util.Timer; +import java.util.TimerTask; public class GtkComponentPeer extends GtkGenericPeer implements ComponentPeer @@ -81,6 +85,8 @@ public class GtkComponentPeer extends GtkGenericPeer boolean isInRepaint; + Timer repaintTimer = new Timer (true); + /* this isEnabled differs from Component.isEnabled, in that it knows if a parent is disabled. In that case Component.isEnabled may return true, but our isEnabled will always return false */ @@ -103,6 +109,13 @@ public class GtkComponentPeer extends GtkGenericPeer native boolean isRealized (); + void realize () + { + // Default implementation does nothing + } + + native void setNativeEventMask (); + void create () { throw new RuntimeException (); @@ -135,6 +148,10 @@ public class GtkComponentPeer extends GtkGenericPeer if (awtComponent instanceof Window || (parent != null && ! parent.isShowing ())) setParentAndBounds (); + + setNativeEventMask (); + + realize (); } void setParentAndBounds () @@ -208,7 +225,12 @@ public class GtkComponentPeer extends GtkGenericPeer public Image createImage (int width, int height) { - GtkImage image = new GtkImage (width, height); + Image image; + if (GtkToolkit.useGraphics2D ()) + image = new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB); + else + image = new GtkImage (width, height); + Graphics g = image.getGraphics(); g.setColor(getBackground()); g.fillRect(0, 0, width, height); @@ -354,8 +376,26 @@ public class GtkComponentPeer extends GtkGenericPeer if (x == 0 && y == 0 && width == 0 && height == 0) return; - q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE, - new Rectangle (x, y, width, height))); + repaintTimer.schedule(new RepaintTimerTask(x, y, width, height), tm); + } + + private class RepaintTimerTask extends TimerTask + { + private int x, y, width, height; + + RepaintTimerTask(int x, int y, int width, int height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public void run() + { + q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE, + new Rectangle (x, y, width, height))); + } } public void requestFocus () @@ -524,6 +564,11 @@ public class GtkComponentPeer extends GtkGenericPeer item, stateChange)); } + protected void postTextEvent () + { + q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED)); + } + public GraphicsConfiguration getGraphicsConfiguration () { // FIXME: just a stub for now. @@ -563,7 +608,8 @@ public class GtkComponentPeer extends GtkGenericPeer public void updateCursorImmediately () { - + if (awtComponent.getCursor() != null) + setCursor(awtComponent.getCursor()); } public boolean handlesWheelScrolling () diff --git a/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/gnu/java/awt/peer/gtk/GtkContainerPeer.java index e4aea64c9..c2865f70f 100644 --- a/gnu/java/awt/peer/gtk/GtkContainerPeer.java +++ b/gnu/java/awt/peer/gtk/GtkContainerPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/gnu/java/awt/peer/gtk/GtkDialogPeer.java index 9bf234404..c2cbc37dc 100644 --- a/gnu/java/awt/peer/gtk/GtkDialogPeer.java +++ b/gnu/java/awt/peer/gtk/GtkDialogPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java b/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java index 9ee41c985..0533d2759 100644 --- a/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java +++ b/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java @@ -16,8 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java index 4281b49cc..bd1f0775a 100644 --- a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java +++ b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkFontPeer.java b/gnu/java/awt/peer/gtk/GtkFontPeer.java index e0f070368..80ad15803 100644 --- a/gnu/java/awt/peer/gtk/GtkFontPeer.java +++ b/gnu/java/awt/peer/gtk/GtkFontPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkFramePeer.java b/gnu/java/awt/peer/gtk/GtkFramePeer.java index 53e06bc08..b242d66ad 100644 --- a/gnu/java/awt/peer/gtk/GtkFramePeer.java +++ b/gnu/java/awt/peer/gtk/GtkFramePeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/gnu/java/awt/peer/gtk/GtkGenericPeer.java index f161526f6..705eed235 100644 --- a/gnu/java/awt/peer/gtk/GtkGenericPeer.java +++ b/gnu/java/awt/peer/gtk/GtkGenericPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -90,4 +90,9 @@ public class GtkGenericPeer } native void gtkWidgetModifyFont (String name, int style, int size); + + static void printCurrentThread () + { + System.out.println ("gtkgenericpeer, thread: " + Thread.currentThread ()); + } } diff --git a/gnu/java/awt/peer/gtk/GtkImage.java b/gnu/java/awt/peer/gtk/GtkImage.java index 9b794b4aa..abb4137f4 100644 --- a/gnu/java/awt/peer/gtk/GtkImage.java +++ b/gnu/java/awt/peer/gtk/GtkImage.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -100,6 +100,11 @@ public class GtkImage extends Image boolean offScreen; /** + * Error flag for loading. + */ + boolean errorLoading; + + /** * Original source, if created from an ImageProducer. */ ImageProducer source; @@ -176,6 +181,7 @@ public class GtkImage extends Image isLoaded = false; observers = new Vector(); source = producer; + errorLoading = false; source.startProduction(new GtkImageConsumer(this, source)); offScreen = false; } @@ -243,6 +249,13 @@ public class GtkImage extends Image this.width = width; this.height = height; props = (properties != null) ? properties : new Hashtable(); + + if (width <= 0 || height <= 0 || pixels == null) + { + errorLoading = true; + return; + } + isLoaded = true; deliver(); createPixmap(); @@ -281,6 +294,8 @@ public class GtkImage extends Image */ public ImageProducer getSource () { + if (!isLoaded) + return null; return new MemoryImageSource(width, height, nativeModel, getPixels(), 0, width); } @@ -344,7 +359,12 @@ public class GtkImage extends Image public int checkImage (ImageObserver observer) { if (addObserver(observer)) - return 0; + { + if (errorLoading == true) + return ImageObserver.ERROR; + else + return 0; + } return ImageObserver.ALLBITS | ImageObserver.WIDTH | ImageObserver.HEIGHT; } @@ -373,18 +393,33 @@ public class GtkImage extends Image int dstY = (dy1 < dy2) ? dy1 : dy2; // Clipping. This requires the dst to be scaled as well, + if (srcWidth > width) + { + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; + } + + if (srcHeight > height) + { + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; + } + if (srcWidth + srcX > width) { dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); srcWidth = width - srcX; - } + } if (srcHeight + srcY > height) { dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); srcHeight = height - srcY; } - + + if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0) + return true; + if(bgcolor != null) drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), bgcolor.getBlue (), @@ -433,7 +468,8 @@ public class GtkImage extends Image ImageObserver.PROPERTIES | ImageObserver.ALLBITS; - for(int i=0; i < observers.size(); i++) + if (observers != null) + for(int i=0; i < observers.size(); i++) ((ImageObserver)observers.elementAt(i)). imageUpdate(this, flags, 0, 0, width, height); diff --git a/gnu/java/awt/peer/gtk/GtkImageConsumer.java b/gnu/java/awt/peer/gtk/GtkImageConsumer.java index 93743fe1a..299f01dca 100644 --- a/gnu/java/awt/peer/gtk/GtkImageConsumer.java +++ b/gnu/java/awt/peer/gtk/GtkImageConsumer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -45,6 +45,7 @@ import java.awt.image.DirectColorModel; import java.awt.image.ImageConsumer; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; +import java.awt.image.MemoryImageSource; import java.util.Hashtable; import java.util.Vector; @@ -70,7 +71,10 @@ public class GtkImageConsumer implements ImageConsumer public synchronized void imageComplete (int status) { - source.removeConsumer(this); + // we need to reuse the pixel cache for memory image sources since + // a memory image's backing array can be updated "live". + if (!(source instanceof MemoryImageSource)) + source.removeConsumer(this); target.setImage(width, height, pixelCache, properties); } diff --git a/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/gnu/java/awt/peer/gtk/GtkLabelPeer.java index 02251632b..fdd5fd15f 100644 --- a/gnu/java/awt/peer/gtk/GtkLabelPeer.java +++ b/gnu/java/awt/peer/gtk/GtkLabelPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkListPeer.java b/gnu/java/awt/peer/gtk/GtkListPeer.java index 13055d33c..ff12fe34b 100644 --- a/gnu/java/awt/peer/gtk/GtkListPeer.java +++ b/gnu/java/awt/peer/gtk/GtkListPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java index 4b547f56a..79eeaf9ba 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java index cd7ca8ac7..8d9d1ca04 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java index f85648ee8..5728f262b 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/gnu/java/awt/peer/gtk/GtkMenuPeer.java index 971a349d2..80332dd6a 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/gnu/java/awt/peer/gtk/GtkPanelPeer.java index fbdfcf472..fb5addeb4 100644 --- a/gnu/java/awt/peer/gtk/GtkPanelPeer.java +++ b/gnu/java/awt/peer/gtk/GtkPanelPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -65,4 +65,6 @@ public class GtkPanelPeer extends GtkContainerPeer } super.handleEvent (event); } + + native void connectSignals (); } diff --git a/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java index ed0b52193..d14c16dd7 100644 --- a/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java +++ b/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java index ae337a071..69f8b4946 100644 --- a/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java +++ b/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java index 065bab12e..aa3a26e34 100644 --- a/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java +++ b/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java index 94874deb6..a842b8318 100644 --- a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java +++ b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -41,11 +41,13 @@ package gnu.java.awt.peer.gtk; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; +import java.awt.Rectangle; import java.awt.TextArea; import java.awt.peer.TextAreaPeer; +import java.awt.peer.TextComponentPeer; -public class GtkTextAreaPeer extends GtkTextComponentPeer - implements TextAreaPeer +public class GtkTextAreaPeer extends GtkComponentPeer + implements TextComponentPeer, TextAreaPeer { private static transient int DEFAULT_ROWS = 10; private static transient int DEFAULT_COLS = 80; @@ -55,6 +57,35 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer native void gtkWidgetModifyFont (String name, int style, int size); native void gtkWidgetRequestFocus (); + public native void connectSignals (); + + public native int getCaretPosition (); + public native void setCaretPosition (int pos); + public native int getSelectionStart (); + public native int getSelectionEnd (); + public native String getText (); + public native void select (int start, int end); + public native void setEditable (boolean state); + public native void setText (String text); + + public int getIndexAtPoint(int x, int y) + { + // FIXME + return 0; + } + + public Rectangle getCharacterBounds (int pos) + { + // FIXME + return null; + } + + public long filterEvents (long filter) + { + // FIXME + return filter; + } + void create () { Font f = awtComponent.getFont (); @@ -87,6 +118,9 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer public GtkTextAreaPeer (TextArea ta) { super (ta); + + setText (ta.getText ()); + setCaretPosition (0); } public native void insert (String str, int pos); diff --git a/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java b/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java deleted file mode 100644 index 3051ecfcf..000000000 --- a/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java +++ /dev/null @@ -1,87 +0,0 @@ -/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.awt.peer.gtk; - -import java.awt.Rectangle; -import java.awt.TextComponent; -import java.awt.event.TextEvent; -import java.awt.peer.TextComponentPeer; - -public class GtkTextComponentPeer extends GtkComponentPeer - implements TextComponentPeer -{ - GtkTextComponentPeer (TextComponent tc) - { - super (tc); - - setText (tc.getText ()); - setCaretPosition(0); - } - - public native void connectSignals (); - - public native int getCaretPosition (); - public native void setCaretPosition (int pos); - public native int getSelectionStart (); - public native int getSelectionEnd (); - public native String getText (); - public native void select (int start, int end); - public native void setEditable (boolean state); - public native void setText (String text); - - public int getIndexAtPoint(int x, int y) - { - return 0; // FIXME - } - - public Rectangle getCharacterBounds (int pos) - { - return null; - } - - public long filterEvents (long filter) - { - return filter; // FIXME - } - - protected void postTextEvent () - { - q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED)); - } -} diff --git a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java index bd1ac8124..73a976bba 100644 --- a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java +++ b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -42,17 +42,48 @@ import java.awt.AWTEvent; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; +import java.awt.Rectangle; import java.awt.TextField; import java.awt.event.KeyEvent; import java.awt.peer.TextFieldPeer; +import java.awt.peer.TextComponentPeer; -public class GtkTextFieldPeer extends GtkTextComponentPeer - implements TextFieldPeer +public class GtkTextFieldPeer extends GtkComponentPeer + implements TextComponentPeer, TextFieldPeer { native void create (int width); native void gtkWidgetSetBackground (int red, int green, int blue); native void gtkWidgetSetForeground (int red, int green, int blue); + public native void connectSignals (); + + public native int getCaretPosition (); + public native void setCaretPosition (int pos); + public native int getSelectionStart (); + public native int getSelectionEnd (); + public native String getText (); + public native void select (int start, int end); + public native void setEditable (boolean state); + public native void setText (String text); + + public int getIndexAtPoint(int x, int y) + { + // FIXME + return 0; + } + + public Rectangle getCharacterBounds (int pos) + { + // FIXME + return null; + } + + public long filterEvents (long filter) + { + // FIXME + return filter; + } + void create () { Font f = awtComponent.getFont (); @@ -86,6 +117,9 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer { super (tf); + setText (tf.getText ()); + setCaretPosition (0); + if (tf.echoCharIsSet ()) setEchoChar (tf.getEchoChar ()); } diff --git a/gnu/java/awt/peer/gtk/GtkToolkit.java b/gnu/java/awt/peer/gtk/GtkToolkit.java index 5c0ab5438..69901102f 100644 --- a/gnu/java/awt/peer/gtk/GtkToolkit.java +++ b/gnu/java/awt/peer/gtk/GtkToolkit.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -40,7 +40,6 @@ package gnu.java.awt.peer.gtk; import gnu.classpath.Configuration; import gnu.java.awt.EmbeddedWindow; -import gnu.java.awt.EmbeddedWindowSupport; import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.ClasspathTextLayoutPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; @@ -86,7 +85,6 @@ import javax.imageio.spi.IIORegistry; * object to be used. */ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit - implements EmbeddedWindowSupport { Hashtable containers = new Hashtable(); static EventQueue q; diff --git a/gnu/java/awt/peer/gtk/GtkVolatileImage.java b/gnu/java/awt/peer/gtk/GtkVolatileImage.java index e4d6bc8fa..496090a09 100644 --- a/gnu/java/awt/peer/gtk/GtkVolatileImage.java +++ b/gnu/java/awt/peer/gtk/GtkVolatileImage.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and diff --git a/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/gnu/java/awt/peer/gtk/GtkWindowPeer.java index eabe59140..71e05a87d 100644 --- a/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -15,8 +15,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and @@ -63,6 +63,8 @@ public class GtkWindowPeer extends GtkContainerPeer native void gtkWindowSetResizable (boolean resizable); native void gtkWindowSetModal (boolean modal); + native void realize (); + int getWidth () { return awtComponent.getWidth(); diff --git a/gnu/java/awt/peer/gtk/package.html b/gnu/java/awt/peer/gtk/package.html index 96bc821dd..8dd4dd892 100644 --- a/gnu/java/awt/peer/gtk/package.html +++ b/gnu/java/awt/peer/gtk/package.html @@ -16,8 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and |