diff options
Diffstat (limited to 'libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java')
-rw-r--r-- | libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java index 468c46dc4af..8d63699eab8 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java @@ -43,6 +43,8 @@ import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; +import gnu.classpath.Pointer; + public class GtkGenericPeer { // Used by Native State Association (NSA) functions to map @@ -56,6 +58,40 @@ public class GtkGenericPeer protected final Object awtWidget; /** + * The pointer to the native GTK widget. + * + * This field is manipulated by native code. Don't change or remove + * without adjusting the native code. + */ + private Pointer widget; + + /** + * The pointer to the global reference to this object. The native + * code creates a JNI global reference of the peer object to be able + * to pass it to the event callbacks. It gets stored here, so that + * we can later delete it in the dispose() method. + * + * This field is manipulated by native code. Don't change or remove + * without adjusting the native code. + */ + private Pointer globalRef; + + /** + * We initialize the field IDs that are used by native code here because + * these remain valid until a class gets unloaded. + */ + static + { + GtkToolkit.initializeGlobalIDs(); + initIDs(); + } + + /** + * Initializes the field IDs that are used by the native code. + */ + private static native void initIDs(); + + /** * Dispose of our native state. Calls gtk_widget_destroy on the * native widget and removes the awtWidget from the native state * tables. Should be overridden by subclasses if this is not (all) |