Skip to content

Commit cbeb6af

Browse files
committed
navigation: Allow click event handling into an inactive pane if
that pane has no selected files. - If there is no selection in the inactive pane, continue processing the event like normal. This will also 'activate' the pane for us. - Some cleanup to use proper event-handling return values in the surrounding code. Navigating between active and inactive panes (like in the split-view mode) can be frustrating because clicking into an inactive pane will only 'activate' it, and not select anything. This is to preserve any existing file selection in that pane's view.
1 parent a3f0a31 commit cbeb6af

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/nemo-icon-view.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,26 +2323,25 @@ button_press_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_da
23232323
{
23242324
NemoView *view = NEMO_VIEW (user_data);
23252325
GdkEventButton *event_button = (GdkEventButton *)event;
2326-
int selection_count;
2326+
gint selection_count = nemo_view_get_selection_count (NEMO_VIEW (view));
23272327

2328-
if (!nemo_view_get_active (view)) {
2328+
if (!nemo_view_get_active (view) && selection_count > 0) {
23292329
NemoWindowSlot *slot = nemo_view_get_nemo_window_slot (view);
23302330
nemo_window_slot_make_hosting_pane_active (slot);
2331-
return TRUE;
2331+
return GDK_EVENT_STOP;
23322332
}
23332333

23342334
/* double left click on blank will go to parent folder */
23352335
if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_CLICK_DOUBLE_PARENT_FOLDER) &&
23362336
(event_button->button == 1) && (event_button->type == GDK_2BUTTON_PRESS)) {
2337-
selection_count = nemo_view_get_selection_count (NEMO_VIEW (view));
23382337
if (selection_count == 0) {
23392338
NemoWindowSlot *slot = nemo_view_get_nemo_window_slot (view);
23402339
nemo_window_slot_go_up (slot, 0);
2341-
return TRUE;
2340+
return GDK_EVENT_STOP;
23422341
}
23432342
}
23442343

2345-
return FALSE;
2344+
return GDK_EVENT_PROPAGATE;
23462345
}
23472346

23482347
static NemoIconContainer *

src/nemo-list-view.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
10961096

10971097
/* Don't handle extra mouse buttons here */
10981098
if (event->button > 5) {
1099-
return FALSE;
1099+
return GDK_EVENT_PROPAGATE;
11001100
}
11011101

11021102
if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
@@ -1110,17 +1110,17 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
11101110
}
11111111
}
11121112

1113-
return TRUE;
1113+
return GDK_EVENT_STOP;
11141114
}
11151115

11161116
if (event->window != gtk_tree_view_get_bin_window (tree_view)) {
1117-
return FALSE;
1117+
return GDK_EVENT_PROPAGATE;
11181118
}
11191119

1120-
if (!nemo_view_get_active (NEMO_VIEW (view))) {
1120+
if (!nemo_view_get_active (NEMO_VIEW (view)) && gtk_tree_selection_count_selected_rows (selection) > 0) {
11211121
NemoWindowSlot *slot = nemo_view_get_nemo_window_slot (NEMO_VIEW (view));
11221122
nemo_window_slot_make_hosting_pane_active (slot);
1123-
return TRUE;
1123+
return GDK_EVENT_STOP;
11241124
}
11251125

11261126
nemo_list_model_set_drag_view
@@ -1280,7 +1280,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
12801280

12811281
/* We chained to the default handler in this method, so never
12821282
* let the default handler run */
1283-
return TRUE;
1283+
return GDK_EVENT_STOP;
12841284
}
12851285

12861286
static gboolean

0 commit comments

Comments
 (0)