[easytag/easytag-2-2] Propagate double-click events on tree view headers



commit 195e0cf176dee6a414b9b32e676c8178b54c8af8
Author: David King <amigadave amigadave com>
Date:   Mon Oct 20 08:31:59 2014 +0100

    Propagate double-click events on tree view headers
    
    Receiving a double-click event on a tree view is not a good indicator of
    whether to change the selection, as the event could have occurred on the
    column headers, resulting in the header resizing and the selection
    changing simultaneously. Avoid the problem by checking that the
    double-click event is in the bin window, and ignoring (and propagating)
    it otherwise.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738830

 src/browser.c |   21 +++++++++++++++++++--
 src/cddb.c    |   14 ++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 822d4b1..ef91e2e 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -533,15 +533,27 @@ Browser_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
 
     if (event->type==GDK_2BUTTON_PRESS && event->button==1)
     {
-        /* Double left mouse click */
-        // Select files of the same directory (useful when browsing sub-directories)
+        /* Double left mouse click. Select files of the same directory (useful
+         * when browsing sub-directories). */
+        GdkWindow *bin_window;
         GList *l;
         gchar *path_ref = NULL;
         gchar *patch_check = NULL;
         GtkTreePath *currentPath = NULL;
 
         if (!ETCore->ETFileDisplayed)
+        {
+            return FALSE;
+        }
+
+        bin_window = gtk_tree_view_get_bin_window (treeView);
+
+        if (bin_window != event->window)
+        {
+            /* If the double-click is not on a tree view row, for example when
+             * resizing a header column, ignore it. */
             return FALSE;
+        }
 
         // File taken as reference...
         path_ref = g_path_get_dirname( ((File_Name *)ETCore->ETFileDisplayed->FileNameCur->data)->value );
@@ -566,11 +578,16 @@ Browser_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
         g_free(path_ref);
         if (currentPath)
             gtk_tree_path_free(currentPath);
+
+        return TRUE;
     }else if (event->type==GDK_3BUTTON_PRESS && event->button==1)
     {
         /* Triple left mouse click, select all files of the list. */
         et_on_action_select_all ();
+
+        return TRUE;
     }
+
     return FALSE;
 }
 
diff --git a/src/cddb.c b/src/cddb.c
index a3bb965..0854255 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -1498,9 +1498,23 @@ Cddb_Track_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
 
     if (event->type==GDK_2BUTTON_PRESS && event->button==1)
     {
+        GdkWindow *bin_window;
+
+        bin_window = gtk_tree_view_get_bin_window (treeView);
+
+        if (bin_window != event->window)
+        {
+            /* Ignore the event if it is on the header (which is not the bin
+             * window). */
+            return FALSE;
+        }
+
         /* Double left mouse click */
         Cddb_Track_List_Select_All();
+
+        return TRUE;
     }
+
     return FALSE;
 }
 


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