diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-01-24 17:00:08 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-01-24 17:00:08 +0000 |
commit | d12bae4bf6b439559e0a0742f1716f10589ab59a (patch) | |
tree | d5bc7c1edc7768ea4b5d000753cbd7dd3ae39b20 | |
parent | f538796e6d3121f91d5ad7b775dd3daaa13909e3 (diff) | |
download | nautilus-d12bae4bf6b439559e0a0742f1716f10589ab59a.tar.gz |
Made Shift as well as Control modify the selection, and prevented
activation on single-click when modifying the selection.
-rw-r--r-- | ChangeLog-20000414 | 15 | ||||
-rw-r--r-- | libnautilus-extensions/gnome-icon-container.c | 31 | ||||
-rw-r--r-- | libnautilus-private/gnome-icon-container.c | 31 | ||||
-rw-r--r-- | libnautilus/gnome-icon-container.c | 31 |
4 files changed, 84 insertions, 24 deletions
diff --git a/ChangeLog-20000414 b/ChangeLog-20000414 index 516fd9830..a77dd89a4 100644 --- a/ChangeLog-20000414 +++ b/ChangeLog-20000414 @@ -1,3 +1,18 @@ +2000-01-24 John Sullivan <sullivan@eazel.com> + + * libnautilus/gnome-icon-container.c: + (button_event_modifies_selection): New function, encapsulates idea + of which button events modify the selection. Formerly this was + done in several places and the answer was "those with the Control + key down". Now the answer is "those with the Control or Shift key down" + to match list view (and traditional, i.e. Mac) behavior more closely. + (button_press_event), (button_release_event), (handle_icon_button_press): + Deployed button_event_modifies_selection. + (button_release_event): Check whether modifying selection and don't + activate on single-click if so. + (kbd_move_to): Just added comment. + + 2000-01-22 Havoc Pennington <hp@pobox.com> * configure.in: check for libwww diff --git a/libnautilus-extensions/gnome-icon-container.c b/libnautilus-extensions/gnome-icon-container.c index 4b5dfd0d9..8119ccff6 100644 --- a/libnautilus-extensions/gnome-icon-container.c +++ b/libnautilus-extensions/gnome-icon-container.c @@ -1065,6 +1065,13 @@ add_idle (GnomeIconContainer *container) /* Container-level icon handling functions. */ +static gboolean +button_event_modifies_selection (GdkEventButton *event) +{ + return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK); +} + + /* Select an icon. Return TRUE if selection has changed. */ static gboolean select_icon (GnomeIconContainer *container, @@ -1487,6 +1494,9 @@ kbd_move_to (GnomeIconContainer *container, GnomeIconContainerIcon *icon, GdkEventKey *event) { + /* Control key causes keyboard selection and "selected icon" to move separately. + * This seems like a confusing and bad idea. + */ if (! (event->state & GDK_CONTROL_MASK)) { gboolean selection_changed; @@ -1891,7 +1901,7 @@ button_press_event (GtkWidget *widget, return TRUE; if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (! (event->state & GDK_CONTROL_MASK)) { + if (! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed = unselect_all (container); @@ -1933,8 +1943,9 @@ button_release_event (GtkWidget *widget, if (event->button == details->drag_button) { details->drag_button = 0; + if (! details->doing_drag - && ! (event->state & GDK_CONTROL_MASK)) { + && ! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed @@ -1950,9 +1961,12 @@ button_release_event (GtkWidget *widget, gint elapsed_time = event->time - details->button_down_time; set_kbd_current (container, details->drag_icon, TRUE); - /* if single-click mode, activate the icon */ - if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME)) { - + /* If single-click mode, activate the icon, unless modifying + * the selection or pressing for a very long time. */ + if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME) + && ! button_event_modifies_selection (event)) { + + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], details->drag_icon->text, details->drag_icon->data); @@ -2249,8 +2263,8 @@ browser_select_timeout_cb (gpointer data) return FALSE; } -/* Conceptually, pressing button 1 together with CTRL toggles selection of a - single icon without affecting the other icons; without CTRL, it selects a +/* Conceptually, pressing button 1 together with CTRL or SHIFT toggles selection of a + single icon without affecting the other icons; without CTRL or SHIFT, it selects a single icon and un-selects all the other icons. But in this latter case, the de-selection should only happen when the button is released if the icon is already selected, because the user might select multiple icons and @@ -2282,7 +2296,7 @@ handle_icon_button_press (GnomeIconContainer *container, if (event->button != 1) return FALSE; - if (event->state & GDK_CONTROL_MASK) { + if (button_event_modifies_selection (event)) { toggle_icon (container, icon); gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]); @@ -2301,6 +2315,7 @@ handle_icon_button_press (GnomeIconContainer *container, details->drag_button = 0; details->drag_icon = NULL; + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], icon->text, icon->data); diff --git a/libnautilus-private/gnome-icon-container.c b/libnautilus-private/gnome-icon-container.c index 4b5dfd0d9..8119ccff6 100644 --- a/libnautilus-private/gnome-icon-container.c +++ b/libnautilus-private/gnome-icon-container.c @@ -1065,6 +1065,13 @@ add_idle (GnomeIconContainer *container) /* Container-level icon handling functions. */ +static gboolean +button_event_modifies_selection (GdkEventButton *event) +{ + return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK); +} + + /* Select an icon. Return TRUE if selection has changed. */ static gboolean select_icon (GnomeIconContainer *container, @@ -1487,6 +1494,9 @@ kbd_move_to (GnomeIconContainer *container, GnomeIconContainerIcon *icon, GdkEventKey *event) { + /* Control key causes keyboard selection and "selected icon" to move separately. + * This seems like a confusing and bad idea. + */ if (! (event->state & GDK_CONTROL_MASK)) { gboolean selection_changed; @@ -1891,7 +1901,7 @@ button_press_event (GtkWidget *widget, return TRUE; if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (! (event->state & GDK_CONTROL_MASK)) { + if (! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed = unselect_all (container); @@ -1933,8 +1943,9 @@ button_release_event (GtkWidget *widget, if (event->button == details->drag_button) { details->drag_button = 0; + if (! details->doing_drag - && ! (event->state & GDK_CONTROL_MASK)) { + && ! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed @@ -1950,9 +1961,12 @@ button_release_event (GtkWidget *widget, gint elapsed_time = event->time - details->button_down_time; set_kbd_current (container, details->drag_icon, TRUE); - /* if single-click mode, activate the icon */ - if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME)) { - + /* If single-click mode, activate the icon, unless modifying + * the selection or pressing for a very long time. */ + if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME) + && ! button_event_modifies_selection (event)) { + + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], details->drag_icon->text, details->drag_icon->data); @@ -2249,8 +2263,8 @@ browser_select_timeout_cb (gpointer data) return FALSE; } -/* Conceptually, pressing button 1 together with CTRL toggles selection of a - single icon without affecting the other icons; without CTRL, it selects a +/* Conceptually, pressing button 1 together with CTRL or SHIFT toggles selection of a + single icon without affecting the other icons; without CTRL or SHIFT, it selects a single icon and un-selects all the other icons. But in this latter case, the de-selection should only happen when the button is released if the icon is already selected, because the user might select multiple icons and @@ -2282,7 +2296,7 @@ handle_icon_button_press (GnomeIconContainer *container, if (event->button != 1) return FALSE; - if (event->state & GDK_CONTROL_MASK) { + if (button_event_modifies_selection (event)) { toggle_icon (container, icon); gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]); @@ -2301,6 +2315,7 @@ handle_icon_button_press (GnomeIconContainer *container, details->drag_button = 0; details->drag_icon = NULL; + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], icon->text, icon->data); diff --git a/libnautilus/gnome-icon-container.c b/libnautilus/gnome-icon-container.c index 4b5dfd0d9..8119ccff6 100644 --- a/libnautilus/gnome-icon-container.c +++ b/libnautilus/gnome-icon-container.c @@ -1065,6 +1065,13 @@ add_idle (GnomeIconContainer *container) /* Container-level icon handling functions. */ +static gboolean +button_event_modifies_selection (GdkEventButton *event) +{ + return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK); +} + + /* Select an icon. Return TRUE if selection has changed. */ static gboolean select_icon (GnomeIconContainer *container, @@ -1487,6 +1494,9 @@ kbd_move_to (GnomeIconContainer *container, GnomeIconContainerIcon *icon, GdkEventKey *event) { + /* Control key causes keyboard selection and "selected icon" to move separately. + * This seems like a confusing and bad idea. + */ if (! (event->state & GDK_CONTROL_MASK)) { gboolean selection_changed; @@ -1891,7 +1901,7 @@ button_press_event (GtkWidget *widget, return TRUE; if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (! (event->state & GDK_CONTROL_MASK)) { + if (! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed = unselect_all (container); @@ -1933,8 +1943,9 @@ button_release_event (GtkWidget *widget, if (event->button == details->drag_button) { details->drag_button = 0; + if (! details->doing_drag - && ! (event->state & GDK_CONTROL_MASK)) { + && ! button_event_modifies_selection (event)) { gboolean selection_changed; selection_changed @@ -1950,9 +1961,12 @@ button_release_event (GtkWidget *widget, gint elapsed_time = event->time - details->button_down_time; set_kbd_current (container, details->drag_icon, TRUE); - /* if single-click mode, activate the icon */ - if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME)) { - + /* If single-click mode, activate the icon, unless modifying + * the selection or pressing for a very long time. */ + if (details->single_click_mode && (elapsed_time < MAX_CLICK_TIME) + && ! button_event_modifies_selection (event)) { + + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], details->drag_icon->text, details->drag_icon->data); @@ -2249,8 +2263,8 @@ browser_select_timeout_cb (gpointer data) return FALSE; } -/* Conceptually, pressing button 1 together with CTRL toggles selection of a - single icon without affecting the other icons; without CTRL, it selects a +/* Conceptually, pressing button 1 together with CTRL or SHIFT toggles selection of a + single icon without affecting the other icons; without CTRL or SHIFT, it selects a single icon and un-selects all the other icons. But in this latter case, the de-selection should only happen when the button is released if the icon is already selected, because the user might select multiple icons and @@ -2282,7 +2296,7 @@ handle_icon_button_press (GnomeIconContainer *container, if (event->button != 1) return FALSE; - if (event->state & GDK_CONTROL_MASK) { + if (button_event_modifies_selection (event)) { toggle_icon (container, icon); gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]); @@ -2301,6 +2315,7 @@ handle_icon_button_press (GnomeIconContainer *container, details->drag_button = 0; details->drag_icon = NULL; + /* FIXME: This should activate all selected icons, not just one */ gtk_signal_emit (GTK_OBJECT (container), signals[ACTIVATE], icon->text, icon->data); |