diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c index e2081b00..33c1e78a 100644 --- a/terminal/terminal-preferences-dialog.c +++ b/terminal/terminal-preferences-dialog.c @@ -174,31 +174,31 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog) "misc-menubar-default", "misc-toolbar-default", "misc-borders-default", "misc-tab-close-middle-click", "misc-middle-click-opens-uri", "misc-mouse-autohide", "misc-rewrap-on-resize", "misc-copy-on-select", "misc-slim-tabs", "misc-new-tab-adjacent", "misc-bell", "misc-bell-urgent", "shortcuts-no-helpkey", "shortcuts-no-mnemonics", "shortcuts-no-menukey", "binding-backspace", "binding-delete", "binding-ambiguous-width", "background-mode", "background-image-style", "color-background-vary", "color-bold-is-bright", "dropdown-keep-open-default", "dropdown-keep-above", "dropdown-toggle-focus", "dropdown-status-icon", "dropdown-move-to-active", "dropdown-always-show-tabs", - "dropdown-show-borders" + "dropdown-show-borders", "misc-tab-key-cycle" }; const gchar *props_color[] = { "color-foreground", "color-background", "tab-activity-color", "color-cursor-foreground", "color-cursor", "color-selection", "color-selection-background", "color-bold" }; const gchar *props_value[] = { "dropdown-height", "dropdown-width", "dropdown-position", "dropdown-position-vertical", "dropdown-opacity", "dropdown-animation-time" }; dialog->preferences = terminal_preferences_get (); /* lookup the ui file */ xfce_resource_push_path (XFCE_RESOURCE_DATA, DATADIR); diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c index 9c25447f..6f668d18 100644 --- a/terminal/terminal-preferences.c +++ b/terminal/terminal-preferences.c @@ -76,30 +76,31 @@ enum PROP_DROPDOWN_WIDTH, PROP_DROPDOWN_HEIGHT, PROP_DROPDOWN_OPACITY, PROP_DROPDOWN_POSITION, PROP_DROPDOWN_POSITION_VERTICAL, PROP_DROPDOWN_MOVE_TO_ACTIVE, PROP_DROPDOWN_ALWAYS_SHOW_TABS, PROP_DROPDOWN_SHOW_BORDERS, PROP_ENCODING, PROP_FONT_ALLOW_BOLD, PROP_FONT_NAME, PROP_FONT_USE_SYSTEM, PROP_MISC_ALWAYS_SHOW_TABS, PROP_MISC_BELL, PROP_MISC_BELL_URGENT, + PROP_MISC_TAB_KEY_CYCLE, PROP_MISC_BORDERS_DEFAULT, PROP_MISC_CURSOR_BLINKS, PROP_MISC_CURSOR_SHAPE, PROP_MISC_DEFAULT_GEOMETRY, PROP_MISC_INHERIT_GEOMETRY, PROP_MISC_MENUBAR_DEFAULT, PROP_MISC_MOUSE_AUTOHIDE, PROP_MISC_MOUSE_WHEEL_ZOOM, PROP_MISC_TOOLBAR_DEFAULT, PROP_MISC_CONFIRM_CLOSE, PROP_MISC_CYCLE_TABS, PROP_MISC_TAB_CLOSE_BUTTONS, PROP_MISC_TAB_CLOSE_MIDDLE_CLICK, PROP_MISC_TAB_POSITION, PROP_MISC_HIGHLIGHT_URLS, @@ -813,30 +814,40 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass) NULL, "MiscBell", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** * TerminalPreferences:misc-bell-urgent: **/ preferences_props[PROP_MISC_BELL_URGENT] = g_param_spec_boolean ("misc-bell-urgent", NULL, "MiscBellUrgent", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + /** + * TerminalPreferences:misc-tab-key-cycle: + **/ + preferences_props[PROP_MISC_TAB_KEY_CYCLE] = + g_param_spec_boolean ("misc-tab-key-cycle", + NULL, + "MiscTabKeyCycle", + FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + /** * TerminalPreferences:misc-borders-default: **/ preferences_props[PROP_MISC_BORDERS_DEFAULT] = g_param_spec_boolean ("misc-borders-default", NULL, "MiscBordersDefault", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** * TerminalPreferences:misc-cursor-blinks: **/ preferences_props[PROP_MISC_CURSOR_BLINKS] = g_param_spec_boolean ("misc-cursor-blinks", diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade index 9ba3ea3c..bcd0fc6f 100644 --- a/terminal/terminal-preferences.glade +++ b/terminal/terminal-preferences.glade @@ -3680,30 +3680,46 @@ when double clicking: _Visual bell True True False Allows the terminal to use WM's capability of urgent hint to indicate some events. start True True True True 7 + + + Use Ctrl(+Shift)+Tab to cycle through _tabs + True + True + False + start + True + True + + + True + True + 8 + + True False Misc diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c index 11553af7..0294c39b 100644 --- a/terminal/terminal-widget.c +++ b/terminal/terminal-widget.c @@ -25,30 +25,31 @@ #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LIBUTEMPTER #include #endif #include #include #include #include #include +#include #include #include #include #define MAILTO "mailto:" enum { GET_CONTEXT_MENU, LAST_SIGNAL, }; @@ -601,61 +602,72 @@ terminal_widget_drag_data_received (GtkWidget *widget, } if (info != TARGET_GTK_NOTEBOOK_TAB) gtk_drag_finish (context, TRUE, FALSE, time); } static gboolean terminal_widget_key_press_event (GtkWidget *widget, GdkEventKey *event) { GtkAdjustment *adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)); gboolean shortcuts_no_menukey; gboolean shift_arrows_scroll; + gboolean tab_key_cycle; gdouble value; /* determine current settings */ g_object_get (G_OBJECT (TERMINAL_WIDGET (widget)->preferences), "shortcuts-no-menukey", &shortcuts_no_menukey, "misc-use-shift-arrows-to-scroll", &shift_arrows_scroll, + "misc-tab-key-cycle", &tab_key_cycle, NULL); /* popup context menu if "Menu" or "F10" is pressed */ if (event->keyval == GDK_KEY_Menu || (!shortcuts_no_menukey && (event->state & GDK_SHIFT_MASK) != 0 && event->keyval == GDK_KEY_F10)) { terminal_widget_context_menu (TERMINAL_WIDGET (widget), 0, event->time, (GdkEvent *) event); return TRUE; } else if (G_UNLIKELY (shift_arrows_scroll)) { /* scroll up one line with "Up" */ if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)) { gtk_adjustment_set_value (adjustment, gtk_adjustment_get_value (adjustment) - 1); return TRUE; } /* scroll down one line with "Down" */ else if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down)) { value = MIN (gtk_adjustment_get_value (adjustment) + 1, gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_page_size (adjustment)); gtk_adjustment_set_value (adjustment, value); return TRUE; } } + else if (G_UNLIKELY ((event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) && tab_key_cycle)) + { + /* cycle tabs with "Tab" and "Tab" */ + if ((event->state & GDK_SHIFT_MASK) != 0) + terminal_window_action_prev_tab(NULL, TERMINAL_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)))); + else + terminal_window_action_next_tab(NULL, TERMINAL_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)))); + return TRUE; + } return (*GTK_WIDGET_CLASS (terminal_widget_parent_class)->key_press_event) (widget, event); } static void terminal_widget_open_uri (TerminalWidget *widget, const gchar *wlink, gint tag) { GtkWindow *window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget))); GError *error = NULL; gchar *uri; guint i; diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c index f7b83e0c..2e8396ed 100644 --- a/terminal/terminal-window.c +++ b/terminal/terminal-window.c @@ -205,34 +205,30 @@ static void terminal_window_action_show_toolbar (GtkToggleActi TerminalWindow *window); static void terminal_window_action_show_borders (GtkToggleAction *action, TerminalWindow *window); static void terminal_window_action_fullscreen (GtkToggleAction *action, TerminalWindow *window); static void terminal_window_action_readonly (GtkToggleAction *action, TerminalWindow *window); static void terminal_window_action_scroll_on_output (GtkToggleAction *action, TerminalWindow *window); static void terminal_window_action_zoom_in (GtkAction *action, TerminalWindow *window); static void terminal_window_action_zoom_out (GtkAction *action, TerminalWindow *window); static void terminal_window_action_zoom_reset (GtkAction *action, TerminalWindow *window); -static void terminal_window_action_prev_tab (GtkAction *action, - TerminalWindow *window); -static void terminal_window_action_next_tab (GtkAction *action, - TerminalWindow *window); static void terminal_window_action_move_tab_left (GtkAction *action, TerminalWindow *window); static void terminal_window_action_move_tab_right (GtkAction *action, TerminalWindow *window); static void terminal_window_action_goto_tab (GtkRadioAction *action, GtkNotebook *notebook); static void terminal_window_action_set_title (GtkAction *action, TerminalWindow *window); static void terminal_window_action_set_title_color (GtkAction *action, TerminalWindow *window); static void terminal_window_action_search (GtkAction *action, TerminalWindow *window); static void terminal_window_action_search_next (GtkAction *action, TerminalWindow *window); static void terminal_window_action_search_prev (GtkAction *action, @@ -2035,41 +2031,41 @@ terminal_window_action_zoom_out (GtkAction *action, static void terminal_window_action_zoom_reset (GtkAction *action, TerminalWindow *window) { terminal_return_if_fail (window->priv->active != NULL); if (window->priv->zoom != TERMINAL_ZOOM_LEVEL_DEFAULT) { window->priv->zoom = TERMINAL_ZOOM_LEVEL_DEFAULT; terminal_window_zoom_update_screens (window); } } -static void +void terminal_window_action_prev_tab (GtkAction *action, TerminalWindow *window) { terminal_window_switch_tab (GTK_NOTEBOOK (window->priv->notebook), TRUE); terminal_window_update_actions (window); } -static void +void terminal_window_action_next_tab (GtkAction *action, TerminalWindow *window) { terminal_window_switch_tab (GTK_NOTEBOOK (window->priv->notebook), FALSE); terminal_window_update_actions (window); } static void terminal_window_action_move_tab_left (GtkAction *action, TerminalWindow *window) { terminal_window_move_tab (GTK_NOTEBOOK (window->priv->notebook), TRUE); terminal_window_update_actions (window); diff --git a/terminal/terminal-window.h b/terminal/terminal-window.h index 9bd8389a..9cd01796 100644 --- a/terminal/terminal-window.h +++ b/terminal/terminal-window.h @@ -94,18 +94,23 @@ void terminal_window_set_zoom_level (TerminalWindow TerminalZoomLevel zoom); gboolean terminal_window_is_drop_down (TerminalWindow *window); void terminal_window_set_drop_down (TerminalWindow *window, gboolean drop_down); gint terminal_window_get_menubar_height (TerminalWindow *window); gint terminal_window_get_toolbar_height (TerminalWindow *window); void terminal_window_rebuild_tabs_menu (TerminalWindow *window); void terminal_window_action_show_menubar (GtkToggleAction *action, TerminalWindow *window); +void terminal_window_action_prev_tab (GtkAction *action, + TerminalWindow *window); +void terminal_window_action_next_tab (GtkAction *action, + TerminalWindow *window); + G_END_DECLS #endif /* !TERMINAL_WINDOW_H */