[nautilus] files-view: fix NautilusFloatingBar interfering with double click



commit 3aba356ac81a8b2714416a544f59cb4b323b2d96
Author: Nelson Benítez León <nbenitezl+gnome gmail com>
Date:   Wed Sep 20 20:43:52 2017 +0500

    files-view: fix NautilusFloatingBar interfering with double click
    
    When you have the mouse pointer at the bottom of the icon view in
    the area of the floating bar (which is hidden as you have the
    pointer there) if the file is not selected and you double-click it,
    it fails to launch because the floating bar appears for an instant
    and eats the second click of the double-click.
    
    What happens is the first click selects the file and queues a
    floating bar show info, the floating bar appears for an instant
    eating your second click, it hides again as you have the pointer
    in the floating bar area.
    
    Fixed by making the floating bar pass-through the click events to
    its underneath window just for the timeframe a double click could
    happen. We can't leave pass-through always on because the parent
    overlay "enter-notify-event" event would not fire in that case.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/28

 src/nautilus-files-view.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index a79ecf2..a18cdeb 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -531,6 +531,17 @@ floating_bar_set_status_timeout_cb (gpointer data)
     return FALSE;
 }
 
+static gboolean
+remove_floating_bar_passthrough (gpointer data)
+{
+    NautilusFilesViewPrivate *priv;
+
+    priv = nautilus_files_view_get_instance_private (NAUTILUS_FILES_VIEW (data));
+    gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+                                          priv->floating_bar, FALSE);
+    return G_SOURCE_REMOVE;
+}
+
 static void
 set_floating_bar_status (NautilusFilesView *view,
                          const gchar       *primary_status,
@@ -559,6 +570,12 @@ set_floating_bar_status (NautilusFilesView *view,
     status_data->detail_status = g_strdup (detail_status);
     status_data->view = view;
 
+    /* Activate passthrough on the floating bar just long enough for a
+     * potential double click to happen, so to not interfere with it */
+    gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+                                          priv->floating_bar, TRUE);
+    g_timeout_add ((guint) double_click_time, remove_floating_bar_passthrough, view);
+
     /* waiting for half of the double-click-time before setting
      * the status seems to be a good approximation of not setting it
      * too often and not delaying the statusbar too much.


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