From 490437a88464f7be839ae646970e3219b04b1562 Mon Sep 17 00:00:00 2001 From: Matthew Loper Date: Wed, 26 Jul 2000 21:00:52 +0000 Subject: A few fixes to the ECanvas selection item a miniature cleanup of the event handler. svn path=/trunk/; revision=4364 --- widgets/misc/e-canvas.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index beb90a2e40..bb4eb60184 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -147,7 +147,7 @@ is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) static int emit_event (GnomeCanvas *canvas, GdkEvent *event) { - GdkEvent ev; + /*GdkEvent ev;*/ gint finished; GnomeCanvasItem *item; GnomeCanvasItem *parent; @@ -203,14 +203,16 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) * offsets of the fields in the event structures. */ - ev = *event; + /*ev = *event;*/ - switch (ev.type) { + switch (event->type) { case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: gnome_canvas_window_to_world (canvas, - ev.crossing.x, ev.crossing.y, - &ev.crossing.x, &ev.crossing.y); + event->crossing.x, + event->crossing.y, + &(event->crossing.x), + &(event->crossing.y)); break; case GDK_MOTION_NOTIFY: @@ -219,8 +221,10 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE: gnome_canvas_window_to_world (canvas, - ev.motion.x, ev.motion.y, - &ev.motion.x, &ev.motion.y); + event->motion.x, + event->motion.y, + &(event->motion.x), + &(event->motion.y)); break; default: @@ -246,7 +250,7 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) gtk_object_ref (GTK_OBJECT (item)); gtk_signal_emit_by_name (GTK_OBJECT (item), "event", - &ev, + event, &finished); if (GTK_OBJECT_DESTROYED (item)) @@ -555,6 +559,9 @@ e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id) func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback"); if (func) func(info->item, flags, info->id); + g_message ("ECANVAS: free info (2): item %p, id %p", + info->item, info->id); + gtk_object_unref (GTK_OBJECT (info->item)); g_free(info); } g_list_free(canvas->selection); @@ -565,7 +572,9 @@ e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id) info = g_new(ECanvasSelectionInfo, 1); info->item = item; + gtk_object_ref (GTK_OBJECT (info->item)); info->id = id; + g_message ("ECANVAS: new info item %p, id %p", item, id); flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback"); @@ -628,7 +637,9 @@ e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id) info = g_new(ECanvasSelectionInfo, 1); info->item = item; + gtk_object_ref (GTK_OBJECT (info->item)); info->id = id; + g_message ("ECANVAS: new info (2): item %p, id %p", item, id); func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback"); if (func) @@ -671,6 +682,9 @@ e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id) if (canvas->cursor == info) canvas->cursor = NULL; + g_message ("ECANVAS: removing info: item %p, info %p", + info->item, info->id); + gtk_object_unref (GTK_OBJECT (info->item)); g_free(info); g_list_free_1(list); break; -- cgit v1.2.3