nautilus r14348 - in branches/gnome-2-22: . libnautilus-private



Author: cneumair
Date: Sat Jul 12 15:31:09 2008
New Revision: 14348
URL: http://svn.gnome.org/viewvc/nautilus?rev=14348&view=rev

Log:
2008-07-12  Christian Neumair  <cneumair gnome org>

	* libnautilus-private/nautilus-icon-container.c
	(button_press_event), (handle_icon_double_click),
	(handle_icon_button_press), (item_event_callback):
	* libnautilus-private/nautilus-icon-container.h:
	Completely rewrite button press detection. Finally fixes #542269
	without any side effects.

	NEWS:
	Update for release.


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/NEWS
   branches/gnome-2-22/configure.in
   branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c
   branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h

Modified: branches/gnome-2-22/NEWS
==============================================================================
--- branches/gnome-2-22/NEWS	(original)
+++ branches/gnome-2-22/NEWS	Sat Jul 12 15:31:09 2008
@@ -1,3 +1,6 @@
+Major changes in 2.22.5.1 are:
+* Fix double-click activation in icon view without any side effects.
+
 Major changes in 2.22.5 are:
 * Fix double-click activation in icon view.
 

Modified: branches/gnome-2-22/configure.in
==============================================================================
--- branches/gnome-2-22/configure.in	(original)
+++ branches/gnome-2-22/configure.in	Sat Jul 12 15:31:09 2008
@@ -27,7 +27,7 @@
 m4_define(nautilus_extension_current,  2)
 m4_define(nautilus_extension_revision, 0)
 
-AC_INIT([nautilus],[2.22.6],
+AC_INIT([nautilus],[2.22.5.1],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=nautilus])
 
 dnl ===========================================================================

Modified: branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c	Sat Jul 12 15:31:09 2008
@@ -3288,7 +3288,12 @@
 
 	/* Forget about where we began with the arrow keys now that we're mousing. */
 	container->details->arrow_key_axis = AXIS_NONE;
-	
+
+	if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
+		/* We use our own double-click detection. */
+		return TRUE;
+	}
+
 	/* Invoke the canvas event handler and see if an item picks up the event. */
 	clicked_on_icon = GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event);
 	
@@ -3303,13 +3308,6 @@
 		return TRUE;
 	}
 
-	/* An item didn't take the press, so it's a background press.
-         * We ignore double clicks on the desktop for now.
-	 */
-	if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
-		return TRUE;
-	}
-
 	if ((event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON) &&
 	    event->type == GDK_BUTTON_PRESS) {
 		/* Clear the last click icon for double click */
@@ -5176,6 +5174,36 @@
 	GdkEventButton	      *event;
 } ContextMenuParameters;
 
+static gboolean
+handle_icon_double_click (NautilusIconContainer *container,
+			  NautilusIcon *icon,
+			  GdkEventButton *event)
+{
+	NautilusIconContainerDetails *details;
+
+	details = container->details;
+
+	if (!details->single_click_mode &&
+	    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)) {
+			if (event->button == MIDDLE_BUTTON) {
+				activate_selected_items_alternate (container, NULL);
+			} else {
+				activate_selected_items (container);
+			}
+			return TRUE;
+		} else if (event->button == DRAG_BUTTON &&
+			   (event->state & GDK_SHIFT_MASK) != 0) {
+			activate_selected_items_alternate (container, icon);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
 /* NautilusIcon event handling.  */
 
 /* Conceptually, pressing button 1 together with CTRL or SHIFT toggles
@@ -5196,13 +5224,7 @@
 
 	details = container->details;
 
-	if (event->type == GDK_3BUTTON_PRESS) {
-		return TRUE;
-	}
-
-	if (details->single_click_mode &&
-	    event->type == GDK_2BUTTON_PRESS) {
-		/* Don't care about double clicks in single click mode */
+	if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
 		return TRUE;
 	}
 	
@@ -5217,32 +5239,21 @@
 		/* The next double click has to be on this icon */
 		details->double_click_icon[1] = details->double_click_icon[0];
 		details->double_click_icon[0] = icon;
+
+		details->double_click_button[1] = details->double_click_button[0];
+		details->double_click_button[0] = event->button;
 	}
 
-	if ((event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)
-	    && (!details->single_click_mode && clicked_within_double_click_interval(container) && details->icon_revealed)) {
+	if (handle_icon_double_click (container, icon, event)) {
 		/* Double clicking does not trigger a D&D action. */
 		details->drag_button = 0;
 		details->drag_icon = NULL;
-		
-		if (icon == details->double_click_icon[1]) {
-			if (!button_event_modifies_selection (event)) {
-				if (event->button == MIDDLE_BUTTON) {
-					activate_selected_items_alternate (container, NULL);
-				} else {
-					activate_selected_items (container);
-				}
-			} else if (event->button == DRAG_BUTTON &&
-				   (event->state & GDK_SHIFT_MASK) != 0) {
-				activate_selected_items_alternate (container, icon);
-			}
-		}
-		details->icon_revealed = FALSE;
 		return TRUE;
 	}
+
 	if (event->button == DRAG_BUTTON
 	    || event->button == DRAG_MENU_BUTTON) {
-		details->drag_button = event->button;
+			details->drag_button = event->button;
 		details->drag_icon = icon;
 		details->drag_x = event->x;
 		details->drag_y = event->y;
@@ -5286,12 +5297,9 @@
 				       signals[SELECTION_CHANGED], 0);
 		} else {
 			select_one_unselect_others (container, icon);
-			details->icon_revealed = TRUE;
 			g_signal_emit (container,
 				       signals[SELECTION_CHANGED], 0);
 		}
-	} else {
-		details->icon_revealed = TRUE;
 	}
 
 	if (event->button == CONTEXTUAL_MENU_BUTTON) {
@@ -5321,7 +5329,6 @@
 
 	switch (event->type) {
 	case GDK_BUTTON_PRESS:
-	case GDK_2BUTTON_PRESS:
 		if (handle_icon_button_press (container, icon, &event->button)) {
 			/* Stop the event from being passed along further. Returning
 			 * TRUE ain't enough. 

Modified: branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h	Sat Jul 12 15:31:09 2008
@@ -170,6 +170,7 @@
 
 	gboolean icon_selected_on_button_down;
 	NautilusIcon *double_click_icon[2]; /* Both clicks in a double click need to be on the same icon */
+	guint double_click_button[2];
 
 	NautilusIcon *range_selection_base_icon;
 	
@@ -274,9 +275,6 @@
 	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. */



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