diff options
author | graydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-16 18:44:45 +0000 |
---|---|---|
committer | graydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-16 18:44:45 +0000 |
commit | 14511e3ad21013e92c6399b2bd2ec09a8263e33a (patch) | |
tree | cb7d0902aeb41d7ea4b23d42752c1c7aec6a2729 /libjava/jni | |
parent | 84a5a09932f24802120cbe2d183bf2c885e6784e (diff) | |
download | gcc-14511e3ad21013e92c6399b2bd2ec09a8263e33a.tar.gz |
2004-04-09 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkPanelPeer.java (connectSignals):
Remove method.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c: Remove
unused code.
2004-04-02 Olga Rodimina <rodimina@redhat.com>
* Makefile.am: Added new file.
* Makefile.in: Regenerate.
* javax/swing/ImageIcon.java:
(ImageIcon(file)): set description of the icon
to the file name
* javax/swing/JCheckBoxMenuItem.java:
Mostly Implemented. Work in progress.
* javax/swing/JRadioButtonMenuItem.java:
Reimplement constructors to use JToggleButtonModel.
* javax/swing/plaf/basic/BasicIconFactory.java:
(getCheckBoxMenuItemIcon): return check box
icon.
* javax/swing/plaf/basic/BasicMenuItemUI.java:
paint menu item selected only when it is armed and
pressed.
2004-04-02 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
(GtkMenuItemPeer): Only connect signals if this isn't a Menu peer.
* java/awt/Component.java
(add): Set the parent of the popup as this component.
* java/awt/PopupMenu.java
(addNotify): Create popup menu when peer is null.
(show): Call addNotify() if peer is null.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
(Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show): Set the button
argument for gtk_menu_popup() as zero. This causes the popup menu to
respond to any mouse button.
2004-03-31 Olga Rodimina <rodimina@redhat.com>
* Makefile.am: Added new file.
* Makefile.in: Regenerate.
* javax/swing/JRadioButtonMenuItem.java:
Implemented.
* javax/swing/plaf/basic/BasicIconFactory.java:
(getRadioButtonMenuItemIcon): Return
radio button icon.
* javax/swing/plaf/basic/BasicMenuItemUI.java:
(getPreferredSize): Add size of checkIcon if it
exists.
(installDefaults): Don't initialize checkIcon.
It's value will be set in subclasses.
(uninstallDefaults): remove uninstallation of
checkIcon.
(paint): Moved code to paintMenuItem().
(paintMenuItem): Implemented.
* javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java:
UI delegate for JRadioButtonMenuItem.
2004-03-29 Olga Rodimina <rodimina@redhat.com>
* javax/swing/plaf/basic/BasicMenuItemUI.java:
Corrected position of the accelerator.
2004-03-29 Olga Rodimina <rodimina@redhat.com>
* Makefile.am: Added new file.
* Makefile.in: Regenerate.
* javax/swing/JMenuItem.java: Partly
implemented. Work in progress
* javax/swing/plaf/basic/BasicLookAndFeel.java:
Changed default value of acceleratorDelimiter.
* javax/swing/plaf/basic/BasicMenuItemUI.java:
New class. Partly implemented.
2004-03-26 Mark Wielaard <mark@klomp.org>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
(item_activate): Declare label before use.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
(gtkSetFont): Removed unused variable label.
(addExposeFilter): Declare variables before use.
(removeExposeFilter): Likewise.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
(ok_clicked): Declare str_fileName before use.
2004-03-26 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkMenuPeer.java
(addSeparator): Remove.
* java/awt/Menu.java
(separator): Remove static final MenuItem field.
(separatorLabel): New static final String field.
(addSeparator): Do not use peer method; use add(MenuItem) instead.
Use separatorLabel to denote that it is a separator.
(insertSeparator): Create a new MenuItem with separatorLabel, instead
of reusing the static separator instance, because a MenuItem instance
can't be added more than once without being cloned.
* java/awt/peer/MenuPeer.java
(addSeparator): Remove from interface.
2004-03-26 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
(connectSignals): New native method declaration.
(GtkMenuItemPeer): Connect signals if the parent is a Menu.
* java/awt/MenuItem.java
(getActionCommand): Return the label if the action command is not set.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
(Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu): Use
gtk_menu_shell_append().
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
(item_activate): Fix argument type.
(Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create): Do not connect
signal here.
(Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals): New
method.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
(Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create): Check if a label is
given. Add the menu widget's top-level GtkWindow to the global window
group, so it can grab the pointer.
(Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem): Use
gtk_menu_shell_append().
2004-03-23 Graydon Hoare <graydon@redhat.com>
* java/text/AttributedString.java
(addAttribute): Fix off-by-one.
(getIterator): Likewise.
* java/text/AttributedStringIterator.java
(getRunLimit): Correct logic.
(getRunStart): Likewise.
(getAttribute): Fix inequality.
(getAttributes): Likewise.
* testsuite/libjava.mauve/xfails: Remove AttributedString xfail.
2004-03-23 Kim Ho <kho@redhat.com>
* javax/swing/plaf/basic/BasicTabbedPaneUI.java:
(calculateSizes): Return real width and height.
2004-03-23 Kim Ho <kho@redhat.com>
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(calculateTabRects): Set the selectedRun before
trying to rotate tabs.
2004-03-23 Kim Ho <kho@redhat.com>
* Makefile.am: New file
* Makefile.in: Regenerate
* java/awt/Graphics.java: (drawRect):
Draw to the correct point.
* javax/swing/DefaultSingleSelectionModel.java
(isSelected): Return true if the selected index
is not -1.
* javax/swing/JLabel.java: Do not change mnemonic
index if text is null.
* javax/swing/JProgressBar.java: Use JComponent's
EventListenerList.
* javax/swing/JScrollBar.java: Ditto.
* javax/swing/JSlider.java: Ditto.
* javax/swing/JTabbedPane.java: Reimplement.
* javax/swing/plaf/basic/BasicLookAndFeel.java:
Add defaults for TabbedPane.
* javax/swing/plaf/basic/BasicArrowButton.java:
Implement
* javax/swing/plaf/basic/BasicProgressBarUI.java:
(paintDeterminate): Don't paint String if it's
empty.
(paintIndeterminate): ditto.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java:
Reimplement.
2004-03-19 Michael Koch <konqueror@gmx.de>
* java/awt/image/AffineTransformOp.java
(AffineTransformOp): Made public.
* javax/swing/JComponent.java
(listenerList): Made protected.
(accessibleContext): Likewise.
* javax/swing/JList.java
(valueChanged): Dont use internal fields of ListSelectionEvent.
* javax/swing/JViewport.java
(getView): Dont use internal fields of Component.
(addImpl): Likewise.
* javax/swing/Timer.java
(isRunning): Made public.
(start): Likewise.
(stop): Likewise.
* javax/swing/UIDefaults.java
(getInt): Made public.
* javax/swing/plaf/basic/BasicListUI.java
(mousePressed): Dont use internal fields of MouseEvent.
(propertyChanged): Dont use internal fields of PropertyChangeEvent.
* javax/swing/plaf/basic/BasicScrollBarUI.java
(arrowIcon): Made static.
* javax/swing/plaf/basic/BasicViewportUI.java
(stateChanged): Dont use internal field on ChangeEvent.
* javax/swing/text/JTextComponent.java
(getUI): Call UIManager.getUI().
(updateUI): Use getUI().
2004-03-19 Graydon Hoare <graydon@redhat.com>
* javax/swing/JComponent.java: Turn off double buffer by default.
* javax/swing/plaf/basic/BasicViewportUI.java: Clear rects before painting.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable):
Use cairo to copy areas.
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip):
Initialize and set clip region.
2004-03-15 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/applet/Applet.java (preferredSize): Override deprecated
variant of getPreferredSize.
(minimumSize): Override deprecated variant of getMinimumSize.
2004-03-15 Olga Rodimina <rodimina@redhat.com>
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
(drawImage(img,xform,bgcolor,obs)): New Method.
Helper function that every drawImage method will
use.
(drawRaster): Added new parameter, bgcolor. All
transparent pixels are changed to bgcolor before
image is drawn.
(drawRenderedImage): Fixed to use changed drawRaster().
(drawImage(image,xform,obs): Fixed to use new helper function
(drawImage(image,op,x,y)): Ditto.
(drawImage (img,x,y,observer)): Ditto.
((PainterThread) bgcolor): New Field.
((PainterThread) (setPixels)): Changed all transparent pixels
to bgcolor.
(drawImage(img,x,y,width,height,bgcolor,observer)):
Fixed FIXME - all the transparent pixels are
changed to the specified bgcolor.
(drawImage(img, x, y, width, height, observer): Changed to
use function above.
(drawImage (img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer)):
Fixed FIXME- changed all transparent pixels to bgcolor.
(drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer)):
Changed to use function above.
2004-03-14 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/applet/Applet.java (dimensions): New field.
(getDimensions): New method.
(getPreferredSize): Call getDimensions.
(getMinimumSize): Likewise.
2004-03-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* jni/classpath/jcl.c: Include stdlib.h, not malloc.h.
* jni/classpath/jnilink.c: Likewise.
* java/applet/Applet.java (getPreferredSize): New method.
(getMinimumSize): New method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80762 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni')
11 files changed, 82 insertions, 104 deletions
diff --git a/libjava/jni/classpath/jcl.c b/libjava/jni/classpath/jcl.c index 629d0716389..8cb132e3f32 100644 --- a/libjava/jni/classpath/jcl.c +++ b/libjava/jni/classpath/jcl.c @@ -1,5 +1,5 @@ /* jcl.c - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,7 +37,7 @@ exception statement from your version. */ #include <stdio.h> #include <jcl.h> -#include <malloc.h> +#include <stdlib.h> #ifndef __GNUC__ #define __attribute__(x) /* nothing */ diff --git a/libjava/jni/classpath/jnilink.c b/libjava/jni/classpath/jnilink.c index 0c244f285af..d92654161c8 100644 --- a/libjava/jni/classpath/jnilink.c +++ b/libjava/jni/classpath/jnilink.c @@ -1,5 +1,5 @@ /* JNILINK 1.1: JNI version. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,7 +40,7 @@ exception statement from your version. */ #include <string.h> #include <jcl.h> -#include <malloc.h> +#include <stdlib.h> #define GETCLASS(c) *(jclass*)(c) diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c index f8ee342a033..a161ba49992 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c @@ -145,7 +145,7 @@ grab_current_drawable (GtkWidget *widget, GdkDrawable **draw, GdkWindow **win) } *draw = *win; - gdk_window_get_internal_paint_info (*win, draw, 0, 0); + gdk_window_get_internal_paint_info (*win, draw, 0, 0); g_object_ref (*draw); } @@ -349,7 +349,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II if (gr->debug) printf ("constructing offscreen drawable of size (%d,%d)\n", width, height); - + gr->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height, gdk_rgb_get_visual ()->depth); g_assert (gr->drawable != NULL); @@ -371,9 +371,12 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable (JNIEnv *env, jobject self, jobject other, jint x, jint y) { + GdkRectangle clipRect; struct graphics2d *src = NULL, *dst = NULL; gint s_height, s_width, d_height, d_width, height, width; + cairo_matrix_t *matrix; GdkGC *gc; + cairo_operator_t tmp_op; src = (struct graphics2d *)NSA_GET_G2D_PTR (env, other); dst = (struct graphics2d *)NSA_GET_G2D_PTR (env, self); @@ -386,19 +389,33 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable gdk_drawable_get_size (src->drawable, &s_width, &s_height); gdk_drawable_get_size (dst->drawable, &d_width, &d_height); width = min (s_width, d_width); - height = min (s_width, d_height); + height = min (s_height, d_height); + gdk_threads_leave (); - gc = gdk_gc_new (dst->drawable); - g_assert (gc != NULL); + begin_drawing_operation(dst); - gdk_draw_drawable(dst->drawable, gc, src->drawable, - 0, 0, x, y, width, height); - gdk_flush (); + matrix = cairo_matrix_create (); + cairo_surface_get_matrix (src->surface, matrix); + cairo_matrix_translate (matrix, (double)-x, (double)-y); + cairo_surface_set_matrix (src->surface, matrix); - g_object_unref (gc); + tmp_op = cairo_current_operator (dst->cr); + cairo_set_operator(dst->cr, CAIRO_OPERATOR_SRC); + cairo_show_surface (dst->cr, src->surface, width, height); + cairo_set_operator(dst->cr, tmp_op); - if (src->debug) printf ("copied %d x %d pixels from offscreen drawable\n", width, height); + cairo_matrix_translate (matrix, (double)x, (double)y); + cairo_surface_set_matrix (src->surface, matrix); + cairo_matrix_destroy (matrix); + + end_drawing_operation(dst); + + gdk_threads_enter (); + gdk_flush (); gdk_threads_leave (); + + if (src->debug) printf ("copied %d x %d pixels from offscreen drawable\n", width, height); + } static jintArray @@ -1215,7 +1232,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); if (gr->debug) printf ("cairo_clip\n"); - cairo_clip (gr->cr); + cairo_init_clip (gr->cr); + cairo_clip (gr->cr); } JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c index cc586a022d2..9b262d33d7d 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c @@ -249,9 +249,10 @@ static void item_activate (GtkItem *item __attribute__((unused)), struct item_event_hook_info *ie) { + jstring label; gdk_threads_leave (); - jstring label = (*gdk_env)->NewStringUTF (gdk_env, ie->label); + label = (*gdk_env)->NewStringUTF (gdk_env, ie->label); (*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj, choicePostItemEventID, label, diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c index 3bb957c92ac..62866d5d5bd 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c @@ -136,7 +136,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus ptr = NSA_GET_PTR (env, obj); gdk_threads_enter (); - gtk_widget_grab_focus (GTK_WIDGET (ptr)); + // gtk_widget_grab_focus (GTK_WIDGET (ptr)); gdk_threads_leave (); } @@ -386,7 +386,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkSetFont { const char *font_name; void *ptr; - GtkWidget *label; PangoFontDescription *font_desc; ptr = NSA_GET_PTR (env, obj); @@ -632,12 +631,13 @@ filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer) JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter (JNIEnv *env, jobject obj) { - void *ptr = NSA_GET_PTR (env, obj); - jobject *gref = NSA_GET_GLOBAL_REF (env, obj); - g_assert (gref); GtkObject *filterobj; GtkWidget *vbox, *layout; GList *children; + void *ptr = NSA_GET_PTR (env, obj); + jobject *gref = NSA_GET_GLOBAL_REF (env, obj); + + g_assert (gref); gdk_threads_enter (); @@ -675,12 +675,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilt JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter (JNIEnv *env, jobject obj) { - void *ptr = NSA_GET_PTR (env, obj); - jobject *gref = NSA_GET_GLOBAL_REF (env, obj); - g_assert (gref); GtkObject *filterobj; GtkWidget *vbox, *layout; GList *children; + void *ptr = NSA_GET_PTR (env, obj); + jobject *gref = NSA_GET_GLOBAL_REF (env, obj); + + g_assert (gref); gdk_threads_enter (); diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c index 9e84dde1b6e..9b9a3dd931a 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c @@ -186,6 +186,7 @@ ok_clicked (GtkButton *button __attribute__((unused)), static jmethodID hideID; void *ptr; G_CONST_RETURN gchar *fileName; + jstring str_fileName; ptr = NSA_GET_PTR (gdk_env, peer_obj); @@ -204,7 +205,7 @@ ok_clicked (GtkButton *button __attribute__((unused)), gdk_threads_leave (); /* Set the Java object field 'file' with this value. */ - jstring str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName); + str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName); (*gdk_env)->CallVoidMethod (gdk_env, peer_obj, gtkSetFilenameID, str_fileName); /* We can hide the dialog now (and unblock show) */ diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c index 48509a5d341..8034f647300 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c @@ -66,7 +66,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu menu = NSA_GET_PTR (env, menupeer); gdk_threads_enter (); - gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu)); + gtk_menu_shell_append (GTK_MENU_SHELL (mbar), GTK_WIDGET (menu)); gdk_threads_leave (); } diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c index 4984760f917..70fc8095519 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c @@ -41,18 +41,16 @@ exception statement from your version. */ #include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" static void item_activate (GtkMenuItem *item __attribute__((unused)), - jobject *peer_obj); + jobject peer_obj); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create (JNIEnv *env, jobject obj, jstring label) { GtkWidget *widget; const char *str; - jobject *gref; /* Create global reference and save it for future use */ NSA_SET_GLOBAL_REF (env, obj); - gref = NSA_GET_GLOBAL_REF (env, obj); str = (*env)->GetStringUTFChars (env, label, NULL); @@ -63,10 +61,6 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create else widget = gtk_menu_item_new_with_label (str); - /* Connect activate hook */ - g_signal_connect (G_OBJECT (widget), "activate", - GTK_SIGNAL_FUNC (item_activate), *gref); - gtk_widget_show (widget); gdk_threads_leave (); @@ -76,6 +70,22 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create NSA_SET_PTR (env, obj, widget); } +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals + (JNIEnv *env, jobject obj) +{ + void *ptr = NSA_GET_PTR (env, obj); + jobject *gref = NSA_GET_GLOBAL_REF (env, obj); + g_assert (gref); + + gdk_threads_enter (); + + g_signal_connect (G_OBJECT (ptr), "activate", + G_CALLBACK (item_activate), *gref); + + gdk_threads_leave (); +} + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel (JNIEnv *env, jobject obj, jstring label) { @@ -104,9 +114,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel } static void -item_activate (GtkMenuItem *item __attribute__((unused)), jobject *peer_obj) +item_activate (GtkMenuItem *item __attribute__((unused)), jobject peer_obj) { - (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj, + (*gdk_env)->CallVoidMethod (gdk_env, peer_obj, postMenuActionEventID); } diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c index 63e6a740158..94ebc7f1cfa 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c @@ -101,10 +101,21 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create menu = gtk_menu_new (); - menu_title = gtk_menu_item_new_with_label (str); + if (str != NULL) + menu_title = gtk_menu_item_new_with_label (str); + else + menu_title = gtk_menu_item_new(); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu); - gtk_widget_show (menu); + // Allow this menu to grab the pointer. + GtkWidget *toplevel = gtk_widget_get_toplevel (menu); + if (GTK_IS_WINDOW (toplevel)) + { + gtk_window_group_add_window (global_gtk_window_group, + GTK_WINDOW(toplevel)); + } + gtk_widget_show (menu_title); NSA_SET_PTR (env, obj, menu_title); @@ -125,8 +136,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem gdk_threads_enter (); - menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu); - gtk_menu_append (menu, GTK_WIDGET (ptr2)); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr1)); + gtk_menu_shell_append (GTK_MENU_SHELL(menu), GTK_WIDGET (ptr2)); if (key) { diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c index 62fff4d8afe..ca576437f04 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c @@ -58,14 +58,6 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create NSA_SET_PTR (env, obj, widget); } -typedef struct _GtkLayoutChild GtkLayoutChild; - -struct _GtkLayoutChild { - GtkWidget *widget; - gint x; - gint y; -}; - JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject (JNIEnv *env, jobject obj) @@ -80,59 +72,3 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject gdk_threads_leave (); } - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectSignals - (JNIEnv *env, jobject obj) -{ - void *ptr = NSA_GET_PTR (env, obj); - jobject *gref = NSA_GET_GLOBAL_REF (env, obj); - g_assert (gref); - - gdk_threads_enter (); - gtk_widget_realize (GTK_WIDGET (ptr)); - - /* FIXME: If we don't need this then remove this method. */ -/* g_signal_connect (G_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */ -/* NULL); */ - gdk_threads_leave (); - - /* Connect the superclass signals. */ - Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj); -} - -/* FIXME: The following doesn't seem to be used. - Is not declared as a native function in GtkPanelPeer.java */ -/* - * Make a new panel. - */ -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew - (JNIEnv *env, jobject obj, jobject parent_obj) -{ - GtkWidget *layout; - void *parent; - - /* Create global reference and save it for future use */ - NSA_SET_GLOBAL_REF (env, obj); - - parent = NSA_GET_PTR (env, parent_obj); - - gdk_threads_enter (); - - layout = gtk_layout_new (NULL, NULL); - - set_parent (layout, GTK_CONTAINER (parent)); - - gtk_widget_realize (layout); - - connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window); - - set_visible (layout, 1); - - gdk_threads_leave (); - - NSA_SET_PTR (env, obj, layout); -} - - diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c index c5a223037e0..4bc697320dd 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c @@ -72,7 +72,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show gdk_threads_enter (); gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu), - NULL, NULL, menu_pos, p, 3, time); + NULL, NULL, menu_pos, p, 0, time); gdk_threads_leave (); g_free (p); |