summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorChristian Neumair <cneumair@gnome.org>2008-06-29 10:53:58 +0000
committerChristian Neumair <cneumair@src.gnome.org>2008-06-29 10:53:58 +0000
commit1e27bdf4d51077812bd86dd0ca0da6f9d931c7cc (patch)
tree45554749835fb6081dbc58dda6f55a8a7b36f3e6 /libnautilus-private
parent2d38452c9593ef43b4bbeca764ac911a77422cbe (diff)
downloadnautilus-1e27bdf4d51077812bd86dd0ca0da6f9d931c7cc.tar.gz
Use customized double click detection, for supporting double clicks on
2008-06-29 Christian Neumair <cneumair@gnome.org> * libnautilus-private/nautilus-icon-container.c (clicked_within_double_click_interval), (handle_icon_button_press): * libnautilus-private/nautilus-icon-private.h: Use customized double click detection, for supporting double clicks on half shown items, where the first click triggers a scroll event. Thanks to Nelson Benítez León. Fixes #347423. svn path=/trunk/; revision=14297
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-icon-container.c32
-rw-r--r--libnautilus-private/nautilus-icon-private.h3
2 files changed, 33 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 2ba65d8e5..e31b9ecd1 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -3817,6 +3817,31 @@ nautilus_icon_container_did_not_drag (NautilusIconContainer *container,
}
}
+static gboolean
+clicked_within_double_click_interval (NautilusIconContainer *container)
+{
+ static gint64 last_click_time = 0;
+ static gint click_count = 0;
+ gint double_click_time;
+ gint64 current_time;
+
+ /* Determine click count */
+ g_object_get (G_OBJECT (gtk_widget_get_settings (GTK_WIDGET (container))),
+ "gtk-double-click-time", &double_click_time,
+ NULL);
+ current_time = eel_get_system_time ();
+ if (current_time - last_click_time < double_click_time * 1000) {
+ click_count++;
+ } else {
+ click_count = 0;
+ }
+
+ /* Stash time for next compare */
+ last_click_time = current_time;
+
+ return (click_count > 0);
+}
+
static void
clear_drag_state (NautilusIconContainer *container)
{
@@ -5571,8 +5596,9 @@ handle_icon_button_press (NautilusIconContainer *container,
details->double_click_icon[1] = details->double_click_icon[0];
details->double_click_icon[0] = icon;
}
- if (event->type == GDK_2BUTTON_PRESS &&
- (event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)) {
+
+ if ((event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)
+ && (!details->single_click_mode && clicked_within_double_click_interval(container) && details->icon_revealed)) {
/* Double clicking does not trigger a D&D action. */
details->drag_button = 0;
details->drag_icon = NULL;
@@ -5589,6 +5615,7 @@ handle_icon_button_press (NautilusIconContainer *container,
activate_selected_items_alternate (container, icon);
}
}
+ details->icon_revealed = FALSE;
return TRUE;
}
if (event->button == DRAG_BUTTON
@@ -5637,6 +5664,7 @@ handle_icon_button_press (NautilusIconContainer *container,
signals[SELECTION_CHANGED], 0);
} else {
select_one_unselect_others (container, icon);
+ details->icon_revealed = TRUE;
g_signal_emit (container,
signals[SELECTION_CHANGED], 0);
}
diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h
index 3c69aad31..e843381a8 100644
--- a/libnautilus-private/nautilus-icon-private.h
+++ b/libnautilus-private/nautilus-icon-private.h
@@ -281,6 +281,9 @@ struct NautilusIconContainerDetails {
GtkWidget *search_entry;
guint search_entry_changed_id;
guint typeselect_flush_timeout;
+
+ /* Needed for dblclicking activation of partially shown icons, see bug #347423 */
+ gboolean icon_revealed;
};
/* Private functions shared by mutiple files. */