From f4b4f2b540452e34e1cdaf1b256b1a9d35ae712e Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 19 Aug 2016 00:23:34 +0200 Subject: [PATCH] VTE: Don't hard-require vte_terminal_im_append_menuitems() VTE 2.91 dropped it, and it seems that recent GTK3 doesn't have IM context menu entries in input field's popups anymore anyway. --- src/vte.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/vte.c b/src/vte.c index eccafeb3e..f08389175 100644 --- a/src/vte.c +++ b/src/vte.c @@ -327,7 +327,8 @@ static void on_vte_realize(void) /* the vte widget has to be realised before color changes take effect */ vte_apply_user_settings(); - vf->vte_terminal_im_append_menuitems(VTE_TERMINAL(vc->vte), GTK_MENU_SHELL(vc->im_submenu)); + if (vf->vte_terminal_im_append_menuitems) + vf->vte_terminal_im_append_menuitems(VTE_TERMINAL(vc->vte), GTK_MENU_SHELL(vc->im_submenu)); } @@ -624,7 +625,7 @@ static gboolean vte_register_symbols(GModule *mod) } BIND_REQUIRED_SYMBOL(vte_terminal_set_background_image_file); BIND_REQUIRED_SYMBOL(vte_terminal_feed_child); - BIND_REQUIRED_SYMBOL(vte_terminal_im_append_menuitems); + BIND_SYMBOL(vte_terminal_im_append_menuitems); if (! BIND_SYMBOL(vte_terminal_set_cursor_blink_mode)) /* vte_terminal_set_cursor_blink_mode() is only available since 0.17.1, so if we don't find * this symbol, we are probably on an older version and use the old API instead */ @@ -777,18 +778,23 @@ static GtkWidget *vte_create_popup_menu(void) msgwin_menu_add_common_items(GTK_MENU(menu)); - item = gtk_separator_menu_item_new(); - gtk_widget_show(item); - gtk_container_add(GTK_CONTAINER(menu), item); + /* VTE 2.91 doesn't have IM context items -- but neither does newer GTK3 apparently */ + if (vf->vte_terminal_im_append_menuitems) + { + item = gtk_separator_menu_item_new(); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); - /* the IM submenu should always be the last item to be consistent with other GTK popup menus */ - vc->im_submenu = gtk_menu_new(); + /* the IM submenu should always be the last item to be consistent with other GTK popup menus */ + vc->im_submenu = gtk_menu_new(); - item = gtk_image_menu_item_new_with_mnemonic(_("_Input Methods")); - gtk_widget_show(item); - gtk_container_add(GTK_CONTAINER(menu), item); + item = gtk_image_menu_item_new_with_mnemonic(_("_Input Methods")); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), vc->im_submenu); + } - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), vc->im_submenu); /* submenu populated after vte realized */ return menu; } -- 2.11.4.GIT