diff options
author | Owen Taylor <owt1@cornell.edu> | 1998-04-09 19:12:12 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-04-09 19:12:12 +0000 |
commit | 26df647a0f526f6c17ad2317b146e639e9917613 (patch) | |
tree | 43ba2f224c0ff1375f99f19d195e6fbf71c6de96 | |
parent | ad7dc0e87f66bc90c2d3a7453ecbf34abe0a17dc (diff) | |
download | gtk+-26df647a0f526f6c17ad2317b146e639e9917613.tar.gz |
(Found by Mattias.Gronlund" <Mattias.Gronlund@sa.erisoft.se>)
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.
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 21 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 21 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | gdk/gdk.c | 34 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 34 | ||||
-rw-r--r-- | gtk/gtkcolorsel.c | 31 | ||||
-rw-r--r-- | gtk/gtkcurve.c | 13 | ||||
-rw-r--r-- | gtk/testgtk.c | 6 | ||||
-rw-r--r-- | tests/testgtk.c | 6 |
14 files changed, 232 insertions, 42 deletions
@@ -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/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -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/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -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/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 505629d03d..dc10c16995 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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 @@ -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 @@ -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); } } } diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 323c737915..b7a4da58f4 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.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); } } } diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index c6332a7529..bfa834f42d 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -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 @@ -520,6 +522,35 @@ gtk_color_selection_realize (GtkWidget *widget) } 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) { GtkColorSelection *colorsel; diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c index e10389cb69..b82100301f 100644 --- a/gtk/gtkcurve.c +++ b/gtk/gtkcurve.c @@ -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: diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 8cfd862438..e56fc7073f 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -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 diff --git a/tests/testgtk.c b/tests/testgtk.c index 8cfd862438..e56fc7073f 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -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 |