(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.
This commit is contained in:
Owen Taylor 1998-04-09 19:12:12 +00:00 committed by Owen Taylor
parent ad7dc0e87f
commit 26df647a0f
14 changed files with 232 additions and 42 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

3
TODO
View File

@ -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.

View 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);
}
}
}

View 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);
}
}
}

View 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)
{

View 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:

View 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

View 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