mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2717: GTK menu items don't show a tooltip
Problem: GTK menu items don't show a tooltip. Solution: Add a callback to show the tooltip. (Leonid V. Fedorenchik, closes #8067, closes #7810)
This commit is contained in:
@@ -684,6 +684,28 @@ menu_item_activate(GtkWidget *widget UNUSED, gpointer data)
|
|||||||
gui_menu_cb((vimmenu_T *)data);
|
gui_menu_cb((vimmenu_T *)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
menu_item_select(GtkWidget *widget UNUSED, gpointer data)
|
||||||
|
{
|
||||||
|
vimmenu_T *menu;
|
||||||
|
char_u *tooltip;
|
||||||
|
static int did_msg = FALSE;
|
||||||
|
|
||||||
|
menu = (vimmenu_T *)data;
|
||||||
|
tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
|
||||||
|
if (tooltip != NULL && utf_valid_string(tooltip, NULL))
|
||||||
|
{
|
||||||
|
msg((char *)tooltip);
|
||||||
|
did_msg = TRUE;
|
||||||
|
}
|
||||||
|
else if (did_msg)
|
||||||
|
{
|
||||||
|
msg("");
|
||||||
|
did_msg = FALSE;
|
||||||
|
}
|
||||||
|
CONVERT_TO_UTF8_FREE(tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||||
{
|
{
|
||||||
@@ -800,8 +822,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
|||||||
menu->id, idx);
|
menu->id, idx);
|
||||||
|
|
||||||
if (menu->id != NULL)
|
if (menu->id != NULL)
|
||||||
|
{
|
||||||
g_signal_connect(G_OBJECT(menu->id), "activate",
|
g_signal_connect(G_OBJECT(menu->id), "activate",
|
||||||
G_CALLBACK(menu_item_activate), menu);
|
G_CALLBACK(menu_item_activate), menu);
|
||||||
|
g_signal_connect(G_OBJECT(menu->id), "select",
|
||||||
|
G_CALLBACK(menu_item_select), menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // FEAT_MENU
|
#endif // FEAT_MENU
|
||||||
@@ -892,8 +918,7 @@ get_menu_position(vimmenu_T *menu)
|
|||||||
void
|
void
|
||||||
gui_mch_menu_set_tip(vimmenu_T *menu)
|
gui_mch_menu_set_tip(vimmenu_T *menu)
|
||||||
{
|
{
|
||||||
if (menu->id != NULL && menu->parent != NULL
|
if (menu->id != NULL && menu->parent != NULL && gui.toolbar != NULL)
|
||||||
&& gui.toolbar != NULL && menu_is_toolbar(menu->parent->name))
|
|
||||||
{
|
{
|
||||||
char_u *tooltip;
|
char_u *tooltip;
|
||||||
|
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2717,
|
||||||
/**/
|
/**/
|
||||||
2716,
|
2716,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user