Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: GitHub noreply@github.com Date: Sat, 17 Sep 2022 10:04:02 UTC Commit: 3698462af9480b0cf2ea54ade32f6f7712f50785 https://github.com/geany/geany/commit/3698462af9480b0cf2ea54ade32f6f7712f507...
Log Message: ----------- Merge pull request #3011 from dolik-rce/fix-context-menus-on-wayland
Fix context menus on wayland (#3009)
Modified Paths: -------------- src/callbacks.c src/editor.c src/msgwindow.c src/notebook.c src/plugins.c src/prefs.c src/sidebar.c src/symbols.c src/ui_utils.c src/ui_utils.h src/vte.c
Modified: src/callbacks.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -634,7 +634,7 @@ gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer u { if (event->button == 3) { - gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time); + ui_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, event->button, event->time); return TRUE; } return FALSE;
Modified: src/editor.c 4 lines changed, 1 insertions(+), 3 deletions(-) =================================================================== @@ -346,9 +346,7 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * g_signal_emit_by_name(geany_object, "update-editor-menu", current_word, editor_info.click_pos, doc);
- gtk_menu_popup(GTK_MENU(main_widgets.editor_menu), - NULL, NULL, NULL, NULL, event->button, event->time); - + ui_menu_popup(GTK_MENU(main_widgets.editor_menu), NULL, NULL, event->button, event->time); return TRUE; } return FALSE;
Modified: src/msgwindow.c 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -1236,20 +1236,20 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton * { case MSG_STATUS: { - gtk_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL, NULL, + event->button, event->time); break; } case MSG_MESSAGE: { - gtk_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, NULL, + event->button, event->time); break; } case MSG_COMPILER: { - gtk_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, NULL, + event->button, event->time); break; } }
Modified: src/notebook.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -508,7 +508,7 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc) gtk_container_add(GTK_CONTAINER(menu), menu_item); g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_all1_activate), NULL);
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); + ui_menu_popup(GTK_MENU(menu), NULL, NULL, event->button, event->time); }
Modified: src/plugins.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1642,8 +1642,8 @@ static gboolean pm_treeview_button_press_cb(GtkWidget *widget, GdkEventButton *e { if (event->button == 3) { - gtk_menu_popup(GTK_MENU(pm_widgets.popup_menu), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(pm_widgets.popup_menu), NULL, NULL, + event->button, event->time); } return FALSE; }
Modified: src/prefs.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -246,7 +246,7 @@ static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton event_time = gtk_get_current_event_time(); }
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, event_time); + ui_menu_popup(GTK_MENU(menu), NULL, NULL, button, event_time); }
Modified: src/sidebar.c 11 lines changed, 5 insertions(+), 6 deletions(-) =================================================================== @@ -145,8 +145,7 @@ on_default_tag_tree_button_press_event(GtkWidget *widget, GdkEventButton *event, { if (event->button == 3) { - gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, event->button, event->time); return TRUE; } return FALSE; @@ -1503,13 +1502,13 @@ static gboolean sidebar_button_press_cb(GtkWidget *widget, GdkEventButton *event
/* update menu item sensitivity */ documents_menu_update(selection); - gtk_menu_popup(GTK_MENU(openfiles_popup_menu), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(openfiles_popup_menu), NULL, NULL, + event->button, event->time); } else { - gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, + event->button, event->time); } handled = TRUE; }
Modified: src/symbols.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1536,8 +1536,8 @@ static void show_goto_popup(GeanyDocument *doc, GPtrArray *tags, gboolean have_b
g_object_set_data_full(G_OBJECT(menu), "geany-button-event", button_event, button_event ? (GDestroyNotify) gdk_event_free : NULL); - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, goto_popup_position_func, doc->editor->sci, - button_event ? button_event->button : 0, gtk_get_current_event_time ()); + ui_menu_popup(GTK_MENU(menu), goto_popup_position_func, doc->editor->sci, + button_event ? button_event->button : 0, gtk_get_current_event_time ()); }
Modified: src/ui_utils.c 12 lines changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -3229,3 +3229,15 @@ gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc } return FALSE; } + +void ui_menu_popup(GtkMenu* menu, GtkMenuPositionFunc func, gpointer data, guint button, guint32 activate_time) +{ + /* Use appropriate function for menu popup: + - gtk_menu_popup_at_pointer is not available on GTK older than 3.22 + - gtk_menu_popup is deprecated and causes issues on multimonitor wayland setups */ +#if GTK_CHECK_VERSION(3,22,0) + gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); +#else + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, func, data, button, activate_time); +#endif +}
Modified: src/ui_utils.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -368,6 +368,8 @@ gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc
gchar *ui_get_project_directory(const gchar *path);
+void ui_menu_popup(GtkMenu* menu, GtkMenuPositionFunc func, gpointer data, guint button, guint32 activate_time); + #endif /* GEANY_PRIVATE */
G_END_DECLS
Modified: src/vte.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -526,7 +526,7 @@ static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpo if (event->button == 3) { gtk_widget_grab_focus(vte_config.vte); - gtk_menu_popup(GTK_MENU(vte_config.menu), NULL, NULL, NULL, NULL, event->button, event->time); + ui_menu_popup(GTK_MENU(vte_config.menu), NULL, NULL, event->button, event->time); return TRUE; } else if (event->button == 2)
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).