[kaffe] CVS kaffe (robilad): resynced with gnu classpath: awt fix and bumped up requirement for gtk+ to 2.6

Kaffe CVS cvs-commits at kaffe.org
Thu May 26 05:26:39 PDT 2005


PatchSet 6576 
Date: 2005/05/26 12:20:13
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: awt fix and bumped up requirement for gtk+ to 2.6

Members: 
	ChangeLog:1.4103->1.4104 
	configure:1.455->1.456 
	configure.ac:1.142->1.143 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4103 kaffe/ChangeLog:1.4104
--- kaffe/ChangeLog:1.4103	Thu May 26 12:00:00 2005
+++ kaffe/ChangeLog	Thu May 26 12:20:13 2005
@@ -1,6 +1,18 @@
 2005-05-26  Dalibor Topic  <robilad at kaffe.org>
 
         Resynced with GNU Classpath.
+	
+	2005-05-24  Thomas Fitzsimmons  <fitzsim at redhat.com>
+
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+	(connectSignals): Connect to new change-value signal.
+	(post_change_event): Remove signal handler.
+	(slider_moved_cb): New signal handler.
+	* configure.ac: Require gtk+-2.0 >= 2.6.
+
+2005-05-26  Dalibor Topic  <robilad at kaffe.org>
+
+        Resynced with GNU Classpath.
 
 	2005-05-24  Gary Benson  <gbenson at redhat.com>
 
Index: kaffe/configure
diff -u kaffe/configure:1.455 kaffe/configure:1.456
--- kaffe/configure:1.455	Mon May 23 14:13:23 2005
+++ kaffe/configure	Thu May 26 12:20:15 2005
@@ -48242,23 +48242,23 @@
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:$LINENO: checking for gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0" >&5
-echo $ECHO_N "checking for gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0... $ECHO_C" >&6
+        echo "$as_me:$LINENO: checking for gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0" >&5
+echo $ECHO_N "checking for gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0... $ECHO_C" >&6
 
-        if $PKG_CONFIG --exists "gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0" ; then
+        if $PKG_CONFIG --exists "gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0" ; then
             echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
             succeeded=yes
 
             echo "$as_me:$LINENO: checking GTK_CFLAGS" >&5
 echo $ECHO_N "checking GTK_CFLAGS... $ECHO_C" >&6
-            GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
+            GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
             echo "$as_me:$LINENO: result: $GTK_CFLAGS" >&5
 echo "${ECHO_T}$GTK_CFLAGS" >&6
 
             echo "$as_me:$LINENO: checking GTK_LIBS" >&5
 echo $ECHO_N "checking GTK_LIBS... $ECHO_C" >&6
-            GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
+            GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
             echo "$as_me:$LINENO: result: $GTK_LIBS" >&5
 echo "${ECHO_T}$GTK_LIBS" >&6
         else
@@ -48266,7 +48266,7 @@
             GTK_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
-            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
+            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0"`
             echo $GTK_PKG_ERRORS
         fi
 
@@ -48281,8 +48281,8 @@
   if test $succeeded = yes; then
      :
   else
-     { { echo "$as_me:$LINENO: error: Library requirements (gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+     { { echo "$as_me:$LINENO: error: Library requirements (gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
    { (exit 1); exit 1; }; }
   fi
 
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.142 kaffe/configure.ac:1.143
--- kaffe/configure.ac:1.142	Mon May 23 14:13:33 2005
+++ kaffe/configure.ac	Thu May 26 12:20:20 2005
@@ -1798,7 +1798,7 @@
         AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
                      [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
                      [${X_LIBS}])
-	PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0)
+	PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0)
 	AC_SUBST(GTK_CFLAGS)
 	AC_SUBST(GTK_LIBS)
 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:1.3	Sat Jan 22 18:25:06 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c	Thu May 26 12:20:23 2005
@@ -36,16 +36,20 @@
 exception statement from your version. */
 
 
+#include <math.h>
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
 #include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
 
-static void post_change_event (GtkRange *range, jobject peer);
+static gboolean slider_moved_cb (GtkRange *range,
+                                 GtkScrollType scroll,
+                                 gdouble value,
+                                 jobject obj);
 
-JNIEXPORT void JNICALL 
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
-(JNIEnv *env, jobject obj, jint orientation, jint value, 
- jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
+  (JNIEnv *env, jobject obj, jint orientation, jint value,
+   jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
 {
   GtkWidget *scrollbar;
   GtkObject *adj;
@@ -54,7 +58,7 @@
   NSA_SET_GLOBAL_REF (env, obj);
 
   gdk_threads_enter ();
-  
+
   adj = gtk_adjustment_new ((gdouble) value,
                             (gdouble) min,
                             (gdouble) max,
@@ -62,8 +66,9 @@
                             (gdouble) page_incr,
 			    (gdouble) visible_amount);
 
-  scrollbar = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
-                       gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
+  scrollbar = orientation
+    ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj))
+    : gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
 
   GTK_RANGE (scrollbar)->round_digits = 0;
   /* These calls seem redundant but they are not.  They clamp values
@@ -78,6 +83,21 @@
 }
 
 JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectJObject
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
   (JNIEnv *env, jobject obj)
 {
@@ -87,8 +107,8 @@
 
   gdk_threads_enter ();
 
-  g_signal_connect (G_OBJECT (ptr), "value-changed",
-                    G_CALLBACK (post_change_event), *gref);
+  g_signal_connect (G_OBJECT (ptr), "change-value",
+                    GTK_SIGNAL_FUNC (slider_moved_cb), *gref);
 
   gdk_threads_leave ();
 
@@ -96,10 +116,9 @@
   Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
 }
 
-
-JNIEXPORT void JNICALL 
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
-    (JNIEnv *env, jobject obj, jint amount)
+  (JNIEnv *env, jobject obj, jint amount)
 {
   void *ptr;
   GtkAdjustment *adj;
@@ -115,9 +134,9 @@
   gdk_threads_leave ();
 }
 
-JNIEXPORT void JNICALL 
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
-    (JNIEnv *env, jobject obj, jint amount)
+  (JNIEnv *env, jobject obj, jint amount)
 {
   void *ptr;
   GtkAdjustment *adj;
@@ -133,9 +152,9 @@
   gdk_threads_leave ();
 }
 
-JNIEXPORT void JNICALL 
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues
-    (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
+  (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
 {
   void *ptr;
   GtkAdjustment *adj;
@@ -150,16 +169,61 @@
   gtk_range_set_range (GTK_RANGE (ptr), (gdouble) min, (gdouble) max);
   gtk_range_set_value (GTK_RANGE (ptr), (gdouble) value);
 
-  gtk_adjustment_changed (adj);
-
   gdk_threads_leave ();
 }
 
-static void
-post_change_event (GtkRange *range, jobject peer)
-{
-  GtkAdjustment *adj;
-  adj = gtk_range_get_adjustment (range);
-  (*gdk_env())->CallVoidMethod (gdk_env(), peer, postAdjustmentEventID,
-                              AWT_ADJUSTMENT_TRACK, (jint) adj->value);
+static gboolean
+slider_moved_cb (GtkRange *range,
+                 GtkScrollType scroll,
+                 gdouble value,
+                 jobject obj)
+{
+  GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (range));
+
+  value = CLAMP (value, adj->lower,
+                 (adj->upper - adj->page_size));
+
+  if (range->round_digits >= 0)
+    {
+      gdouble power;
+      gint i;
+
+      i = range->round_digits;
+      power = 1;
+      while (i--)
+        power *= 10;
+      
+      value = floor ((value * power) + 0.5) / power;
+    }
+  
+  switch (scroll)
+    {
+    case GTK_SCROLL_STEP_BACKWARD:
+      (*gdk_env())->CallVoidMethod (gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_UNIT_DECREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_STEP_FORWARD:
+      (*gdk_env())->CallVoidMethod (gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_UNIT_INCREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_PAGE_BACKWARD:
+      (*gdk_env())->CallVoidMethod (gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_BLOCK_DECREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_PAGE_FORWARD:
+      (*gdk_env())->CallVoidMethod (gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_BLOCK_INCREMENT,
+                                    (jint) value);
+      break;
+    default:
+      /* GTK_SCROLL_JUMP: */
+      (*gdk_env())->CallVoidMethod (gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_TRACK,
+                                    (jint) value);
+      break;
+    }
+  return FALSE;
 }




More information about the kaffe mailing list