vim -g --clean -c 'set go-=m'F10Not sure if you want to keep this feature, but with GTK3 F10 brings up the menu even when the menubar is hidden.
9.2.491
Arch Linux GTK 4 GUI, Wayfire Wayland compositor.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Sorry, I'm not very familiar with the GUI side. Can you confirm that GTK3 actually pops up the menu on F10 when the menubar is hidden with set go-=m? Looking at the X11 code, vim explicitly disables gtk-menu-bar-accel (so GTK shouldn't grab F10) and the menubar widget is hidden via gtk_widget_hide() when go-=m, so I'm a bit unsure whether the behaviour you're describing was intentional or some side effect.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Yes, GTK3 pops up the "File" menu on F10, and I can move left and right with arrow keys despite the menubar itself doesn't show up. A warning is printed however:
(gvim:1176280): Gtk-WARNING **: 14:34:23.365: no trigger event for menu popup
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra What do you think about adding this explicit F10 handler? In GTK3 the menubar widget itself reacted to F10 even when hidden (lilydjwg's report; GTK prints a no trigger event for menu popup warning but it still works). GTK4's GtkPopoverMenuBar does not have this implicit behaviour, so F10 only opens the menu if the GUI side wires it up.
The patch below pops up the menubar as a GtkPopoverMenu when F10 is pressed and is not already mapped by the user. Mappings still win.
diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c index c12256790e..9995f66b0e 100644 --- a/src/gui_gtk4.c +++ b/src/gui_gtk4.c @@ -286,6 +286,9 @@ static void drawarea_resize_cb(GtkDrawingArea *area, int width, int height, gpoi static void drawarea_scale_factor_cb(GObject *object, GParamSpec *pspec, gpointer data); static cairo_surface_t *create_backing_surface(int width, int height); static void clipboard_changed_cb(GdkClipboard *clipboard, gpointer user_data); +#ifdef FEAT_MENU +static void show_menubar_popover(void); +#endif /* * Parse the GUI related command-line arguments. Any arguments used are @@ -1557,6 +1560,19 @@ key_press_event(GtkEventControllerKey *controller UNUSED, } #endif +#ifdef FEAT_MENU + if (key_sym == GDK_KEY_F10 && gui.menubar != NULL) + { + static char_u k10[] = {K_SPECIAL, 'k', ';', 0}; + + if (check_map(k10, State, FALSE, TRUE, FALSE, NULL, NULL) == NULL) + { + show_menubar_popover(); + return TRUE; + } + } +#endif + len = keyval_to_string(key_sym, string2); if (len > 1 && input_conv.vc_type != CONV_NONE) @@ -3702,6 +3718,33 @@ gui_mch_show_popupmenu(vimmenu_T *menu) gtk_popover_popup(GTK_POPOVER(popover)); } + static void +show_menubar_popover(void) +{ + GMenu *gmenu; + GtkWidget *popover; + GdkRectangle rect; + + if (gui.menubar == NULL || gui.drawarea == NULL) + return; + gmenu = (GMenu *)g_object_get_data(G_OBJECT(gui.menubar), "vim-gmenu"); + if (gmenu == NULL || g_menu_model_get_n_items(G_MENU_MODEL(gmenu)) == 0) + return; + + popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(gmenu)); + gtk_widget_set_parent(popover, gui.drawarea); + gtk_popover_set_has_arrow(GTK_POPOVER(popover), FALSE); + gtk_popover_set_position(GTK_POPOVER(popover), GTK_POS_BOTTOM); + rect.x = 0; + rect.y = 0; + rect.width = 1; + rect.height = 1; + gtk_popover_set_pointing_to(GTK_POPOVER(popover), &rect); + g_signal_connect(popover, "closed", + G_CALLBACK(popupmenu_closed_cb), NULL); + gtk_popover_popup(GTK_POPOVER(popover)); +} + /* * =========================================================== * Scrollbar functions
Is making the GUI wire F10 explicitly like this acceptable, or should we leave it to users to map <F10> themselves via :menu?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Thanks mattn, I think this is acceptable.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()