diff options
-rw-r--r-- | e-util/ChangeLog | 9 | ||||
-rw-r--r-- | e-util/e-canvas.c | 30 | ||||
-rw-r--r-- | widgets/misc/e-canvas.c | 30 |
3 files changed, 53 insertions, 16 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 9cc276db56..02b2af4e88 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,4 +1,13 @@ 2000-07-25 Peter Williams <peterw@helixcode.com> + + * e-canvas.c (emit_event): Don't bother with + dereferencing the event pointer. + (e_canvas_item_set_cursor): Reference our selection + item; print a debug message. Deref when destroying + (e_canvas_item_add_selection): Same. + (e_canvas_item_remove_selection): Same. + +2000-07-25 Peter Williams <peterw@helixcode.com> * Makefile.am (libeutil_static_la_LDFLAGS): Build both libraries (a typo didn't build libeutil.la, only -static.) diff --git a/e-util/e-canvas.c b/e-util/e-canvas.c index beb90a2e40..bb4eb60184 100644 --- a/e-util/e-canvas.c +++ b/e-util/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; 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; |