From d4bf3e01bc44d7d8471251e2e890ce0e0ca07113 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Tue, 18 Sep 2001 01:40:20 +0000 Subject: Code implicitly assumed that event->button.button is 1, 2, or 3, causing 2001-09-17 Jon Trowbridge * gui/widgets/e-minicard.c (e_minicard_event): Code implicitly assumed that event->button.button is 1, 2, or 3, causing disaster when using a wheel-mouse. Fixed. (bug #9400) svn path=/trunk/; revision=12926 --- addressbook/gui/widgets/e-minicard.c | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'addressbook/gui/widgets/e-minicard.c') diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index d5d2b84bdf..6f6df9b27c 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -511,24 +511,27 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_BUTTON_PRESS: { - int ret_val = e_minicard_selected(e_minicard, event); - GdkEventMask mask = ((1 << (4 + event->button.button)) | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK); - - e_canvas_item_grab_focus(item, TRUE); - - if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (e_minicard), - mask, NULL, event->button.time)) { - return FALSE; + if (1 <= event->button.button && event->button.button <= 3) { + int ret_val = e_minicard_selected(e_minicard, event); + GdkEventMask mask = ((1 << (4 + event->button.button)) | + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK); + + e_canvas_item_grab_focus(item, TRUE); + + if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (e_minicard), + mask, NULL, event->button.time)) { + return FALSE; + } + gtk_grab_add (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas)); + e_minicard->button_x = event->button.x; + e_minicard->button_y = event->button.y; + e_minicard->drag_button = event->button.button; + e_minicard->drag_button_down = TRUE; + return ret_val; } - gtk_grab_add (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas)); - e_minicard->button_x = event->button.x; - e_minicard->button_y = event->button.y; - e_minicard->drag_button = event->button.button; - e_minicard->drag_button_down = TRUE; - return ret_val; + break; } case GDK_BUTTON_RELEASE: if (e_minicard->drag_button == event->button.button) { -- cgit