From 2801d67dabe9b57ffe2f044fa93f6302eac63114 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Mon, 8 Oct 2012 22:14:36 +0200 Subject: [PATCH] Fix bug where, after double-clicking to switch sheet view, a spurious release event was processed. From http://developer.gnome.org/gdk/2.24/gdk-Event-Structures.html#GdkEventButton Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be: 1. GDK_BUTTON_PRESS 2. GDK_BUTTON_RELEASE 3. GDK_BUTTON_PRESS 4. GDK_2BUTTON_PRESS 5. GDK_BUTTON_RELEASE So what was happening was this: When the var-name was double-clicked, the view switched from VarView to DataView as soon as event 4 (GDK_2BUTTON_PRESS) occured. Then event 5 (GDK_BUTTON_RELEASE) occured. Now the PsppSheetView object is written such that, it decides to edit a cell, on button release event. Hence, whichever cell the pointer happended to be in, when the user lifts his finger after double clicking, starts to be edited. This change ignores button release events on the object unless a corresponding button press event was seen. --- src/ui/gui/pspp-sheet-view.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index 4f3ce3b367..32627beffd 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -2635,6 +2635,10 @@ pspp_sheet_view_button_release_edit (PsppSheetView *tree_view, if (event->window != tree_view->priv->bin_window) return FALSE; + /* Ignore a released button, if that button wasn't depressed */ + if (tree_view->priv->pressed_button != event->button) + return FALSE; + if (!find_click (tree_view, event->x, event->y, &node, &column, &background_area, &cell_area)) return FALSE; -- 2.30.2