Skip to content

Commit 35205a5

Browse files
info-cppspraveit65
authored andcommitted
run-dialog: use F6 to switch between entry field and program list
fix #676
1 parent ef29ff1 commit 35205a5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎mate-panel/panel-run-dialog.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,35 @@ panel_run_dialog_setup_pixmap (PanelRunDialog *dialog,
18921892
dialog);
18931893
}
18941894

1895+
/* this runs after entry_event() */
1896+
static gboolean
1897+
key_press_event (GtkWidget *run_dialog,
1898+
GdkEventKey *event,
1899+
PanelRunDialog *dialog)
1900+
{
1901+
1902+
/* allow only key presses */
1903+
if (event->type != GDK_KEY_PRESS)
1904+
return FALSE;
1905+
1906+
/* If the program list is enabled and open and the user presses the F6 key
1907+
* the focus should jump between GtkComboBoxText and the program list */
1908+
if (panel_profile_get_enable_program_list () && panel_profile_get_show_program_list () && event->keyval == GDK_KEY_F6) {
1909+
1910+
/* jump to the program list from anywhere */
1911+
if (!gtk_widget_has_focus (dialog->program_list)) {
1912+
gtk_widget_grab_focus (dialog->program_list);
1913+
/* on the program list, jump to the entry box */
1914+
} else {
1915+
gtk_widget_grab_focus (dialog->combobox);
1916+
}
1917+
1918+
return TRUE;
1919+
}
1920+
1921+
return FALSE;
1922+
}
1923+
18951924
static PanelRunDialog *
18961925
panel_run_dialog_new (GdkScreen *screen,
18971926
GtkBuilder *gui,
@@ -1920,6 +1949,10 @@ panel_run_dialog_new (GdkScreen *screen,
19201949
panel_run_dialog_setup_program_list (dialog, gui);
19211950
panel_run_dialog_setup_list_expander (dialog, gui);
19221951

1952+
/* key press event signal for the whole dialog */
1953+
g_signal_connect (dialog->run_dialog, "key-press-event",
1954+
G_CALLBACK (key_press_event), dialog);
1955+
19231956
panel_run_dialog_set_default_icon (dialog, FALSE);
19241957

19251958
panel_run_dialog_update_content (dialog, panel_profile_get_show_program_list ());

0 commit comments

Comments
 (0)