From: John Darrington Date: Mon, 8 Oct 2012 20:14:36 +0000 (+0200) Subject: Fix bug where, after double-clicking to switch sheet view, a spurious release event... X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fbuilds%2F20121013032614%2Fpspp;p=pspp 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. --- 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;