[geany/geany] f4b4f2: VTE: Don't hard-require vte_terminal_im_append_menuitems()

Colomban Wendling git-noreply at geany.org
Sat Oct 29 14:09:04 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 29 Oct 2016 14:09:04 UTC
Commit:      f4b4f2b540452e34e1cdaf1b256b1a9d35ae712e
             https://github.com/geany/geany/commit/f4b4f2b540452e34e1cdaf1b256b1a9d35ae712e

Log Message:
-----------
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.


Modified Paths:
--------------
    src/vte.c

Modified: src/vte.c
28 lines changed, 17 insertions(+), 11 deletions(-)
===================================================================
@@ -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;
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list