[gnumeric] GUI: Fix unresponsive-keyboard problem.



commit dc1fb44692b0e6a565d970e84839aef91a19044f
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 16 17:43:28 2016 -0500

    GUI: Fix unresponsive-keyboard problem.
    
    It was possible through double/triple click on the col/row dividers and
    buttons to enter an unbalanced-grab situation.

 ChangeLog      |    5 +++++
 NEWS           |    1 +
 src/item-bar.c |   29 ++++++++++++++++++++---------
 3 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d7782e0..645342b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-16  Morten Welinder  <terra gnome org>
+
+       * src/item-bar.c (item_bar_button_pressed): Handle multiple clicks
+       without regrabbing the focus.  See #760639.
+
 2016-01-13  Morten Welinder  <terra gnome org>
 
        * src/sstest.c (test_random_randsnorm)
diff --git a/NEWS b/NEWS
index 5901e21..5508d37 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Morten:
          [#760104] [#760229] [#760231] [#760232] [#760544] [#760545]
        * Fix R.DBINOM extreme-value case.  [#760230]
        * New function AGM.
+       * Fix canvas problem leaving grab in place.  [#760639]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.26
diff --git a/src/item-bar.c b/src/item-bar.c
index a1d7be4..6510ecc 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -869,14 +869,18 @@ colrow_tip_setlabel (GnmItemBar *ib, gboolean const is_cols, int size_pixels)
 static void
 item_bar_resize_stop (GnmItemBar *ib, int new_size)
 {
-       if (new_size != 0 && ib->colrow_being_resized >= 0)
-               scg_colrow_size_set (ib->pane->simple.scg,
-                                    ib->is_col_header,
-                                    ib->colrow_being_resized, new_size);
-       ib->colrow_being_resized = -1;
-       ib->has_resize_guides = FALSE;
-       scg_size_guide_stop (ib->pane->simple.scg);
-
+       if (ib->colrow_being_resized != -1) {
+               if (new_size != 0)
+                       scg_colrow_size_set (ib->pane->simple.scg,
+                                            ib->is_col_header,
+                                            ib->colrow_being_resized,
+                                            new_size);
+               ib->colrow_being_resized = -1;
+       }
+       if (ib->has_resize_guides) {
+               ib->has_resize_guides = FALSE;
+               scg_size_guide_stop (ib->pane->simple.scg);
+       }
        if (ib->tip != NULL) {
                gtk_widget_destroy (gtk_widget_get_toplevel (ib->tip));
                ib->tip = NULL;
@@ -935,6 +939,12 @@ item_bar_button_pressed (GocItem *item, int button, double x_, double y_)
        GdkEventButton *bevent = &event->button;
        gint64 x = x_ * item->canvas->pixels_per_unit, y = y_ * item->canvas->pixels_per_unit;
 
+       if (ib->colrow_being_resized != -1 || ib->start_selection != -1) {
+               // This happens with repeated clicks on colrow divider.
+               // Ignore it.  Definitely don't regrab.
+               return TRUE;
+       }
+
        if (button > 3)
                return FALSE;
 
@@ -1104,9 +1114,10 @@ item_bar_motion (GocItem *item, double x_, double y_)
 static gboolean
 item_bar_button_released (GocItem *item, int button, double x, double y)
 {
-       GnmItemBar      *ib = GNM_ITEM_BAR (item);
+       GnmItemBar *ib = GNM_ITEM_BAR (item);
        if (item == goc_canvas_get_grabbed_item (item->canvas))
                gnm_simple_canvas_ungrab (item, 0);
+
        if (ib->colrow_being_resized >= 0) {
                if (ib->has_resize_guides)
                        item_bar_resize_stop (ib, ib->colrow_resize_size);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]