app, menus: get rid of custom input method menu.

The input menu added with gtk_im_multicontext_append_menuitems() mostly
provides redundant (e.g. the system defaults) or useless options
(e.g. "None" or "Simple" which basically seems to mean the keyboard
mapping straight keys, and I don't see why anyone would want this if one
set a system-wide input system). Worse it can provide unstable options
(e.g. "Wayland" which crashes GIMP when I tried it on my X11 desktop! It
crashes on _gtk_immodule_wayland_init which is probably normal as we are
not on a Wayland client).

Anyway gtk_im_multicontext_append_menuitems() is deprecated since
GTK+3.10, as well as the "gtk-show-input-method-menu" property which we
read from GTK+ settings (and is FALSE anyway nowadays by default, so we
usually never show this submenu) to determine if we should show this
additional text tool submenu or not. Furthermore there is just no reason
not to leave the defaults system input method engine does its job (which
works well as far as I can see, at the very least on my GNU/Linux X11
desktop and on Wayland also, last I tested).
This commit is contained in:
Jehan 2020-12-15 02:51:30 +01:00
parent 0f7c6285ca
commit f6f94836c1
3 changed files with 1 additions and 32 deletions

View File

@ -50,10 +50,6 @@ static const GimpActionEntry text_tool_actions[] =
NC_("text-tool-action", "Text Tool Menu"), NULL, NULL, NULL,
NULL },
{ "text-tool-input-methods-menu", NULL,
NC_("text-tool-action", "Input _Methods"), NULL, NULL, NULL,
NULL },
{ "text-tool-cut", GIMP_ICON_EDIT_CUT,
NC_("text-tool-action", "Cu_t"), NULL, "<primary>X",
text_tool_cut_cmd_callback,
@ -150,8 +146,6 @@ text_tool_actions_setup (GimpActionGroup *group)
NULL,
GIMP_TEXT_DIRECTION_LTR,
text_tool_direction_cmd_callback);
SET_HIDE_EMPTY ("text-tool-input-methods-menu", FALSE);
}
/* The following code is written on the assumption that this is for a
@ -174,7 +168,6 @@ text_tool_actions_update (GimpActionGroup *group,
gboolean text_layer = FALSE;
gboolean text_sel = FALSE; /* some text is selected */
gboolean clip = FALSE; /* clipboard has text available */
gboolean input_method_menu;
gboolean unicode_menu;
GimpTextDirection direction;
gint i;
@ -195,8 +188,7 @@ text_tool_actions_update (GimpActionGroup *group,
clip = gtk_clipboard_wait_is_text_available (clipboard);
g_object_get (gtk_widget_get_settings (shell->canvas),
"gtk-show-input-method-menu", &input_method_menu,
"gtk-show-unicode-menu", &unicode_menu,
"gtk-show-unicode-menu", &unicode_menu,
NULL);
#define SET_VISIBLE(action,condition) \
@ -224,6 +216,4 @@ text_tool_actions_update (GimpActionGroup *group,
break;
}
}
SET_VISIBLE ("text-tool-input-methods-menu", input_method_menu);
}

View File

@ -842,8 +842,6 @@ gimp_text_tool_get_popup (GimpTool *tool,
GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
GimpImageWindow *image_window;
GimpDialogFactory *dialog_factory;
GtkWidget *im_menu;
GList *children;
image_window = gimp_display_shell_get_window (shell);
dialog_factory = gimp_dock_container_get_dialog_factory (GIMP_DOCK_CONTAINER (image_window));
@ -852,23 +850,6 @@ gimp_text_tool_get_popup (GimpTool *tool,
gimp_menu_factory_manager_new (gimp_dialog_factory_get_menu_factory (dialog_factory),
"<TextTool>",
text_tool);
im_menu = gimp_ui_manager_get_widget (text_tool->ui_manager,
"/text-tool-popup/text-tool-input-methods-menu");
if (GTK_IS_MENU_ITEM (im_menu))
im_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (im_menu));
/* hide the generated "empty" item */
children = gtk_container_get_children (GTK_CONTAINER (im_menu));
while (children)
{
gtk_widget_hide (children->data);
children = g_list_remove (children, children->data);
}
gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_tool->im_context),
GTK_MENU_SHELL (im_menu));
}
gimp_ui_manager_update (text_tool->ui_manager, text_tool);

View File

@ -20,7 +20,5 @@
<menuitem action="text-tool-direction-ttb-rtl-upright" />
<menuitem action="text-tool-direction-ttb-ltr" />
<menuitem action="text-tool-direction-ttb-ltr-upright" />
<separator />
<menu action="text-tool-input-methods-menu" />
</popup>
</ui>