]> Pileus Git - ~andy/gtk/commitdiff
(Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
authorOwen Taylor <owt1@cornell.edu>
Thu, 9 Apr 1998 19:12:12 +0000 (19:12 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 9 Apr 1998 19:12:12 +0000 (19:12 +0000)
Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>

(Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)

* gtk/gtkcurve.c (gtk_curve_interpolate): Added a
missing g_free.

* gtk/gtkcurve.c (gtk_curve_graph_events): Limits
were off by one, resulting in writing past array
bounds. Removed some unused code.

* gdk/gdk.c (gdk_dnd_drag_begin): The event structure
used for gdk_event_put should be a GdkEvent, not a
subtype, since it will all be copied.

* gtk/gtkcolorsel.c: Added a unrealize handler that
unref's the GC's that were created.

* gtk/testgtk.c (clist_warning_test): ref and sink
child because it may never be added to anything.

14 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
TODO
gdk/gdk.c
gdk/x11/gdkmain-x11.c
gtk/gtkcolorsel.c
gtk/gtkcurve.c
gtk/testgtk.c
tests/testgtk.c

index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
index 505629d03d085c5152ea396673f8d3fcedf65e62..dc10c16995612664dc2f880560ccb020147dfc15 100644 (file)
@@ -1,3 +1,24 @@
+Thu Apr  9 14:24:35 1998  Owen Taylor  <owt1@cornell.edu>
+
+       (Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
+       
+       * gtk/gtkcurve.c (gtk_curve_interpolate): Added a
+       missing g_free.
+
+       * gtk/gtkcurve.c (gtk_curve_graph_events): Limits
+       were off by one, resulting in writing past array
+       bounds. Removed some unused code.
+
+       * gdk/gdk.c (gdk_dnd_drag_begin): The event structure
+       used for gdk_event_put should be a GdkEvent, not a 
+       subtype, since it will all be copied.
+
+       * gtk/gtkcolorsel.c: Added a unrealize handler that
+       unref's the GC's that were created.
+
+       * gtk/testgtk.c (clist_warning_test): ref and sink
+       child because it may never be added to anything.
+
 Wed Apr  8 20:50:02 1998  Owen Taylor  <owt1@cornell.edu>
 
        * gtk/gtkwindow.c (gtk_window_set_hints): Removed unsed
diff --git a/TODO b/TODO
index 101a219e2c47398f32893e3ad127060256319ce8..ae20a96af43fdaeef674bdbf673b803589da0fa4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -272,3 +272,6 @@ TODO AFTER GTK 1.0
    every widget realization involves a XGetGeometry and a
    XGetWindowAttributes. And every GdkWindow destruction
    involves a XQueryTree.
+
+ * Scrolled windows need to be smarter about when they size-request/allocate
+   their children.
\ No newline at end of file
index 323c737915c871937e23dcb2d0535df7504e714c..b7a4da58f4f05bc40ecf3f60d745c7587fb67108 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -3186,16 +3186,16 @@ gdk_signal (int sig_num)
 static void
 gdk_dnd_drag_begin (GdkWindow *initial_window)
 {
-  GdkEventDragBegin tev;
+  GdkEvent tev;
 
   GDK_NOTE(DND, g_print("------- STARTING DRAG from %p\n", initial_window));
 
   tev.type = GDK_DRAG_BEGIN;
-  tev.window = initial_window;
-  tev.u.allflags = 0;
-  tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+  tev.dragbegin.window = initial_window;
+  tev.dragbegin.u.allflags = 0;
+  tev.dragbegin.u.flags.protocol_version = DND_PROTOCOL_VERSION;
 
-  gdk_event_put ((GdkEvent *) &tev);
+  gdk_event_put (&tev);
 }
 
 static void
@@ -3927,28 +3927,28 @@ gdk_dnd_drag_end (Window     dest,
                  GdkPoint   coords)
 {
   GdkWindowPrivate *wp;
-  GdkEventDragRequest tev;
+  GdkEvent tev;
   int i;
 
-  tev.type = GDK_DRAG_REQUEST;
-  tev.drop_coords = coords;
-  tev.requestor = dest;
-  tev.u.allflags = 0;
-  tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
-  tev.isdrop = 1;
+  tev.dragrequest.type = GDK_DRAG_REQUEST;
+  tev.dragrequest.drop_coords = coords;
+  tev.dragrequest.requestor = dest;
+  tev.dragrequest.u.allflags = 0;
+  tev.dragrequest.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+  tev.dragrequest.isdrop = 1;
 
   for (i = 0; i < gdk_dnd.drag_numwindows; i++)
     {
       wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
       if (wp->dnd_drag_accepted)
        {
-         tev.window = (GdkWindow *) wp;
-         tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
-          tev.timestamp = gdk_dnd.last_drop_time;
-         tev.data_type = 
+         tev.dragrequest.window = (GdkWindow *) wp;
+         tev.dragrequest.u.flags.delete_data = wp->dnd_drag_destructive_op;
+          tev.dragrequest.timestamp = gdk_dnd.last_drop_time;
+         tev.dragrequest.data_type = 
                gdk_atom_name(wp->dnd_drag_data_type);
 
-         gdk_event_put((GdkEvent *) &tev);
+         gdk_event_put(&tev);
        }
     }
 }
index 323c737915c871937e23dcb2d0535df7504e714c..b7a4da58f4f05bc40ecf3f60d745c7587fb67108 100644 (file)
@@ -3186,16 +3186,16 @@ gdk_signal (int sig_num)
 static void
 gdk_dnd_drag_begin (GdkWindow *initial_window)
 {
-  GdkEventDragBegin tev;
+  GdkEvent tev;
 
   GDK_NOTE(DND, g_print("------- STARTING DRAG from %p\n", initial_window));
 
   tev.type = GDK_DRAG_BEGIN;
-  tev.window = initial_window;
-  tev.u.allflags = 0;
-  tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+  tev.dragbegin.window = initial_window;
+  tev.dragbegin.u.allflags = 0;
+  tev.dragbegin.u.flags.protocol_version = DND_PROTOCOL_VERSION;
 
-  gdk_event_put ((GdkEvent *) &tev);
+  gdk_event_put (&tev);
 }
 
 static void
@@ -3927,28 +3927,28 @@ gdk_dnd_drag_end (Window     dest,
                  GdkPoint   coords)
 {
   GdkWindowPrivate *wp;
-  GdkEventDragRequest tev;
+  GdkEvent tev;
   int i;
 
-  tev.type = GDK_DRAG_REQUEST;
-  tev.drop_coords = coords;
-  tev.requestor = dest;
-  tev.u.allflags = 0;
-  tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
-  tev.isdrop = 1;
+  tev.dragrequest.type = GDK_DRAG_REQUEST;
+  tev.dragrequest.drop_coords = coords;
+  tev.dragrequest.requestor = dest;
+  tev.dragrequest.u.allflags = 0;
+  tev.dragrequest.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+  tev.dragrequest.isdrop = 1;
 
   for (i = 0; i < gdk_dnd.drag_numwindows; i++)
     {
       wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
       if (wp->dnd_drag_accepted)
        {
-         tev.window = (GdkWindow *) wp;
-         tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
-          tev.timestamp = gdk_dnd.last_drop_time;
-         tev.data_type = 
+         tev.dragrequest.window = (GdkWindow *) wp;
+         tev.dragrequest.u.flags.delete_data = wp->dnd_drag_destructive_op;
+          tev.dragrequest.timestamp = gdk_dnd.last_drop_time;
+         tev.dragrequest.data_type = 
                gdk_atom_name(wp->dnd_drag_data_type);
 
-         gdk_event_put((GdkEvent *) &tev);
+         gdk_event_put(&tev);
        }
     }
 }
index c6332a752969f2b2e293f424d22a4fc1806e9758..bfa834f42d1090149f4bfa0d6bbabb69fc06aaa2 100644 (file)
@@ -114,6 +114,7 @@ static void gtk_color_selection_rgb_updater       (GtkWidget         *widget,
 static void gtk_color_selection_opacity_updater   (GtkWidget         *widget,
                                                    gpointer           data);
 static void gtk_color_selection_realize           (GtkWidget         *widget);
+static void gtk_color_selection_unrealize         (GtkWidget         *widget);
 static void gtk_color_selection_finalize          (GtkObject         *object);
 static void gtk_color_selection_color_changed     (GtkColorSelection *colorsel);
 static void gtk_color_selection_update_input      (GtkWidget         *scale,
@@ -237,6 +238,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
   object_class->finalize = gtk_color_selection_finalize;
 
   widget_class->realize = gtk_color_selection_realize;
+  widget_class->unrealize = gtk_color_selection_unrealize;
 }
 
 static void
@@ -519,6 +521,35 @@ gtk_color_selection_realize (GtkWidget         *widget)
                            colorsel);
 }
 
+static void
+gtk_color_selection_unrealize (GtkWidget      *widget)
+{
+  GtkColorSelection *colorsel;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_COLOR_SELECTION (widget));
+
+  colorsel = GTK_COLOR_SELECTION (widget);
+
+  if (colorsel->value_gc != NULL)
+    {
+      gdk_gc_unref (colorsel->value_gc);
+      colorsel->value_gc = NULL;
+    }
+  if (colorsel->wheel_gc != NULL)
+    {
+      gdk_gc_unref (colorsel->wheel_gc);
+      colorsel->wheel_gc = NULL;
+    }
+  if (colorsel->sample_gc != NULL)
+    {
+      gdk_gc_unref (colorsel->sample_gc);
+      colorsel->sample_gc = NULL;
+    }
+
+  (* GTK_WIDGET_CLASS (color_selection_parent_class)->unrealize) (widget);
+}
+
 static void
 gtk_color_selection_finalize (GtkObject *object)
 {
index e10389cb69294e8b437da1b3e0586dee8e523919..b82100301f2523e17f167c7e1521cf79954ce721 100644 (file)
@@ -26,7 +26,6 @@
 #include "gtksignal.h"
 #include "gtktable.h"
 
-#define BOUNDS(a,x,y)  (((a) < (x)) ? (x) : (((a) > (y)) ? (y) : (a)))
 #define RADIUS         3       /* radius of the control points */
 #define MIN_DISTANCE   8       /* min distance between control points */
 
@@ -214,6 +213,8 @@ gtk_curve_interpolate (GtkCurve *c, gint width, gint height)
       c->point[i].y = RADIUS + height
        - project (vector[i], c->min_y, c->max_y, height);
     }
+
+  g_free (vector);
 }
 
 static void
@@ -294,8 +295,8 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c)
 
   /*  get the pointer position  */
   gdk_window_get_pointer (w->window, &tx, &ty, NULL);
-  x = BOUNDS ((tx - RADIUS), 0, width);
-  y = BOUNDS ((ty - RADIUS), 0, height);
+  x = CLAMP ((tx - RADIUS), 0, width-1);
+  y = CLAMP ((ty - RADIUS), 0, height-1);
 
   min_x = c->min_x;
 
@@ -409,11 +410,7 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c)
 
     case GDK_MOTION_NOTIFY:
       mevent = (GdkEventMotion *) event;
-      if (mevent->is_hint)
-       {
-         mevent->x = tx;
-         mevent->y = ty;
-       }
+
       switch (c->curve_type)
        {
        case GTK_CURVE_TYPE_LINEAR:
index 8cfd862438205566fa8b187166e9be9c58228d4c..e56fc7073f90398c02099c6c4e9dd46377d1342d 100644 (file)
@@ -3076,7 +3076,11 @@ clist_warning_test (GtkWidget *button,
   static gboolean add_remove = FALSE;
 
   add_remove = !add_remove;
+
   child = gtk_label_new ("Test");
+  gtk_widget_ref (child);
+  gtk_object_sink (child);
+
   if (add_remove)
     gtk_container_add (GTK_CONTAINER (clist), child);
   else
@@ -3085,7 +3089,9 @@ clist_warning_test (GtkWidget *button,
       gtk_container_remove (GTK_CONTAINER (clist), child);
       child->parent = NULL;
     }
+
   gtk_widget_destroy (child);
+  gtk_widget_unref (child);
 }
 
 static void
index 8cfd862438205566fa8b187166e9be9c58228d4c..e56fc7073f90398c02099c6c4e9dd46377d1342d 100644 (file)
@@ -3076,7 +3076,11 @@ clist_warning_test (GtkWidget *button,
   static gboolean add_remove = FALSE;
 
   add_remove = !add_remove;
+
   child = gtk_label_new ("Test");
+  gtk_widget_ref (child);
+  gtk_object_sink (child);
+
   if (add_remove)
     gtk_container_add (GTK_CONTAINER (clist), child);
   else
@@ -3085,7 +3089,9 @@ clist_warning_test (GtkWidget *button,
       gtk_container_remove (GTK_CONTAINER (clist), child);
       child->parent = NULL;
     }
+
   gtk_widget_destroy (child);
+  gtk_widget_unref (child);
 }
 
 static void