nautilus r14350 - in trunk: . libnautilus-private
- From: cneumair svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14350 - in trunk: . libnautilus-private
- Date: Sat, 12 Jul 2008 15:42:10 +0000 (UTC)
Author: cneumair
Date: Sat Jul 12 15:42:10 2008
New Revision: 14350
URL: http://svn.gnome.org/viewvc/nautilus?rev=14350&view=rev
Log:
2008-07-12 Christian Neumair <cneumair gnome org>
* libnautilus-private/nautilus-icon-container.c
(button_press_event):
* libnautilus-private/nautilus-icon-private.h:
Completely rewrite button press detection. Finally fixes #542269
without any side effects.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-icon-container.c
trunk/libnautilus-private/nautilus-icon-private.h
Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c (original)
+++ trunk/libnautilus-private/nautilus-icon-container.c Sat Jul 12 15:42:10 2008
@@ -3667,7 +3667,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);
@@ -3682,13 +3687,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 */
@@ -5555,6 +5553,38 @@
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);
+ return TRUE;
+ else if (event->button == DRAG_BUTTON) {
+ activate_selected_items (container);
+ return TRUE;
+ }
+ } else if (event->button == DRAG_BUTTON &&
+ (event->state & GDK_CONTROL_MASK) == 0 &&
+ (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
@@ -5575,13 +5605,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;
}
@@ -5596,32 +5620,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;
@@ -5665,12 +5678,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) {
@@ -5700,7 +5710,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: trunk/libnautilus-private/nautilus-icon-private.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-private.h (original)
+++ trunk/libnautilus-private/nautilus-icon-private.h Sat Jul 12 15:42:10 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;
@@ -281,9 +282,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]