[cp-patches] Patch: DropTargetDragEvent fix
Implemented a missing function 2006-08-15 Lillian Angel [EMAIL PROTECTED] * java/awt/dnd/DropTargetDragEvent.java (getTransferable): Implemented. Index: java/awt/dnd/DropTargetDragEvent.java === RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DropTargetDragEvent.java,v retrieving revision 1.6 diff -u -r1.6 DropTargetDragEvent.java --- java/awt/dnd/DropTargetDragEvent.java 17 Jul 2006 18:37:19 - 1.6 +++ java/awt/dnd/DropTargetDragEvent.java 15 Aug 2006 20:33:50 - @@ -147,7 +147,6 @@ */ public Transferable getTransferable() { -// FIXME: Not implemented -return null; +return context.getTransferable(); } } // class DropTargetDragEvent
[cp-patches] Patch: GtkDragSourceContextPeer fixlet
Small fix 2006-08-10 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (getComponentPeer): Added check to prevent NPE. Index: gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java,v retrieving revision 1.6 diff -u -r1.6 GtkDragSourceContextPeer.java --- gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 8 Aug 2006 15:40:49 - 1.6 +++ gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 10 Aug 2006 15:08:38 - @@ -87,6 +87,9 @@ ComponentPeer getComponentPeer(Component c) { +if (c == null) + return null; + Component curr = c; while (curr.getPeer() instanceof LightweightPeer) curr = curr.getParent();
[cp-patches] Re: FYI: Removed GTK drop target code from java/awt/Component.java
On Sat, 2006-08-05 at 11:28 +0200, Jeroen Frijters wrote: Hi, I commented out the GTK specific code in java/awt/Component.java. Component cannot have dependencies on any specific type of peer. Lillian could you please find a generic way to do what is required? Right now, its not possible to do it another way. I have removed this code and added a comment else where. Thanks for pointing this out. 2006-08-08 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added FIXME. Changed call to setTarget. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java (GtkDropTargetContextPeer): Removed target initialization. * java/awt/Component.java (setTarget): Removed commented out code. Regards, Jeroen 2006-08-05 Jeroen Frijters [EMAIL PROTECTED] * java/awt/Component.java (setDropTarget): Commented out GTK specific code. Index: gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java,v retrieving revision 1.5 diff -u -r1.5 GtkDragSourceContextPeer.java --- gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 28 Jul 2006 16:52:14 - 1.5 +++ gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 8 Aug 2006 15:37:25 - @@ -67,7 +67,7 @@ native void connectSignals(ComponentPeer comp); native void create(ComponentPeer comp); native void nativeSetCursor(int cursor); - native void setTarget(ComponentPeer target); + native void setTarget(GtkDropTargetContextPeer target); public GtkDragSourceContextPeer(DragGestureEvent e) { @@ -79,8 +79,10 @@ connectSignals(peer); cursor = comp.getCursor(); -if (target != null) - setTarget(target.getPeer()); +// FIXME: Where do we set the target? + +if ((target != null)) + setTarget(new GtkDropTargetContextPeer(target)); } ComponentPeer getComponentPeer(Component c) Index: gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java,v retrieving revision 1.3 diff -u -r1.3 GtkDropTargetContextPeer.java --- gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java 28 Jul 2006 15:52:06 - 1.3 +++ gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java 8 Aug 2006 15:37:25 - @@ -40,7 +40,6 @@ import gnu.java.awt.peer.gtk.GtkGenericPeer; -import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; @@ -55,7 +54,6 @@ public GtkDropTargetContextPeer(Object obj) { super(obj); -GtkDragSourceContextPeer.target = (Component) obj; } public void setTargetActions(int actions) Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.143 diff -u -r1.143 Component.java --- java/awt/Component.java 5 Aug 2006 09:28:06 - 1.143 +++ java/awt/Component.java 8 Aug 2006 15:37:26 - @@ -700,10 +700,7 @@ public void setDropTarget(DropTarget dt) { this.dropTarget = dt; -// XXX this is bogus, Component cannot have a dependency on GTK -// if (dropTarget != null) -// dropTarget.getDropTargetContext().addNotify( -// new GtkDropTargetContextPeer(this)); +dropTarget.addNotify(peer); } /**
[cp-patches] RE: FYI: Removed GTK drop target code from java/awt/Component.java
On Tue, 2006-08-08 at 17:52 +0200, Jeroen Frijters wrote: Jeroen Frijters wrote: Lillian Angel wrote: On Sat, 2006-08-05 at 11:28 +0200, Jeroen Frijters wrote: Hi, I commented out the GTK specific code in java/awt/Component.java. Component cannot have dependencies on any specific type of peer. Lillian could you please find a generic way to do what is required? Right now, its not possible to do it another way. I have removed this code and added a comment else where. Thanks for pointing this out. Thanks, but shouldn't setDropTarget check if peer == null and in that case store the drop target and call its addNotify in Component.addNotify? Oh I see it already does that, in that case I would think that all that is needed is an extra if (peer != null) around the dropTarget.addNotify() in setDropTarget. Ah, not really required but it is good to have. I have added the check in. Thanks 2006-08-08 Lillian Angel [EMAIL PROTECTED] * java/awt/Component.java (setDropTarget): Added check. Regards, Jeroen Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.144 diff -u -r1.144 Component.java --- java/awt/Component.java 8 Aug 2006 15:40:49 - 1.144 +++ java/awt/Component.java 8 Aug 2006 16:01:51 - @@ -700,7 +700,9 @@ public void setDropTarget(DropTarget dt) { this.dropTarget = dt; -dropTarget.addNotify(peer); + +if (peer != null) + dropTarget.addNotify(peer); } /**
[cp-patches] Patch: DnD stuff
I have implemented more functions/classes for DnD. It is still a work in progress and the native code is very much under construction, so please don't mind the mess. Now, we are able to drag from a source widget and drag to a target. The target is now recognized. We cannot drop the widget onto the target just yet. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added more static functions to handle widget signals. (create): Initialized the javaObj field. (connectSignals): Added code to connect all signals to the appropriate functions and initialized all java function fields. (drag_begin_cb): New callback, not implemented. (drag_motion_cb): Likewise. (drag_data_get_cb): Likewise. (drag_data_delete_cb): Likewise. (drag_drop_cb): Likewise. (drag_end_cb): Likewise. (drag_data_received_cb): Likewise. (setTarget): New function. (nativeStartDrag): Added code to set the destination and source widgets. * java/awt/dnd/DragSource.java (startDrag): Removed FIXME. * java/awt/dnd/DragGestureRecognizer.java (fireDragGestureRecognized): Reset recognizer when events are fired. * java/awt/Component.java (setDropTarget): Added code to create the DropTargetContextPeer. * include/GtkDragSourceContextPeer.h: Regenerated. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java: Removed file. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java (GtkDropTargetContextPeer): Implemented. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added code to set the target. Index: native/jni/gtk-peer/GtkDragSourceContextPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c,v retrieving revision 1.1 diff -u -r1.1 GtkDragSourceContextPeer.c --- native/jni/gtk-peer/GtkDragSourceContextPeer.c 17 Jul 2006 18:37:19 - 1.1 +++ native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 15:44:33 - @@ -42,7 +42,19 @@ #include gtk/gtk.h static GtkWidget * get_widget (GtkWidget *widget); - +static void drag_begin_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); +static gboolean drag_motion_cb (GtkWidget *w, GdkDragContext *dc, +gint x, gint y, guint t, gpointer data); +static void drag_data_get_cb (GtkWidget *w, GdkDragContext *dc, GtkSelectionData + *selection_data, guint info, guint t, gpointer data); +static void drag_data_delete_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); +static gboolean drag_drop_cb (GtkWidget *w, GdkDragContext *dc, gint x, +gint y, guint t, gpointer data); +static void drag_end_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); +static void drag_data_received_cb (GtkWidget *w, GdkDragContext *dc, gint x, +gint y, GtkSelectionData *selection_data, +guint info, guint t, gpointer data); + #define ACTION_COPY 1 #define ACTION_MOVE 2 #define ACTION_COPY_OR_MOVE 3 @@ -63,7 +75,21 @@ #define AWT_HAND_CURSOR 12 #define AWT_MOVE_CURSOR 13 +static jmethodID dragEnterID; +static jmethodID dragExitID; +static jmethodID dragDropEndID; +static jmethodID dragMouseMovedID; +static jmethodID dragOverID; +static jmethodID dragActionChangedID; +static jmethodID acceptDragID; +static jmethodID rejectDragID; +static jmethodID acceptDropID; +static jmethodID rejectDropID; +static jmethodID dropCompleteID; + GtkWidget *widget; +GtkWidget *tgt; +jobject javaObj; JNIEXPORT void JNICALL Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create @@ -72,7 +98,8 @@ void *ptr; gdk_threads_enter (); - + + javaObj = obj; NSA_SET_GLOBAL_REF (env, obj); NSA_SET_GLOBAL_REF (env, comp); @@ -93,6 +120,7 @@ gdk_threads_enter (); + javaObj = obj; ptr = NSA_GET_GLOBAL_REF (env, obj); switch (type) @@ -160,29 +188,137 @@ { jobject *gref; void *ptr; + jclass gtkdragsourcecontextpeer; + jclass gtkdroptargetcontextpeer; gdk_threads_enter (); + javaObj = obj; ptr = NSA_GET_GLOBAL_REF (env, obj); gref = NSA_GET_GLOBAL_REF (env, comp); - /* Uncomment when needed: g_signal_connect (G_OBJECT (widget), drag_motion, G_CALLBACK (drag_motion_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_begin, -G_CALLBACK (drag_begin_cb), *gref); + g_signal_connect (G_OBJECT (widget), drag_data_delete, +G_CALLBACK (drag_data_delete_cb), *gref); g_signal_connect (G_OBJECT (widget), drag_end, G_CALLBACK (drag_end_cb), *gref
Re: [cp-patches] FYI: DnD stuff
Added code to connect the signals to the target widget. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added new static helper function. (Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer _connectSignals): Moved code to connect signals to the helper function. (Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create): Removed ptr field and changed to use global gref. (connect_signals_for_widget): Implemented new helper. (setTarget): Added call to connect_signals_for_widget. On Fri, 2006-07-28 at 11:53 -0400, Lillian Angel wrote: I have implemented more functions/classes for DnD. It is still a work in progress and the native code is very much under construction, so please don't mind the mess. Now, we are able to drag from a source widget and drag to a target. The target is now recognized. We cannot drop the widget onto the target just yet. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added more static functions to handle widget signals. (create): Initialized the javaObj field. (connectSignals): Added code to connect all signals to the appropriate functions and initialized all java function fields. (drag_begin_cb): New callback, not implemented. (drag_motion_cb): Likewise. (drag_data_get_cb): Likewise. (drag_data_delete_cb): Likewise. (drag_drop_cb): Likewise. (drag_end_cb): Likewise. (drag_data_received_cb): Likewise. (setTarget): New function. (nativeStartDrag): Added code to set the destination and source widgets. * java/awt/dnd/DragSource.java (startDrag): Removed FIXME. * java/awt/dnd/DragGestureRecognizer.java (fireDragGestureRecognized): Reset recognizer when events are fired. * java/awt/Component.java (setDropTarget): Added code to create the DropTargetContextPeer. * include/GtkDragSourceContextPeer.h: Regenerated. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java: Removed file. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java (GtkDropTargetContextPeer): Implemented. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added code to set the target. Index: native/jni/gtk-peer/GtkDragSourceContextPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c,v retrieving revision 1.2 diff -u -r1.2 GtkDragSourceContextPeer.c --- native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 15:52:06 - 1.2 +++ native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 16:41:31 - @@ -42,6 +42,7 @@ #include gtk/gtk.h static GtkWidget * get_widget (GtkWidget *widget); +static void connect_signals_for_widget (GtkWidget *widget); static void drag_begin_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); static gboolean drag_motion_cb (GtkWidget *w, GdkDragContext *dc, gint x, gint y, guint t, gpointer data); @@ -89,21 +90,20 @@ GtkWidget *widget; GtkWidget *tgt; +jobject *gref; jobject javaObj; JNIEXPORT void JNICALL Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create (JNIEnv *env, jobject obj, jobject comp) { - void *ptr; - gdk_threads_enter (); javaObj = obj; NSA_SET_GLOBAL_REF (env, obj); NSA_SET_GLOBAL_REF (env, comp); - ptr = NSA_GET_PTR (env, comp); + gref = NSA_GET_PTR (env, comp); widget = get_widget (GTK_WIDGET (ptr)); gdk_threads_leave (); @@ -186,32 +186,15 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_connectSignals (JNIEnv *env, jobject obj, jobject comp) { - jobject *gref; - void *ptr; jclass gtkdragsourcecontextpeer; jclass gtkdroptargetcontextpeer; gdk_threads_enter (); javaObj = obj; - ptr = NSA_GET_GLOBAL_REF (env, obj); gref = NSA_GET_GLOBAL_REF (env, comp); - - g_signal_connect (G_OBJECT (widget), drag_motion, -G_CALLBACK (drag_motion_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_data_delete, -G_CALLBACK (drag_data_delete_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_end, -G_CALLBACK (drag_end_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_data_get, -G_CALLBACK (drag_data_get_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_data_received, -G_CALLBACK (drag_data_received_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_begin, -G_CALLBACK (drag_begin_cb), *gref); - g_signal_connect (G_OBJECT (widget), drag_drop, -G_CALLBACK (drag_drop_cb), *gref
Re: [cp-patches] FYI: DnD stuff
Fixed a small error. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: (Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create): Fixed to use gref not ptr. On Fri, 2006-07-28 at 12:43 -0400, Lillian Angel wrote: Added code to connect the signals to the target widget. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added new static helper function. (Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer _connectSignals): Moved code to connect signals to the helper function. (Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create): Removed ptr field and changed to use global gref. (connect_signals_for_widget): Implemented new helper. (setTarget): Added call to connect_signals_for_widget. On Fri, 2006-07-28 at 11:53 -0400, Lillian Angel wrote: I have implemented more functions/classes for DnD. It is still a work in progress and the native code is very much under construction, so please don't mind the mess. Now, we are able to drag from a source widget and drag to a target. The target is now recognized. We cannot drop the widget onto the target just yet. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added more static functions to handle widget signals. (create): Initialized the javaObj field. (connectSignals): Added code to connect all signals to the appropriate functions and initialized all java function fields. (drag_begin_cb): New callback, not implemented. (drag_motion_cb): Likewise. (drag_data_get_cb): Likewise. (drag_data_delete_cb): Likewise. (drag_drop_cb): Likewise. (drag_end_cb): Likewise. (drag_data_received_cb): Likewise. (setTarget): New function. (nativeStartDrag): Added code to set the destination and source widgets. * java/awt/dnd/DragSource.java (startDrag): Removed FIXME. * java/awt/dnd/DragGestureRecognizer.java (fireDragGestureRecognized): Reset recognizer when events are fired. * java/awt/Component.java (setDropTarget): Added code to create the DropTargetContextPeer. * include/GtkDragSourceContextPeer.h: Regenerated. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java: Removed file. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java (GtkDropTargetContextPeer): Implemented. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added code to set the target. Index: native/jni/gtk-peer/GtkDragSourceContextPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c,v retrieving revision 1.3 diff -u -r1.3 GtkDragSourceContextPeer.c --- native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 16:43:11 - 1.3 +++ native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 16:46:51 - @@ -104,7 +104,7 @@ NSA_SET_GLOBAL_REF (env, comp); gref = NSA_GET_PTR (env, comp); - widget = get_widget (GTK_WIDGET (ptr)); + widget = get_widget (GTK_WIDGET (gref)); gdk_threads_leave (); }
[cp-patches] Patch: GtkDragSourceContextPeer NPE fix
ChangeLog says it all... 2006-07-28 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added check to avoid NPE. Index: gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java,v retrieving revision 1.4 diff -u -r1.4 GtkDragSourceContextPeer.java --- gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 28 Jul 2006 15:52:06 - 1.4 +++ gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 28 Jul 2006 16:50:54 - @@ -78,7 +78,9 @@ create(peer); connectSignals(peer); cursor = comp.getCursor(); -setTarget(target.getPeer()); + +if (target != null) + setTarget(target.getPeer()); } ComponentPeer getComponentPeer(Component c)
Re: [cp-patches] FYI: DnD stuff
Apparently, this patch raised some problems with the builder. I have removed all stub functions until I implement them 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Removed function declarations. (connect_signals_for_widget): Removed implementation because stub functions have been removed. (drag_begin_cb): Removed function. (drag_motion_cb): Likewise. (drag_data_get_cb): Likewise. (drag_data_delete_cb): Likewise. (drag_drop_cb): Likewise. (drag_end_cb): Likewise. (drag_data_received_cb): Likewise. On Fri, 2006-07-28 at 11:53 -0400, Lillian Angel wrote: I have implemented more functions/classes for DnD. It is still a work in progress and the native code is very much under construction, so please don't mind the mess. Now, we are able to drag from a source widget and drag to a target. The target is now recognized. We cannot drop the widget onto the target just yet. 2006-07-28 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/GtkDragSourceContextPeer.c: Added more static functions to handle widget signals. (create): Initialized the javaObj field. (connectSignals): Added code to connect all signals to the appropriate functions and initialized all java function fields. (drag_begin_cb): New callback, not implemented. (drag_motion_cb): Likewise. (drag_data_get_cb): Likewise. (drag_data_delete_cb): Likewise. (drag_drop_cb): Likewise. (drag_end_cb): Likewise. (drag_data_received_cb): Likewise. (setTarget): New function. (nativeStartDrag): Added code to set the destination and source widgets. * java/awt/dnd/DragSource.java (startDrag): Removed FIXME. * java/awt/dnd/DragGestureRecognizer.java (fireDragGestureRecognized): Reset recognizer when events are fired. * java/awt/Component.java (setDropTarget): Added code to create the DropTargetContextPeer. * include/GtkDragSourceContextPeer.h: Regenerated. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java: Removed file. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java (GtkDropTargetContextPeer): Implemented. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Added code to set the target. Index: native/jni/gtk-peer/GtkDragSourceContextPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c,v retrieving revision 1.4 diff -u -r1.4 GtkDragSourceContextPeer.c --- native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 16:48:00 - 1.4 +++ native/jni/gtk-peer/GtkDragSourceContextPeer.c 28 Jul 2006 20:46:30 - @@ -43,18 +43,6 @@ static GtkWidget * get_widget (GtkWidget *widget); static void connect_signals_for_widget (GtkWidget *widget); -static void drag_begin_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); -static gboolean drag_motion_cb (GtkWidget *w, GdkDragContext *dc, -gint x, gint y, guint t, gpointer data); -static void drag_data_get_cb (GtkWidget *w, GdkDragContext *dc, GtkSelectionData - *selection_data, guint info, guint t, gpointer data); -static void drag_data_delete_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); -static gboolean drag_drop_cb (GtkWidget *w, GdkDragContext *dc, gint x, -gint y, guint t, gpointer data); -static void drag_end_cb (GtkWidget *w, GdkDragContext *dc, gpointer data); -static void drag_data_received_cb (GtkWidget *w, GdkDragContext *dc, gint x, -gint y, GtkSelectionData *selection_data, -guint info, guint t, gpointer data); #define ACTION_COPY 1 #define ACTION_MOVE 2 @@ -244,69 +232,8 @@ static void connect_signals_for_widget (GtkWidget *w) { - g_signal_connect (G_OBJECT (w), drag_motion, -G_CALLBACK (drag_motion_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_data_delete, -G_CALLBACK (drag_data_delete_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_end, -G_CALLBACK (drag_end_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_data_get, -G_CALLBACK (drag_data_get_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_data_received, -G_CALLBACK (drag_data_received_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_begin, -G_CALLBACK (drag_begin_cb), *gref); - g_signal_connect (G_OBJECT (w), drag_drop, -G_CALLBACK (drag_drop_cb), *gref); -} - -static void -drag_begin_cb
[cp-patches] Patch: GtkMouseDragGestureRecognizer implementation
Finished implementing GtkMouseDragGestureRecognizer. 2006-07-20 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java (GtkMouseDragGestureRecognizer): New constructor. (GtkMouseDragGestureRecognizer): New constructor. (GtkMouseDragGestureRecognizer): New constructor. (mouseClicked): Removed FIXME. (mousePressed): Implemented. (mouseReleased): Implemented. (mouseEntered): Implemented. (mouseDragged): Implemented to check mouse point and trigger origin. (mouseMoved): Removed FIXME. (getDropActionFromEvent): New helper function used to convert mouse event modifiers to a drop action. * java/awt/dnd/DragSource.java (getDragThreshold): Changed to return some arbitrary value for testing purposes. Index: gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java,v retrieving revision 1.1 diff -u -r1.1 GtkMouseDragGestureRecognizer.java --- gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 6 Jul 2006 19:47:05 - 1.1 +++ gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 21 Jul 2006 20:40:14 - @@ -39,7 +39,8 @@ package gnu.java.awt.dnd; import java.awt.Component; -import java.awt.dnd.DragGestureEvent; +import java.awt.Point; +import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragSource; import java.awt.dnd.MouseDragGestureRecognizer; @@ -48,21 +49,31 @@ public class GtkMouseDragGestureRecognizer extends MouseDragGestureRecognizer { - + DragSource ds; Component c; int actions; DragGestureListener dgl; + + public GtkMouseDragGestureRecognizer (DragSource ds) + { +this(ds, null, 0, null); + } + + public GtkMouseDragGestureRecognizer (DragSource ds, Component c) + { +this (ds, c, 0, null); + } - GtkMouseDragGestureRecognizer() + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act) { -super(null); +this(ds, c, act, null); } public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act, DragGestureListener dgl) { -super (ds, c, act, dgl); +super(ds, c, act, dgl); registerListeners(); @@ -74,37 +85,90 @@ public void mouseClicked (MouseEvent e) { -// FIXME: Not Implemented +// Nothing to do here. } public void mousePressed (MouseEvent e) { -// FIXME: Not Implemented +events.clear(); +if (getDropActionFromEvent(e) != DnDConstants.ACTION_NONE) + appendEvent(e); } public void mouseReleased (MouseEvent e) { -// FIXME: Not Implemented +events.clear(); } public void mouseEntered (MouseEvent e) { -// FIXME: Not Implemented +events.clear(); } - public void mouseExited (MouseEvent e) + public void mouseExited(MouseEvent e) { -// FIXME: Not Implemented +if (!events.isEmpty()) + if (getDropActionFromEvent(e) == DnDConstants.ACTION_NONE) +events.clear(); } public void mouseDragged(MouseEvent e) { -dgl.dragGestureRecognized(new DragGestureEvent(this, actions, e.getPoint(), - events)); +if (!events.isEmpty()) + { +int act = getDropActionFromEvent(e); + +if (act == DnDConstants.ACTION_NONE) + return; + +Point origin = ((MouseEvent) events.get(0)).getPoint(); +Point current = e.getPoint(); +int dx = Math.abs(origin.x - current.x); +int dy = Math.abs(origin.y - current.y); +int threshold = DragSource.getDragThreshold(); + +if (dx threshold || dy threshold) + fireDragGestureRecognized(act, origin); +else + appendEvent(e); + } } - + public void mouseMoved (MouseEvent e) { -// FIXME: Not Implemented +// Nothing to do here. + } + + private int getDropActionFromEvent(MouseEvent e) + { +int modEx = e.getModifiersEx(); +int buttons = modEx (MouseEvent.BUTTON1_DOWN_MASK + | MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK); +if (!(buttons == MouseEvent.BUTTON1_DOWN_MASK || +buttons == MouseEvent.BUTTON2_DOWN_MASK)) + return DnDConstants.ACTION_NONE; + +// Convert modifier to a drop action +int sourceActions = getSourceActions(); +int mod = modEx + (MouseEvent.SHIFT_DOWN_MASK | MouseEvent.CTRL_DOWN_MASK); +switch (mod) + { + case MouseEvent.SHIFT_DOWN_MASK | MouseEvent.CTRL_DOWN_MASK: +return DnDConstants.ACTION_LINK sourceActions; + case MouseEvent.CTRL_DOWN_MASK: +return DnDConstants.ACTION_COPY sourceActions; + case MouseEvent.SHIFT_DOWN_MASK: +return
Re: [cp-patches] FYI: GtkMouseDragGestureRecognizer implementation
I forgot to remove some unused fields in the last patch. 2006-07-20 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java: Removed unused fields. (GtkMouseDragGestureRecognizer): Removed initializations. On Fri, 2006-07-21 at 16:45 -0400, Lillian Angel wrote: Finished implementing GtkMouseDragGestureRecognizer. 2006-07-20 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java (GtkMouseDragGestureRecognizer): New constructor. (GtkMouseDragGestureRecognizer): New constructor. (GtkMouseDragGestureRecognizer): New constructor. (mouseClicked): Removed FIXME. (mousePressed): Implemented. (mouseReleased): Implemented. (mouseEntered): Implemented. (mouseDragged): Implemented to check mouse point and trigger origin. (mouseMoved): Removed FIXME. (getDropActionFromEvent): New helper function used to convert mouse event modifiers to a drop action. * java/awt/dnd/DragSource.java (getDragThreshold): Changed to return some arbitrary value for testing purposes. Index: gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java,v retrieving revision 1.2 diff -u -r1.2 GtkMouseDragGestureRecognizer.java --- gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 21 Jul 2006 20:44:30 - 1.2 +++ gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 21 Jul 2006 21:04:17 - @@ -50,11 +50,6 @@ extends MouseDragGestureRecognizer { - DragSource ds; - Component c; - int actions; - DragGestureListener dgl; - public GtkMouseDragGestureRecognizer (DragSource ds) { this(ds, null, 0, null); @@ -76,11 +71,6 @@ super(ds, c, act, dgl); registerListeners(); - -this.ds = ds; -this.c = c; -this.actions = act; -this.dgl = dgl; } public void mouseClicked (MouseEvent e)
[cp-patches] Patch: GtkDragSourceContextPeer.java
Implemented a few more functions in GtkDragSourceContextPeer. 2006-07-19 Lillian Angel [EMAIL PROTECTED] * examples/gnu/classpath/examples/awt/Demo.java (DragDropWindow): Fixed typo in Label text. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java (GtkDragSourceContextPeer): Removed unneeded initialization for field. (startDrag): Initialized context field. (transferablesFlavorsChanged): Removed FIXME. Nothing is done in this function. (dragEnter): New function. (dragExit): Likewise. (dragDropEnd): Likewise. (dragMouseMoved): Likewise. (dragOver): Likewise. (dragActionChanged): Likewise. Index: examples/gnu/classpath/examples/awt/Demo.java === RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/Demo.java,v retrieving revision 1.7 diff -u -r1.7 Demo.java --- examples/gnu/classpath/examples/awt/Demo.java 17 Jul 2006 18:37:19 - 1.7 +++ examples/gnu/classpath/examples/awt/Demo.java 19 Jul 2006 15:59:17 - @@ -863,8 +863,7 @@ extends SubFrame implements ActionListener, DropTargetListener { -DragLabel source = new DragLabel( - Drag and drop me to the following JButton, +DragLabel source = new DragLabel(Drag and drop me to the following Button, Label.CENTER); Button target = new Button(); Index: gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java,v retrieving revision 1.2 diff -u -r1.2 GtkDragSourceContextPeer.java --- gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 17 Jul 2006 18:37:19 - 1.2 +++ gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java 19 Jul 2006 15:59:17 - @@ -44,9 +44,11 @@ import java.awt.Cursor; import java.awt.Image; import java.awt.Point; -import java.awt.Window; import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragSourceContext; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; import java.awt.dnd.InvalidDnDOperationException; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.peer.ComponentPeer; @@ -56,10 +58,9 @@ extends GtkGenericPeer implements DragSourceContextPeer { - - private DragGestureEvent dge; private ComponentPeer peer; private Cursor cursor; + private DragSourceContext context; native void nativeStartDrag(Image i, int x, int y, int action, String target); native void connectSignals(ComponentPeer comp); @@ -69,11 +70,9 @@ public GtkDragSourceContextPeer(DragGestureEvent e) { super(e.getComponent()); -dge = e; - Component comp = e.getComponent(); - peer = getComponentPeer(comp); + create(peer); connectSignals(peer); cursor = comp.getCursor(); @@ -93,6 +92,8 @@ public void startDrag(DragSourceContext context, Cursor c, Image i, Point p) throws InvalidDnDOperationException { +this.context = context; + if (p == null) p = new Point(); @@ -120,6 +121,54 @@ public void transferablesFlavorsChanged() { -// FIXME: Not Implemented +// Nothing to do here. + } + + /** + * Called from native code. + */ + + public void dragEnter(int action, int modifiers) + { +context.dragEnter(new DragSourceDragEvent(context, action, + action + context.getSourceActions(), + modifiers)); + } + + public void dragExit(int action, int x, int y) + { +context.dragExit(new DragSourceEvent(context, x, y)); + } + + public void dragDropEnd(int action, boolean success, int x, int y) + { +context.dragDropEnd(new DragSourceDropEvent(context, action, success, x, y)); + } + + public void dragMouseMoved(int action, int modifiers) + { +context.dragMouseMoved(new DragSourceDragEvent(context, + action, + action +context.getSourceActions(), + modifiers)); + } + + public void dragOver(int action, int modifiers) + { +context.dragOver(new DragSourceDragEvent(context, action, + action + context.getSourceActions(), + modifiers)); + } + + public void dragActionChanged(int newAction, int modifiers) + { +context.dropActionChanged(new DragSourceDragEvent(context
Re: [cp-patches] RFA: FlowLayout.java
On Fri, 2006-07-14 at 10:10 -0400, Tania Bento wrote: Hey, According to Java's API, setHgap and setVgap do not throw an Illegal Argument Exception if hgap or vgap are negative values. Two Intel tests now pass on Classpath (test.java.awt.FlowLayoutTest.testGetSetHgap() and test.java.awt.FlowLayoutTest.testGetSetVgap()). Could someone please comment on and/or approve this patch. Can you update the comments for these functions to reflect the changes? Otherwise, someone is bound to put the exception throwing back in. I think it is good fine to commit. Lillian Thanks. Tania 2006-07-14 Tania Bento [EMAIL PROTECTED] * java/awt/FlowLayout.java (setHgap): Illegal Argument Exception should not be thrown if hgap has a negative value. (setVgap): Illegal Argument Exception should not be thrown if vgap has a negative value.
Re: [cp-patches] RFA: Canvas.java
On Thu, 2006-07-06 at 12:54 -0400, Tania Bento wrote: Hey, This patch fixes a Harmony Test that was failing on Classpath. We now generate the canvas name in the same manner as Sun. If someone could please approve/comment on this patch, that would be great. 2006-07-06 Tania Bento [EMAIL PROTECTED] * gnu/java/awt/Canvas.java Added new private variable 'next_canvas_number. (generateName): Added. (getUniqueLong): Added. There are several components that also generate a name on Sun (like Panels, etc). It would be good if this was added to all the appropriate ones. Lillian Thanks, Tania
[cp-patches] Patch: DragSource.startDrag implementation
After reading some articles on DnD, I figured out how to implement startDrag. I added a bunch of comments (and a referring URL) into the function. 2006-07-06 Lillian Angel [EMAIL PROTECTED] * java/awt/dnd/DragSource.java (startDrag): Implemented. Added comments describing what the function should do. Removed FIXME. Index: java/awt/dnd/DragSource.java === RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragSource.java,v retrieving revision 1.7 diff -u -r1.7 DragSource.java --- java/awt/dnd/DragSource.java 5 Jul 2006 17:45:50 - 1.7 +++ java/awt/dnd/DragSource.java 6 Jul 2006 17:34:03 - @@ -127,9 +127,39 @@ Image dragImage, Point imageOffset, Transferable trans, DragSourceListener dsl, FlavorMap map) -throws NotImplementedException { -// FIXME: Implement this +// http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html + +// This function creates a DragSourceContext object. This object tracks the +// state of the operation by listening to a native peer. In this situation, +// the DragSource may be obtained from the event or by an instance variable. +// This function also creates a new DragSourceContextPeer. + +// This function sends the same message to the context, which then forwards +// it to the peer, passing itself as a parameter. Now, the native system has +// access to the Transferable through the context. + +try + { +flavorMap = map; +DragSourceContextPeer peer = Toolkit.getDefaultToolkit(). + createDragSourceContextPeer(trigger); +DragSourceContext context = createDragSourceContext(peer, trigger, +dragCursor, +dragImage, +imageOffset, trans, +dsl); + +if (peer == null) + throw new InvalidDnDOperationException(); + +peer.startDrag(context, dragCursor, dragImage, imageOffset); + } +catch (Exception e) + { +throw new InvalidDnDOperationException(Drag and Drop system is ++ unable to initiate a drag operation.); + } } /**
[cp-patches] Patch: DnD peers
I have started to implemented the peers for Drag and Drop. It is coming along :) Most of the functions in the peers are still not implemented. I am working on it. 2006-07-06 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java: New class not fully implemented. * gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java: New class not fully implemented. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java: New class not fully implemented. * gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java: New class not fully implemented. * nu/java/awt/peer/gtk/GtkToolkit.java: Fixed Imports. (createDragSourceContextPeer): Implemented. (createDragGestureRecognizer): New function to override java.awt.Toolkit.createDragGestureRecognizer. * java/awt/dnd/DragSource.java (NoDragGestureRecognizer): Removed inner class. (createDragGestureRecognizer): Re-Implemented to call Toolkit's createDragGestureRecognizer. (createDefaultDragGestureRecognizer): Re-Implemented to call Toolkit's createDragGestureRecognizer. * java/awt/dnd/DropTarget.java (addNotify): Added check to determine type of peer and call addDropTarget. (removeNotify): Added call to removeDropTarget. Index: gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java === RCS file: gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java diff -N gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java --- /dev/null 1 Jan 1970 00:00:00 - +++ gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 6 Jul 2006 19:40:20 - @@ -0,0 +1,110 @@ +/* GtkMouseDragGestureRecognizer.java -- + Copyright (C) 2006 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., 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 +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.dnd; + +import java.awt.Component; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.MouseDragGestureRecognizer; +import java.awt.event.MouseEvent; + +public class GtkMouseDragGestureRecognizer +extends MouseDragGestureRecognizer +{ + + DragSource ds; + Component c; + int actions; + DragGestureListener dgl; + + GtkMouseDragGestureRecognizer() + { +super(null); + } + + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act, +DragGestureListener dgl) + { +super (ds, c, act, dgl); + +registerListeners(); + +this.ds = ds; +this.c = c; +this.actions = act; +this.dgl = dgl; + } + + public void mouseClicked (MouseEvent e) + { +// FIXME: Not Implemented + } + + public void mousePressed (MouseEvent e) + { +// FIXME: Not Implemented + } + + public void mouseReleased (MouseEvent e) + { +// FIXME: Not Implemented + } + + public void mouseEntered (MouseEvent e) + { +// FIXME: Not Implemented + } + + public void mouseExited (MouseEvent e) + { +// FIXME: Not Implemented + } + + public void mouseDragged(MouseEvent e) + { +dgl.dragGestureRecognized(new DragGestureEvent(this, actions, e.getPoint(), + events
[cp-patches] Patch: BasicMenuUI
Implemented some missing functions to make JAPI a little happier. I marked a couple of functions as unimplemented, as well. 2006-07-04 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicMenuUI.java (installKeyboardActions): Implemented to call super. Nothing else needs to be done here. (setupPostTimer): Marked as unimplemented. (uninstallKeyboardActions): Implemented to call super. Nothing else needs to be done here. (mouseMoved): Removed TODO. Nothing to be done here. (ChangeHandler): Implemented. (menuDragMouseExited): Removed TODO. Nothing to be done here. (menuDragMouseReleased): Removed TODO. Nothing to be done here. (menuKeyReleased): Removed TODO. Nothing to be done here. (menuKeyTyped): Marked as unimplemented. Index: javax/swing/plaf/basic/BasicMenuUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuUI.java,v retrieving revision 1.24 diff -u -r1.24 BasicMenuUI.java --- javax/swing/plaf/basic/BasicMenuUI.java 21 Jun 2006 13:13:40 - 1.24 +++ javax/swing/plaf/basic/BasicMenuUI.java 4 Jul 2006 16:11:55 - @@ -220,9 +220,8 @@ * */ protected void installKeyboardActions() -throws NotImplementedException { -// FIXME: Need to implement +super.installKeyboardActions(); } /** @@ -235,6 +234,7 @@ } protected void setupPostTimer(JMenu menu) + throws NotImplementedException { // TODO: Implement this properly. } @@ -263,9 +263,8 @@ * Basic look and feel's defaults. */ protected void uninstallKeyboardActions() -throws NotImplementedException { -// FIXME: Need to implement +super.installKeyboardActions(); } /** @@ -348,7 +347,7 @@ public void mouseMoved(MouseEvent e) { - // TODO: What should be done here, if anything? + // Nothing to do here. } public void mousePressed(MouseEvent e) @@ -469,7 +468,8 @@ */ public ChangeHandler(JMenu m, BasicMenuUI ui) { - // Not used. + menu = m; + this.ui = ui; } /** @@ -517,7 +517,7 @@ */ public void menuDragMouseExited(MenuDragMouseEvent e) { - // TODO: What should be done here, if anything? + // Nothing to do here. } /** @@ -528,7 +528,7 @@ */ public void menuDragMouseReleased(MenuDragMouseEvent e) { - // TODO: What should be done here, if anything? + // Nothing to do here. } } @@ -545,7 +545,7 @@ */ public void menuKeyPressed(MenuKeyEvent e) { - // TODO: What should be done here, if anything? + // Nothing to do here. } /** @@ -555,7 +555,7 @@ */ public void menuKeyReleased(MenuKeyEvent e) { - // TODO: What should be done here, if anything? + // Nothing to do here. } /** @@ -565,6 +565,7 @@ * @param e A [EMAIL PROTECTED] MenuKeyEvent}. */ public void menuKeyTyped(MenuKeyEvent e) +throws NotImplementedException { // TODO: What should be done here, if anything? }
[cp-patches] Patch: DragSourceContext implementation
Implemented some missing functions. 2006-07-04 Lillian Angel [EMAIL PROTECTED] * java/awt/dnd/DragSourceContext.java (DragSourceContext): Implemented fully. Fixed API docs. (transferablesFlavorsChanged): Implemented. (dragEnter): Implemented. (dragOver): Implemented. (dragExit): Implemented. (dropActionChanged): Implemented. (dragDropEnd): Implemented. Index: java/awt/dnd/DragSourceContext.java === RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragSourceContext.java,v retrieving revision 1.8 diff -u -r1.8 DragSourceContext.java --- java/awt/dnd/DragSourceContext.java 22 Mar 2006 19:15:24 - 1.8 +++ java/awt/dnd/DragSourceContext.java 4 Jul 2006 18:54:04 - @@ -82,16 +82,17 @@ * are null, the drag action for the trigger event is DnDConstants.ACTION_NONE * or if the source actions for the DragGestureRecognizer associated with the * trigger event are equal to DnDConstants.ACTION_NONE. - * @exception NullPointerException If peer or trigger is null. + * @exception NullPointerException If peer, trans or trigger is null or if the + * image is not null but the offset is. */ public DragSourceContext (DragSourceContextPeer peer, DragGestureEvent trigger, Cursor cursor, Image image, Point offset, Transferable trans, DragSourceListener dsl) -throws NotImplementedException - { + { if (peer == null -|| trigger == null) +|| trigger == null || trans == null +|| (image != null offset == null)) throw new NullPointerException (); if (trigger.getComponent () == null @@ -108,8 +109,6 @@ this.offset = offset; this.transferable = trans; this.dragSourceListener = dsl; - -throw new Error (not implemented); } public DragSource getDragSource() @@ -165,34 +164,52 @@ dragSourceListener = null; } + /** + * This function tells the peer that the DataFlavors have been modified. + */ public void transferablesFlavorsChanged() -throws NotImplementedException { +peer.transferablesFlavorsChanged(); } + /** + * Calls dragEnter on the DragSourceListener registered with this. + */ public void dragEnter(DragSourceDragEvent e) -throws NotImplementedException { +dragSourceListener.dragEnter(e); } + /** + * Calls dragOver on the DragSourceListener registered with this. + */ public void dragOver(DragSourceDragEvent e) -throws NotImplementedException { +dragSourceListener.dragOver(e); } - + + /** + * Calls dragExit on the DragSourceListener registered with this. + */ public void dragExit(DragSourceEvent e) -throws NotImplementedException { +dragSourceListener.dragExit(e); } + /** + * Calls dropActionChanged on the DragSourceListener registered with this. + */ public void dropActionChanged(DragSourceDragEvent e) -throws NotImplementedException { +dragSourceListener.dropActionChanged(e); } + /** + * Calls dragDropEnd on the DragSourceListener registered with this. + */ public void dragDropEnd(DragSourceDropEvent e) -throws NotImplementedException { +dragSourceListener.dragDropEnd(e); } public void dragMouseMoved(DragSourceDragEvent e)
[cp-patches] Patch: more DragSourceContext
Fixed up the API documentation and implemented some more missing functions according to the API. I will write a demo for this when it is in a working state. 2006-07-04 Lillian Angel [EMAIL PROTECTED] * java/awt/dnd/DragSourceContext.java: Removed FIXMEs from fields. (DragSourceContext): Added code to initialize cursor and sourceActions. (getDragSource): Added documentation. (getComponent): Likewise. (getTrigger): Likewise. (getSourceActions): Added documentation and implemented. (setCursor): Implemented. Added documentation. (getCursor): Implemented. Added documentation. (dragEnter): Added code to notify DragSource's listeners. (dragOver): Likewise. (dragExit): Likewise. (dropActionChanged): Likewise. (dragDropEnd): Likewise. (dragMouseMoved): Implemented. (getTransferable): Added API documentation. (updateCurrentCursor): Added API documentation and partially implemented. Index: java/awt/dnd/DragSourceContext.java === RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragSourceContext.java,v retrieving revision 1.9 diff -u -r1.9 DragSourceContext.java --- java/awt/dnd/DragSourceContext.java 4 Jul 2006 18:56:27 - 1.9 +++ java/awt/dnd/DragSourceContext.java 4 Jul 2006 20:19:15 - @@ -70,8 +70,8 @@ private Transferable transferable; private DragGestureEvent trigger; private DragSourceListener dragSourceListener; - private boolean useCustomCursor; // FIXME: currently unused but needed for serialization. - private int sourceActions; // FIXME: currently unused but needed for serialization. + private boolean useCustomCursor; + private int sourceActions; private Image image; private Point offset; @@ -109,35 +109,77 @@ this.offset = offset; this.transferable = trans; this.dragSourceListener = dsl; +this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions(); + +setCursor(cursor); +updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT); } + /** + * Returns the DragSource object associated with the + * DragGestureEvent. + * + * @return the DragSource associated with the trigger. + */ public DragSource getDragSource() { return trigger.getDragSource (); } + /** + * Returns the component associated with this. + * + * @return the component associated with the trigger. + */ public Component getComponent() { return trigger.getComponent (); } + /** + * Gets the trigger associated with this. + * + * @return the trigger. + */ public DragGestureEvent getTrigger() { return trigger; } + /** + * Returns the source actions for the DragGestureRecognizer. + * + * @return the source actions for DragGestureRecognizer. + */ public int getSourceActions() { -return trigger.getSourceAsDragGestureRecognizer ().getSourceActions (); +if (sourceActions == 0) + sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions(); +return sourceActions; } - public void setCursor (Cursor cursor) -throws NotImplementedException + /** + * Sets the cursor for this drag operation to the specified cursor. + * + * @param cursor c - the Cursor to use, or null to use the default drag + * cursor. + */ + public void setCursor(Cursor cursor) { +if (cursor == null) + useCustomCursor = false; +else + useCustomCursor = true; this.cursor = cursor; -// FIXME: Check if we need to do more here +peer.setCursor(cursor); } + /** + * Returns the current cursor or null if the default + * drag cursor is used. + * + * @return the current cursor or null. + */ public Cursor getCursor() { return cursor; @@ -173,57 +215,151 @@ } /** - * Calls dragEnter on the DragSourceListener registered with this. + * Calls dragEnter on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDragEvent */ public void dragEnter(DragSourceDragEvent e) { -dragSourceListener.dragEnter(e); +if (dragSourceListener != null) + dragSourceListener.dragEnter(e); + +DragSource ds = getDragSource(); +DragSourceListener[] dsl = ds.getDragSourceListeners(); +for (int i = 0; i dsl.length; i++) + dsl[i].dragEnter(e); + +updateCurrentCursor(e.getDropAction(), e.getTargetActions(), ENTER); } /** - * Calls dragOver on the DragSourceListener registered with this. + * Calls dragOver on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDragEvent */ public void dragOver(DragSourceDragEvent e) { -dragSourceListener.dragOver(e); +if (dragSourceListener != null
[cp-patches] Patch: Checkbox group fix
This patch fixes the long standing problem of not being able to dynamically switch between a checkbox and a radio button. I.e. moving a checkbox to a checkbox group changes the checkbox to a radio button. Tom helped a lot with this patch. He removed the CheckboxGroupPeer and we fixed it so everything is handled in GtkCheckboxPeer. There is a mauve test for this. The harmony test (test.java.awt.CheckboxTest) now passes. 2006-06-30 Lillian Angel [EMAIL PROTECTED] Tom Fitzsimmons [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java: Removed class. * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: Added current_group, groupMap fields. Added definitions for new native functions. (create): Removed FIXME. Added code to create the check button or radio button when appropriate. Updated groupMap to contain pointer to the newly created group. (setCheckboxGroup): Added code to handle all cases. Removing a button from a group, adding a button to a group, or changing the group of a button. (dispose): Changed to call super. * include/Makefile.am: Removed reference to gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h. * include/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h: Removed file. * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Added definitions for new functions. * native/jni/gtk-peer/Makefile.am: Removed reference to gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c: Removed file. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_combobox_get_widget): Renamed to checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectSignals): Changed to use checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup): Removed. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont): Changed to use checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel): Likewise. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createCheckButton): New function. Creates checkbutton without a group. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): Creates a radio button in a group, using groupPointer. If groupPointer is 0, then a new group is created. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addToGroup): Adds the check button to a group, using groupPointer. A radio button is created in its place. If groupPointer is 0, then a new group is created. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): The radio button is removed from the group. A check button is created in its place. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): The radio button is moved to a new group. Index: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java === RCS file: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java diff -N gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java 2 Jul 2005 20:32:12 - 1.3 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,86 +0,0 @@ -/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup - Copyright (C) 2002 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., 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 -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
Re: [cp-patches] Patch: Checkbox group fix
Hi, I fixed the issues Tom stated below. On Fri, 2006-06-30 at 13:03 -0400, Thomas Fitzsimmons wrote: Hi, Lillian Angel wrote: This patch fixes the long standing problem of not being able to dynamically switch between a checkbox and a radio button. I.e. moving a checkbox to a checkbox group changes the checkbox to a radio button. Tom helped a lot with this patch. He removed the CheckboxGroupPeer and we fixed it so everything is handled in GtkCheckboxPeer. There is a mauve test for this. The harmony test (test.java.awt.CheckboxTest) now passes. [...] + if (groupPointer != 0) + { +native_group = JLONG_TO_PTR (GSList, groupPointer); +if(! GTK_IS_RADIO_BUTTON (native_group-data)) + native_group = NULL; When does it happen that the data field is not a GtkRadioButton? I suspect only after removing a Checkbox from a CheckboxGroup? This is likely a memory leak -- if the native_group's data field is no longer valid then we should probably free the GSList. Gtk actually frees the list when needed. I changed these checks to asserts and set the native_group to null in *_removeFromGroup (when needed). [...] + gdk_threads_leave (); + + return PTR_TO_JLONG (native_group); I realized that there is a race condition here. Instead of returning the pointer value, we should use JNI to set the groupPointer field with the GDK lock held. I changed all functions in GtkCheckboxPeer to be syncronized, and added a new function to put the new group in the groupMap. This function is called from the native peer. [...] + NSA_DEL_PTR (env, obj); + NSA_SET_PTR (env, obj, container); The NSA table points to the containing event box, so I don't think these two lines are necessary. Removed 2006-06-30 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: Changed all return values of native functions to void. (create): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (setState): Changed function to be syncronized. (setLabel): Changed function to be syncronized. (setCheckboxGroup): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (postItemEvent): Changed function to be syncronized. (addToGroupMap): New function. Called by native code to add new value to the group. (dispose): Changed function to be syncronized. * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Updated all functions. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (cp_gtk_checkbox_init_jni): Added code to link to java function. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): Changed return value to void. Added call to java function to set pointer in groupMap. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addtoGroup): Likewise. Also, changed check to an assert. Also, removed call to set/del pointer. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): Likewise. Also, added check to determine if native_group should be set to NULL. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): Likewise. Committed, Lillian Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.26 diff -u -r1.26 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 14:47:17 - 1.26 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:19:55 - @@ -60,11 +60,11 @@ private static WeakHashMap groupMap = new WeakHashMap(); public native void createCheckButton (); - public native long createRadioButton (long groupPointer); + public native void createRadioButton (long groupPointer); - public native long addToGroup (long groupPointer); - public native long removeFromGroup (); - public native long switchToGroup (long groupPointer); + public native void addToGroup (long groupPointer); + public native void removeFromGroup (); + public native void switchToGroup (long groupPointer); public native void connectSignals (); @@ -80,7 +80,7 @@ super (c); } - public void create () + public synchronized void create () { Checkbox checkbox = (Checkbox) awtComponent; current_group = checkbox.getCheckboxGroup (); @@ -100,15 +100,14 @@ { // We don't know about this group. Create a new native // group pointer for this group and store it in our map. -groupMap.put(current_group, new Long (createRadioButton(0))); + createRadioButton(0); } else
Re: [cp-patches] FYI: Checkbox group fix
fitzsim suggested that not all functions be synchronized, but there be a synchronized block around the code that adds the new pointer to the groupMap. Fixed. 2006-06-30 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java (create): Changed to be non-synchronized. (setLabel): Likewise. (setCheckboxGroup): Likewise. (addToGroupMap): Likewise. Added synchronized block around code. (dispose): Changed to be non-synchronized. On Fri, 2006-06-30 at 15:31 -0400, Lillian Angel wrote: Hi, I fixed the issues Tom stated below. On Fri, 2006-06-30 at 13:03 -0400, Thomas Fitzsimmons wrote: Hi, Lillian Angel wrote: This patch fixes the long standing problem of not being able to dynamically switch between a checkbox and a radio button. I.e. moving a checkbox to a checkbox group changes the checkbox to a radio button. Tom helped a lot with this patch. He removed the CheckboxGroupPeer and we fixed it so everything is handled in GtkCheckboxPeer. There is a mauve test for this. The harmony test (test.java.awt.CheckboxTest) now passes. [...] + if (groupPointer != 0) + { +native_group = JLONG_TO_PTR (GSList, groupPointer); +if(! GTK_IS_RADIO_BUTTON (native_group-data)) + native_group = NULL; When does it happen that the data field is not a GtkRadioButton? I suspect only after removing a Checkbox from a CheckboxGroup? This is likely a memory leak -- if the native_group's data field is no longer valid then we should probably free the GSList. Gtk actually frees the list when needed. I changed these checks to asserts and set the native_group to null in *_removeFromGroup (when needed). [...] + gdk_threads_leave (); + + return PTR_TO_JLONG (native_group); I realized that there is a race condition here. Instead of returning the pointer value, we should use JNI to set the groupPointer field with the GDK lock held. I changed all functions in GtkCheckboxPeer to be syncronized, and added a new function to put the new group in the groupMap. This function is called from the native peer. [...] + NSA_DEL_PTR (env, obj); + NSA_SET_PTR (env, obj, container); The NSA table points to the containing event box, so I don't think these two lines are necessary. Removed 2006-06-30 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: Changed all return values of native functions to void. (create): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (setState): Changed function to be syncronized. (setLabel): Changed function to be syncronized. (setCheckboxGroup): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (postItemEvent): Changed function to be syncronized. (addToGroupMap): New function. Called by native code to add new value to the group. (dispose): Changed function to be syncronized. * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Updated all functions. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (cp_gtk_checkbox_init_jni): Added code to link to java function. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): Changed return value to void. Added call to java function to set pointer in groupMap. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addtoGroup): Likewise. Also, changed check to an assert. Also, removed call to set/del pointer. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): Likewise. Also, added check to determine if native_group should be set to NULL. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): Likewise. Committed, Lillian Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.27 diff -u -r1.27 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:28:21 - 1.27 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:52:25 - @@ -80,7 +80,7 @@ super (c); } - public synchronized void create () + public void create () { Checkbox checkbox = (Checkbox) awtComponent; current_group = checkbox.getCheckboxGroup (); @@ -133,12 +133,12 @@ } } - public synchronized void setLabel (String label) + public void setLabel (String label) { gtkButtonSetLabel (label); } - public synchronized void setCheckboxGroup (CheckboxGroup group) + public void setCheckboxGroup
Re: [cp-patches] RFA: JMenu Constructor Regressions
I looked over all your patches. They look fine. Go ahead and commit them. Lillian On Wed, 2006-06-21 at 09:32 -0400, Tania Bento wrote: Hey, For some reason when I did a CVS diff to create the patch for these changes, the change I made to BasicPopupMenuUI.java wasn't included. I only realized this afterwards. Again, this change was due to the mauve test I created (getPopUPMenu.java) that I have already committed. Below is the changelog entry for this change. When someone approves this patch, I'll combine the two changelog entries when I commit it. Thanks. Here's the changelog entry: 2006-06-21 Tania Bento [EMAIL PROTECTED] *javax/swing/plaf/basic/BasicPopupMenu.UI.java (popupMenuWillBecomeVisible): Component Listener should only be added to the root container if the root container is not null. This avoids a null pointer exception. Cheers, Tania On Tue, 2006-06-20 at 16:53 -0400, Tania Bento wrote: Sorry, forgot to mention that these specific changes are due to the getPopUpMenu.java mauve test I just committed. Tania On Tue, 2006-06-20 at 16:52 -0400, Tania Bento wrote: Hey, I have written a test for all of JMenu's constructors and found many constructor regressions. This patches fixes all of them. Could someone please approve this patch so that I may commit it. Thanks. Here's the Changelog entry: 2006-06-20 Tania Bento [EMAIL PROTECTED] * javax/swing/JMenu.java Changed instantiation of popupMenu to null. (JMenu): Instantiated popupMenu to new JPopupMenu. (JMenu): Instantiated popupMenu to new JPopupMenu. (add): Changed popupMenu to getPopupMenu(). (add): Changed popupMenu to getPopupMenu(). (add): Changed popupMenu to getPopupMenu(). (add): Changed popupMenu to getPopupMenu(). (remove): Changed popupMenu to getPopupMenu(). (remove): Changed popupMenu to getPopupMenu(). (insert): Changed popupMenu to getPopupMenu(). (setSelectedHelper): Changed popupMenu to getPopupMenu(). (isPopupMenuVisible): Changed popupMenu to getPopupMenu(). (setPopupMenuVisible): Changed popupMenu to getPopupMenu(). (getMenuComponentCount): Changed popupMenu to getPopupMenu(). (getMenuComponents): Changed popupMenu to getPopupMenu(). (getPopupMenu): Check first if popupMenu is null and if so, instantiate it to a new JPopupMenu and set the invoker.
[cp-patches] Patch: DefaultCaret fixlet
Resolved a couple of NPEs. 2006-06-21 Lillian Angel [EMAIL PROTECTED] * javax/swing/text/DefaultCaret.java (install): Added check to prevent NPE. (propertyChange): Added checks to prevent NPEs. Index: javax/swing/text/DefaultCaret.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v retrieving revision 1.41 diff -u -r1.41 DefaultCaret.java --- javax/swing/text/DefaultCaret.java 11 May 2006 16:29:29 - 1.41 +++ javax/swing/text/DefaultCaret.java 21 Jun 2006 15:32:34 - @@ -221,9 +221,12 @@ if (name.equals(document)) { Document oldDoc = (Document) e.getOldValue(); - oldDoc.removeDocumentListener(documentListener); + if (oldDoc != null) +oldDoc.removeDocumentListener(documentListener); + Document newDoc = (Document) e.getNewValue(); - newDoc.addDocumentListener(documentListener); + if (newDoc != null) +newDoc.addDocumentListener(documentListener); } else if (name.equals(editable)) { @@ -708,7 +711,11 @@ propertyChangeListener = new PropertyChangeHandler(); textComponent.addPropertyChangeListener(propertyChangeListener); documentListener = new DocumentHandler(); -textComponent.getDocument().addDocumentListener(documentListener); + +Document doc = textComponent.getDocument(); +if (doc != null) + doc.addDocumentListener(documentListener); + active = textComponent.isEditable() textComponent.isEnabled(); repaint();
[cp-patches] Patch: CairoGraphics2D fix
This fixes the painting of the grid in the chess applet. updateColor() needs to be called before returning. 2006-06-20 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/CairoGraphics2D.java (drawImage): Added call to updateColor because Cairo seems to lose the current color. Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.26 diff -u -r1.26 CairoGraphics2D.java --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 19 Jun 2006 20:28:22 - 1.26 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 20 Jun 2006 13:56:26 - @@ -1233,6 +1233,7 @@ if(db instanceof CairoSurface) { ((CairoSurface)db).drawSurface(nativePointer, i2u, alpha); +updateColor(); return true; }
[cp-patches] Patch: JTextComponent.AccessibleJTextComponent javadocs rewrite
I rewrote the docs for this inner class. 2006-06-20 Lillian Angel [EMAIL PROTECTED] * javax/swing/text/JTextComponent.java (AccessibleJTextComponent): Rewrote all javadocs for this inner class. Index: javax/swing/text/JTextComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v retrieving revision 1.58 diff -u -r1.58 JTextComponent.java --- javax/swing/text/JTextComponent.java 15 May 2006 13:01:03 - 1.58 +++ javax/swing/text/JTextComponent.java 20 Jun 2006 18:22:57 - @@ -90,9 +90,10 @@ implements Scrollable, Accessible { /** - * This class implements accessibility support for the JTextComponent class. - * It provides an implementation of the Java Accessibility API appropriate - * to menu user-interface elements. + * AccessibleJTextComponent implements accessibility hooks for + * JTextComponent. It allows an accessibility driver to read and + * manipulate the text component's contents as well as update UI + * elements such as the caret. */ public class AccessibleJTextComponent extends AccessibleJComponent implements AccessibleText, CaretListener, DocumentListener, AccessibleAction, @@ -100,15 +101,18 @@ { private static final long serialVersionUID = 7664188944091413696L; -/** The caret's offset. */ +/** + * The caret's offset. + */ int dot = 0; - -/** The current JTextComponent. */ + +/** + * The current JTextComponent. + */ JTextComponent textComp = JTextComponent.this; - + /** - * Constructs an AccessibleJTextComponent. - * Adds a listener to track caret change. + * Construct an AccessibleJTextComponent. */ public AccessibleJTextComponent() { @@ -117,11 +121,10 @@ } /** - * Returns the zero-based offset of the caret. Note: The character - * to the right of the caret will have the same index value as the - * offset (the caret is between two characters). - * - * @return offset of caret + * Retrieve the current caret position. The index of the first + * caret position is 0. + * + * @return caret position */ public int getCaretPosition() { @@ -130,9 +133,10 @@ } /** - * Returns the portion of the text that is selected. - * - * @return null if no text is selected. + * Retrieve the current text selection. If no text is selected + * this method returns null. + * + * @return the currently selected text or null */ public String getSelectedText() { @@ -140,11 +144,14 @@ } /** - * Returns the start offset within the selected text. If there is no - * selection, but there is a caret, the start and end offsets will be - * the same. Return 0 if the text is empty, or the caret position if no selection. - * - * @return index of the start of the text = 0. + * Retrieve the index of the first character in the current text + * selection. If there is no text in the text component, this + * method returns 0. If there is text in the text component, but + * there is no selection, this method returns the current caret + * position. + * + * @return the index of the first character in the selection, the + * current caret position or 0 */ public int getSelectionStart() { @@ -154,12 +161,14 @@ } /** - * Returns the end offset within the selected text. If there is no - * selection, but there is a caret, the start and end offsets will - * be the same. Return 0 if the text is empty, or the caret position - * if no selection. - * - * @return index of the end of the text = 0. + * Retrieve the index of the last character in the current text + * selection. If there is no text in the text component, this + * method returns 0. If there is text in the text component, but + * there is no selection, this method returns the current caret + * position. + * + * @return the index of the last character in the selection, the + * current caret position or 0 */ public int getSelectionEnd() { @@ -169,13 +178,10 @@ } /** - * Handles caret updates (fire appropriate property change event, which are - * AccessibleContext.ACCESSIBLE_CARET_PROPERTY and - * AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY). This keeps track of - * the dot position internally. When the caret moves, the internal position - * is updated after firing the event. - * - * @param e - caret event + * Handle a change in the caret position and fire any applicable + * property change events. + * + * @param e - the caret update event */ public void caretUpdate(CaretEvent e) throws NotImplementedException @@ -185,7 +191,7
[cp-patches] Patch: Applet seg. fault fixes
This patch fixes some seg faults fitzsim found when running a couple of Sun's demo applets. I have added a link to these demos on the wiki. 2006-06-20 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java (create): Added check to prevent Seg Fault. Should not set the label if it is null. * gnu/java/awt/peer/gtk/GtkLabelPeer.java (setText): Changed to be a non-native function. Calls setNativeText if the String parameter is non-null. (setNativeText): Replaces old native setText function. * include/gnu_java_awt_peer_gtk_GtkLabelPeer.h: Regenerated. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText): Removed. Replaced by Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText. (Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText): Replaced Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText. Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.24 diff -u -r1.24 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 22 Feb 2006 14:47:50 - 1.24 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 20 Jun 2006 20:32:16 - @@ -78,7 +78,10 @@ create (old_group); currentState = checkbox.getState(); gtkToggleButtonSetActive(currentState); -gtkButtonSetLabel (checkbox.getLabel ()); + +String label = checkbox.getLabel(); +if (label != null) + gtkButtonSetLabel(label); } /** Index: gnu/java/awt/peer/gtk/GtkLabelPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java,v retrieving revision 1.25 diff -u -r1.25 GtkLabelPeer.java --- gnu/java/awt/peer/gtk/GtkLabelPeer.java 13 Feb 2006 18:57:03 - 1.25 +++ gnu/java/awt/peer/gtk/GtkLabelPeer.java 20 Jun 2006 20:32:16 - @@ -56,7 +56,7 @@ native void nativeSetAlignment (float alignment); - public native void setText(String text); + public native void setNativeText(String text); native void setNativeBounds (int x, int y, int width, int height); // Because this is a composite widget, we need to retrieve the @@ -69,6 +69,12 @@ create (label.getText (), getGtkAlignment (label.getAlignment ())); } + public void setText(String text) + { +if (text != null) + setNativeText(text); + } + public GtkLabelPeer (Label l) { super (l); Index: include/gnu_java_awt_peer_gtk_GtkLabelPeer.h === RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h,v retrieving revision 1.11 diff -u -r1.11 gnu_java_awt_peer_gtk_GtkLabelPeer.h --- include/gnu_java_awt_peer_gtk_GtkLabelPeer.h 30 Apr 2006 10:37:36 - 1.11 +++ include/gnu_java_awt_peer_gtk_GtkLabelPeer.h 20 Jun 2006 20:32:17 - @@ -13,7 +13,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create (JNIEnv *env, jobject, jstring, jfloat); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment (JNIEnv *env, jobject, jfloat); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText (JNIEnv *env, jobject, jstring); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText (JNIEnv *env, jobject, jstring); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds (JNIEnv *env, jobject, jint, jint, jint, jint); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray); Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c,v retrieving revision 1.17 diff -u -r1.17 gnu_java_awt_peer_gtk_GtkLabelPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c 12 Aug 2005 22:49:42 - 1.17 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c 20 Jun 2006 20:32:17 - @@ -147,7 +147,7 @@ } JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText +Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText (JNIEnv *env, jobject obj, jstring text) { const char *str;
[cp-patches] Patch: CairoGraphics2D fix
I spoke to Sven about this patch. getData was returning an incorrect array of pixels. It seems to work the best when getRGB is always used. 2006-06-19 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/CairoGraphics2D.java (drawImage): Should always use getRGB to get the pixels. getData returns an incorrect array of pixels. Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.25 diff -u -r1.25 CairoGraphics2D.java --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 16 Jun 2006 10:27:29 - 1.25 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 19 Jun 2006 20:26:25 - @@ -1247,24 +1249,7 @@ setPaint( oldPaint ); } -int[] pixels; - -// Shortcut for easy color models. -if( b.getColorModel().equals(rgb32) ) - { - pixels = ((DataBufferInt)db).getData(); - for(int i = 0; i pixels.length; i++) - pixels[i] |= 0xFF00; - } -else if( b.getColorModel().equals(argb32) ) - { - pixels = ((DataBufferInt)db).getData(); - } -else - { - pixels = b.getRGB(0, 0, width, height, - null, 0, width); - } +int[] pixels = b.getRGB(0, 0, width, height, null, 0, width); drawPixels(nativePointer, pixels, width, height, width, i2u, alpha);
[cp-patches] Patch: some javax.swing.plaf.basic.* missing functions
I implemented some missing 1.5 swing functions. 2006-06-16 Lillian Angel [EMAIL PROTECTED] * java/awt/font/TextLayout.java: Removed unneeded imports. * javax/swing/plaf/basic/BasicScrollBarUI.java: Added new thumbRollover field. (mouseMoved): Added code to set thumbRollover field. (isThumbRollover): New function. (setThumbRollover): New function. (getSupportsAbsolutePositioning): Implemented. This needs to be changed once the feature has been implemented. * javax/swing/plaf/basic/BasicSliderUI.java: Added new dragging field. (mouseDragged): Initialized dragging field. (isDragging): New function. * javax/swing/plaf/basic/BasicTabbedPaneUI.java (focusGained): Marked as not implemented. (focusLost): Likewise. Index: java/awt/font/TextLayout.java === RCS file: /cvsroot/classpath/classpath/java/awt/font/TextLayout.java,v retrieving revision 1.11 diff -u -r1.11 TextLayout.java --- java/awt/font/TextLayout.java 15 Jun 2006 18:59:28 - 1.11 +++ java/awt/font/TextLayout.java 16 Jun 2006 15:14:09 - @@ -43,13 +43,11 @@ import java.awt.Font; import java.awt.Graphics2D; import java.awt.Shape; -import java.awt.Toolkit; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; import java.text.AttributedCharacterIterator; -import java.text.AttributedString; import java.text.Bidi; import java.util.Map; Index: javax/swing/plaf/basic/BasicScrollBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v retrieving revision 1.35 diff -u -r1.35 BasicScrollBarUI.java --- javax/swing/plaf/basic/BasicScrollBarUI.java 13 Jun 2006 09:28:57 - 1.35 +++ javax/swing/plaf/basic/BasicScrollBarUI.java 16 Jun 2006 15:14:10 - @@ -302,8 +302,10 @@ */ public void mouseMoved(MouseEvent e) { - // Not interested in where the mouse - // is unless it is being dragged. + if (thumbRect.contains(e.getPoint())) +thumbRollover = true; + else +thumbRollover = false; } /** @@ -486,6 +488,9 @@ /** The scrollbar this UI is acting for. */ protected JScrollBar scrollbar; + + /** True if the mouse is over the thumb. */ + boolean thumbRollover; /** * This method adds a component to the layout. @@ -1401,4 +1406,39 @@ value = min; return value; } + + /** + * Returns true if the mouse is over the thumb. + * + * @return true if the mouse is over the thumb. + */ + public boolean isThumbRollover() + { + return thumbRollover; + } + + /** + * Set thumbRollover to active. This indicates + * whether or not the mouse is over the thumb. + * + * @param active - true if the mouse is over the thumb. + */ + protected void setThumbRollover(boolean active) + { +thumbRollover = active; + } + + /** + * Indicates whether the user can position the thumb with + * a mouse click (i.e. middle button). + * + * @return true if the user can position the thumb with a mouse + * click. + */ + public boolean getSupportsAbsolutePositioning() + { +// The positioning feature has not been implemented. +// So, false is always returned. +return false; + } } Index: javax/swing/plaf/basic/BasicSliderUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v retrieving revision 1.32 diff -u -r1.32 BasicSliderUI.java --- javax/swing/plaf/basic/BasicSliderUI.java 13 Jun 2006 15:10:38 - 1.32 +++ javax/swing/plaf/basic/BasicSliderUI.java 16 Jun 2006 15:14:10 - @@ -371,6 +371,7 @@ */ public void mouseDragged(MouseEvent e) { + dragging = true; if (slider.isEnabled()) { currentMouseX = e.getX(); @@ -450,6 +451,7 @@ */ public void mouseReleased(MouseEvent e) { + dragging = false; if (slider.isEnabled()) { currentMouseX = e.getX(); @@ -593,6 +595,9 @@ /** True if the slider has focus. */ private transient boolean hasFocus; + + /** True if the user is dragging the slider. */ + boolean dragging; /** * Creates a new Basic look and feel Slider UI. @@ -605,6 +610,16 @@ } /** + * Returns true if the user is dragging the slider. + * + * @return true if the slider is being dragged. + */ + protected boolean isDragging() + { +return dragging; + } + + /** * Gets the shadow color to be used for this slider. The shadow color is the * color used for drawing the top and left edges of the track. * Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
[cp-patches] Patch: FileDialog and Font additions
More for JAPI 2006-06-16 Lillian Angel [EMAIL PROTECTED] * java/awt/FileDialog.java (FileDialog): Implemented. (FileDialog): Implemented. (FileDialog): Implemented. * java/awt/Font.java: Added TYPE1_FONT constant field. Index: java/awt/FileDialog.java === RCS file: /cvsroot/classpath/classpath/java/awt/FileDialog.java,v retrieving revision 1.14 diff -u -r1.14 FileDialog.java --- java/awt/FileDialog.java 2 Jul 2005 20:32:24 - 1.14 +++ java/awt/FileDialog.java 16 Jun 2006 15:38:22 - @@ -101,6 +101,52 @@ * Constructors */ + /** + * Initializes a new instance of codeFileDialog/code with the specified + * parent. This dialog will have no title and will be for loading a file. + * + * @param parent The parent dialog for this. + */ + public FileDialog(Dialog parent) + { +this(parent, , LOAD); + } + + /** + * Initialized a new instance of codeFileDialog/code with the + * specified parent and title. This dialog will be for opening a file. + * + * @param parent The parent dialog for this. + * @param title The title for this dialog. + */ + public FileDialog(Dialog parent, String title) + { +this(parent, title, LOAD); + } + + /** + * Initialized a new instance of codeFileDialog/code with the specified + * parent, title, and mode. + * + * @param parent The parent dialog for this. + * @param title The title for this dialog. + * @param mode The mode of the dialog, either codeLOAD/code or + * codeSAVE/code. + * @throws IllegalArgumentException - if illegal mode, if + * GraphicsEnvironment.isHeadless or if parent is null. + */ + public FileDialog(Dialog parent, String title, int mode) + { +super(parent, title, true); + +// Other IllegalArgumentException cases are taken care of in Window.java +if (mode != LOAD mode != SAVE) + throw new IllegalArgumentException ( +Mode argument must be either LOAD or SAVE); + +setMode(mode); + } + /** * Initializes a new instance of codeFileDialog/code with the * specified parent. This dialog will have no title and will be for Index: java/awt/Font.java === RCS file: /cvsroot/classpath/classpath/java/awt/Font.java,v retrieving revision 1.34 diff -u -r1.34 Font.java --- java/awt/Font.java 20 May 2006 12:52:52 - 1.34 +++ java/awt/Font.java 16 Jun 2006 15:38:22 - @@ -114,7 +114,12 @@ * @since 1.3 */ public static final int TRUETYPE_FONT = 0; - + + /** + * Indicates to codecreateFont/code that the supplied font data + * is in Type1 format. + */ + public static final int TYPE1_FONT = 1; /** * A flag for codelayoutGlyphVector/code, indicating that the
Re: [cp-patches] FYI: FileDialog and Font additions
On Fri, 2006-06-16 at 09:59 -0600, Tom Tromey wrote: Lillian == Lillian Angel [EMAIL PROTECTED] writes: Lillian * java/awt/FileDialog.java Lillian (FileDialog): Implemented. Lillian (FileDialog): Implemented. Lillian (FileDialog): Implemented. Lillian + /** Lillian + * Initialized a new instance of codeFileDialog/code with the Lillian + * specified parent and title. This dialog will be for opening a file. Lillian + * Lillian + * @param parent The parent dialog for this. Lillian + * @param title The title for this dialog. Lillian + */ Lillian + public FileDialog(Dialog parent, String title) Lillian + { Lillian +this(parent, title, LOAD); Lillian + } New things from 1.5 should be marked '@since 1.5' in their javadoc. Fixed 2006-06-16 Lillian Angel [EMAIL PROTECTED] * java/awt/FileDialog.java (FileDialog): Added @since tag to API docs. (FileDialog): Likewise. (FileDialog): Likewise. * java/awt/Font.java: Added @since tag to TYPE1_FONT field docs. * javax/swing/plaf/basic/BasicScrollBarUI.java: (isThumbRollover): Likewise. (setThumbRollover): Likewise. (getSupportsAbsolutePositioning): Likewise. * javax/swing/plaf/basic/BasicSliderUI.java: (isDragging): Likewise. Tom Index: java/awt/FileDialog.java === RCS file: /cvsroot/classpath/classpath/java/awt/FileDialog.java,v retrieving revision 1.15 diff -u -r1.15 FileDialog.java --- java/awt/FileDialog.java 16 Jun 2006 15:41:39 - 1.15 +++ java/awt/FileDialog.java 16 Jun 2006 16:06:58 - @@ -106,6 +106,8 @@ * parent. This dialog will have no title and will be for loading a file. * * @param parent The parent dialog for this. + * + * @since 1.5 */ public FileDialog(Dialog parent) { @@ -118,6 +120,8 @@ * * @param parent The parent dialog for this. * @param title The title for this dialog. + * + * @since 1.5 */ public FileDialog(Dialog parent, String title) { @@ -134,6 +138,8 @@ * codeSAVE/code. * @throws IllegalArgumentException - if illegal mode, if * GraphicsEnvironment.isHeadless or if parent is null. + * + * @since 1.5 */ public FileDialog(Dialog parent, String title, int mode) { Index: java/awt/Font.java === RCS file: /cvsroot/classpath/classpath/java/awt/Font.java,v retrieving revision 1.35 diff -u -r1.35 Font.java --- java/awt/Font.java 16 Jun 2006 15:41:40 - 1.35 +++ java/awt/Font.java 16 Jun 2006 16:06:58 - @@ -118,6 +118,8 @@ /** * Indicates to codecreateFont/code that the supplied font data * is in Type1 format. + * + * @since 1.5 */ public static final int TYPE1_FONT = 1; Index: javax/swing/plaf/basic/BasicScrollBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v retrieving revision 1.36 diff -u -r1.36 BasicScrollBarUI.java --- javax/swing/plaf/basic/BasicScrollBarUI.java 16 Jun 2006 15:14:56 - 1.36 +++ javax/swing/plaf/basic/BasicScrollBarUI.java 16 Jun 2006 16:06:58 - @@ -1411,6 +1411,8 @@ * Returns true if the mouse is over the thumb. * * @return true if the mouse is over the thumb. + * + * @since 1.5 */ public boolean isThumbRollover() { @@ -1422,6 +1424,8 @@ * whether or not the mouse is over the thumb. * * @param active - true if the mouse is over the thumb. + * + * @since 1.5 */ protected void setThumbRollover(boolean active) { @@ -1434,6 +1438,8 @@ * * @return true if the user can position the thumb with a mouse * click. + * + * @since 1.5 */ public boolean getSupportsAbsolutePositioning() { Index: javax/swing/plaf/basic/BasicSliderUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v retrieving revision 1.33 diff -u -r1.33 BasicSliderUI.java --- javax/swing/plaf/basic/BasicSliderUI.java 16 Jun 2006 15:14:56 - 1.33 +++ javax/swing/plaf/basic/BasicSliderUI.java 16 Jun 2006 16:06:58 - @@ -613,6 +613,8 @@ * Returns true if the user is dragging the slider. * * @return true if the slider is being dragged. + * + * @since 1.5 */ protected boolean isDragging() {
Re: [cp-patches] RFA: AbstractButton
On Thu, 2006-06-15 at 13:29 -0400, Tania Bento wrote: Hey, In a previous mauve test, I changed 'focusable' to be set to false (and not true) in AbstractButton.java. However, for the past couple of days I have been writing mauve tests and it should in fact be set to true and only set to false by the other classes (JRadioButtonMenuItem, JCheckMenuBoxItem, BasicArrowButton, and MetalScrollButton). I will be posting these classpath patches and mauve tests soon. Can someone please approve this modication to AbstractButton so that I can commit it. Yes, I agree. Please commit. Cheers, Tania 2006-06-15 Tania Bento [EMAIL PROTECTED] * javx/swing/AbstractButton.java: (AbstractButton): 'Focusable' should be set to true and not false.
[cp-patches] Patch: TextLayout fix
JAPI pointed out a problem with the field in TextLayout. 2006-06-15 Lillian Angel [EMAIL PROTECTED] * java/awt/font/TextLayout.java: DEFAULT_CARET_POLICY changed to be public static final. Index: java/awt/font/TextLayout.java === RCS file: /cvsroot/classpath/classpath/java/awt/font/TextLayout.java,v retrieving revision 1.10 diff -u -r1.10 TextLayout.java --- java/awt/font/TextLayout.java 11 Jun 2006 03:09:03 - 1.10 +++ java/awt/font/TextLayout.java 15 Jun 2006 18:57:48 - @@ -85,7 +85,7 @@ /** * The default caret policy. */ - static TextLayout.CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy(); + public static final TextLayout.CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy(); /** * Constructs a TextLayout.
Re: [cp-patches] Patch: PixelGrabber fix
On Tue, 2006-06-13 at 21:13 +0100, David Gilbert wrote: Lillian Angel wrote: On Tue, 2006-06-13 at 12:16 -0600, Tom Tromey wrote: In cases like this it is nice to have a comment, either in the javadoc or in the code, explaining what happens when ip==null. That way nobody will be tempted to add the check back in later. Good idea. 2006-06-13 Lillian Angel [EMAIL PROTECTED] * java/awt/image/PixelGrabber.java (PixelGrabber): Added to API documentation. And if you really want to be sure, a Mauve test will allow us all to sleep well at night. ;-) Good idea. I have committed a test for this. Lillian Regards. Dave
[cp-patches] Patch: Component and TextComponent fix.
The JDK TextComponent ignores all old mouse events. I fixed our implementation to do this by creating a package-private function in Component and TextComponent. This also fixes: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27695 I have committed a mauve test for this as well. 2006-06-14 Lillian Angel [EMAIL PROTECTED] * java/awt/Component.java (ignoreOldMouseEvents): New helper function. (translateEvent): Changed to be non-static and use new helper. * java/awt/TextComponent.java (ignoreOldMouseEvents): New helper function. Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.122 diff -u -r1.122 Component.java --- java/awt/Component.java 13 Jun 2006 19:41:22 - 1.122 +++ java/awt/Component.java 14 Jun 2006 16:24:05 - @@ -2318,6 +2318,17 @@ } /** + * By default, no old mouse events should be ignored. + * This can be overridden by subclasses. + * + * @return false, no mouse events are ignored. + */ + boolean ignoreOldMouseEvents() + { +return false; + } + + /** * AWT 1.0 event handler. * * This method simply calls handleEvent and returns the result. @@ -4801,7 +4812,7 @@ * * @return an AWT 1.0 event representing e */ - static Event translateEvent (AWTEvent e) + Event translateEvent (AWTEvent e) { Object target = e.getSource (); Event translated = null; @@ -4864,7 +4875,7 @@ if ((mods InputEvent.ALT_DOWN_MASK) != 0) oldMods |= Event.ALT_MASK; -if (e instanceof MouseEvent) +if (e instanceof MouseEvent !ignoreOldMouseEvents()) { if (id == MouseEvent.MOUSE_PRESSED) oldID = Event.MOUSE_DOWN; Index: java/awt/TextComponent.java === RCS file: /cvsroot/classpath/classpath/java/awt/TextComponent.java,v retrieving revision 1.21 diff -u -r1.21 TextComponent.java --- java/awt/TextComponent.java 20 Sep 2005 01:05:28 - 1.21 +++ java/awt/TextComponent.java 14 Jun 2006 16:24:06 - @@ -734,8 +734,17 @@ return null; } - - + /** + * All old mouse events for this component should + * be ignored. + * + * @return true to ignore all old mouse events. + */ + boolean + ignoreOldMouseEvents() + { +return true; + } } // class TextComponent
Re: [cp-patches] FYI: Component and TextComponent fix.
Small fix. All these functions should be static. 2006-06-14 Lillian Angel [EMAIL PROTECTED] * java/awt/Component.java (ignoreOldMouseEvents): Made static. (translateEvent): Made static. * java/awt/TextComponent.java (ignoreOldMouseEvents): Made static. On Wed, 2006-06-14 at 12:27 -0400, Lillian Angel wrote: The JDK TextComponent ignores all old mouse events. I fixed our implementation to do this by creating a package-private function in Component and TextComponent. This also fixes: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27695 I have committed a mauve test for this as well. 2006-06-14 Lillian Angel [EMAIL PROTECTED] * java/awt/Component.java (ignoreOldMouseEvents): New helper function. (translateEvent): Changed to be non-static and use new helper. * java/awt/TextComponent.java (ignoreOldMouseEvents): New helper function. Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.123 diff -u -r1.123 Component.java --- java/awt/Component.java 14 Jun 2006 16:26:07 - 1.123 +++ java/awt/Component.java 14 Jun 2006 19:08:25 - @@ -2323,7 +2323,7 @@ * * @return false, no mouse events are ignored. */ - boolean ignoreOldMouseEvents() + static boolean ignoreOldMouseEvents() { return false; } @@ -4812,7 +4812,7 @@ * * @return an AWT 1.0 event representing e */ - Event translateEvent (AWTEvent e) + static Event translateEvent (AWTEvent e) { Object target = e.getSource (); Event translated = null; Index: java/awt/TextComponent.java === RCS file: /cvsroot/classpath/classpath/java/awt/TextComponent.java,v retrieving revision 1.22 diff -u -r1.22 TextComponent.java --- java/awt/TextComponent.java 14 Jun 2006 16:26:08 - 1.22 +++ java/awt/TextComponent.java 14 Jun 2006 19:08:25 - @@ -740,7 +740,7 @@ * * @return true to ignore all old mouse events. */ - boolean + static boolean ignoreOldMouseEvents() { return true;
[cp-patches] Patch: PixelGrabber fix
I found this problem when I tested this applet: http://www.btinternet.com/~se16/js/mapproj.htm The JDK doesnt care if the ImageProducer is null when passed to the constructor. 2006-06-13 Lillian Angel [EMAIL PROTECTED] * java/awt/image/PixelGrabber.java (PixelGrabber): Removed check to throw exception. JDK does not do this. (startGrabbing): Removed line to print stacktrace. Index: java/awt/image/PixelGrabber.java === RCS file: /cvsroot/classpath/classpath/java/awt/image/PixelGrabber.java,v retrieving revision 1.15 diff -u -r1.15 PixelGrabber.java --- java/awt/image/PixelGrabber.java 18 Aug 2005 13:45:44 - 1.15 +++ java/awt/image/PixelGrabber.java 13 Jun 2006 14:14:59 - @@ -131,9 +131,6 @@ public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize) { -if (ip == null) - throw new NullPointerException(The ImageProducer must not be null.); - this.ip = ip; this.x = x; this.y = y; @@ -222,7 +219,6 @@ } catch (Exception ex) { - ex.printStackTrace(); imageComplete(ImageConsumer.IMAGEABORTED); } }
Re: [cp-patches] Patch: PixelGrabber fix
On Tue, 2006-06-13 at 12:16 -0600, Tom Tromey wrote: Lillian == Lillian Angel [EMAIL PROTECTED] writes: Lillian The JDK doesnt care if the ImageProducer is null when passed to the Lillian constructor. Lillian -if (ip == null) Lillian - throw new NullPointerException(The ImageProducer must not be null.); In cases like this it is nice to have a comment, either in the javadoc or in the code, explaining what happens when ip==null. That way nobody will be tempted to add the check back in later. Good idea. 2006-06-13 Lillian Angel [EMAIL PROTECTED] * java/awt/image/PixelGrabber.java (PixelGrabber): Added to API documentation. Tom Index: java/awt/image/PixelGrabber.java === RCS file: /cvsroot/classpath/classpath/java/awt/image/PixelGrabber.java,v retrieving revision 1.15 diff -u -r1.15 PixelGrabber.java --- java/awt/image/PixelGrabber.java 18 Aug 2005 13:45:44 - 1.15 +++ java/awt/image/PixelGrabber.java 13 Jun 2006 14:14:59 - @@ -131,9 +131,6 @@ public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize) { -if (ip == null) - throw new NullPointerException(The ImageProducer must not be null.); - this.ip = ip; this.x = x; this.y = y; @@ -222,7 +219,6 @@ } catch (Exception ex) { - ex.printStackTrace(); imageComplete(ImageConsumer.IMAGEABORTED); } }
Re: [cp-patches] FYI: PixelGrabber fix
On Tue, 2006-06-13 at 15:01 -0400, Lillian Angel wrote: On Tue, 2006-06-13 at 12:16 -0600, Tom Tromey wrote: Lillian == Lillian Angel [EMAIL PROTECTED] writes: Lillian The JDK doesnt care if the ImageProducer is null when passed to the Lillian constructor. Lillian -if (ip == null) Lillian - throw new NullPointerException(The ImageProducer must not be null.); In cases like this it is nice to have a comment, either in the javadoc or in the code, explaining what happens when ip==null. That way nobody will be tempted to add the check back in later. Good idea. Attached is the new patch. 2006-06-13 Lillian Angel [EMAIL PROTECTED] * java/awt/image/PixelGrabber.java (PixelGrabber): Added to API documentation. Tom Index: java/awt/image/PixelGrabber.java === RCS file: /cvsroot/classpath/classpath/java/awt/image/PixelGrabber.java,v retrieving revision 1.16 diff -u -r1.16 PixelGrabber.java --- java/awt/image/PixelGrabber.java 13 Jun 2006 14:18:18 - 1.16 +++ java/awt/image/PixelGrabber.java 13 Jun 2006 18:59:52 - @@ -112,7 +112,8 @@ * in the grab rectangle will be stored at * codepix[(n - y) * scansize + (m - x) + off]/code. * - * @param ip the ImageProducer from which to grab pixels + * @param ip the ImageProducer from which to grab pixels. This can + * be null. * @param x the x coordinate of the grab rectangle's top-left pixel, * specified relative to the top-left corner of the image produced * by codeip/code
[cp-patches] Patch: gcjwebplugin fix
I moved the code to create the whitelist file from NP_Initialize to GCJ_New. The file should be opened for each applet instance created. This prevents any reading/writing/loading errors that were encountered. 2006-06-13 Lillian Angel [EMAIL PROTECTED] * native/plugin/gcjwebplugin.cc (NP_Initialize): Removed code to create whitelist file. (GCJ_New): Added code to create whitelist file. (plugin_user_trusts_documentbase): Fixed error message. Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.11 diff -u -r1.11 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 9 Jun 2006 14:53:34 - 1.11 +++ native/plugin/gcjwebplugin.cc 13 Jun 2006 21:37:04 - @@ -323,14 +323,34 @@ Browser not Mozilla-based?); goto cleanup_appletviewer_mutex; } + + // Open the user's documentbase whitelist. + whitelist_file = g_io_channel_new_file (whitelist_filename, + a+, channel_error); + if (!whitelist_file) +{ + if (channel_error) +{ + PLUGIN_ERROR_THREE (Failed to open whitelist file, + whitelist_filename, + channel_error-message); + g_error_free (channel_error); + channel_error = NULL; +} + else +PLUGIN_ERROR_TWO (Failed to open whitelist file, + whitelist_filename); + return NPERR_GENERIC_ERROR; +} + if (!plugin_user_trusts_documentbase (documentbase)) { PLUGIN_ERROR (User does not trust applet.); np_error = NPERR_GENERIC_ERROR; goto cleanup_appletviewer_mutex; } - + // Create appletviewer-to-plugin pipe which we refer to as the input // pipe. @@ -959,7 +979,7 @@ channel_error = NULL; } else -PLUGIN_ERROR (Failed to open whitelist file.); +PLUGIN_ERROR (Failed to read line from whitelist file.); g_free (whitelist_entry); whitelist_entry = NULL; break; @@ -1632,26 +1652,6 @@ } } - // Open the user's documentbase whitelist. - whitelist_file = g_io_channel_new_file (whitelist_filename, - a+, channel_error); - if (!whitelist_file) -{ - if (channel_error) -{ - PLUGIN_ERROR_THREE (Failed to open whitelist file, - whitelist_filename, - channel_error-message); - g_error_free (channel_error); - channel_error = NULL; -} - else -PLUGIN_ERROR_TWO (Failed to open whitelist file, - whitelist_filename); - - return NPERR_GENERIC_ERROR; -} - // Store in a local table the browser functions that we may use. browserFunctions.version = browserTable-version; browserFunctions.size = browserTable-size;
[cp-patches] Patch: BasicTabbedPaneUI fixlet
A small fix for limewire. 2006-06-12 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTabbedPaneUI.java (layoutContainer): Added check to prevent exception. Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v retrieving revision 1.46 diff -u -r1.46 BasicTabbedPaneUI.java --- javax/swing/plaf/basic/BasicTabbedPaneUI.java 9 Jun 2006 23:34:34 - 1.46 +++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 12 Jun 2006 16:06:43 - @@ -532,7 +532,10 @@ Insets insets = tabPane.getInsets(); int selectedIndex = tabPane.getSelectedIndex(); - Component selectedComponent = tabPane.getComponentAt(selectedIndex); + + Component selectedComponent = null; + if (selectedIndex = 0) +tabPane.getComponentAt(selectedIndex); // The RI doesn't seem to change the component if the new selected // component == null. This is probably so that applications can add // one single component for every tab.
Re: [cp-patches] Patch: BasicTabbedPaneUI fixlet
Made a dumb mistake in the last patch. Thanks fitzsim for catching this. 2006-06-12 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTabbedPaneUI.java (layoutContainer): Added missing selectedComponent assignment. On Mon, 2006-06-12 at 12:08 -0400, Lillian Angel wrote: A small fix for limewire. 2006-06-12 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTabbedPaneUI.java (layoutContainer): Added check to prevent exception. Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v retrieving revision 1.47 diff -u -r1.47 BasicTabbedPaneUI.java --- javax/swing/plaf/basic/BasicTabbedPaneUI.java 12 Jun 2006 16:08:27 - 1.47 +++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 12 Jun 2006 16:55:06 - @@ -535,7 +535,7 @@ Component selectedComponent = null; if (selectedIndex = 0) -tabPane.getComponentAt(selectedIndex); +selectedComponent = tabPane.getComponentAt(selectedIndex); // The RI doesn't seem to change the component if the new selected // component == null. This is probably so that applications can add // one single component for every tab.
[cp-patches] Patch: StandaloneAppletWindow title fix
Small minor fix for the standalone appletviewer. IMO, it should say GNU Classpath Applet Viewer instead of GCJ Applet Viewer. 2006-06-12 Lillian Angel [EMAIL PROTECTED] * tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java (StandaloneAppletWindow): Changed title of standalone window. Index: tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java === RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java,v retrieving revision 1.1 diff -u -r1.1 StandaloneAppletWindow.java --- tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java 8 May 2006 20:36:46 - 1.1 +++ tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java 12 Jun 2006 18:57:19 - @@ -199,7 +199,7 @@ menuApplet.add(closeItem); menuApplet.add(quitItem); setMenuBar(menuBar); -setTitle(GCJ Applet Viewer: + tag.code); +setTitle(GNU Classpath Applet Viewer: + tag.code); AppletContext context = (AppletContext) contexts.get(tag.codebase); ((StandaloneAppletContext) context).addApplet(applet);
Re: [cp-patches] Small ComboBox fix
Committed. On Thu, 2006-06-08 at 15:03 -0400, Francis Kung wrote: Hi, Came across a problem when painting a JComboBox with null or empty items in it; patch is attached. It's a bit of a workaround, but I think it's good enough (it's a rare case, so it's not worth hacking into the higher Component-level methods that the ComboBox inherits). Corresponding Mauve testcase is also being submitted on that list. Francis
[cp-patches] Patch: BasicProgressBarUI Fix
Small fix 2006-06-08 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicProgressBarUI.java (paintString): Fixed to paint string at the correct location. Index: javax/swing/plaf/basic/BasicProgressBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java,v retrieving revision 1.15 diff -u -r1.15 BasicProgressBarUI.java --- javax/swing/plaf/basic/BasicProgressBarUI.java 15 Nov 2005 20:32:46 - 1.15 +++ javax/swing/plaf/basic/BasicProgressBarUI.java 31 May 2006 18:56:04 - @@ -52,6 +52,7 @@ import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.geom.AffineTransform; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -725,40 +726,35 @@ protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) { -// FIXME: We do not support vertical text painting because Java2D is needed -// for this. -if (progressBar.getOrientation() == JProgressBar.VERTICAL) - return; - -// We want to place in the exact center of the bar. +String str = progressBar.getString(); +int full = getAmountFull(b, width, height); Point placement = getStringPlacement(g, progressBar.getString(), - x + b.left, y + b.top, + x + b.left, y + b.top, width - b.left - b.right, height - b.top - b.bottom); - Color savedColor = g.getColor(); Shape savedClip = g.getClip(); -FontMetrics fm = g.getFontMetrics(progressBar.getFont()); -int full = getAmountFull(b, width, height); -String str = progressBar.getString(); - -// We draw this string two times with different clips so that the text -// over the filled area is painted with selectionForeground and over -// the clear area with selectionBackground. + +if (progressBar.getOrientation() == JProgressBar.VERTICAL) + { +AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2); +g.setFont(progressBar.getFont().deriveFont(rotate)); + } + g.setColor(getSelectionForeground()); g.setClip(0, 0, full + b.left, height); -g.drawString(str, placement.x, placement.y + fm.getAscent()); +g.drawString(str, placement.x, placement.y); g.setColor(getSelectionBackground()); g.setClip(full + b.left, 0, width - full, height); -g.drawString(str, placement.x, placement.y + fm.getAscent()); +g.drawString(str, placement.x, placement.y); g.setClip(savedClip); g.setColor(savedColor); } /** - * This method sets the current animation index. If the index - * is greater than the number of frames, it resets to 0. - * + * This method sets the current animation index. If the index is greater than + * the number of frames, it resets to 0. + * * @param newValue The new animation index. */ protected void setAnimationIndex(int newValue)
[cp-patches] Patch: gcjwebplugin fix
Anthony Green found a problem with gcjwebplugin. The browser no longer crashes. 2006-06-08 Tom Fitzsimmons [EMAIL PROTECTED] Lillian Angel [EMAIL PROTECTED] * native/plugin/gcjwebplugin.cc (NP_Shutdown): Added code to free plugin mutex and whitelist file. Also, reset initialized field. Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.5 diff -u -r1.5 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 6 Jun 2006 15:43:14 - 1.5 +++ native/plugin/gcjwebplugin.cc 8 Jun 2006 15:45:19 - @@ -1740,11 +1740,20 @@ PLUGIN_DEBUG (NP_Shutdown); // Free mutex. - g_mutex_free (plugin_instance_mutex); - plugin_instance_mutex = NULL; - - g_io_channel_close (whitelist_file); + if (plugin_instance_mutex) +{ + g_mutex_free (plugin_instance_mutex); + plugin_instance_mutex = NULL; +} + if (whitelist_file) +{ + g_io_channel_close (whitelist_file); + whitelist_file = NULL; +} + + initialized = false; + PLUGIN_DEBUG (NP_Shutdown return); return NPERR_NO_ERROR;
[cp-patches] Patch: gcjwebplugin data directory fix
To avoid any problems with saving the whitelist file (permission denied, etc), we have decided to store all the plugin data in ~/.gcjwebplugin. 2006-06-08 Lillian Angel [EMAIL PROTECTED] * native/plugin/Makefile.am: Changed DATA_DIRECTORY to be ~/.gcjwebplugin. * native/plugin/gcjwebplugin.cc: Changed all instances of PLUGIN_DATA_DIRECTORY to DATA_DIRECTORY. Index: native/plugin/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/plugin/Makefile.am,v retrieving revision 1.2 diff -u -r1.2 Makefile.am --- native/plugin/Makefile.am 5 Jun 2006 14:20:00 - 1.2 +++ native/plugin/Makefile.am 8 Jun 2006 20:25:50 - @@ -4,7 +4,7 @@ libgcjwebplugin_la_CXXFLAGS = \ -Wall -DAPPLETVIEWER_EXECUTABLE=\$(bindir)/appletviewer\ \ - -DPLUGIN_DATA_DIRECTORY=\$(PLUGIN_DIR)/gcjwebplugin-data\ \ + -DDATA_DIRECTORY=\$(HOME)/.gcjwebplugin\ \ $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) libgcjwebplugin_la_LDFLAGS = -avoid-version \ Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.7 diff -u -r1.7 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 8 Jun 2006 15:59:20 - 1.7 +++ native/plugin/gcjwebplugin.cc 8 Jun 2006 20:25:50 - @@ -120,7 +120,7 @@ // Security dialog messages. #define RESPONSE_TRUST_APPLET Trust Applet #define RESPONSE_TRUST_APPLET_ADD_TO_LIST Trust Applet and Add to Whitelist -#define WHITELIST_FILENAME PLUGIN_DATA_DIRECTORY /whitelist.txt +#define WHITELIST_FILENAME DATA_DIRECTORY /whitelist.txt #define SECURITY_WARNING\ %s wants to load an applet.\n \ GNU Classpath's security implementation is not complete.\n \ @@ -326,7 +326,7 @@ // pipe. // data-in_pipe_name - data-in_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY + data-in_pipe_name = g_strdup_printf (DATA_DIRECTORY /gcj-%s-appletviewer-to-plugin, data-instance_string); if (!data-in_pipe_name) @@ -349,7 +349,7 @@ // output pipe. // data-out_pipe_name - data-out_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY + data-out_pipe_name = g_strdup_printf (DATA_DIRECTORY /gcj-%s-plugin-to-appletviewer, data-instance_string); @@ -1608,16 +1608,16 @@ // Make sure the plugin data directory exists, creating it if // necessary. - if (!g_file_test (PLUGIN_DATA_DIRECTORY, + if (!g_file_test (DATA_DIRECTORY, (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { int file_error = 0; - file_error = g_mkdir (PLUGIN_DATA_DIRECTORY, 0700); + file_error = g_mkdir (DATA_DIRECTORY, 0700); if (file_error != 0) { PLUGIN_ERROR_TWO (Failed to create data directory -PLUGIN_DATA_DIRECTORY , +DATA_DIRECTORY , strerror (errno)); return NPERR_GENERIC_ERROR; }
[cp-patches] Patch: gcjwebplugin data directory fix
I fixed gcjwebplugin to determine the data directory at runtime, instead of when the plugin is installed. 2006-06-08 Lillian Angel [EMAIL PROTECTED] * native/plugin/Makefile.am: Removed DATA_DIRECTORY. * native/plugin/gcjwebplugin.cc: Added new global fields for whitelist_file and data_directory. Removed WHITELIST_FILE. (NP_Initialize): Initialized new fields. Also, Changed to use new fields. (NP_Shutdown): Freed data_directory. (GCJ_New): Changed to use new fields. (plugin_ask_user_about_documentbase): Likewise. Index: native/plugin/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/plugin/Makefile.am,v retrieving revision 1.3 diff -u -r1.3 Makefile.am --- native/plugin/Makefile.am 8 Jun 2006 20:27:54 - 1.3 +++ native/plugin/Makefile.am 8 Jun 2006 21:38:46 - @@ -4,7 +4,6 @@ libgcjwebplugin_la_CXXFLAGS = \ -Wall -DAPPLETVIEWER_EXECUTABLE=\$(bindir)/appletviewer\ \ - -DDATA_DIRECTORY=\$(HOME)/.gcjwebplugin\ \ $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) libgcjwebplugin_la_LDFLAGS = -avoid-version \ Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.8 diff -u -r1.8 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 8 Jun 2006 20:27:54 - 1.8 +++ native/plugin/gcjwebplugin.cc 8 Jun 2006 21:38:46 - @@ -120,7 +120,6 @@ // Security dialog messages. #define RESPONSE_TRUST_APPLET Trust Applet #define RESPONSE_TRUST_APPLET_ADD_TO_LIST Trust Applet and Add to Whitelist -#define WHITELIST_FILENAME DATA_DIRECTORY /whitelist.txt #define SECURITY_WARNING\ %s wants to load an applet.\n \ GNU Classpath's security implementation is not complete.\n \ @@ -132,7 +131,7 @@ and run this applet from now on, without asking.\n \ The whitelist is a list of the URLs from which you trust\ applets.\n \ - Your whitelist file is \ WHITELIST_FILENAME \. + Your whitelist file is \ %s \. #define FAILURE_MESSAGE \ This page wants to load an applet.\n\ The appletviewer is missing or not installed properly in \ \ @@ -144,9 +143,15 @@ // Browser function table. static NPNetscapeFuncs browserFunctions; +// Data directory for plugin. +static gchar* data_directory; + +// Whitelist filename +static gchar* whitelist_filename; + // Keeps track of initialization. NP_Initialize should only be // called once. -bool initialized = false; +gboolean initialized = false; // GCJPluginData stores all the data associated with a single plugin // instance. A separate plugin instance is created for each APPLET @@ -326,9 +331,8 @@ // pipe. // data-in_pipe_name - data-in_pipe_name = g_strdup_printf (DATA_DIRECTORY -/gcj-%s-appletviewer-to-plugin, -data-instance_string); + data-in_pipe_name = g_strdup_printf (%s/gcj-%s-appletviewer-to-plugin, + data_directory, data-instance_string); if (!data-in_pipe_name) { PLUGIN_ERROR (Failed to create input pipe name.); @@ -349,9 +353,8 @@ // output pipe. // data-out_pipe_name - data-out_pipe_name = g_strdup_printf (DATA_DIRECTORY - /gcj-%s-plugin-to-appletviewer, - data-instance_string); + data-out_pipe_name = g_strdup_printf (%s/gcj-%s-plugin-to-appletviewer, + data_directory, data-instance_string); if (!data-out_pipe_name) { @@ -1061,7 +1064,7 @@ SECURITY_WARNING, documentbase); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), -SECURITY_DESCRIPTION); +SECURITY_DESCRIPTION, whitelist_filename); cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, @@ -1577,7 +1580,7 @@ return NPERR_INVALID_FUNCTABLE_ERROR; } - + // Ensure that the major version of the plugin API that the browser // expects is not more recent than the major version of the API that // we've implemented. @@ -1606,39 +1609,41 @@ return NPERR_INVALID_FUNCTABLE_ERROR; } + data_directory = g_strconcat(getenv(HOME), /.gcjwebplugin, NULL); + whitelist_filename = g_strconcat (data_directory, /whitelist.txt, NULL); + // Make sure the plugin data directory exists, creating
[cp-patches] Re: FYI: gcjwebplugin data directory fix
2006-06-08 Lillian Angel [EMAIL PROTECTED] * native/plugin/gcjwebplugin.cc: (NP_Shutdown): Freed whitelist_filename. On Thu, 2006-06-08 at 17:45 -0400, Lillian Angel wrote: I fixed gcjwebplugin to determine the data directory at runtime, instead of when the plugin is installed. 2006-06-08 Lillian Angel [EMAIL PROTECTED] * native/plugin/Makefile.am: Removed DATA_DIRECTORY. * native/plugin/gcjwebplugin.cc: Added new global fields for whitelist_file and data_directory. Removed WHITELIST_FILE. (NP_Initialize): Initialized new fields. Also, Changed to use new fields. (NP_Shutdown): Freed data_directory. (GCJ_New): Changed to use new fields. (plugin_ask_user_about_documentbase): Likewise. Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- native/plugin/gcjwebplugin.cc 8 Jun 2006 21:43:45 - 1.9 +++ native/plugin/gcjwebplugin.cc 8 Jun 2006 21:49:11 - 1.10 @@ -1761,6 +1761,12 @@ g_free (data_directory); data_directory = NULL; } + + if (whitelist_filename) +{ + g_free (whitelist_filename); + whitelist_filename = NULL; +} initialized = false;
[cp-patches] Patch: FreetypeGlyphVector and String fix
I have started working on limewire. This patch fixes the exceptions that were thrown at startup. 2006-06-07 Lillian Angel [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (FreetypeGlyphVector): Removed assignment. Caused compilation error. * java/lang/String.java (codePointCount): Fixed check to match API. Shouldn't throw exception if end == count. end is 1 more than the endIndex, so end == count is possible. Index: gnu/java/awt/peer/gtk/FreetypeGlyphVector.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,v retrieving revision 1.1 diff -u -r1.1 FreetypeGlyphVector.java --- gnu/java/awt/peer/gtk/FreetypeGlyphVector.java 7 Jun 2006 13:54:32 - 1.1 +++ gnu/java/awt/peer/gtk/FreetypeGlyphVector.java 7 Jun 2006 15:20:00 - @@ -102,7 +102,6 @@ */ public FreetypeGlyphVector(Font f, int[] codes, FontRenderContext frc) { -this.s = s; this.font = f; this.frc = frc; if( !(font.getPeer() instanceof GdkFontPeer ) ) Index: java/lang/String.java === RCS file: /cvsroot/classpath/classpath/java/lang/String.java,v retrieving revision 1.81 diff -u -r1.81 String.java --- java/lang/String.java 15 Feb 2006 23:00:38 - 1.81 +++ java/lang/String.java 7 Jun 2006 15:20:00 - @@ -1820,7 +1820,7 @@ */ public synchronized int codePointCount(int start, int end) { -if (start 0 || end = count || start end) +if (start 0 || end count || start end) throw new StringIndexOutOfBoundsException(); start += offset;
[cp-patches] Patch: BasicTabbedPaneUI fixlet
Small fix for limewire. Prevents an ArrayOutofBoundsException 2006-06-07 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTabbedPaneUI.java (getTabBounds): If this method is called with a tab index that is not in the rects array, we need to re-layout the container so it is created. Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v retrieving revision 1.44 diff -u -r1.44 BasicTabbedPaneUI.java --- javax/swing/plaf/basic/BasicTabbedPaneUI.java 1 Jun 2006 05:17:02 - 1.44 +++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 7 Jun 2006 18:48:52 - @@ -2410,6 +2410,9 @@ */ public Rectangle getTabBounds(JTabbedPane pane, int i) { +// Need to re-layout container if tab does not exist. +if (i = rects.length) + layoutManager.layoutContainer(pane); return rects[i]; }
Re: [cp-patches] RFC: small JMenuBar fix
On Wed, 2006-06-07 at 14:37 -0400, Francis Kung wrote: Hi, While writing some Mauve tests, I came across a small bug in JMenuBar's getSubElements() method: instead of returning an array of only menu's, we currently insert null values for non-menu components as well. A patch is attached. Committed. Regards, Francis 2006-06-07 Francis Kung [EMAIL PROTECTED] * javax/swing/JMenuBar.java: (getSubElements): Do not return null values.
[cp-patches] Patch: gcjwebplugin comments
Added more detailed comments. 2006-06-06 Lillian Angel [EMAIL PROTECTED] * native/plugin/gcjwebplugin.cc: Fixed failure message and commenting. (NP_Initialize): Added more comments. Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.3 diff -u -r1.3 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 5 Jun 2006 18:20:15 - 1.3 +++ native/plugin/gcjwebplugin.cc 6 Jun 2006 15:21:51 - @@ -134,9 +134,10 @@ The whitelist is a list of the URLs from which you trust\ applets.\n \ Your whitelist file is \ WHITELIST_FILENAME \. -#define FAILURE_MESSAGE \ - This page wants to load an applet.\n\ - There is no appletviewer installed in \ APPLETVIEWER_EXECUTABLE \. \ +#define FAILURE_MESSAGE \ + This page wants to load an applet.\n\ + The appletviewer is missing or not installed properly in \ \ + APPLETVIEWER_EXECUTABLE \. // Documentbase retrieval required definition. static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); @@ -144,7 +145,7 @@ // Browser function table. static NPNetscapeFuncs browserFunctions; -// Keeps track of initialization. NP_INITIALIZE should only be +// Keeps track of initialization. NP_Initialize should only be // called once. bool initialized = false; @@ -376,7 +377,7 @@ // appletviewer, create the IO channels and install the channel // watch callbacks. g_mutex_lock (data-appletviewer_mutex); - + np_error = plugin_start_appletviewer (data); // If the appletviewer is not installed, then a dialog box will @@ -386,7 +387,7 @@ if (plugin_failed ()) goto cleanup_applet_failure; } - + // Create plugin-to-appletviewer channel. The default encoding for // the file is UTF-8. // data-out_to_appletviewer @@ -1559,6 +1560,11 @@ // implement and initializes a local table with browser functions that // we may wish to call. Called once, after browser startup and before // the first plugin instance is created. +// The field 'initialized' is set to true once this function has +// finished. If 'initialized' is already true at the beginning of +// this function, then it is evident that NP_Initialize has already +// been called. There is no need to call this function more than twice and +// this workaround avoids any duplicate calls. NPError NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) {
[cp-patches] Patch: GtkImage fix
I am committing this for Francis. It has been approved by Sven. This fixes bug #27507. 2006-06-05 Francis Kung [EMAIL PROTECTED] PR 27507 * gnu/java/awt/peer/gtk/GtkImage.java (getSource): Added check to determine if in errorLoading state. * gnu/java/awt/peer/gtk/GtkToolkit.java (createImage): Added check to prevent NPE. Index: gnu/java/awt/peer/gtk/GtkImage.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkImage.java,v retrieving revision 1.33 diff -u -r1.33 GtkImage.java --- gnu/java/awt/peer/gtk/GtkImage.java 30 May 2006 21:42:56 - 1.33 +++ gnu/java/awt/peer/gtk/GtkImage.java 5 Jun 2006 13:46:23 - @@ -421,9 +421,12 @@ return null; int[] pixels; -synchronized(pixbufLock) +synchronized (pixbufLock) { - pixels = getPixels(); +if (!errorLoading) + pixels = getPixels(); +else + return null; } return new MemoryImageSource(width, height, nativeModel, pixels, 0, width); Index: gnu/java/awt/peer/gtk/GtkToolkit.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.86 diff -u -r1.86 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 30 May 2006 22:36:32 - 1.86 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 5 Jun 2006 13:46:23 - @@ -184,6 +184,9 @@ public Image createImage (ImageProducer producer) { +if (producer == null) + return null; + Image image; try {
[cp-patches] Patch: Security warning for appletviewer
I worked with fitzsim to add a security warning for each applet loaded. The user has the choice to load (trust) the applet, cancel the loading of the applet, or load the applet and add the address to a whitelist. This whitelist is a file that contains a list of applets that the user would like to trust indefinitely. All temp appletviewer files and the whitelist are stored in the .mozilla/plugins/gcjwebplugin-data/ directory. Tom has checked over all the code and has cleaned it up. This has been committed. Please comment. 2006-06-05 Lillian Angel [EMAIL PROTECTED] * native/plugin/Makefile.am: Fixed to use a set plugin directory in the .mozilla directory. All applet logs are now stored here, instead of /tmp. * native/plugin/gcjwebplugin.cc: Added new fields for security warning. (GCJ_NEW): Added code to generate a security warning for all pages that spawn an appletviewer. This warning asks the user if they trust the applet and if they would like to add it to a 'whitelist'. This whitelist keeps track of all the addresses the user would like to trust indefinitely. (plugin_user_trusts_documentbase): New helper function. (plugin_add_documentbase_to_whitelist): New helper function. (plugin_ask_user_about_documentbase): New helper function. (plugin_in_pipe_callback): Fixed check to determine if channel_error has been set. (plugin_start_appletviewer): Likewise. (plugin_create_applet_tag): Reset all fields to null after they have been freed. (plugin_send_message_to_appletviewer): Fixed all error checks to determine if channel_error has been set. (plugin_stop_appletviewer): Likewise. (NP_Initialize): Likewise. Also, added code to determine if directory and file should be created. Index: native/plugin/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/plugin/Makefile.am,v retrieving revision 1.1 diff -u -r1.1 Makefile.am --- native/plugin/Makefile.am 9 May 2006 18:11:13 - 1.1 +++ native/plugin/Makefile.am 5 Jun 2006 13:38:32 - @@ -4,15 +4,16 @@ libgcjwebplugin_la_CXXFLAGS = \ -Wall -DAPPLETVIEWER_EXECUTABLE=\$(bindir)/appletviewer\ \ - $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) + -DPLUGIN_DATA_DIRECTORY=\$(PLUGIN_DIR)/gcjwebplugin-data\ \ + $(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) libgcjwebplugin_la_LDFLAGS = -avoid-version \ - $(GLIB_LIBS) \ + $(GLIB_LIBS) $(GTK_LIBS) \ -lstdc++ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - $(INSTALL) -d -m0755 $(DESTDIR)@PLUGIN_DIR@ - $(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)@PLUGIN_DIR@ +install-plugin: $(lib_LTLIBRARIES) + $(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR) + $(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR) -uninstall-libLTLIBRARIES: - rm -f $(DESTDIR)@PLUGIN_DIR@/libgcjwebplugin.so +uninstall-plugin: + rm -f $(DESTDIR)$(PLUGIN_DIR)/libgcjwebplugin.so Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.1 diff -u -r1.1 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 9 May 2006 18:11:13 - 1.1 +++ native/plugin/gcjwebplugin.cc 5 Jun 2006 13:38:32 - @@ -49,6 +49,10 @@ // GLib includes. #include glib.h +#include glib/gstdio.h + +// GTK includes. +#include gtk/gtk.h // gcjwebplugin includes. #include config.h @@ -113,8 +117,23 @@ #define PLUGIN_FILE_EXTS class,jar,zip #define PLUGIN_MIME_COUNT 1 -// Directory in which named pipes are created. -#define PIPE_DIRECTORY /tmp +// Security dialog messages. +#define RESPONSE_TRUST_APPLET Trust Applet +#define RESPONSE_TRUST_APPLET_ADD_TO_LIST Trust Applet and Add to Whitelist +#define WHITELIST_FILENAME PLUGIN_DATA_DIRECTORY /whitelist.txt +#define SECURITY_WARNING\ + %s wants to load an applet.\n \ + GNU Classpath's security implementation is not complete.\n \ + HOSTILE APPLETS WILL STEAL AND/OR DESTROY YOUR DATA!\n +#define SECURITY_DESCRIPTION\ + If you do not know or trust the source of this applet, click\ + \Cancel\.\n \ + Click \Trust Applet\ to load and run this applet now.\n \ + Click \Trust Applet and Add To Whitelist\ to always load \ + and run this applet from now on, without asking.\n \ + The whitelist is a list of the URLs from which you trust\ + applets.\n \ + Your whitelist file is \ WHITELIST_FILENAME \. // Documentbase retrieval required definition. static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); @@ -173,6 +192,10 @@ static void
[cp-patches] Patch: another appletviewer fix
At this point, if the appletviewer has not been installed the browser will hang. I added in an error message for this. The plugin is killed and the browser operates normally. 2006-06-05 Lillian Angel [EMAIL PROTECTED] * native/plugin/gcjwebplugin.cc: Added new field to keep track of initialization. (plugin_start_appletviewer): Fixed to return an error value, if an error was encountered when loading the appletviewer. (GCJ_NEW): Added call to plugin_failed if the loading of the appletviewer has failed. (plugin_failed): New helper function. Shows a warning if the appletviewer has not been installed. (NP_Initialize): Added code to make sure this function is only called once. Index: native/plugin/gcjwebplugin.cc === RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v retrieving revision 1.2 diff -u -r1.2 gcjwebplugin.cc --- native/plugin/gcjwebplugin.cc 5 Jun 2006 14:20:00 - 1.2 +++ native/plugin/gcjwebplugin.cc 5 Jun 2006 18:03:58 - @@ -134,6 +134,9 @@ The whitelist is a list of the URLs from which you trust\ applets.\n \ Your whitelist file is \ WHITELIST_FILENAME \. +#define FAILURE_MESSAGE \ + This page wants to load an applet.\n\ + There is no appletviewer installed in \ APPLETVIEWER_EXECUTABLE \. \ // Documentbase retrieval required definition. static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); @@ -141,6 +144,10 @@ // Browser function table. static NPNetscapeFuncs browserFunctions; +// Keeps track of initialization. NP_INITIALIZE should only be +// called once. +bool initialized = false; + // GCJPluginData stores all the data associated with a single plugin // instance. A separate plugin instance is created for each APPLET // tag. For now, each plugin instance spawns its own applet viewer @@ -192,6 +199,8 @@ static void plugin_data_new (GCJPluginData** data); // Documentbase retrieval. static gchar* plugin_get_documentbase (NPP instance); +// plugin failure handling. +static bool plugin_failed (); // Whitelist handling. static bool plugin_user_trusts_documentbase (char* documentbase); static bool plugin_ask_user_about_documentbase (char* documentbase); @@ -204,7 +213,7 @@ static gboolean plugin_out_pipe_callback (GIOChannel* source, GIOCondition condition, gpointer plugin_data); -static void plugin_start_appletviewer (GCJPluginData* data); +static NPError plugin_start_appletviewer (GCJPluginData* data); static gchar* plugin_create_applet_tag (int16 argc, char* argn[], char* argv[]); static void plugin_send_message_to_appletviewer (GCJPluginData* data, @@ -368,7 +377,15 @@ // watch callbacks. g_mutex_lock (data-appletviewer_mutex); - plugin_start_appletviewer (data); + np_error = plugin_start_appletviewer (data); + + // If the appletviewer is not installed, then a dialog box will + // show up and the plugin will be killed. + if (np_error != NPERR_NO_ERROR) +{ + if (plugin_failed ()) +goto cleanup_applet_failure; +} // Create plugin-to-appletviewer channel. The default encoding for // the file is UTF-8. @@ -492,7 +509,8 @@ // cleanup_out_pipe: // Delete output pipe. unlink (data-out_pipe_name); - + + cleanup_applet_failure: cleanup_out_pipe_name: g_free (data-out_pipe_name); data-out_pipe_name = NULL; @@ -879,6 +897,32 @@ return documentbase_copy; } +// This function shows a error message if the appletviewer has +// not been installed. It returns true, if the user presses the +// ok button. +static bool +plugin_failed () +{ + GtkWidget* dialog = NULL; + GtkWidget* ok_button = NULL; + + dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + FAILURE_MESSAGE); + ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), + GTK_STOCK_OK, + GTK_RESPONSE_OK); + gtk_widget_show_all (dialog); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) +{ + gtk_widget_destroy (dialog); + return true; +} + return false; +} + // plugin_user_trusts_documentbase returns true if the given // documentbase is in the documentbase whitelist. Otherwise it asks // the user if he trusts the given documentbase by calling @@ -1173,11 +1217,12 @@ return FALSE; } -static void +static NPError plugin_start_appletviewer (GCJPluginData* data) { PLUGIN_DEBUG
[cp-patches] Patch: JFrame frameInit fix
I am committing this for Tania. She has also written a mauve test for this. She has fixed the constructor regressions 2006-06-05 Tania Bento [EMAIL PROTECTED] * javax/swing/JFrame.java (frameInit): Set background color and fixed layout parameters. Index: javax/swing/JFrame.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JFrame.java,v retrieving revision 1.35 diff -u -r1.35 JFrame.java --- javax/swing/JFrame.java 11 May 2006 11:18:42 - 1.35 +++ javax/swing/JFrame.java 5 Jun 2006 20:26:51 - @@ -157,7 +157,8 @@ protected void frameInit() { -super.setLayout(new BorderLayout(1, 1)); +super.setLayout(new BorderLayout()); +setBackground(UIManager.getDefaults().getColor(control)); enableEvents(AWTEvent.WINDOW_EVENT_MASK); getRootPane(); // will do set/create
[cp-patches] Patch: Frame KeyEvents
This fixes the problem where windows did not get notified of key events. See the bug report. 2006-06-01 Lillian Angel [EMAIL PROTECTED] PR 24458 * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent): Fixed to getFocusOwner, if that fails it tries to get the focused window. Index: java/awt/DefaultKeyboardFocusManager.java === RCS file: /cvsroot/classpath/classpath/java/awt/DefaultKeyboardFocusManager.java,v retrieving revision 1.17 diff -u -r1.17 DefaultKeyboardFocusManager.java --- java/awt/DefaultKeyboardFocusManager.java 5 Apr 2006 10:31:26 - 1.17 +++ java/awt/DefaultKeyboardFocusManager.java 2 Jun 2006 16:16:21 - @@ -274,10 +274,12 @@ public boolean dispatchKeyEvent (KeyEvent e) { -Component focusOwner = getGlobalPermanentFocusOwner (); - +Component focusOwner = getFocusOwner(); +if (focusOwner == null) + focusOwner = getFocusedWindow(); + if (focusOwner != null) - redispatchEvent(focusOwner, e); + redispatchEvent(focusOwner, e); // Loop through all registered KeyEventPostProcessors, giving // each a chance to process this event. @@ -294,7 +296,7 @@ // MenuShortcut. if (postProcessKeyEvent (e)) return true; - + // Always return true. return true; }
[cp-patches] Patch: Appletviewer fix
This fixes the classloading problem with a lot of applets. 2006-06-01 Lillian Angel [EMAIL PROTECTED] * tools/gnu/classpath/tools/appletviewer/AppletTag.java (prependCodebase): Fixed check. No dirname was ever considered to be a file, so every applet fell into the if-statement causing a lot of classloading problems with the applets. Index: tools/gnu/classpath/tools/appletviewer/AppletTag.java === RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/appletviewer/AppletTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- tools/gnu/classpath/tools/appletviewer/AppletTag.java 24 May 2006 20:14:22 - 1.2 +++ tools/gnu/classpath/tools/appletviewer/AppletTag.java 1 Jun 2006 16:40:11 - 1.3 @@ -451,7 +451,7 @@ else { String dirname = documentbase.getFile(); -if (!new File(dirname).isFile()) +if (dirname.indexOf(.) 0) fullcodebase = new URL(documentbase + File.separator); else {
Re: [cp-patches] Patch: Appletviewer fix
On Thu, 2006-06-01 at 13:26 -0400, Thomas Fitzsimmons wrote: Lillian Angel wrote: This fixes the classloading problem with a lot of applets. 2006-06-01 Lillian Angel [EMAIL PROTECTED] * tools/gnu/classpath/tools/appletviewer/AppletTag.java (prependCodebase): Fixed check. No dirname was ever considered to be a file, so every applet fell into the if-statement causing a lot of classloading problems with the applets. Index: tools/gnu/classpath/tools/appletviewer/AppletTag.java === RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/appletviewer/AppletTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- tools/gnu/classpath/tools/appletviewer/AppletTag.java 24 May 2006 20:14:22 - 1.2 +++ tools/gnu/classpath/tools/appletviewer/AppletTag.java 1 Jun 2006 16:40:11 - 1.3 @@ -451,7 +451,7 @@ else { String dirname = documentbase.getFile(); -if (!new File(dirname).isFile()) +if (dirname.indexOf(.) 0) fullcodebase = new URL(documentbase + File.separator); This is fine for now, but I'm thinking we may be working around a general problem with our URL class. Shouldn't http://gnu.org/software/classpath and http://gnu.org/software/classpath/ resolve to the same location when passed to the URL constructor? In prependCodebase, we pass in a directory name to create the documentbase URL. It assumes the directory is everything from the first character to the last File separator (/): dirname = dirname.substring(0, dirname.lastIndexOf(File.separatorChar) + 1); This is a bad assumption, because the directory can be the entire documentbase. Therefore, the code in URL is not wrong. This is how we handle it in the AppletTag class ATM. This check I added is a work-around, but it is the best way to handle this. We need to check if the entire documentbase is the parent directory to the applet's main class. Lillian Tom
[cp-patches] Patch: BasicProgressBarUI fix
I have fixed paintString to actually draw a string vertically. But this does not seem to happen because of some bug in Graphics2D. Once this is fixed in Graphics2D, it should work perfectly. See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23887 2006-05-31 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicProgressBarUI.java (paintString): Implemented to paint the string vertically. Index: javax/swing/plaf/basic/BasicProgressBarUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java,v retrieving revision 1.15 diff -u -r1.15 BasicProgressBarUI.java --- javax/swing/plaf/basic/BasicProgressBarUI.java 15 Nov 2005 20:32:46 - 1.15 +++ javax/swing/plaf/basic/BasicProgressBarUI.java 31 May 2006 18:56:04 - @@ -52,6 +52,7 @@ import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.geom.AffineTransform; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -725,40 +726,35 @@ protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) { -// FIXME: We do not support vertical text painting because Java2D is needed -// for this. -if (progressBar.getOrientation() == JProgressBar.VERTICAL) - return; - -// We want to place in the exact center of the bar. +String str = progressBar.getString(); +int full = getAmountFull(b, width, height); Point placement = getStringPlacement(g, progressBar.getString(), - x + b.left, y + b.top, + x + b.left, y + b.top, width - b.left - b.right, height - b.top - b.bottom); - Color savedColor = g.getColor(); Shape savedClip = g.getClip(); -FontMetrics fm = g.getFontMetrics(progressBar.getFont()); -int full = getAmountFull(b, width, height); -String str = progressBar.getString(); - -// We draw this string two times with different clips so that the text -// over the filled area is painted with selectionForeground and over -// the clear area with selectionBackground. + +if (progressBar.getOrientation() == JProgressBar.VERTICAL) + { +AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2); +g.setFont(progressBar.getFont().deriveFont(rotate)); + } + g.setColor(getSelectionForeground()); g.setClip(0, 0, full + b.left, height); -g.drawString(str, placement.x, placement.y + fm.getAscent()); +g.drawString(str, placement.x, placement.y); g.setColor(getSelectionBackground()); g.setClip(full + b.left, 0, width - full, height); -g.drawString(str, placement.x, placement.y + fm.getAscent()); +g.drawString(str, placement.x, placement.y); g.setClip(savedClip); g.setColor(savedColor); } /** - * This method sets the current animation index. If the index - * is greater than the number of frames, it resets to 0. - * + * This method sets the current animation index. If the index is greater than + * the number of frames, it resets to 0. + * * @param newValue The new animation index. */ protected void setAnimationIndex(int newValue)
[cp-patches] Patch: Window focus lost/gained fix
This patch fixes the focus lost/gained notification for all windows. 2006-05-25 Lillian Angel [EMAIL PROTECTED] PR 26174 * java/awt/Window.java (Window): Moved code to helper. (addWindowFocusListener): New function. Handles focus listener code. Added code to handle focus lost/gained from the window. Index: java/awt/Window.java === RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- java/awt/Window.java 16 May 2006 16:39:00 - 1.70 +++ java/awt/Window.java 26 May 2006 15:36:04 - 1.71 @@ -42,6 +42,7 @@ import java.awt.event.ComponentEvent; import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowFocusListener; @@ -132,33 +133,7 @@ // cycle roots. focusCycleRoot = true; setLayout(new BorderLayout()); - -addWindowFocusListener (new WindowAdapter () - { -public void windowGainedFocus (WindowEvent event) -{ - if (windowFocusOwner != null) -{ - // FIXME: move this section and the other similar - // sections in Component into a separate method. - EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); - synchronized (eq) -{ - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); - Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); - if (currentFocusOwner != null) -{ - eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST, -false, windowFocusOwner)); - eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, -false, currentFocusOwner)); -} - else -eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false)); -} -} -} - }); +addWindowFocusListener(); GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration(); @@ -169,7 +144,68 @@ this(); graphicsConfiguration = gc; } + + private void addWindowFocusListener() + { +addWindowFocusListener(new WindowAdapter() +{ + public void windowGainedFocus(WindowEvent event) + { +EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); +if (windowFocusOwner != null) + { +synchronized (eq) + { +KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); +Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); +if (currentFocusOwner != null) + { +eq.postEvent(new FocusEvent(currentFocusOwner, +FocusEvent.FOCUS_LOST, false, +windowFocusOwner)); +eq.postEvent(new FocusEvent(windowFocusOwner, +FocusEvent.FOCUS_GAINED, false, +currentFocusOwner)); + } +else + eq.postEvent(new FocusEvent(windowFocusOwner, + FocusEvent.FOCUS_GAINED, false)); + } + } +else + eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_GAINED, + false)); + } + public void windowLostFocus(WindowEvent event) + { +EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); +if (windowFocusOwner != null) + { +synchronized (eq) + { +KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); +Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); +if (currentFocusOwner != null) + { +eq.postEvent(new FocusEvent(currentFocusOwner, +FocusEvent.FOCUS_GAINED, false, +windowFocusOwner)); +eq.postEvent(new FocusEvent(windowFocusOwner, +FocusEvent.FOCUS_LOST, false, +currentFocusOwner)); + } +else
[cp-patches] Patch: gnu_java_awt_peer_gtk_GtkComponentPeer fix
An exception was being thrown from the awt demo in the RandomTests test. This is now fixed 2006-05-25 Lillian Angel [EMAIL PROTECTED] * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked): Added check to prevent assertion error. If widget-window is null, then use the parent widget's window to set the cursor on. Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c === RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,v retrieving revision 1.62 diff -u -r1.62 gnu_java_awt_peer_gtk_GtkComponentPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c 29 Mar 2006 10:18:27 - 1.62 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c 25 May 2006 14:24:54 - @@ -204,6 +204,7 @@ { void *ptr; GtkWidget *widget; + GdkWindow *win; GdkCursorType gdk_cursor_type; GdkCursor *gdk_cursor; @@ -255,16 +256,20 @@ } widget = get_widget(GTK_WIDGET(ptr)); - + + win = widget-window; + if ((widget-window) == NULL) +win = GTK_WIDGET(ptr)-window; + if (image == NULL) gdk_cursor = gdk_cursor_new (gdk_cursor_type); else gdk_cursor - = gdk_cursor_new_from_pixbuf (gdk_drawable_get_display (widget-window), + = gdk_cursor_new_from_pixbuf (gdk_drawable_get_display (win), cp_gtk_image_get_pixbuf (env, image), x, y); - gdk_window_set_cursor (widget-window, gdk_cursor); + gdk_window_set_cursor (win, gdk_cursor); gdk_cursor_unref (gdk_cursor); /* Make sure the cursor is replaced on screen. */
[cp-patches] Patch: GlyphVector implementation
Added the default implementation for all the stubbed functions in the abstract GlyphVector class. 2006-05-19 Lillian Angel [EMAIL PROTECTED] * java/awt/font/GlyphVector.java (getGlyphCharIndex): Implemented. (getGlyphCharIndices): Implemented. (getGlyphOutline): Implemented. (getGlyphVisualBounds): Implemented. (getGlyphVisualBounds): Implemented. (getPixelBounds): Implemented. (getLayoutFlags): Implemented. Index: java/awt/font/GlyphVector.java === RCS file: /cvsroot/classpath/classpath/java/awt/font/GlyphVector.java,v retrieving revision 1.3 diff -u -r1.3 GlyphVector.java --- java/awt/font/GlyphVector.java 22 Mar 2006 19:15:24 - 1.3 +++ java/awt/font/GlyphVector.java 19 May 2006 14:27:45 - @@ -38,8 +38,6 @@ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Font; import java.awt.Rectangle; import java.awt.Shape; @@ -48,6 +46,7 @@ import java.awt.geom.Rectangle2D; /** + * @author Lillian Angel (langel at redhat dot com) * @author Michael Koch */ public abstract class GlyphVector implements Cloneable @@ -72,16 +71,22 @@ public abstract FontRenderContext getFontRenderContext (); public int getGlyphCharIndex (int glyphIndex) -throws NotImplementedException { -throw new Error (not implemented); +return glyphIndex; } - public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, -int[] codeReturn) -throws NotImplementedException + public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, + int[] codeReturn) { -throw new Error (not implemented); +if (codeReturn == null) + codeReturn = new int[numEntries]; + +int i = 0; +int j = beginGlyphIndex; +while (j numEntries) + codeReturn[i++] = getGlyphCharIndex(j++); + +return codeReturn; } public abstract int getGlyphCode (int glyphIndex); @@ -98,17 +103,27 @@ public abstract Shape getGlyphOutline (int glyphIndex); - public Shape getGlyphOutline (int glyphIndex, float x, float y) -throws NotImplementedException + public Shape getGlyphOutline(int glyphIndex, float x, float y) { -throw new Error (not implemented); +Shape s = getGlyphOutline(glyphIndex); + +// This is the only way to translate the origin of a shape +AffineTransform at = AffineTransform.getTranslateInstance(x, y); +return at.createTransformedShape(s); } - public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, -float x, float y) -throws NotImplementedException + public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, + float x, float y) { -throw new Error (not implemented); +Rectangle bounds = new Rectangle(); +Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D(); + +bounds.x = (int) (rect.getX() + x); +bounds.y = (int) (rect.getY() + y); +bounds.width = (int) rect.getMaxX() - bounds.x; +bounds.height = (int) rect.getMaxY() - bounds.y; + +return bounds; } public abstract Point2D getGlyphPosition (int glyphIndex); @@ -121,10 +136,9 @@ public abstract Shape getGlyphVisualBounds (int glyphIndex); - public int getLayoutFlags () -throws NotImplementedException + public int getLayoutFlags() { -throw new Error (not implemented); +return 0; } public abstract Rectangle2D getLogicalBounds (); @@ -137,9 +151,16 @@ public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) -throws NotImplementedException { -throw new Error (not implemented); +Rectangle bounds = new Rectangle(); +Rectangle2D rect = getVisualBounds(); + +bounds.x = (int) (rect.getX() + x); +bounds.y = (int) (rect.getY() + y); +bounds.width = (int) rect.getMaxX() - bounds.x; +bounds.height = (int) rect.getMaxY() - bounds.y; + +return bounds; } public abstract Rectangle2D getVisualBounds ();
[cp-patches] Patch: ShapeGraphicAttribute implemented.
I implemented and documented ShapeGraphicAttribute. I have also committed a mauve test for it. 2006-05-18 Lillian Angel [EMAIL PROTECTED] * java/awt/font/ShapeGraphicAttribute.java: Documented entire class. (ShapeGraphicAttribute): Initialized bounds field. (draw): Implemented. (equals): Implemented. (getAdvance): Implemented. (getAscent): Implemented. (getBounds): Implemented. (getDescent): Implemented. (hashCode): Implemented. Index: java/awt/font/ShapeGraphicAttribute.java === RCS file: /cvsroot/classpath/classpath/java/awt/font/ShapeGraphicAttribute.java,v retrieving revision 1.3 diff -u -r1.3 ShapeGraphicAttribute.java --- java/awt/font/ShapeGraphicAttribute.java 22 Mar 2006 19:15:24 - 1.3 +++ java/awt/font/ShapeGraphicAttribute.java 18 May 2006 15:48:05 - @@ -38,74 +38,148 @@ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Rectangle2D; +/** + * This is an implementation of GraphicAttribute that draws shapes in a TextLayout. + * + * @author Lillian Angel (langel at redhat dot com) + */ public final class ShapeGraphicAttribute extends GraphicAttribute { + /** True if the shape should be filled. */ public static final boolean FILL = false; + + /** True if the shape should be stroked with a 1-pixel wide stroke. */ public static final boolean STROKE = true; private Shape shape; private boolean stroke; + private Rectangle2D bounds; - public ShapeGraphicAttribute (Shape shape, int alignment, boolean stroke) + /** + * Constructor. + * + * @param shape - the Shape to render. The Shape is rendered with its origin. + * @param alignment - the alignment + * @param stroke - true if the Shape should be stroked; false if the Shape + * should be filled. + */ + public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke) { -super (alignment); +super(alignment); this.shape = shape; this.stroke = stroke; +this.bounds = shape.getBounds2D(); } - public void draw (Graphics2D graphics, float x, float y) -throws NotImplementedException - { -throw new Error (not implemented); - } - - public boolean equals (Object obj) + /** + * Draws the graphic at the given location. + * + * @param graphics - the graphics to use. + * @param x - the x location to draw at. + * @param y - the y location to draw at. + */ + public void draw(Graphics2D graphics, float x, float y) + { +graphics.translate(x, y); +if (stroke == STROKE) + graphics.draw(shape); +else + graphics.fill(shape); +graphics.translate(- x, - y); + } + + /** + * Compares this ShapeGraphicAttribute to obj. + * + * @param obj - the object to compare. + */ + public boolean equals(Object obj) { if (! (obj instanceof ShapeGraphicAttribute)) return false; -return equals ((ShapeGraphicAttribute) obj); - } - - public boolean equals (ShapeGraphicAttribute rhs) - { -return (shape.equals (rhs.shape) - getAlignment () == rhs.getAlignment () - stroke == rhs.stroke); - } - - public float getAdvance () -throws NotImplementedException - { -throw new Error (not implemented); - } - - public float getAscent () -throws NotImplementedException - { -throw new Error (not implemented); - } - - public Rectangle2D getBounds () - { -return shape.getBounds2D (); - } - - public float getDescent () -throws NotImplementedException - { -throw new Error (not implemented); +return equals((ShapeGraphicAttribute) obj); } - public int hashCode () + /** + * Compares this ShapeGraphicAttribute to rhs. + * + * @param rhs - the ShapeGraphicAttribute to compare. + */ + public boolean equals(ShapeGraphicAttribute rhs) + { +return (this == rhs || (this.shape.equals(rhs.shape) + getAlignment() == rhs.getAlignment() + stroke == rhs.stroke + getAdvance() == rhs.getAdvance() + getAscent() == rhs.getAscent() + getBounds().equals(rhs.getBounds()) + getDescent() == rhs.getDescent() + hashCode() == rhs.hashCode())); + } + + /** + * Gets the distance from the origin of its Shape to the right side of the + * bounds of its Shape. + * + * @return the advance + */ + public float getAdvance() + { +return Math.max(0, (float) bounds.getMaxX()); + } + + /** + * Gets the positive distance from the origin of its Shape to the top of + * bounds. + * + * @return the ascent + */ + public float getAscent() + { +return Math.max(0, -(float) bounds.getMinY()); + } + + /** + * Gets
Re: [cp-patches] Patch: GraphicAttribute implementation
On Thu, 2006-05-18 at 12:59 -0600, Tom Tromey wrote: Lillian == Lillian Angel [EMAIL PROTECTED] writes: Lillian - public static final int BOTTOM_ALIGNMENT = -2; Lillian + public static final int BOTTOM_ALIGNMENT = - 2; This is kind of weird. If there is an eclipse formatter setting for this, we should change it. Yes, I noticed this too. There is an option under 'white space-expressions-operators-after unary operators' If not, we should file a feature request. Tom Lillian
[cp-patches] Patch: GlyphMetrics
I implemented two unimplemented functions. 2006-05-18 Lillian Angel [EMAIL PROTECTED] * java/awt/font/GlyphMetrics.java (getLSB): Implemented. (getRSB): Implemented. Index: java/awt/font/GlyphMetrics.java === RCS file: /cvsroot/classpath/classpath/java/awt/font/GlyphMetrics.java,v retrieving revision 1.3 diff -u -r1.3 GlyphMetrics.java --- java/awt/font/GlyphMetrics.java 22 Mar 2006 19:15:24 - 1.3 +++ java/awt/font/GlyphMetrics.java 18 May 2006 19:28:53 - @@ -38,8 +38,6 @@ package java.awt.font; -import gnu.classpath.NotImplementedException; - import java.awt.geom.Rectangle2D; /** @@ -94,16 +92,18 @@ return bounds; } - public float getLSB () -throws NotImplementedException + public float getLSB() { -throw new Error (not implemented); +if (horizontal) + return (float) bounds.getX(); +return (float) bounds.getY(); } - public float getRSB () - throws NotImplementedException + public float getRSB() { -throw new Error (not implemented); +if (horizontal) + return (float) (advanceX - (bounds.getX() + bounds.getWidth())); +return (float) (advanceY - (bounds.getY() + bounds.getHeight())); } public int getType ()
[cp-patches] Patch: JSlider focus fix
Added code to paint the focus for the slider. 2006-05-17 Lillian Angel [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicSliderUI.java (focusGained): Implemented. (focusLost): Implemented. (paint): Added code to paint the focus. * javax/swing/plaf/metal/MetalSliderUI.java (paintThumb): Added code to set the thumbColor. (paintFocus): Implemented properly. Index: javax/swing/plaf/basic/BasicSliderUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v retrieving revision 1.29 diff -u -r1.29 BasicSliderUI.java --- javax/swing/plaf/basic/BasicSliderUI.java 18 Apr 2006 08:40:10 - 1.29 +++ javax/swing/plaf/basic/BasicSliderUI.java 17 May 2006 15:29:03 - @@ -38,8 +38,6 @@ package javax.swing.plaf.basic; -import gnu.classpath.NotImplementedException; - import java.awt.Color; import java.awt.Component; import java.awt.ComponentOrientation; @@ -70,6 +68,7 @@ import javax.swing.JLabel; import javax.swing.JSlider; import javax.swing.LookAndFeel; +import javax.swing.RepaintManager; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.UIManager; @@ -209,9 +208,9 @@ * @param e A [EMAIL PROTECTED] FocusEvent}. */ public void focusGained(FocusEvent e) - throws NotImplementedException { - // FIXME: implement. + slider.repaint(); + hasFocus = true; } /** @@ -221,9 +220,9 @@ * @param e A [EMAIL PROTECTED] FocusEvent}. */ public void focusLost(FocusEvent e) - throws NotImplementedException { - // FIXME: implement. + slider.repaint(); + hasFocus = false; } } @@ -592,6 +591,9 @@ /** The focus color. */ private transient Color focusColor; + + /** True if the slider has focus. */ + private transient boolean hasFocus; /** * Creates a new Basic look and feel Slider UI. @@ -1548,9 +1550,11 @@ paintTicks(g); if (slider.getPaintLabels()) paintLabels(g); - -//FIXME: Paint focus. + paintThumb(g); + +if (hasFocus) + paintFocus(g); } /** @@ -1602,7 +1606,7 @@ Color saved_color = g.getColor(); g.setColor(getFocusColor()); - + g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height); g.setColor(saved_color); @@ -1989,7 +1993,7 @@ public void paintThumb(Graphics g) { Color saved_color = g.getColor(); - + Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); @@ -1997,11 +2001,11 @@ Point e = new Point(a); Polygon bright; -Polygon light; // light shadow -Polygon dark; // dark shadow +Polygon light; // light shadow +Polygon dark; // dark shadow Polygon all; -// This will be in X-dimension if the slider is inverted and y if it isn't. +// This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) @@ -2016,13 +2020,15 @@ bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); -dark = new Polygon(new int[] { b.x, c.x, d.x + 1 }, - new int[] { b.y, c.y - 1, d.y }, 3); - -light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 }, -new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3); - -all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 }, +dark = new Polygon(new int[] { b.x, c.x, d.x + 1 }, new int[] { b.y, + c.y - 1, + d.y }, 3); + +light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 }, +new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3); + +all = new Polygon( + new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y }, 5); } @@ -2038,15 +2044,16 @@ bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x }, new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4); -dark = new Polygon(new int[] { c.x, d.x, e.x }, - new int[] { c.y, d.y, e.y }, 3); +dark = new Polygon(new int[] { c.x, d.x, e.x }, new int[] { c.y, d.y, + e.y }, 3); -light = new Polygon(new int[] { c.x - 1, d.x, e.x + 1}, - new int[] { c.y, d.y - 1, e.y - 1}, 3); -all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x, - e.x + 1
[cp-patches] Patch: GraphicsConfiguration
Implemented missing functions. 2006-05-17 Lillian Angel [EMAIL PROTECTED] * java/awt/GraphicsConfiguration.java (getImageCapabilities): Implemented. (getBufferCapabilities): Implemented. Index: java/awt/GraphicsConfiguration.java === RCS file: /cvsroot/classpath/classpath/java/awt/GraphicsConfiguration.java,v retrieving revision 1.9 diff -u -r1.9 GraphicsConfiguration.java --- java/awt/GraphicsConfiguration.java 22 Mar 2006 19:15:24 - 1.9 +++ java/awt/GraphicsConfiguration.java 17 May 2006 16:05:30 - @@ -65,6 +65,13 @@ */ public abstract class GraphicsConfiguration { + + /** The cached image capabilities. */ + private ImageCapabilities imageCapabilities; + + /** The cached buffer capabilities. */ + private BufferCapabilities bufferCapabilities; + /** * The default constructor. * @@ -218,9 +225,14 @@ * @since 1.4 */ public BufferCapabilities getBufferCapabilities() -throws NotImplementedException { -throw new Error(not implemented); +if (imageCapabilities == null) + getImageCapabilities(); + +if (bufferCapabilities == null) + bufferCapabilities = new BufferCapabilities(imageCapabilities, + imageCapabilities, null); +return bufferCapabilities; } /** @@ -230,8 +242,9 @@ * @since 1.4 */ public ImageCapabilities getImageCapabilities() -throws NotImplementedException { -throw new Error(not implemented); +if (imageCapabilities == null) + imageCapabilities = new ImageCapabilities(false); +return imageCapabilities; } } // class GraphicsConfiguration
[cp-patches] Patch: TexturePaint
Implemented a missing function from TexturePaint and documented entire class. 2006-05-17 Lillian Angel [EMAIL PROTECTED] * java/awt/TexturePaint.java: Added documentation for class and all functions. (getTransparency): Implemented. Index: java/awt/TexturePaint.java === RCS file: /cvsroot/classpath/classpath/java/awt/TexturePaint.java,v retrieving revision 1.3 diff -u -r1.3 TexturePaint.java --- java/awt/TexturePaint.java 22 Mar 2006 19:15:21 - 1.3 +++ java/awt/TexturePaint.java 17 May 2006 17:34:56 - @@ -45,35 +45,74 @@ import java.awt.image.BufferedImage; import java.awt.image.ColorModel; -/** STUB CLASS ONLY */ +/** + * This class provides a way to fill a Shape with a texture that is + * specified by a BufferedImage. + */ public class TexturePaint implements Paint { private final BufferedImage texture; private final Rectangle2D anchor; + + /** + * Constructor. + * + * @param texture - the texture + * @param anchor - the shape + */ public TexturePaint(BufferedImage texture, Rectangle2D anchor) { this.texture = texture; this.anchor = anchor; } + + /** + * Gets the texture image. + * + * @return the texture + */ public BufferedImage getImage() { return texture; } + + /** + * Gets the shape anchor. + * + * @return the shape anchor + */ public Rectangle2D getAnchorRect() { return anchor; } + + /** + * Creates the context used to paint the texture. + * + * @param cm - the ColorModel that receives the Paint data. Used only as a hint. + * @param deviceBounds - the device space being rendered. + * @param userBounds - the user space being rendered + * @param xform - the AffineTransform from user space into device space + * @param hints - a RenderingHints object that is used to specify how the + * pattern is rendered + * @return the paint context used to paint the texture + */ public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, -AffineTransform xform, -RenderingHints hints) -throws NotImplementedException +AffineTransform xform, RenderingHints hints) + throws NotImplementedException { -throw new Error(not implemented); +// FIXME: Not implemented. +return null; } + + /** + * Returns the transparency mode. + * + * @return the transparency mode. + */ public int getTransparency() -throws NotImplementedException { -throw new Error(not implemented); +return texture.getTransparency(); } } // class TexturePaint
[cp-patches] Patch: java.awt.Window
I implemented the deprecated function applyResourceBundle. 2005-05-16 Lillian Angel [EMAIL PROTECTED] * java/awt/Window.java (applyResourceBundle): Implemented. Index: java/awt/Window.java === RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v retrieving revision 1.69 diff -u -r1.69 Window.java --- java/awt/Window.java 11 Apr 2006 18:05:49 - 1.69 +++ java/awt/Window.java 16 May 2006 16:37:45 - @@ -1046,12 +1046,11 @@ /** * @since 1.2 * - * @deprecated + * @deprecated replaced by Component.applyComponentOrientation. */ public void applyResourceBundle(ResourceBundle rb) -throws NotImplementedException { -throw new Error (Not implemented); +applyComponentOrientation(ComponentOrientation.getOrientation(rb)); } /**
[cp-patches] Patch: StyleContext implementations
I implemented most of the stubs in StyleContext. I am not sure how to implement writeAttributeSet just yet, so I left this one. The API docs were pretty helpful here. 2006-05-16 Lillian Angel [EMAIL PROTECTED] * javax/swing/text/StyleContext.java: Changed staticAttributeKeys to be a Hashtable. (getStaticAttribute): Implemented. (getStaticAttributeKey): Implemented. (readAttributeSet): Implemented. (writeAttributeSet): Added FIXME. Not sure how to implement this. (readAttributes): Implemented. (writeAttributes): Implemented. (registerStaticAttibuteKey): Fixed to add key to the hash table. Index: javax/swing/text/StyleContext.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyleContext.java,v retrieving revision 1.11 diff -u -r1.11 StyleContext.java --- javax/swing/text/StyleContext.java 23 Mar 2006 00:30:14 - 1.11 +++ javax/swing/text/StyleContext.java 16 May 2006 20:36:26 - @@ -413,7 +413,7 @@ /** * These attribute keys are handled specially in serialization. */ - private static HashSet staticAttributeKeys = new HashSet(); + private static Hashtable staticAttributeKeys = new Hashtable(); EventListenerList listenerList; Hashtable styleTable; @@ -708,44 +708,107 @@ } } - - // FIXME: there's some sort of quasi-serialization stuff in here which I - // have left incomplete; I'm not sure I understand the intent properly. - + /** + * Gets the object previously registered with registerStaticAttributeKey. + * + * @param key - the key that was registered. + * @return the object previously registered with registerStaticAttributeKey. + */ public static Object getStaticAttribute(Object key) -throws NotImplementedException { -throw new InternalError(not implemented); +if (key == null) + return null; +return staticAttributeKeys.get(key); } + /** + * Returns the String that key will be registered with + * registerStaticAttributeKey. + * + * @param key - the key that will be registered. + * @return the string the key will be registered with. + */ public static Object getStaticAttributeKey(Object key) -throws NotImplementedException { -throw new InternalError(not implemented); +return key.getClass().getName() + . + key.toString(); } + /** + * Reads a set of attributes from the given object input stream. This will + * attempt to restore keys that were static objects by considering only the + * keys that have were registered with registerStaticAttributeKey. The + * attributes retrieved will be placed into the given set. + * + * @param in - the stream to read from + * @param a - the set of attributes + * @throws ClassNotFoundException - may be encountered when reading from + * stream + * @throws IOException - any I/O error + */ public static void readAttributeSet(ObjectInputStream in, MutableAttributeSet a) -throws ClassNotFoundException, IOException, NotImplementedException +throws ClassNotFoundException, IOException { -throw new InternalError(not implemented); +if (in == null || a == null) + return; + +Object key = in.readObject(); +Object val = in.readObject(); +while (key != null val != null) + { +Object staticKey = staticAttributeKeys.get(key); +Object staticVal = staticAttributeKeys.get(val); + +if (staticKey != null) + key = staticKey; +if (staticVal != null) + val = staticVal; + +a.addAttribute(key, val); +key = in.readObject(); +val = in.readObject(); + } } + /** + * TODO: DOCUMENT ME! + * + * @param out - stream to write to + * @param a - the attribute set + * @throws IOException - any I/O error + */ public static void writeAttributeSet(ObjectOutputStream out, AttributeSet a) throws IOException, NotImplementedException { -throw new InternalError(not implemented); +// FIXME: Not implemented } + /** + * Handles reading in the attributes. + * @see #readAttributeSet(ObjectInputStream, MutableAttributeSet) + * + * @param in - the stream to read from + * @param a - the set of attributes + * @throws ClassNotFoundException - may be encountered when reading from stream + * @throws IOException - any I/O error + */ public void readAttributes(ObjectInputStream in, MutableAttributeSet a) -throws ClassNotFoundException, IOException, NotImplementedException +throws ClassNotFoundException, IOException { -throw new InternalError(not implemented); +readAttributeSet(in, a); } + /** + * Handles writing of the given attributes. + * @see #writeAttributeSet(ObjectOutputStream, AttributeSet) + * + * @param out - stream to write to + * @param a - the attribute set
Re: [cp-patches] RFC: ClassLoader reference implementation using getResources
On Thu, 2006-05-11 at 15:43 +0200, Olivier Jolly wrote: Lillian Angel wrote: Not sure if it helps, but there is an IndexListParser in gnu/java/net Right, it can be useful. Not in its current state as far as I understand the code because it focus on retrieving the list of dependant jar urls from one .jar while I need to get the list of the packages referenced in all dependant (or own) .jar from many resource. Anyway, I think it's better to add some code in the Parser rather than the reference layer. I'll handle this (when I'll have time). Yep, no problem. Feel free to add all the code you want to that parser... I only implemented what I needed. Thx +Olivier 2006-05-11 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Use getResources to allow retrieving the glizj.zip META-INF/INDEX.LIST entry even if some endorsed jar file embed one.
[cp-patches] Patch: Focus traversal fix
When trying to traverse through focusable and non-focusable objects using the TAB key, several issues came up where not all components were visited and some exceptions were being thrown in the wrong places. You can test out the issue with the buttons in the Swing demo's main frame or the attached test case that Riccardo sent me (they are very helpful). We are now able to successfully traverse through all focusable components forwards and backwards continuously :) The main issue was because we only traversed from the current component to the end of the array of components. It should have been set to traverse from the current component to the component prior to it. 2006-05-11 Lillian Angel [EMAIL PROTECTED] * java/awt/ContainerOrderFocusTraversalPolicy.java (getComponentAfter): Should not throw exception if the ancestor is null. Added a check for this. Also, changed to use new helper function, we should iterate through all the components at least once. (getNextAvailableComponent): New helper function. (getPrevAvailableComponent): New helper function. (getComponentBefore): Should not throw exception if the ancestor is null. Added a check for this. Also, changed to use new helper function, we should iterate through all the components at least once. (getFirstComponent): Changed check to manually check fields. Calling accept() casts the object to a Component, so different values may be returned. (getLastComponent): Likewise. Index: java/awt/ContainerOrderFocusTraversalPolicy.java === RCS file: /cvsroot/classpath/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java,v retrieving revision 1.8 diff -u -r1.8 ContainerOrderFocusTraversalPolicy.java --- java/awt/ContainerOrderFocusTraversalPolicy.java 2 Jul 2005 20:32:24 - 1.8 +++ java/awt/ContainerOrderFocusTraversalPolicy.java 11 May 2006 20:25:31 - @@ -111,14 +111,16 @@ ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { - // We've reached the top focus cycle root ancestor. Check - // if it is root. - if (ancestor != root) +// We've reached the top focus cycle root ancestor. Check +// if it is root. +if (ancestor == null) + ancestor = root; +else if (ancestor != root) throw new IllegalArgumentException (the given container is not + a focus cycle root of the + current component); - else - break; +else + break; } prevAncestor = ancestor; } @@ -146,47 +147,104 @@ // Find component's index. for (int i = 0; i numComponents; i++) { -if (components[i] == current) +if (components[i].equals(current)) componentIndex = i; } -// Search forward for the next acceptable component. -for (int i = componentIndex + 1; i numComponents; i++) +// Search forward for the next acceptable component. +// Search through all components at least one time +// i.e. start at componentIndex + 1 -- nComponents -1 -- 0 --- componentIndex +int i = componentIndex + 1; +int end = numComponents - 1; +Component next = getNextAvailableComponent(components, i, end); +if (next != null) + return next; + +// Now check remainder of components from 0 to componentIndex +i = 0; +end = componentIndex; +next = getNextAvailableComponent(components, i, end); +if (next != null) + return next; + +// No focusable components after current in its Container. So go +// to the next Component after current's Container (parent). +Component result = getComponentAfter (root, parent); +return result; + } + } + + /** + * Gets the next available component in the array between the given range. + * + * @param components - the array of components. + * @param start - where to start + * @param end - where to end + * @return next component if found + */ + private Component getNextAvailableComponent(Component[] components, int start, int end) + { +while (start = end) + { +Component c = components[start]; + +if (c.visible c.isDisplayable() c.enabled c.focusable) + return c; + +if (c instanceof Container) { -if (accept (components[i])) - return components[i]; +Component result = getFirstComponent((Container) c); -if (components[i] instanceof Container) - { -Component result = getFirstComponent ((Container) components[i]); - -if (result != null - implicitDownCycleTraversal) - return
Re: [cp-patches] Patch: SimpleTimeZone fix
Sorry wrong patch attached. Attached is the right one. On Wed, 2006-05-10 at 13:12 -0400, Lillian Angel wrote: I reverted this patch. It caused regressions. I am going to look into the bug I had and try to think of a better solution. 2006-05-10 Lillian Angel [EMAIL PROTECTED] * java/util/SimpleTimeZone.java: Reverted patch. (SimpleTimeZone): Throw exception if startMonth == endMonth. (SimpleTimeZone): Likewise. (checkRule): Rewritten to properly check all values (more efficently). This code is now more stable, at least less buggy than before. Fixed API documentation. (setStartRule): Moved checkRule call to end. (setStartRule): Likewise. (setEndRule): Likewise. (setEndRule): Likewise. On Mon, 2006-05-01 at 16:39 -0400, Lillian Angel wrote: After testing a timezone app, I noticed that SimpleTimeZone is a little buggy. I fixed it up a bit... I imagine there are more bugs in this code. It does work better now. 2006-05-01 Lillian Angel [EMAIL PROTECTED] * java/util/SimpleTimeZone.java (SimpleTimeZone): Do not throw exception if startMonth == endMonth. (SimpleTimeZone): Likewise. (checkRule): Rewritten to properly check all values (more efficently). This code is now more stable, at least less buggy than before. Fixed API documentation. (setStartRule): Moved checkRule call to end. (setStartRule): Likewise. (setEndRule): Likewise. (setEndRule): Likewise. Index: java/util/SimpleTimeZone.java === RCS file: /cvsroot/classpath/classpath/java/util/SimpleTimeZone.java,v retrieving revision 1.29 diff -u -r1.29 SimpleTimeZone.java --- java/util/SimpleTimeZone.java 23 Oct 2005 17:04:46 - 1.29 +++ java/util/SimpleTimeZone.java 1 May 2006 20:37:39 - @@ -333,8 +333,6 @@ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime); setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime); -if (startMonth == endMonth) - throw new IllegalArgumentException(startMonth and endMonth must be different); this.startYear = 0; } @@ -393,8 +391,6 @@ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime); setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime); -if (startMonth == endMonth) - throw new IllegalArgumentException(startMonth and endMonth must be different); this.startYear = 0; this.dstSavings = dstSavings; @@ -413,67 +409,66 @@ } /** - * Checks if the month, day, dayOfWeek arguments are in range and + * Checks if the values are in range and * returns the mode of the rule. * @param month the month parameter as in the constructor - * @param day the day parameter as in the constructor - * @param dayOfWeek the day of week parameter as in the constructor * @return the mode of this rule see startMode. * @exception IllegalArgumentException if parameters are out of range. * @see #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int) * @see #startMode */ - private int checkRule(int month, int day, int dayOfWeek) + private int checkRule(int month) { -if (month 0 || month 11) - throw new IllegalArgumentException(month out of range); - -int daysInMonth = getDaysInMonth(month, 1); -if (dayOfWeek == 0) - { - if (day = 0 || day daysInMonth) - throw new IllegalArgumentException(day out of range); - return DOM_MODE; - } -else if (dayOfWeek 0) - { - if (Math.abs(day) (daysInMonth + 6) / 7) - throw new IllegalArgumentException(dayOfWeekInMonth out of range); - if (dayOfWeek Calendar.SATURDAY) - throw new IllegalArgumentException(dayOfWeek out of range); - return DOW_IN_MONTH_MODE; - } -else +if (startDay != 0) { - if (day == 0 || Math.abs(day) daysInMonth) - throw new IllegalArgumentException(day out of range); - if (dayOfWeek -Calendar.SATURDAY) - throw new IllegalArgumentException(dayOfWeek out of range); - if (day 0) - return DOW_LE_DOM_MODE; - else - return DOW_GE_DOM_MODE; +if (startMonth 0 || startMonth 11) + throw new IllegalArgumentException(month out of range); + +if (startDayOfWeek == 0) + startMode = DOM_MODE; +else + { +if (startDayOfWeek 0) + startMode = DOW_IN_MONTH_MODE; +else + { +startDayOfWeek = -startDayOfWeek; +if (startDay 0) + { +startDay = - startDay; +startMode = DOW_LE_DOM_MODE; + } +else + startMode = DOW_GE_DOM_MODE; + } + +if (startDayOfWeek Calendar.SATURDAY
[cp-patches] Patch: URLClassLoader fix
Added handling for the META-INF/INDEX.LIST file. 2006-05-08 Lillian Angel [EMAIL PROTECTED] PR 27444 * java/net/URLClassLoader.java (JarURLLoader): Added code to go through META-INF/INDEX.LIST file to load all jars listed. Index: java/net/URLClassLoader.java === RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v retrieving revision 1.46 diff -u -r1.46 URLClassLoader.java --- java/net/URLClassLoader.java 25 Mar 2006 20:31:08 - 1.46 +++ java/net/URLClassLoader.java 8 May 2006 14:03:21 - @@ -39,6 +39,7 @@ package java.net; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.EOFException; import java.io.File; @@ -46,6 +47,7 @@ import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.security.AccessControlContext; import java.security.AccessController; import java.security.CodeSource; @@ -62,6 +63,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; /** @@ -315,27 +318,50 @@ jarfile = ((JarURLConnection) baseJarURL.openConnection()).getJarFile(); - + Manifest manifest; Attributes attributes; String classPathString; + this.classPath = new Vector(); + + // This goes through the cached jar files listed + // in the INDEX.LIST file. All the jars found are added + // to the classPath vector so they can be loaded. + String dir = META-INF/INDEX.LIST; + jarfile.getEntry(dir); + BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, + dir).openStream())); + String line = br.readLine(); + while (line != null) +{ + if (line.endsWith(.jar)) +{ + try +{ + this.classPath.add(new URL(baseURL, line)); +} + catch (java.net.MalformedURLException xx) +{ + // Give up +} +} + line = br.readLine(); +} + if ((manifest = jarfile.getManifest()) != null (attributes = manifest.getMainAttributes()) != null ((classPathString = attributes.getValue(Attributes.Name.CLASS_PATH)) != null)) - { - this.classPath = new Vector(); - + { StringTokenizer st = new StringTokenizer(classPathString, ); while (st.hasMoreElements ()) { String e = st.nextToken (); try { - URL url = new URL(baseURL, e); - this.classPath.add(url); + this.classPath.add(new URL(baseURL, e)); } catch (java.net.MalformedURLException xx) {
Re: [cp-patches] Patch: URLClassLoader fix
A fixed a small bug in the last patch I committed. Unfortunately, this is the best way to load all the jars listed in INDEX.LIST. This fixes the case where INDEX.LIST exists and Class-Path does not appear in the MANIFEST. We first check for INDEX.LIST and if it does not exist we check for Class-Path. For example: http://wiki.cubic.uni-koeln.de/jetspeed/cdkwebhtml/jchempaint-applet-core.jar 2006-05-08 Lillian Angel [EMAIL PROTECTED] * java/net/URLClassLoader.java (JarURLLoader): Added check to make sure the INDEX.LIST file exists. On Mon, 2006-05-08 at 10:32 -0400, Thomas Fitzsimmons wrote: Lillian Angel wrote: Added handling for the META-INF/INDEX.LIST file. I don't think this patch is correct -- it is likely working around another problem. The class loader should refer to INDEX.LIST, if it exists, when trying to resolve a class external to the jar file to which INDEX.LIST belongs, as an optimization so it doesn't download dependency jars it doesn't need. But looking in INDEX.LIST is an optimization; applet class loading should not depend on INDEX.LIST since it is not guaranteed to exist. From PR 27444, it seems that there is another problem, perhaps with how AppletClassLoader's classpath is built, or with how URLClassLoader searches for external dependency classes. Tom 2006-05-08 Lillian Angel [EMAIL PROTECTED] PR 27444 * java/net/URLClassLoader.java (JarURLLoader): Added code to go through META-INF/INDEX.LIST file to load all jars listed. Index: java/net/URLClassLoader.java === RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v retrieving revision 1.46 diff -u -r1.46 URLClassLoader.java --- java/net/URLClassLoader.java25 Mar 2006 20:31:08 - 1.46 +++ java/net/URLClassLoader.java8 May 2006 14:03:21 - @@ -39,6 +39,7 @@ package java.net; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.EOFException; import java.io.File; @@ -46,6 +47,7 @@ import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.security.AccessControlContext; import java.security.AccessController; import java.security.CodeSource; @@ -62,6 +63,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; /** @@ -315,27 +318,50 @@ jarfile = ((JarURLConnection) baseJarURL.openConnection()).getJarFile(); - + Manifest manifest; Attributes attributes; String classPathString; + this.classPath = new Vector(); + + // This goes through the cached jar files listed + // in the INDEX.LIST file. All the jars found are added + // to the classPath vector so they can be loaded. + String dir = META-INF/INDEX.LIST; + jarfile.getEntry(dir); + BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, + dir).openStream())); + String line = br.readLine(); + while (line != null) +{ + if (line.endsWith(.jar)) +{ + try +{ + this.classPath.add(new URL(baseURL, line)); +} + catch (java.net.MalformedURLException xx) +{ + // Give up +} +} + line = br.readLine(); +} + if ((manifest = jarfile.getManifest()) != null (attributes = manifest.getMainAttributes()) != null ((classPathString = attributes.getValue(Attributes.Name.CLASS_PATH)) != null)) - { - this.classPath = new Vector(); - + { StringTokenizer st = new StringTokenizer(classPathString, ); while (st.hasMoreElements ()) { String e = st.nextToken (); try { - URL url = new URL(baseURL, e); - this.classPath.add(url); + this.classPath.add(new URL(baseURL, e)); } catch (java.net.MalformedURLException xx) { Index: java/net/URLClassLoader.java === RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v retrieving revision 1.47 diff -u -r1.47
Re: [cp-patches] Patch: URLClassLoader fix
On Mon, 2006-05-08 at 14:17 -0600, Tom Tromey wrote: Lillian == Lillian Angel [EMAIL PROTECTED] writes: Lillian A fixed a small bug in the last patch I committed. Lillian Unfortunately, this is the best way to load all the jars listed in Lillian INDEX.LIST. This patch has a problem and a missing feature. The problem is that it doesn't actually parse the index file format. It is merely looking for lines that end in '.jar' -- but a package name can also validly end that way. I agree. Thanks for pointing this out. I have created a helper file in gnu/java/net to do the parsing of INDEX.LIST 2006-05-08 Lillian Angel [EMAIL PROTECTED] * gnu/java/net/IndexListParser.java: New class. * java/net/URLClassLoader.java (JarURLLoader): Fixed code to use new class. The missing feature is that one of the major points of using index.list is to speed up applications by letting jars be lazily downloaded. This isn't implemented at all. I don't think this is a requirement before checking the patch in, but I do think that PR 27444 should be left open until this feature is implemented. Yes, I spoke to fitzsim about this earlier. It is inefficent at the moment and will need to be fixed later. The bug has been reopened. Lillian Index: gnu/java/net/IndexListParser.java === RCS file: gnu/java/net/IndexListParser.java diff -N gnu/java/net/IndexListParser.java --- /dev/null 1 Jan 1970 00:00:00 - +++ gnu/java/net/IndexListParser.java 8 May 2006 21:25:14 - @@ -0,0 +1,159 @@ +/* IndexListParser.java -- + Copyright (C) 2006 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., 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 +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.net; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.jar.JarFile; + +/** + * The INDEX.LIST file contains sections each separated by a blank line. + * Each section defines the content of a jar, with a + * header defining the jar file path name, followed by a list of paths. + * The jar file paths are relative to the codebase of the root jar. + * +Specification +index file :version-info blankline section* +version-info : JarIndex-Version: version-number +version-number :digit+{.digit+}* +section : body blankline +body : header name* +header :char+.jar newline +name : char+ newline + + * @author langel at redhat dot com + */ +public class IndexListParser +{ + String filePath = META-INF/INDEX.LIST; + String versInfo = JarIndex-Version: ; + double versionNumber; + ArrayList headers = new ArrayList(); + + /** + * Parses the given jarfile's INDEX.LIST file if it exists. + * + * @param jarfile - the given jar file + * @param baseJarURL - the codebase of the jar file + * @param baseURL - the base url for the headers + */ + public IndexListParser(JarFile jarfile, URL baseJarURL, URL baseURL) + { +try +{ +// Parse INDEX.LIST if it exists +if (jarfile.getEntry(filePath) != null) + { +BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL
[cp-patches] Patch: JLabel fix
After testing several applets, I noticed that there were NPEs caused by JLabel. Sun passes in an empty string for text in the constructors that do not take text as a parameter. I fixed this. 2006-05-04 Lillian Angel [EMAIL PROTECTED] * javax/swing/JLabel.java (JLabel): Pass in an empty string for the text parameter. (JLabel): Likewise. (JLabel): Likewise. Index: javax/swing/JLabel.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JLabel.java,v retrieving revision 1.31 diff -u -r1.31 JLabel.java --- javax/swing/JLabel.java 4 May 2006 13:28:59 - 1.31 +++ javax/swing/JLabel.java 4 May 2006 19:06:43 - @@ -344,7 +344,7 @@ */ public JLabel() { -this(null, null, LEADING); +this(, null, LEADING); } /** @@ -355,7 +355,7 @@ */ public JLabel(Icon image) { -this(null, image, CENTER); +this(, image, CENTER); } /** @@ -368,7 +368,7 @@ */ public JLabel(Icon image, int horizontalAlignment) { -this(null, image, horizontalAlignment); +this(, image, horizontalAlignment); } /**
Re: [cp-patches] Patch: SwingUtilities fix
After doing some tests on Sun, it seems that getRoot should return the Window component of an applet. This doesn't seem like a good solution, but I changed ours back to match it. I added a function to JComponent and RepaintManager to override this unusual behaviour. The JApplet still paint correctly. 2006-05-03 Lillian Angel [EMAIL PROTECTED] * javax/swing/JComponent.java (getRoot): New private function. Gets the root appropriate for painting. If an applet exists as a parent, then it is returned. (paintDoubleBuffered): Changed to use new function. * javax/swing/RepaintManager.java (getRoot): New private function. Gets the root appropriate for painting. If an applet exists as a parent, then it is returned. (getOffscreenBuffer): Changed to use new function. * javax/swing/SwingUtilties.java (getRoot): Reverted last patch to return Window, even if an Applet exists. On Tue, 2006-05-02 at 14:18 -0400, Lillian Angel wrote: This fixes the painting problem with JApplets. In most cases, the components were being drawn on the Window rather than the actual applet. 2006-05-02 Lillian Angel [EMAIL PROTECTED] * javax/swing/SwingUtilities.java (getRoot): Should return the Applet if it exists. Only return the Window if an Applet has not been encountered. Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.117 diff -u -r1.117 JComponent.java --- javax/swing/JComponent.java 30 Apr 2006 09:24:19 - 1.117 +++ javax/swing/JComponent.java 3 May 2006 14:23:00 - @@ -2159,6 +2159,33 @@ } /** + * Gets the root of the component given. If a parent of the + * component is an instance of Applet, then the applet is + * returned. The applet is considered the root for painting + * and adding/removing components. Otherwise, the root Window + * is returned if it exists. + * + * @param comp - The component to get the root for. + * @return the parent root. An applet if it is a parent, + * or the root window. If neither exist, null is returned. + */ + private Component getRoot(Component comp) + { + Applet app = null; + + while (comp != null) +{ + if (app == null comp instanceof Window) +return comp; + else if (comp instanceof Applet) +app = (Applet) comp; + comp = comp.getParent(); +} + + return app; + } + + /** * Performs double buffered repainting. */ private void paintDoubleBuffered(Rectangle r) @@ -2166,7 +2193,7 @@ RepaintManager rm = RepaintManager.currentManager(this); // Paint on the offscreen buffer. -Component root = SwingUtilities.getRoot(this); +Component root = getRoot(this); Image buffer = rm.getOffscreenBuffer(this, root.getWidth(), root.getHeight()); //Rectangle targetClip = SwingUtilities.convertRectangle(this, r, root); Index: javax/swing/RepaintManager.java === RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v retrieving revision 1.30 diff -u -r1.30 RepaintManager.java --- javax/swing/RepaintManager.java 18 Apr 2006 12:48:32 - 1.30 +++ javax/swing/RepaintManager.java 3 May 2006 14:23:00 - @@ -38,11 +38,13 @@ package javax.swing; +import java.applet.Applet; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; +import java.awt.Window; import java.awt.image.VolatileImage; import java.util.ArrayList; import java.util.Collections; @@ -607,7 +609,7 @@ public Image getOffscreenBuffer(Component component, int proposedWidth, int proposedHeight) { -Component root = SwingUtilities.getRoot(component); +Component root = getRoot(component); Image buffer = (Image) offscreenBuffers.get(root); if (buffer == null || buffer.getWidth(null) proposedWidth @@ -622,7 +624,33 @@ } return buffer; } - + + /** + * Gets the root of the component given. If a parent of the + * component is an instance of Applet, then the applet is + * returned. The applet is considered the root for painting. + * Otherwise, the root Window is returned if it exists. + * + * @param comp - The component to get the root for. + * @return the parent root. An applet if it is a parent, + * or the root window. If neither exist, null is returned. + */ + private Component getRoot(Component comp) + { + Applet app = null; + + while (comp != null) +{ + if (app == null comp instanceof Window) +return comp; + else if (comp
Re: [cp-patches] Patch: Parser fix
On Tue, 2006-05-02 at 14:32 +0200, Audrius Meskauskas wrote: Now there are two identical cases in the switch statement: case NUMTOKEN: (code, ends with break) case SLASH: (same code again) Probably it may be better just to put two labels: No, the code is slightly different. I will retest this and possibly change it back. case NUMTOKEN: case SLASH: (code) rather than duplicating the whole section. It seems still parsing correctly. 2006-05-02 Audrius Meskauskas [EMAIL PROTECTED] * gnu/javax/swing/text/html/parser/support/Parser.java (readAttributes): Merge case NUMTOKEN: and case SLASH sections.
Re: [cp-patches] Patch: Parser fix
Reverted. Try this to see the problem with parsing: gcjappletviewer --verbose https://service.oneaccount.com/Service/Status/int001p.main_page?brand=2 2006-05-02 Lillian Angel [EMAIL PROTECTED] * gnu/javax/swing/text/html/parser/support/Parser.java (readAttributes): Reverted Audrius' last patch. There is a slight difference in code between the NUMTOKEN and SLASH case. On Tue, 2006-05-02 at 09:45 -0400, Lillian Angel wrote: On Tue, 2006-05-02 at 14:32 +0200, Audrius Meskauskas wrote: Now there are two identical cases in the switch statement: case NUMTOKEN: (code, ends with break) case SLASH: (same code again) Probably it may be better just to put two labels: No, the code is slightly different. I will retest this and possibly change it back. case NUMTOKEN: case SLASH: (code) rather than duplicating the whole section. It seems still parsing correctly. 2006-05-02 Audrius Meskauskas [EMAIL PROTECTED] * gnu/javax/swing/text/html/parser/support/Parser.java (readAttributes): Merge case NUMTOKEN: and case SLASH sections.
[cp-patches] Patch: Parser fix
Fixed the reading of attributes in the parser. Apparently, some attributes were being skipped if the value started with \. This is fixed. 2006-05-01 Lillian Angel [EMAIL PROTECTED] * gnu/javax/swing/text/html/parser/support/Parser.java (readAttributes): Formatted function. Added handling for SLASH token. The value of an attribute may start with a slash (i.e. a path). I added handling similar to to the NUMTOKEN code. We should not be skipping over these type of attributes. Index: gnu/javax/swing/text/html/parser/support/Parser.java === RCS file: /cvsroot/classpath/classpath/gnu/javax/swing/text/html/parser/support/Parser.java,v retrieving revision 1.4 diff -u -r1.4 Parser.java --- gnu/javax/swing/text/html/parser/support/Parser.java 25 Apr 2006 14:58:48 - 1.4 +++ gnu/javax/swing/text/html/parser/support/Parser.java 1 May 2006 13:37:31 - @@ -933,8 +933,7 @@ optional(WS); -attributeReading: -while (getTokenAhead().kind == NUMTOKEN) +attributeReading: while (getTokenAhead().kind == NUMTOKEN) { name = getNextToken(); optional(WS); @@ -949,61 +948,90 @@ switch (next.kind) { -case QUOT : + case QUOT: - // read quoted attribute. - buffer.setLength(0); - readTillTokenE(QUOT); - attrValue = buffer.toString(); - break; - -case AP : - - // read 'quoted' attribute. - buffer.setLength(0); - readTillTokenE(AP); - attrValue = buffer.toString(); - break; - -// read unquoted attribute. -case NUMTOKEN : - value = next; - optional(WS); - - // Check maybe the opening quote is missing. - next = getTokenAhead(); - if (bQUOTING.get(next.kind)) -{ - hTag = next; - error(The value without opening quote is closed with ' + -next.getImage() + ' - ); - attrValue = value.getImage(); -} - else if (next.kind == SLASH) -// The slash in this context is treated as the ordinary -// character, not as a token. The slash may be part of -// the unquoted URL. -{ - StringBuffer image = new StringBuffer(value.getImage()); - while (next.kind == NUMTOKEN || next.kind == SLASH) -{ - image.append(getNextToken().getImage()); - next = getTokenAhead(); -} - attrValue = image.toString(); -} - else +// read quoted attribute. +buffer.setLength(0); +readTillTokenE(QUOT); +attrValue = buffer.toString(); +break; + + case AP: + +// read 'quoted' attribute. +buffer.setLength(0); +readTillTokenE(AP); +attrValue = buffer.toString(); +break; + + // read unquoted attribute. + case NUMTOKEN: +value = next; +optional(WS); + +// Check maybe the opening quote is missing. +next = getTokenAhead(); +if (bQUOTING.get(next.kind)) + { +hTag = next; +error(The value without opening quote is closed with ' + + next.getImage() + '); attrValue = value.getImage(); - break; + } +else if (next.kind == SLASH) +// The slash in this context is treated as the ordinary +// character, not as a token. The slash may be part of +// the unquoted URL. + { +StringBuffer image = new StringBuffer(value.getImage()); +while (next.kind == NUMTOKEN || next.kind == SLASH) + { +image.append(getNextToken().getImage()); +next = getTokenAhead(); + } +attrValue = image.toString(); + } +else + attrValue = value.getImage(); +break; -default : - break attributeReading; + case SLASH: +value = next; +optional(WS); + +// Check maybe
[cp-patches] Patch: SimpleTimeZone fix
After testing a timezone app, I noticed that SimpleTimeZone is a little buggy. I fixed it up a bit... I imagine there are more bugs in this code. It does work better now. 2006-05-01 Lillian Angel [EMAIL PROTECTED] * java/util/SimpleTimeZone.java (SimpleTimeZone): Do not throw exception if startMonth == endMonth. (SimpleTimeZone): Likewise. (checkRule): Rewritten to properly check all values (more efficently). This code is now more stable, at least less buggy than before. Fixed API documentation. (setStartRule): Moved checkRule call to end. (setStartRule): Likewise. (setEndRule): Likewise. (setEndRule): Likewise. Index: ChangeLog === RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.7250 diff -u -r1.7250 ChangeLog --- ChangeLog 1 May 2006 15:48:52 - 1.7250 +++ ChangeLog 1 May 2006 20:37:38 - @@ -1,3 +1,16 @@ +2006-05-01 Lillian Angel [EMAIL PROTECTED] + + * java/util/SimpleTimeZone.java + (SimpleTimeZone): Do not throw exception if startMonth == endMonth. + (SimpleTimeZone): Likewise. + (checkRule): Rewritten to properly check all values (more efficently). + This code is now more stable, at least less buggy than before. Fixed + API documentation. + (setStartRule): Moved checkRule call to end. + (setStartRule): Likewise. + (setEndRule): Likewise. + (setEndRule): Likewise. + 2006-05-01 Tom Tromey [EMAIL PROTECTED] * lib/.cvsignore: Added classes.2. Index: java/util/SimpleTimeZone.java === RCS file: /cvsroot/classpath/classpath/java/util/SimpleTimeZone.java,v retrieving revision 1.29 diff -u -r1.29 SimpleTimeZone.java --- java/util/SimpleTimeZone.java 23 Oct 2005 17:04:46 - 1.29 +++ java/util/SimpleTimeZone.java 1 May 2006 20:37:39 - @@ -333,8 +333,6 @@ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime); setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime); -if (startMonth == endMonth) - throw new IllegalArgumentException(startMonth and endMonth must be different); this.startYear = 0; } @@ -393,8 +391,6 @@ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime); setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime); -if (startMonth == endMonth) - throw new IllegalArgumentException(startMonth and endMonth must be different); this.startYear = 0; this.dstSavings = dstSavings; @@ -413,67 +409,66 @@ } /** - * Checks if the month, day, dayOfWeek arguments are in range and + * Checks if the values are in range and * returns the mode of the rule. * @param month the month parameter as in the constructor - * @param day the day parameter as in the constructor - * @param dayOfWeek the day of week parameter as in the constructor * @return the mode of this rule see startMode. * @exception IllegalArgumentException if parameters are out of range. * @see #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int) * @see #startMode */ - private int checkRule(int month, int day, int dayOfWeek) + private int checkRule(int month) { -if (month 0 || month 11) - throw new IllegalArgumentException(month out of range); - -int daysInMonth = getDaysInMonth(month, 1); -if (dayOfWeek == 0) - { - if (day = 0 || day daysInMonth) - throw new IllegalArgumentException(day out of range); - return DOM_MODE; - } -else if (dayOfWeek 0) - { - if (Math.abs(day) (daysInMonth + 6) / 7) - throw new IllegalArgumentException(dayOfWeekInMonth out of range); - if (dayOfWeek Calendar.SATURDAY) - throw new IllegalArgumentException(dayOfWeek out of range); - return DOW_IN_MONTH_MODE; - } -else +if (startDay != 0) { - if (day == 0 || Math.abs(day) daysInMonth) - throw new IllegalArgumentException(day out of range); - if (dayOfWeek -Calendar.SATURDAY) - throw new IllegalArgumentException(dayOfWeek out of range); - if (day 0) - return DOW_LE_DOM_MODE; - else - return DOW_GE_DOM_MODE; +if (startMonth 0 || startMonth 11) + throw new IllegalArgumentException(month out of range); + +if (startDayOfWeek == 0) + startMode = DOM_MODE; +else + { +if (startDayOfWeek 0) + startMode = DOW_IN_MONTH_MODE; +else + { +startDayOfWeek = -startDayOfWeek; +if (startDay 0) + { +startDay = - startDay; +startMode = DOW_LE_DOM_MODE; + } +else + startMode = DOW_GE_DOM_MODE; + } + +if (startDayOfWeek Calendar.SATURDAY) + throw new IllegalArgumentException(day
Re: [cp-patches] FYI:JTree view and navigation fixes during the multiple selection
The JTree is coming along really well. Some other issues: - if a directory node is selected, and you press the left arrow key, the control icon collapses, but the directory does not. I am not sure if it should, but it should be consistant with the icon. - Clicking on nodes does not work after using the arrow keys to expand/collapse nodes. - If a child node of a directory is selected, and the left arrow key is pressed, then the directory collapses. I think this is wrong... it should expand/collapse when a parent node is selected, not the child. - When a parent is expanded/collapsed using the arrow keys, then the first child is selected. This is wrong, the parent should remain highlighted. - The left/right arrow keys on the root node do not work properly. The control icons collapse/expand, but the actual children of the parent remain in the same state (expanded if they were expanded before the key presses). etc... There seems to be a lot of inconsistencies with the key pressing/painting of the tree. You need to be sure that mouse clicks still work if the arrow keys are pressed. TreeTraverseAction should handle the left/right keys. You might want to look into this function as well as the updating of the tree when these keys are pressed. Thanks, Lillian On Wed, 2006-04-26 at 14:28 +0200, Audrius Meskauskas wrote: This path makes the view and navigation rules during the multiple tree selection closer to Sun's. 2006-04-26 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/JTree.java (setLeadSelectionPath): Repaint the new and old lead pathes. * javax/swing/plaf/basic/BasicTreeUI.java (FocusHandler): Repaint the lead row when focus changes. (PropertyChangeHandler): Use existing constants, not the string literals for the property names. (TreeIncrementAction): Shrink the selection when moving from the selection edge to the selection anchor. (TreeSelectionHandler.valueChanged): Repaint the new and old lead pathes. (paintRow): Treat row as focused only if it is the lead row. * javax/swing/tree/DefaultTreeCellRenderer.java (getTreeCellRendererComponent): Set the vertical alignment to CENTER. (paint): Rewritten. * javax/swing/tree/DefaultTreeSelectionModel.java (addSelectionPath): Event construction fix (old and new lead were always the same). (addSelectionPaths): Likewise. * javax/swing/JComponent.java (setOpaque): Explained. * javax/swing/tree/FixedHeightLayoutCache.java (getBounds): Accept null. * javax/swing/tree/VariableHeightLayoutCache.java (getBounds): Accept null.
Re: [cp-patches] FYI: Rewriting the child expansion handling with arrow keys
On Wed, 2006-04-26 at 21:32 +0200, Audrius Meskauskas wrote: As Lillian noticed, our conception about the tree expansion with arrow keys is different from Sun's. I also finally succeeded to reproduce the reported mouse control freezing after extensive navigation with arrow keys. This happens after the attempt to collapse the root node only and is also fixed by the attached patch. I tested it out. As far as I can see, it is back in working condition. Looks really good! Thanks, Lillian 2006-04-26 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicTreeUI.java (TreeAction.actionPerformed):Newly obtain the current lead path that must stay visible. (TreeTraverseAction.actionPerformed):Rewritten. * javax/swing/tree/FixedHeightLayoutCache.java (countRows): Do not treat root specially. (setModel): Assume the root node initially expanded. * javax/swing/tree/VariableHeightLayoutCache.java:(countRows): Do not treat root specially. (setModel): Assume the root node initially expanded.
Re: [cp-patches] FYI: JTree multiple selection fix.
On Tue, 2006-04-25 at 10:20 -0400, Lillian Angel wrote: On Tue, 2006-04-25 at 10:19 -0400, Lillian Angel wrote: I noticed that the control icons are painted behind the lines drawn for the tree. I ran into this problem when working on BasicTreeUI. You need to make sure all the lines are painted before painting the control icons. It does not work if you try to paint both simulataneously. Sorry for sending another email :( Here are all the problems I see with the swing tree demo: - Every time you click new element, the tree should be repainted instantly to see the new element. This happens when you add an element to an expanded directory. - The selection rectangle around the node is too small - The key listener does not work properly. I.e. expanding/collapsing nodes with the left and right keys. - The editing does not work well. The cursor does not appear when editing is activated (only on triple click this is broken). If you click on another node to cancel editing, the changes are made to that node you click on and the original name for that node is changed. - Location of the editing cell is a bit off. - The padding around the cells/icons/lines is non-existant. - control icons are painted behind the lines. - Sometimes the anchor is not shown on the node selected. Your work on JTree/BasicTreeUI has been really good. I am sure you are still working on this, but I thought you would be interested in knowing the remaining aesthetic issues. Lillian Let me know if you need further clarification, Lillian On Sun, 2006-04-23 at 20:17 +0200, Audrius Meskauskas wrote: It was discovered that JTree multiple element selection is currently not working as expected. This path fixes the tree ability to select multiple nodes, if permitted. 2006-04-23 Audrius Meskauskas [EMAIL PROTECTED] * examples/gnu/classpath/examples/swing/TreeDemo.java: (createContent): Added check box to swith between single and multiple selection. * javax/swing/JTree.java (leadSelectionPath): Removed. (addSelectionInterval): Explained. (getLeadSelectionPath): Request the path from model. (getPathsBetweenRows): Explained. (setLeadSelectionPath): Set the path in model. * javax/swing/plaf/basic/BasicTreeUI.java (TreeIncrementAction.actionPerformed, isMultiSelectionEvent, isToggleSelectionEvent, selectPath, selectPathForEvent): Rewritten. (MouseHandler.mousePressed): Call selectPathForEvent.
Re: [cp-patches] FYI: JTree multiple selection fix.
I noticed that the control icons are painted behind the lines drawn for the tree. I ran into this problem when working on BasicTreeUI. You need to make sure all the lines are painted before painting the control icons. It does not work if you try to paint both simulataneously. Let me know if you need further clarification, Lillian On Sun, 2006-04-23 at 20:17 +0200, Audrius Meskauskas wrote: It was discovered that JTree multiple element selection is currently not working as expected. This path fixes the tree ability to select multiple nodes, if permitted. 2006-04-23 Audrius Meskauskas [EMAIL PROTECTED] * examples/gnu/classpath/examples/swing/TreeDemo.java: (createContent): Added check box to swith between single and multiple selection. * javax/swing/JTree.java (leadSelectionPath): Removed. (addSelectionInterval): Explained. (getLeadSelectionPath): Request the path from model. (getPathsBetweenRows): Explained. (setLeadSelectionPath): Set the path in model. * javax/swing/plaf/basic/BasicTreeUI.java (TreeIncrementAction.actionPerformed, isMultiSelectionEvent, isToggleSelectionEvent, selectPath, selectPathForEvent): Rewritten. (MouseHandler.mousePressed): Call selectPathForEvent.
Re: [Fwd: Re: [cp-patches] FYI: gnu.xml.dom.html2.* fixes and additions]
On Tue, 2006-04-25 at 16:57 +0200, Audrius Meskauskas wrote: If you run http://www.geocities.com/SiliconValley/Park/9967/atari.html in the standalone (using gcjappletviewer), you will notice one of the applets is not loaded. The problem is the codebase for the applet is being parsed to http: instead of the entire url. Hello, Lillian, I did not expected that the unquoted parameter value may contain slash. This is simple to fix. As far as I checked there are no regressions from this change, let me known if they are. So far I don't see any regressions. Thank you for fixing this. :) 2006-04-25 Audrius Meskauskas [EMAIL PROTECTED] * gnu/javax/swing/text/html/parser/support/Parser.java (readAttributes): Allow slashes (/) in the unquoted parameter value.
Re: [cp-patches] FYI: JTree multiple selection fix.
On Tue, 2006-04-25 at 20:47 +0200, Audrius Meskauskas wrote: Lillian Angel wrote: Sorry for sending another email :( Here are all the problems I see with the swing tree demo: - Every time you click new element, the tree should be repainted instantly to see the new element. This happens when you add an element to an expanded directory. Sorry, I think i worded that wrong. In the swing demo, if you click the NEW ELEMENT button, the tree should repaint. I am not sure if I understand. How can I click an element if I do not see it on the screen? If I already see it on the screen, why should it be repainted? - The selection rectangle around the node is too small Yes. - The key listener does not work properly. I.e. expanding/collapsing nodes with the left and right keys. For me, the left key collapses the current tree branch, and the right key expands the current node. It looks same as in the Sun's implementation. Some time age the left key was not collapsing the branch (just selecting the parent node), but this disappeared as the side effect of the other changes. Hmm, It doesnt seem right in the demo. I'll try to update again. - The editing does not work well. The cursor does not appear when editing is activated (only on triple click this is broken). If you click on another node to cancel editing, the changes are made to that node you click on and the original name for that node is changed. Yes. I did not noticed this because I was always testing the editing with click - pause - click or with the F2 key. - Location of the editing cell is a bit off. - The padding around the cells/icons/lines is non-existant. Probably yes. - control icons are painted behind the lines. Fixed today. - Sometimes the anchor is not shown on the node selected. Your work on JTree/BasicTreeUI has been really good. I am sure you are still working on this, but I thought you would be interested in knowing the remaining aesthetic issues. Lillian Best wishes. Audrius. Lillian
Re: [cp-patches] FYI: gnu.xml.dom.html2.* fixes and additions
On Mon, 2006-04-17 at 09:11 +0100, Chris Burdess wrote: Lillian Angel wrote: More bug fixes for the parser and related classes. 2006-04-12 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomDocument.java (checkNCName): Removed unneeded part of check. Hi Lillian, --- gnu/xml/dom/DomDocument.java 12 Jan 2006 16:35:52 - 1.8 +++ gnu/xml/dom/DomDocument.java 12 Apr 2006 16:04:42 - @@ -535,8 +535,7 @@ int index = name.indexOf(':'); if (index != -1) { -if (index == 0 || index == (len - 1) || -name.lastIndexOf(':') != index) +if (index == 0 || name.lastIndexOf(':') != index) { throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); That's wrong. The colon is not permitted to appear as the last character in the string. You removed a valid check. Sun does permit a ':' to be the last character in a string. Lillian
Re: [cp-patches] FYI: gnu.xml.dom.html2.* fixes and additions
On Tue, 2006-04-18 at 17:13 -0400, Lillian Angel wrote: On Mon, 2006-04-17 at 09:11 +0100, Chris Burdess wrote: Lillian Angel wrote: More bug fixes for the parser and related classes. 2006-04-12 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomDocument.java (checkNCName): Removed unneeded part of check. Hi Lillian, --- gnu/xml/dom/DomDocument.java12 Jan 2006 16:35:52 - 1.8 +++ gnu/xml/dom/DomDocument.java12 Apr 2006 16:04:42 - @@ -535,8 +535,7 @@ int index = name.indexOf(':'); if (index != -1) { -if (index == 0 || index == (len - 1) || -name.lastIndexOf(':') != index) +if (index == 0 || name.lastIndexOf(':') != index) { throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); That's wrong. The colon is not permitted to appear as the last character in the string. You removed a valid check. Sun does permit a ':' to be the last character in a string. I was rather quick to assume that I was correct. I retested the applets that posed to be a problem, and they now work with this part of the patch reverted. 2006-04-18 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomDocument.java (checkNCName): Reverted last patch. Added check for colon at last position back in. Thanks for pointing this out, I have changed it back. Lillian ? lib/classes.2 Index: gnu/xml/dom/DomDocument.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.9 diff -u -r1.9 DomDocument.java --- gnu/xml/dom/DomDocument.java 12 Apr 2006 16:10:25 - 1.9 +++ gnu/xml/dom/DomDocument.java 18 Apr 2006 21:23:12 - @@ -535,10 +535,9 @@ int index = name.indexOf(':'); if (index != -1) { -if (index == 0 || name.lastIndexOf(':') != index) +if (index == 0 || index == (len - 1) || name.lastIndexOf(':') != index) { -throw new DomDOMException(DOMException.NAMESPACE_ERR, - name, null, 0); +throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } } }
[cp-patches] Patch: DomDocument and DomHTMLParser fixes
Applets such as www.vassargolfcourse.com fail if the checkingCharacters flag is true. I added a function to avoid checking this when parsing html. 2006-04-18 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomDocument.java (setCheckingCharacters): New function used to set checkingCharacters flag. * gnu/xml/dom/html2/DomHTMLParser.java (parseDocument): Added call to set checkingCharacters flag to false. Index: gnu/xml/dom/DomDocument.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.10 diff -u -r1.10 DomDocument.java --- gnu/xml/dom/DomDocument.java 18 Apr 2006 21:24:32 - 1.10 +++ gnu/xml/dom/DomDocument.java 18 Apr 2006 21:29:38 - @@ -150,6 +150,14 @@ } /** + * Sets whether to check for document characters. + */ + public void setCheckingCharacters(boolean flag) + { +checkingCharacters = flag; + } + + /** * bDOM L1/b * Returns the constant #document. */ Index: gnu/xml/dom/html2/DomHTMLParser.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/html2/DomHTMLParser.java,v retrieving revision 1.5 diff -u -r1.5 DomHTMLParser.java --- gnu/xml/dom/html2/DomHTMLParser.java 12 Apr 2006 16:10:25 - 1.5 +++ gnu/xml/dom/html2/DomHTMLParser.java 18 Apr 2006 21:29:38 - @@ -125,6 +125,7 @@ { document = new DomHTMLDocument(); document.setCheckWellformedness(false); +document.setCheckingCharacters(false); cursor = document;
Re: [cp-patches] FYI: BasicTreeUI rewrite, using layout cache.
On Thu, 2006-04-13 at 12:48 +0200, Audrius Meskauskas wrote: This patch contains changes in BasicTreeUI and related classes, making it to use the newly implemented VariableHeightLayoutCache. Caching sizes should increase the drawing speed (the tree was reported many times as a little bit too slow). But the main reason of rewriting was that the recent code blocks the further implementation of the DefaultTreeModel that requires the working RowMapper (=LayoutCache) to operate properly. It seems expensive to have and maintain the working layout cache just for DefaultTreeMode, typically without actualy taking any use from it. The patch also fixes the noticed but if the ViewportLayout that prevents the new implementation from working correctly. This patch looks really good. Its great to have BasicTreeUI using FixedHeightLayoutCache and VariableHeightLayoutCache. Thanks! 2006-04-13 Audrius Meskauskas [EMAIL PROTECTED] * javax/swing/JTree.java (getPreferredSize): Return the cloned instance. * javax/swing/ViewportLayout.java (layoutContainer): Do not manage the view size and location if the view is in the scroll pane. Also manage size and location for Scrollable, if it is not in the scroll pane. * javax/swing/plaf/basic/BasicTreeUI.java, * javax/swing/tree/FixedHeightLayoutCache.java, * javax/swing/tree/VariableHeightLayoutCache.java: Rewritten. * gnu/javax/swing/tree/GnuPath.java: New file.
Re: [cp-patches] FYI: gnu.xml.dom.html2.* fixes and additions
More bug fixes for the parser and related classes. 2006-04-12 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomDocument.java (checkNCName): Removed unneeded part of check. * gnu/xml/dom/DomNode.java (dispatchEvent): Added code to grow ancestors array if needed. Changed checks to use depth of node instead. Fixes an infinite loop and segmentation fault. * gnu/xml/dom/html2/DomHTMLParser.java (handleEndTag): No need to use/make a copy of the node. Causes an infinite loop. On Tue, 2006-04-11 at 14:07 -0400, Lillian Angel wrote: I have changed gcjwebplugin to use the parser in gnu/xml/dom/html2/*. I added some needed functions/classes. Also, fixed a few minor bugs in the parser and awt. 2006-04-11 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomNodeIterator.java (nextNode): Moved line of code to avoid an infinite loop. * gnu/xml/dom/html2/DomHTMLAppletElement.java (getCls): New function. (setCls): Likewise. (getSrc): Likewise. (setSrc): Likewise. * gnu/xml/dom/html2/DomHTMLDocument.java: Added DomHTMLEmbedElement to map. (getApplets): Added node name, 'embed'. * gnu/xml/dom/html2/DomHTMLEmbedElement.java: New class. * gnu/xml/dom/html2/DomHTMLObjectElement.java (getJavaCode): New function. (setJavaCode): Likewise. (getObject): Likewise. (setObject): Likewise. (getJavaObject): Likewise. (setJavaObject): Likewise. (getJavaArchive): Likewise. (setJavaArchive): Likewise. (getJavaCodeBase): Likewise. (setJavaCodeBase): Likewise. (getJavaType): Likewise. (setJavaType): Likewise. (setMayscript): Likewise. (getMayscript): Likewise. (setScriptable): Likewise. (getScriptable): Likewise. * gnu/xml/dom/html2/DomHTMLParser.java (parseDocument): Should not check for well formedness when parsing an html document. * java/awt/Window.java (dispatchEvent): Added check to avoid NPE. Index: gnu/xml/dom/DomDocument.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.8 diff -u -r1.8 DomDocument.java --- gnu/xml/dom/DomDocument.java 12 Jan 2006 16:35:52 - 1.8 +++ gnu/xml/dom/DomDocument.java 12 Apr 2006 16:04:42 - @@ -535,8 +535,7 @@ int index = name.indexOf(':'); if (index != -1) { -if (index == 0 || index == (len - 1) || -name.lastIndexOf(':') != index) +if (index == 0 || name.lastIndexOf(':') != index) { throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); Index: gnu/xml/dom/DomNode.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNode.java,v retrieving revision 1.13 diff -u -r1.13 DomNode.java --- gnu/xml/dom/DomNode.java 12 Jan 2006 19:46:59 - 1.13 +++ gnu/xml/dom/DomNode.java 12 Apr 2006 16:04:42 - @@ -1120,7 +1120,6 @@ node.appendChild(newChild); } } - if (nodeType == ENTITY_REFERENCE_NODE) { node.makeReadonly(); @@ -1556,23 +1555,30 @@ ancestorLen = ancestors.length; } -// XXX autogrow ancestors ... based on statistics - // Climb to the top of this subtree and handle capture, letting // each node (from the top down) capture until one stops it or // until we get to this one. - -for (index = 0, current = parent; - current != null index ancestorLen; - index++, current = current.parent) +current = parent; +if (current.depth = ANCESTORS_INIT) + { +DomNode[] newants = new DomNode[current.depth + 1]; +System.arraycopy(ancestors, 0, newants, 0, ancestors.length); +ancestors = newants; +ancestorLen = ancestors.length; + } +for (index = 0; index ancestorLen; index++) { +if (current == null || current.depth == 0) + break; + if (current.nListeners != 0) { haveAncestorRegistrations = true; } ancestors [index] = current; +current = current.parent; } -if (current != null) +if (current.depth 0) { throw new RuntimeException(dispatchEvent capture stack size); } Index: gnu/xml/dom/html2/DomHTMLParser.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/html2/DomHTMLParser.java,v retrieving revision 1.4
[cp-patches] Patch: gnu.xml.dom.html2.* fixes and additions
I have changed gcjwebplugin to use the parser in gnu/xml/dom/html2/*. I added some needed functions/classes. Also, fixed a few minor bugs in the parser and awt. 2006-04-11 Lillian Angel [EMAIL PROTECTED] * gnu/xml/dom/DomNodeIterator.java (nextNode): Moved line of code to avoid an infinite loop. * gnu/xml/dom/html2/DomHTMLAppletElement.java (getCls): New function. (setCls): Likewise. (getSrc): Likewise. (setSrc): Likewise. * gnu/xml/dom/html2/DomHTMLDocument.java: Added DomHTMLEmbedElement to map. (getApplets): Added node name, 'embed'. * gnu/xml/dom/html2/DomHTMLEmbedElement.java: New class. * gnu/xml/dom/html2/DomHTMLObjectElement.java (getJavaCode): New function. (setJavaCode): Likewise. (getObject): Likewise. (setObject): Likewise. (getJavaObject): Likewise. (setJavaObject): Likewise. (getJavaArchive): Likewise. (setJavaArchive): Likewise. (getJavaCodeBase): Likewise. (setJavaCodeBase): Likewise. (getJavaType): Likewise. (setJavaType): Likewise. (setMayscript): Likewise. (getMayscript): Likewise. (setScriptable): Likewise. (getScriptable): Likewise. * gnu/xml/dom/html2/DomHTMLParser.java (parseDocument): Should not check for well formedness when parsing an html document. * java/awt/Window.java (dispatchEvent): Added check to avoid NPE. Index: gnu/xml/dom/DomNodeIterator.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNodeIterator.java,v retrieving revision 1.2 diff -u -r1.2 DomNodeIterator.java --- gnu/xml/dom/DomNodeIterator.java 2 Jul 2005 20:32:15 - 1.2 +++ gnu/xml/dom/DomNodeIterator.java 11 Apr 2006 17:58:20 - @@ -137,9 +137,10 @@ { ret = current.getNextSibling(); } +current = (ret == null) ? current : ret; } while (!accept(ret)); -current = (ret == null) ? current : ret; + return ret; } Index: gnu/xml/dom/html2/DomHTMLAppletElement.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/html2/DomHTMLAppletElement.java,v retrieving revision 1.2 diff -u -r1.2 DomHTMLAppletElement.java --- gnu/xml/dom/html2/DomHTMLAppletElement.java 2 Jul 2005 20:32:16 - 1.2 +++ gnu/xml/dom/html2/DomHTMLAppletElement.java 11 Apr 2006 17:58:20 - @@ -65,6 +65,26 @@ setHTMLAttribute(align, align); } + public String getCls() + { +return getHTMLAttribute(class); + } + + public void setCls(String cls) + { +setHTMLAttribute(class, cls); + } + + public String getSrc() + { +return getHTMLAttribute(src); + } + + public void setSrc(String src) + { +setHTMLAttribute(src, src); + } + public String getAlt() { return getHTMLAttribute(alt); @@ -164,6 +184,5 @@ { setHTMLAttribute(width, width); } - } Index: gnu/xml/dom/html2/DomHTMLDocument.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/html2/DomHTMLDocument.java,v retrieving revision 1.5 diff -u -r1.5 DomHTMLDocument.java --- gnu/xml/dom/html2/DomHTMLDocument.java 2 Jul 2005 20:32:16 - 1.5 +++ gnu/xml/dom/html2/DomHTMLDocument.java 11 Apr 2006 17:58:20 - @@ -87,6 +87,7 @@ map.put(dir, DomHTMLDirectoryElement.class); map.put(div, DomHTMLDivElement.class); map.put(dlist, DomHTMLDListElement.class); +map.put(embed, DomHTMLEmbedElement.class); map.put(fieldset, DomHTMLFieldSetElement.class); map.put(font, DomHTMLFontElement.class); map.put(form, DomHTMLFormElement.class); @@ -311,6 +312,7 @@ public HTMLCollection getApplets() { DomHTMLCollection ret = new DomHTMLCollection(this, this); +ret.addNodeName(embed); ret.addNodeName(object); ret.addNodeName(applet); ret.evaluate(); Index: gnu/xml/dom/html2/DomHTMLEmbedElement.java === RCS file: gnu/xml/dom/html2/DomHTMLEmbedElement.java diff -N gnu/xml/dom/html2/DomHTMLEmbedElement.java --- /dev/null 1 Jan 1970 00:00:00 - +++ gnu/xml/dom/html2/DomHTMLEmbedElement.java 11 Apr 2006 17:58:20 - @@ -0,0 +1,129 @@ +/* DomHTMLEmbedElement.java -- + Copyright (C) 2006 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
[cp-patches] Patch: Component.eventTypeEnabled fix
Added code to eventTypeEnabled. Now, HierachyEvent.* are dispatched properly. 2006-04-07 Lillian Angel [EMAIL PROTECTED] * java/awt/Component.java (eventTypeEnabled): Added code for HierarchyEvent.HIERARCHY_CHANGED, HierarchyEvent.ANCESTOR_MOVED and HierarchyEvent.ANCESTOR_RESIZED. Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.114 diff -u -r1.114 Component.java --- java/awt/Component.java 6 Apr 2006 21:51:32 - 1.114 +++ java/awt/Component.java 7 Apr 2006 16:52:46 - @@ -5071,6 +5071,16 @@ switch (type) { + case HierarchyEvent.HIERARCHY_CHANGED: +return (hierarchyListener != null +|| (eventMask AWTEvent.HIERARCHY_EVENT_MASK) != 0); + + + case HierarchyEvent.ANCESTOR_MOVED: + case HierarchyEvent.ANCESTOR_RESIZED: +return (hierarchyBoundsListener != null +|| (eventMask AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0); + case ComponentEvent.COMPONENT_HIDDEN: case ComponentEvent.COMPONENT_MOVED: case ComponentEvent.COMPONENT_RESIZED:
Re: [cp-patches] Patch: ZipFile fix
On Mon, 2006-04-03 at 18:57 -0600, Tom Tromey wrote: Return 'sz' doesn't seem to be correct after the caller has read some bytes. It is only correct the first time. I think you want something like: final Inflater inf = new Inflater(true); return new InflaterInputStream() { return sz - inf.getTotalOut(); What do you think? Yes, you are right. Thanks for pointing this out. 2006-04-04 Lillian Angel [EMAIL PROTECTED] * java/util/zip/ZipFile.java (getInputStream): Fixed to return size of ZipEntry minus the total bytes read. This guarantees that the right value is returned even if some bytes have already been read. Index: java/util/zip/ZipFile.java === RCS file: /sources/classpath/classpath/java/util/zip/ZipFile.java,v retrieving revision 1.31 diff -u -r1.31 ZipFile.java --- java/util/zip/ZipFile.java 3 Apr 2006 20:50:38 - 1.31 +++ java/util/zip/ZipFile.java 4 Apr 2006 14:03:12 - @@ -445,13 +445,14 @@ case ZipOutputStream.STORED: return inp; case ZipOutputStream.DEFLATED: +final Inflater inf = new Inflater(true); final int sz = (int) entry.getSize(); -return new InflaterInputStream(inp, new Inflater(true)) +return new InflaterInputStream(inp, inf) { public int available() throws IOException { if (super.available() != 0) - return sz; + return sz - inf.getTotalOut(); return 0; } };
[cp-patches] Patch: ZipFile fix
This patch fixes bug #24596 and #26930. For ZipFile.getInputStream(), Sun returns an InflatorInputStream (as do we) and returns the size of the ZipEntry for that instance's available() function. Despite what the API says for InflatorInputStream.available(), Sun has overridden this function for the instance returned by ZipFile.getInputStream. InflatorInputStream.available() works according to the API for any other instance. This patch fixes ZipFile to do the same. 2006-04-03 Lillian Angel [EMAIL PROTECTED] PR classpath/24596 and PR classpath/26930 * java/util/zip/ZipFile.java (getInputStream): Override available function for InflaterInputStream instance. Index: java/util/zip/ZipFile.java === RCS file: /sources/classpath/classpath/java/util/zip/ZipFile.java,v retrieving revision 1.30 diff -u -r1.30 ZipFile.java --- java/util/zip/ZipFile.java 16 Mar 2006 14:30:11 - 1.30 +++ java/util/zip/ZipFile.java 3 Apr 2006 20:44:11 - @@ -445,7 +445,16 @@ case ZipOutputStream.STORED: return inp; case ZipOutputStream.DEFLATED: - return new InflaterInputStream(inp, new Inflater(true)); +final int sz = (int) entry.getSize(); +return new InflaterInputStream(inp, new Inflater(true)) +{ + public int available() throws IOException + { +if (super.available() != 0) + return sz; +return 0; + } +}; default: throw new ZipException(Unknown compression method + method); }
[cp-patches] Patch: GtkCanvasPeer fix
This fixes a segmentation fault in but #26924. Apparently, the Canvas's graphics were being used when it was not realized. 2006-03-31 Lillian Angel [EMAIL PROTECTED] PR classpath/26924 * gnu/java/awt/peer/gtk/GtkCanvasPeer.java (realize): New native function. * include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h: Added new function declaration. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c (realize): New function. Index: gnu/java/awt/peer/gtk/GtkCanvasPeer.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkCanvasPeer.java,v retrieving revision 1.16 diff -u -r1.16 GtkCanvasPeer.java --- gnu/java/awt/peer/gtk/GtkCanvasPeer.java 16 Mar 2006 03:24:18 - 1.16 +++ gnu/java/awt/peer/gtk/GtkCanvasPeer.java 31 Mar 2006 18:54:05 - @@ -38,16 +38,14 @@ package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; import java.awt.Canvas; import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.event.PaintEvent; import java.awt.peer.CanvasPeer; public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer { native void create (); + native void realize (); public GtkCanvasPeer (Canvas c) { Index: include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h === RCS file: /sources/classpath/classpath/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h,v retrieving revision 1.3 diff -u -r1.3 gnu_java_awt_peer_gtk_GtkCanvasPeer.h --- include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h 28 May 2004 17:27:52 - 1.3 +++ include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h 31 Mar 2006 18:54:06 - @@ -11,6 +11,7 @@ #endif JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create (JNIEnv *env, jobject); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_realize (JNIEnv *env, jobject); #ifdef __cplusplus } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c === RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,v retrieving revision 1.11 diff -u -r1.11 gnu_java_awt_peer_gtk_GtkCanvasPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c 22 Sep 2005 20:25:39 - 1.11 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c 31 Mar 2006 18:54:06 - @@ -56,3 +56,17 @@ gdk_threads_leave (); } + +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_realize (JNIEnv *env, jobject obj) +{ + void *ptr; + + gdk_threads_enter (); + + ptr = NSA_GET_PTR (env, obj); + + gtk_widget_realize (GTK_WIDGET (ptr)); + + gdk_threads_leave (); +}