From 1de4b21c42204c218b86ca95f368b66d579d2962 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 27 Feb 2003 22:24:38 +0000 Subject: use gdk_event_copy and gdk_event_free to dup the event. 2003-02-27 Mike Kestner * gal/widgets/e-canvas.c (emit_event): use gdk_event_copy and gdk_event_free to dup the event. svn path=/trunk/; revision=20088 --- widgets/misc/e-canvas.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 54282f5408..1bbeef9a28 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -161,7 +161,7 @@ e_canvas_new () static int emit_event (GnomeCanvas *canvas, GdkEvent *event) { - GdkEvent ev; + GdkEvent *ev; gint finished; GnomeCanvasItem *item; GnomeCanvasItem *parent; @@ -225,14 +225,14 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) * offsets of the fields in the event structures. */ - ev = *event; + ev = gdk_event_copy (event); - switch (ev.type) { + switch (ev->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); + ev->crossing.x, ev->crossing.y, + &ev->crossing.x, &ev->crossing.y); break; case GDK_MOTION_NOTIFY: @@ -241,8 +241,8 @@ 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); + ev->motion.x, ev->motion.y, + &ev->motion.x, &ev->motion.y); break; default: @@ -259,17 +259,7 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) while (item && !finished) { g_object_ref (item); - g_signal_emit_by_name (item, "event", - &ev, - &finished); - -#ifndef NO_WARNINGS -#warning FIXME - needs thought -#endif -#if 0 - if (GTK_OBJECT_DESTROYED (item)) - finished = TRUE; -#endif + g_signal_emit_by_name (item, "event", ev, &finished); parent = item->parent; g_object_unref (item); @@ -277,6 +267,8 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) item = parent; } + gdk_event_free (ev); + return finished; } @@ -696,8 +688,8 @@ e_canvas_style_set (GtkWidget *widget, GtkStyle *previous_style) static void e_canvas_realize (GtkWidget *widget) { - gint width, height; #ifdef GAL_GDK_IM + gint width, height; ECanvas *ecanvas = E_CANVAS (widget); #endif -- cgit v1.2.3