This changes the System.loadLibrary() calls in the GTK peers, so that they are only called when configured so. This is important for VMs that can't or don't want to link dynamically, e.g. when creating full static linked binaries like Jamaica.
2008-02-08 Roman Kennke <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/CairoGraphics2D.java, * gnu/java/awt/peer/gtk/GdkFontPeer.java, * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java, * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java, * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java, * gnu/java/awt/peer/gtk/GtkComponentPeer.java, * gnu/java/awt/peer/gtk/GtkToolkit.java: Only call System.loadLibrary() when configured so. /Roman -- Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-0 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.72 retrieving revision 1.73 diff -u -1 -0 -r1.72 -r1.73 --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 9 Jan 2008 20:42:37 -0000 1.72 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 8 Feb 2008 22:17:39 -0000 1.73 @@ -31,20 +31,22 @@ 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 gnu.classpath.Configuration; + import gnu.java.awt.ClasspathToolkit; import java.awt.AWTPermission; import java.awt.AlphaComposite; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Composite; import java.awt.CompositeContext; import java.awt.Font; import java.awt.FontMetrics; @@ -113,21 +115,24 @@ * Also, dispose() must be overloaded to free any native datastructures * used by subclass and in addition call super.dispose() to free the * native cairographics2d structure and cairo_t. * * @author Sven de Marothy */ public abstract class CairoGraphics2D extends Graphics2D { static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } } /** * Important: This is a pointer to the native cairographics2d structure * * DO NOT CHANGE WITHOUT CHANGING NATIVE CODE. */ long nativePointer; // Drawing state variables Index: gnu/java/awt/peer/gtk/GdkFontPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -1 -0 -r1.25 -r1.26 --- gnu/java/awt/peer/gtk/GdkFontPeer.java 25 Jun 2007 11:25:51 -0000 1.25 +++ gnu/java/awt/peer/gtk/GdkFontPeer.java 8 Feb 2008 22:17:40 -0000 1.26 @@ -31,20 +31,21 @@ 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 gnu.classpath.Configuration; import gnu.classpath.Pointer; import gnu.java.awt.ClasspathToolkit; import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.font.opentype.NameDecoder; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Toolkit; import java.awt.font.FontRenderContext; @@ -159,21 +160,24 @@ float maxDescent; float maxAdvance; float height; float underlineOffset; float underlineThickness; GdkFontMetrics metrics; static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } initStaticState (); } private ByteBuffer nameTable = null; /** * The pointer to the native font data. * Index: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -1 -0 -r1.18 -r1.19 --- gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java 27 Nov 2007 22:06:58 -0000 1.18 +++ gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java 8 Feb 2008 22:17:40 -0000 1.19 @@ -31,20 +31,21 @@ 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 gnu.classpath.Configuration; import gnu.java.awt.ClasspathGraphicsEnvironment; import java.awt.Font; import java.awt.Graphics2D; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.Raster; @@ -65,21 +66,24 @@ /** * The pointer to the native display resource. * * This field is manipulated by native code. Don't change or remove * without adjusting the native code. */ private Pointer display; static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } GtkToolkit.initializeGlobalIDs(); initIDs(); } private static native void initIDs(); public GdkGraphicsEnvironment () { nativeInitState(); Index: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -1 -0 -r1.27 -r1.28 --- gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 25 Apr 2007 14:53:03 -0000 1.27 +++ gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 8 Feb 2008 22:17:40 -0000 1.28 @@ -61,27 +61,31 @@ import javax.imageio.ImageTypeSpecifier; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.metadata.IIOMetadata; import javax.imageio.spi.IIORegistry; import javax.imageio.spi.ImageReaderSpi; import javax.imageio.spi.ImageWriterSpi; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; +import gnu.classpath.Configuration; import gnu.classpath.Pointer; public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder { static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } initStaticState (); } /** * Lock that should be held for all gdkpixbuf operations. We don't use * the global gdk_threads_enter/leave functions since gdkpixbuf * operations can be done in parallel to drawing and manipulating gtk * widgets. */ Index: gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -1 -0 -r1.9 -r1.10 --- gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java 25 Apr 2007 14:53:03 -0000 1.9 +++ gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java 8 Feb 2008 22:17:40 -0000 1.10 @@ -39,20 +39,21 @@ package gnu.java.awt.peer.gtk; import java.awt.DisplayMode; import java.awt.Frame; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.Rectangle; import java.awt.Window; import java.util.ArrayList; +import gnu.classpath.Configuration; import gnu.classpath.Pointer; class GdkScreenGraphicsDevice extends GraphicsDevice { private final int native_state = GtkGenericPeer.getUniqueInteger (); private Window fullscreenWindow; private boolean oldWindowDecorationState; @@ -91,21 +92,25 @@ /** * The pointer to the native screen resource. * * This field is manipulated by native code. Don't change or remove * without adjusting the native code. */ private Pointer screen; static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } + GtkToolkit.initializeGlobalIDs(); initIDs(); } static native void initIDs(); GdkScreenGraphicsDevice (GdkGraphicsEnvironment e) { super(); env = e; Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v retrieving revision 1.130 retrieving revision 1.131 diff -u -1 -0 -r1.130 -r1.131 --- gnu/java/awt/peer/gtk/GtkComponentPeer.java 27 Nov 2007 22:06:59 -0000 1.130 +++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 8 Feb 2008 22:17:40 -0000 1.131 @@ -73,20 +73,22 @@ import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; import java.awt.peer.LightweightPeer; import java.awt.peer.WindowPeer; import java.util.Timer; import java.util.TimerTask; +import sun.java2d.pipe.Region; + public class GtkComponentPeer extends GtkGenericPeer implements ComponentPeer { VolatileImage backBuffer; BufferCapabilities caps; Component awtComponent; Insets insets; @@ -911,11 +913,15 @@ public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, sun.awt.CausedFocusEvent.Cause cause) { // TODO: Implement this properly and remove the other requestFocus() // methods. return true; } + public void applyShape(Region shape) + { + // TODO: Implement properly. + } } Index: gnu/java/awt/peer/gtk/GtkToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.104 retrieving revision 1.105 diff -u -1 -0 -r1.104 -r1.105 --- gnu/java/awt/peer/gtk/GtkToolkit.java 22 Jun 2007 09:52:07 -0000 1.104 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 8 Feb 2008 22:17:40 -0000 1.105 @@ -32,20 +32,22 @@ 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 gnu.classpath.Configuration; + import gnu.java.awt.AWTUtilities; import gnu.java.awt.EmbeddedWindow; import gnu.java.awt.dnd.GtkMouseDragGestureRecognizer; import gnu.java.awt.dnd.peer.gtk.GtkDragSourceContextPeer; import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; import java.awt.AWTException; import java.awt.Button; import java.awt.Canvas; @@ -58,20 +60,21 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FileDialog; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Frame; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Image; +import java.awt.KeyboardFocusManager; import java.awt.Label; import java.awt.List; import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.Panel; import java.awt.Point; import java.awt.PopupMenu; import java.awt.PrintJob; import java.awt.Rectangle; @@ -95,20 +98,21 @@ import java.awt.image.ImageProducer; import java.awt.peer.ButtonPeer; import java.awt.peer.CanvasPeer; import java.awt.peer.CheckboxMenuItemPeer; import java.awt.peer.CheckboxPeer; import java.awt.peer.ChoicePeer; import java.awt.peer.DialogPeer; import java.awt.peer.FileDialogPeer; import java.awt.peer.FontPeer; import java.awt.peer.FramePeer; +import java.awt.peer.KeyboardFocusManagerPeer; import java.awt.peer.LabelPeer; import java.awt.peer.ListPeer; import java.awt.peer.MenuBarPeer; import java.awt.peer.MenuItemPeer; import java.awt.peer.MenuPeer; import java.awt.peer.MouseInfoPeer; import java.awt.peer.PanelPeer; import java.awt.peer.PopupMenuPeer; import java.awt.peer.RobotPeer; import java.awt.peer.ScrollPanePeer; @@ -118,28 +122,31 @@ import java.awt.peer.WindowPeer; import java.io.InputStream; import java.net.URL; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import javax.imageio.spi.IIORegistry; +import sun.awt.KeyboardFocusManagerPeerProvider; + /* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer(). This merits comment. We are basically calling Sun's bluff on this one. We think Sun has deprecated it simply to discourage its use as it is bad programming style. However, we need to get at a component's peer in this class. If getPeer() ever goes away, we can implement a hash table that will keep up with every window's peer, but for now this is faster. */ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit + implements KeyboardFocusManagerPeerProvider { static final Object GTK_LOCK; private static EventQueue q; static native void gtkInit(int portableNativeSync, Object lock); static native void gtkMain(); static native void gtkQuit(); @@ -163,21 +170,24 @@ { if (! initializedGlobalIDs) { initIDs(); initializedGlobalIDs = true; } } static { - System.loadLibrary("gtkpeer"); + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("gtkpeer"); + } /** * Gotta do that first. */ initializeGlobalIDs(); int portableNativeSync; String portNatSyncProp = System.getProperty("gnu.classpath.awt.gtk.portable.native.sync"); @@ -751,11 +761,16 @@ { return false; } @Override public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) { return false; } + public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) + { + return null; + } + } // class GtkToolkit