From 414408be596cdff396e6295d8a9d82ecb6d40e6a Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 9 Feb 2001 22:27:37 +0000 Subject: Since gdkevent is a union, casting a smaller struct to a gdkevent caused 2001-02-09 JP Rosevear * gal/widgets/e-canvas.c (e_canvas_key): Since gdkevent is a union, casting a smaller struct to a gdkevent caused unknown memory to be copied around. fix by copying to a full gdkevent structure before calling gdkevent. (e_canvas_focus_in): ditto (e_canvas_focus_out): ditto svn path=/trunk/; revision=8153 --- widgets/misc/e-canvas.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index e772cd686f..ffc3a333f8 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -271,14 +271,17 @@ static gint e_canvas_key (GtkWidget *widget, GdkEventKey *event) { GnomeCanvas *canvas; + GdkEvent full_event; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); canvas = GNOME_CANVAS (widget); + + full_event.key = *event; - return emit_event (canvas, (GdkEvent *) event); + return emit_event (canvas, &full_event); } @@ -333,6 +336,7 @@ e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) { GnomeCanvas *canvas; ECanvas *ecanvas; + GdkEvent full_event; canvas = GNOME_CANVAS (widget); ecanvas = E_CANVAS (widget); @@ -342,10 +346,12 @@ e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) if (ecanvas->ic) gdk_im_begin (ecanvas->ic, canvas->layout.bin_window); - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else + if (canvas->focused_item) { + full_event.focus_change = *event; + return emit_event (canvas, &full_event); + } else { return FALSE; + } } /* Focus out handler for the canvas */ @@ -354,6 +360,7 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) { GnomeCanvas *canvas; ECanvas *ecanvas; + GdkEvent full_event; canvas = GNOME_CANVAS (widget); ecanvas = E_CANVAS (widget); @@ -363,10 +370,12 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) if (ecanvas->ic) gdk_im_end (); - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else + if (canvas->focused_item) { + full_event.focus_change = *event; + return emit_event (canvas, &full_event); + } else { return FALSE; + } } static void -- cgit