[nautilus] Register double-click on button release



commit 3fe654aad79cdc549950018f2cff9bc87128ee83
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Mon Mar 9 18:25:06 2015 +0000

    Register double-click on button release
    
    Only perform the double-click action when the second click is released.
    This fixes a strange problem where double-clicking on a
    password-protected webdav share (as exported by gnome-user-share) fails
    to show the password dialog (which gnome-shell does) due to Nautilus
    holding a grab. By only taking action when the click is released,
    Nautilus is not holding a grab and the password dialog is shown.
    
    When it fails, the following is shown in the log:
    gnome-session[20151]: Gjs-Message: JS LOG: pushModal: invocation of begin_modal failed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745859

 libnautilus-private/nautilus-canvas-container.c |   28 +++++++++++++++-------
 libnautilus-private/nautilus-canvas-private.h   |    1 +
 2 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 14848a9..705db9d 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -5310,14 +5310,8 @@ handle_canvas_double_click (NautilusCanvasContainer *container,
            clicked_within_double_click_interval (container) &&
            details->double_click_icon[0] == details->double_click_icon[1] &&
            details->double_click_button[0] == details->double_click_button[1]) {
-               if (!button_event_modifies_selection (event)) {
-                       activate_selected_items (container);
-                       return TRUE;
-               } else if ((event->state & GDK_CONTROL_MASK) == 0 &&
-                          (event->state & GDK_SHIFT_MASK) != 0) {
-                       activate_selected_items_alternate (container, icon);
-                       return TRUE;
-               }
+               details->double_clicked = TRUE;
+               return TRUE;
        }
 
        return FALSE;
@@ -5440,22 +5434,38 @@ item_event_callback (EelCanvasItem *item,
 {
        NautilusCanvasContainer *container;
        NautilusCanvasIcon *icon;
+       GdkEventButton *event_button;
 
        container = NAUTILUS_CANVAS_CONTAINER (data);
 
        icon = NAUTILUS_CANVAS_ITEM (item)->user_data;
        g_assert (icon != NULL);
 
+       event_button = &event->button;
+
        switch (event->type) {
        case GDK_BUTTON_PRESS:
-               if (handle_canvas_button_press (container, icon, &event->button)) {
+               container->details->double_clicked = FALSE;
+               if (handle_canvas_button_press (container, icon, event_button)) {
                        /* Stop the event from being passed along further. Returning
                         * TRUE ain't enough. 
                         */
                        return TRUE;
                }
                return FALSE;
+       case GDK_BUTTON_RELEASE:
+               if (event_button->button == DRAG_BUTTON
+                   && container->details->double_clicked) {
+                       if (!button_event_modifies_selection (event_button)) {
+                               activate_selected_items (container);
+                       } else if ((event_button->state & GDK_CONTROL_MASK) == 0 &&
+                                  (event_button->state & GDK_SHIFT_MASK) != 0) {
+                               activate_selected_items_alternate (container, icon);
+                       }
+               }
+               /* fall through */
        default:
+               container->details->double_clicked = FALSE;
                return FALSE;
        }
 }
diff --git a/libnautilus-private/nautilus-canvas-private.h b/libnautilus-private/nautilus-canvas-private.h
index 0efaa9e..8cf46ca 100644
--- a/libnautilus-private/nautilus-canvas-private.h
+++ b/libnautilus-private/nautilus-canvas-private.h
@@ -170,6 +170,7 @@ struct NautilusCanvasContainerDetails {
        StretchState stretch_start;
 
        gboolean icon_selected_on_button_down;
+       gboolean double_clicked;
        NautilusCanvasIcon *double_click_icon[2]; /* Both clicks in a double click need to be on the same 
icon */
        guint double_click_button[2];
 


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