To: vim_dev@googlegroups.com Subject: Patch 8.2.2717 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2717 Problem: GTK menu items don't show a tooltip. Solution: Add a callback to show the tooltip. (Leonid V. Fedorenchik, closes #8067, closes #7810) Files: src/gui_gtk.c *** ../vim-8.2.2716/src/gui_gtk.c 2021-04-04 15:57:08.631155559 +0200 --- src/gui_gtk.c 2021-04-05 14:11:42.162217073 +0200 *************** *** 684,689 **** --- 684,711 ---- 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 gui_mch_add_menu_item(vimmenu_T *menu, int idx) { *************** *** 800,807 **** --- 822,833 ---- menu->id, idx); if (menu->id != NULL) + { g_signal_connect(G_OBJECT(menu->id), "activate", G_CALLBACK(menu_item_activate), menu); + g_signal_connect(G_OBJECT(menu->id), "select", + G_CALLBACK(menu_item_select), menu); + } } } #endif // FEAT_MENU *************** *** 892,899 **** void gui_mch_menu_set_tip(vimmenu_T *menu) { ! if (menu->id != NULL && menu->parent != NULL ! && gui.toolbar != NULL && menu_is_toolbar(menu->parent->name)) { char_u *tooltip; --- 918,924 ---- void gui_mch_menu_set_tip(vimmenu_T *menu) { ! if (menu->id != NULL && menu->parent != NULL && gui.toolbar != NULL) { char_u *tooltip; *** ../vim-8.2.2716/src/version.c 2021-04-05 13:59:48.720005966 +0200 --- src/version.c 2021-04-05 14:06:44.862968913 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2717, /**/ -- hundred-and-one symptoms of being an internet addict: 60. As your car crashes through the guardrail on a mountain road, your first instinct is to search for the "back" button. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///