diff options
author | Wolfgang Ulbrich <[email protected]> | 2015-11-15 23:47:05 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2015-11-15 23:47:05 +0100 |
commit | f3e72e52a44305092a07f49ba9dcd3399977ebfa (patch) | |
tree | 62e8afc87480f2eb617ddefed6cafd58532cec91 /src | |
parent | d9a196be38781261573361e5e71ee6e133e06e23 (diff) | |
download | mate-terminal-f3e72e52a44305092a07f49ba9dcd3399977ebfa.tar.bz2 mate-terminal-f3e72e52a44305092a07f49ba9dcd3399977ebfa.tar.xz |
port to vte291
Thank you to
Author: [email protected]
Diffstat (limited to 'src')
-rw-r--r-- | src/terminal-profile.c | 7 | ||||
-rw-r--r-- | src/terminal-screen-container.c | 8 | ||||
-rw-r--r-- | src/terminal-screen.c | 69 | ||||
-rw-r--r-- | src/terminal-window.c | 14 |
4 files changed, 96 insertions, 2 deletions
diff --git a/src/terminal-profile.c b/src/terminal-profile.c index d917a23..fec496e 100644 --- a/src/terminal-profile.c +++ b/src/terminal-profile.c @@ -1271,10 +1271,17 @@ terminal_profile_class_init (TerminalProfileClass *klass) TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS); TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE); +#if VTE_CHECK_VERSION (0, 38, 0) + TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING); + TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE); + TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE); + TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING); +#else TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_TERMINAL_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING); TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE); TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_TERMINAL_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE); TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_TERMINAL_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING); +#endif TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION); TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION); TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE); diff --git a/src/terminal-screen-container.c b/src/terminal-screen-container.c index 1681c6d..8c82c63 100644 --- a/src/terminal-screen-container.c +++ b/src/terminal-screen-container.c @@ -143,7 +143,11 @@ terminal_screen_container_constructor (GType type, g_assert (priv->screen != NULL); #ifdef USE_SCROLLED_WINDOW +#if VTE_CHECK_VERSION (0, 38, 0) + priv->scrolled_window = gtk_scrolled_window_new (NULL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->screen))); +#else priv->scrolled_window = gtk_scrolled_window_new (NULL, vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen))); +#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), priv->hscrollbar_policy, @@ -163,7 +167,11 @@ terminal_screen_container_constructor (GType type, priv->hbox = gtk_hbox_new (FALSE, 0); +#if VTE_CHECK_VERSION (0, 38, 0) + priv->vscrollbar = gtk_vscrollbar_new (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->screen))); +#else priv->vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen))); +#endif gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->screen), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->vscrollbar, FALSE, FALSE, 0); diff --git a/src/terminal-screen.c b/src/terminal-screen.c index b3318bc..d5c8c14 100644 --- a/src/terminal-screen.c +++ b/src/terminal-screen.c @@ -119,7 +119,11 @@ static gboolean terminal_screen_popup_menu (GtkWidget *widget); static gboolean terminal_screen_button_press (GtkWidget *widget, GdkEventButton *event); static void terminal_screen_launch_child_on_idle (TerminalScreen *screen); -static void terminal_screen_child_exited (VteTerminal *terminal); +#if VTE_CHECK_VERSION (0, 38, 0) +static void terminal_screen_child_exited (VteTerminal *terminal, int status); +#else +static void terminal_screen_child_exited (VteTerminal *terminal); +#endif static void terminal_screen_window_title_changed (VteTerminal *vte_terminal, TerminalScreen *screen); @@ -305,11 +309,13 @@ terminal_screen_realize (GtkWidget *widget) GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize (widget); +#if !VTE_CHECK_VERSION (0, 38, 0) /* FIXME: Don't enable this if we have a compmgr. */ bg_type = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_BACKGROUND_TYPE); vte_terminal_set_background_transparent (VTE_TERMINAL (screen), bg_type == TERMINAL_BACKGROUND_TRANSPARENT && !window_uses_argb_visual (screen)); +#endif } static void @@ -970,8 +976,15 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile, vte_terminal_set_audible_bell (vte_terminal, !terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SILENT_BELL)); if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS)) +#if VTE_CHECK_VERSION (0, 40, 0) + vte_terminal_set_word_char_exceptions (vte_terminal, + terminal_profile_get_property_string (profile, TERMINAL_PROFILE_WORD_CHARS)); +#elif !VTE_CHECK_VERSION (0, 38, 0) vte_terminal_set_word_chars (vte_terminal, terminal_profile_get_property_string (profile, TERMINAL_PROFILE_WORD_CHARS)); +#else + {} +#endif if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE)) vte_terminal_set_scroll_on_keystroke (vte_terminal, terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE)); @@ -1013,6 +1026,8 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile, } #endif /* ENABLE_SKEY */ +/* Background image support was removed in vte 0.38 */ +#if !VTE_CHECK_VERSION (0, 38, 0) if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE) || prop_name == I_(TERMINAL_PROFILE_BACKGROUND_IMAGE) || @@ -1053,6 +1068,7 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile, bg_type == TERMINAL_BACKGROUND_TRANSPARENT && !window_uses_argb_visual (screen)); } +#endif if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING)) vte_terminal_set_backspace_binding (vte_terminal, @@ -1077,6 +1093,22 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile, g_object_thaw_notify (object); } +/* TODO: Once Gtk2 support is dropped, mate-terminal should be converted to use GdkRGBA everywhere instead of GdkColor. */ +#if VTE_CHECK_VERSION (0, 38, 0) +static GdkRGBA * +gdk_color_to_rgba (const GdkColor *color, + GdkRGBA *rgba) +{ + if (color == NULL) + return NULL; + rgba->red = color->red / 65535.0; + rgba->green = color->green / 65535.0; + rgba->blue = color->blue / 65535.0; + rgba->alpha = 1.0; + return rgba; +} +#endif + static void update_color_scheme (TerminalScreen *screen) { @@ -1112,11 +1144,30 @@ update_color_scheme (TerminalScreen *screen) n_colors = G_N_ELEMENTS (colors); terminal_profile_get_palette (priv->profile, colors, &n_colors); +#if VTE_CHECK_VERSION (0, 38, 0) + { + GdkRGBA colors_rgba[TERMINAL_PALETTE_SIZE]; + GdkRGBA fg_rgba, bg_rgba, bold_rgba; + int i; + + for (i = 0; i < n_colors; i++) + gdk_color_to_rgba (&colors[i], &colors_rgba[i]); + + vte_terminal_set_colors (VTE_TERMINAL (screen), + gdk_color_to_rgba (&fg, &fg_rgba), + gdk_color_to_rgba (&bg, &bg_rgba), + colors_rgba, n_colors); + if (bold_color) + vte_terminal_set_color_bold (VTE_TERMINAL (screen), + gdk_color_to_rgba (bold_color, &bold_rgba)); + } +#else vte_terminal_set_colors (VTE_TERMINAL (screen), &fg, &bg, colors, n_colors); if (bold_color) vte_terminal_set_color_bold (VTE_TERMINAL (screen), bold_color); vte_terminal_set_background_tint_color (VTE_TERMINAL (screen), &bg); +#endif } void @@ -1502,7 +1553,12 @@ terminal_screen_launch_child_cb (TerminalScreen *screen) pty_flags |= VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP; if (!get_child_command (screen, shell, &spawn_flags, &argv, &err) || - !vte_terminal_fork_command_full (terminal, +#if VTE_CHECK_VERSION (0, 38, 0) + !vte_terminal_spawn_sync ( +#else + !vte_terminal_fork_command_full ( +#endif + terminal, pty_flags, working_dir, argv, @@ -1510,6 +1566,9 @@ terminal_screen_launch_child_cb (TerminalScreen *screen) spawn_flags, NULL, NULL, &pid, +#if VTE_CHECK_VERSION (0, 38, 0) + NULL, +#endif &err)) { GtkWidget *info_bar; @@ -1872,7 +1931,11 @@ terminal_screen_icon_title_changed (VteTerminal *vte_terminal, } static void +#if VTE_CHECK_VERSION (0, 38, 0) +terminal_screen_child_exited (VteTerminal *terminal, int status) +#else terminal_screen_child_exited (VteTerminal *terminal) +#endif { TerminalScreen *screen = TERMINAL_SCREEN (terminal); TerminalScreenPrivate *priv = screen->priv; @@ -1900,9 +1963,11 @@ terminal_screen_child_exited (VteTerminal *terminal) case TERMINAL_EXIT_HOLD: { GtkWidget *info_bar; +#if !VTE_CHECK_VERSION (0, 38, 0) int status; status = vte_terminal_get_child_exit_status (terminal); +#endif info_bar = terminal_info_bar_new (GTK_MESSAGE_INFO, _("_Relaunch"), RESPONSE_RELAUNCH, diff --git a/src/terminal-window.c b/src/terminal-window.c index 3b8dc97..3b803ca 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -766,7 +766,11 @@ terminal_set_encoding_callback (GtkToggleAction *action, g_assert (encoding); vte_terminal_set_encoding (VTE_TERMINAL (priv->active_screen), +#if VTE_CHECK_VERSION (0, 38, 0) + terminal_encoding_get_charset (encoding), NULL); +#else terminal_encoding_get_charset (encoding)); +#endif } static void @@ -1366,6 +1370,7 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard, action = gtk_action_group_get_action (priv->action_group, "PopupInputMethods"); gtk_action_set_visible (action, show_input_method_menu); +#if !VTE_CHECK_VERSION (0, 38, 0) im_menu_item = gtk_ui_manager_get_widget (priv->ui_manager, "/Popup/PopupInputMethods"); /* FIXME: fix this when gtk+ bug #500065 is done, use vte_terminal_im_merge_ui */ @@ -1381,6 +1386,7 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard, { gtk_menu_item_set_submenu (GTK_MENU_ITEM (im_menu_item), NULL); } +#endif popup_menu = gtk_ui_manager_get_widget (priv->ui_manager, "/Popup"); g_signal_connect (popup_menu, "deactivate", @@ -3769,7 +3775,11 @@ search_find_response_callback (GtkWidget *dialog, flags = terminal_search_dialog_get_search_flags (dialog); +#if VTE_CHECK_VERSION (0, 38, 0) + vte_terminal_search_set_gregex (VTE_TERMINAL (priv->active_screen), regex, 0); +#else vte_terminal_search_set_gregex (VTE_TERMINAL (priv->active_screen), regex); +#endif vte_terminal_search_set_wrap_around (VTE_TERMINAL (priv->active_screen), (flags & TERMINAL_SEARCH_FLAG_WRAP_AROUND)); @@ -3840,7 +3850,11 @@ search_clear_highlight_callback (GtkAction *action, if (G_UNLIKELY (!window->priv->active_screen)) return; +#if VTE_CHECK_VERSION (0, 38, 0) + vte_terminal_search_set_gregex (VTE_TERMINAL (window->priv->active_screen), NULL, 0); +#else vte_terminal_search_set_gregex (VTE_TERMINAL (window->priv->active_screen), NULL); +#endif } static void |