Skip to content
Snippets Groups Projects
Commit bd02e9a9 authored by Alexander Schwinn's avatar Alexander Schwinn
Browse files

Update selected notebook on tab press (#1067)

parent 4f35cfeb
No related branches found
No related tags found
No related merge requests found
Pipeline #21748 passed
......@@ -245,6 +245,9 @@ static gboolean thunar_window_action_show_highlight (ThunarWindow
static gboolean thunar_window_propagate_key_event (GtkWindow *window,
GdkEvent *key_event,
gpointer user_data);
static gboolean thunar_window_after_propagate_key_event (GtkWindow *window,
GdkEvent *key_event,
gpointer user_data);
static gboolean thunar_window_action_open_file_menu (ThunarWindow *window);
static void thunar_window_current_directory_changed (ThunarFile *current_directory,
ThunarWindow *window);
......@@ -828,6 +831,7 @@ thunar_window_init (ThunarWindow *window)
/* Catch key events before accelerators get processed */
g_signal_connect (window, "key-press-event", G_CALLBACK (thunar_window_propagate_key_event), NULL);
g_signal_connect (window, "key-release-event", G_CALLBACK (thunar_window_propagate_key_event), NULL);
g_signal_connect_after (window, "key-release-event", G_CALLBACK (thunar_window_after_propagate_key_event), NULL);
window->action_mgr = g_object_new (THUNAR_TYPE_ACTION_MANAGER, "widget", GTK_WIDGET (window), NULL);
......@@ -4652,6 +4656,38 @@ thunar_window_propagate_key_event (GtkWindow* window,
static gboolean
thunar_window_after_propagate_key_event (GtkWindow* window,
GdkEvent *key_event,
gpointer user_data)
{
GtkWidget *focused_widget;
ThunarWindow *thunar_window = THUNAR_WINDOW (window);
_thunar_return_val_if_fail (THUNAR_IS_WINDOW (window), GDK_EVENT_PROPAGATE);
focused_widget = gtk_window_get_focus (window);
/* After 'tab' was preassed, we might need to update the selected notebook */
if (thunar_window_split_view_is_active (thunar_window))
{
if (thunar_window->notebook_left != NULL && gtk_widget_is_ancestor (focused_widget, thunar_window->notebook_left))
{
thunar_window->notebook_selected = thunar_window->notebook_left;
thunar_window_notebook_select_current_page (thunar_window);
}
if(thunar_window->notebook_right != NULL && gtk_widget_is_ancestor (focused_widget, thunar_window->notebook_right))
{
thunar_window->notebook_selected = thunar_window->notebook_right;
thunar_window_notebook_select_current_page (thunar_window);
}
}
return GDK_EVENT_PROPAGATE;
}
static void
thunar_window_action_open_bookmark (GFile *g_file)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment