Commit 1e27bdf4 authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair

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
parent 2d38452c
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.
2008-06-28 A. Walton <awalton@gnome.org>
* 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);
}
......
......@@ -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. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment