Branch: refs/heads/master Author: Jan Dolinar jan.dolinar@firma.seznam.cz Committer: Colomban Wendling ban@herbesfolles.org Date: Tue, 10 Oct 2023 13:30:33 UTC Commit: bbfc201313f948f0528280a9089bc79af1af98a0 https://github.com/geany/geany/commit/bbfc201313f948f0528280a9089bc79af1af98...
Log Message: ----------- drop ui_menu_popup function
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) { - ui_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(ui_widgets.toolbar_menu), NULL); return TRUE; } return FALSE;
Modified: src/editor.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -346,7 +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);
- ui_menu_popup(GTK_MENU(main_widgets.editor_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(main_widgets.editor_menu), NULL); return TRUE; } return FALSE;
Modified: src/msgwindow.c 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -1236,17 +1236,17 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton * { case MSG_STATUS: { - ui_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_status_menu), NULL); break; } case MSG_MESSAGE: { - ui_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_msg_menu), NULL); break; } case MSG_COMPILER: { - ui_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_compiler_menu), NULL); break; } }
Modified: src/notebook.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -512,7 +512,7 @@ static void show_tab_bar_popup_menu(GeanyDocument *doc) gtk_container_add(GTK_CONTAINER(menu), menu_item); g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_all1_activate), NULL);
- ui_menu_popup(GTK_MENU(menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); }
Modified: src/plugins.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1642,7 +1642,7 @@ static gboolean pm_treeview_button_press_cb(GtkWidget *widget, GdkEventButton *e { if (event->button == 3) { - ui_menu_popup(GTK_MENU(pm_widgets.popup_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(pm_widgets.popup_menu), NULL); } return FALSE; }
Modified: src/prefs.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -234,7 +234,7 @@ static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget) gtk_menu_attach_to_widget(GTK_MENU(menu), widget, NULL); }
- ui_menu_popup(GTK_MENU(menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); }
Modified: src/sidebar.c 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -145,7 +145,7 @@ on_default_tag_tree_button_press_event(GtkWidget *widget, GdkEventButton *event, { if (event->button == 3) { - ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(tv.popup_taglist), NULL); return TRUE; } return FALSE; @@ -1513,11 +1513,11 @@ static gboolean sidebar_button_press_cb(GtkWidget *widget, GdkEventButton *event
/* update menu item sensitivity */ documents_menu_update(selection); - ui_menu_popup(GTK_MENU(openfiles_popup_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(openfiles_popup_menu), NULL); } else { - ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(tv.popup_taglist), NULL); } handled = TRUE; }
Modified: src/symbols.c 16 lines changed, 15 insertions(+), 1 deletions(-) =================================================================== @@ -1407,6 +1407,20 @@ static guint get_tag_class(const TMTag *tag) return TM_ICON_STRUCT; }
+/* opens menu at caret position */ +static void show_menu_at_caret(GtkMenu* menu, ScintillaObject *sci) +{ + GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(sci)); + gint pos = sci_get_current_position(sci); + gint line = sci_get_line_from_position(sci, pos); + gint line_height = SSM(sci, SCI_TEXTHEIGHT, line, 0); + gint x = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos); + gint y = SSM(sci, SCI_POINTYFROMPOSITION, 0, pos) + line_height; + GdkRectangle rect = {x, y, 0, 0}; + GdkGravity rect_anchor = gtk_widget_get_direction(GTK_WIDGET(menu)) == GTK_TEXT_DIR_RTL ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST; + gtk_menu_popup_at_rect(GTK_MENU(menu), window, &rect, rect_anchor, GDK_GRAVITY_NORTH_WEST, NULL); +} +
static void show_goto_popup(GeanyDocument *doc, GPtrArray *tags, gboolean have_best) { @@ -1478,7 +1492,7 @@ static void show_goto_popup(GeanyDocument *doc, GPtrArray *tags, gboolean have_b if (first) /* always select the first item for better keyboard navigation */ g_signal_connect(menu, "realize", G_CALLBACK(gtk_menu_shell_select_item), first);
- ui_menu_popup(GTK_MENU(menu), doc->editor->sci); + show_menu_at_caret(GTK_MENU(menu), doc->editor->sci);
g_object_unref(group); }
Modified: src/ui_utils.c 20 lines changed, 0 insertions(+), 20 deletions(-) =================================================================== @@ -3257,23 +3257,3 @@ gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc } return FALSE; } - - -/* opens menu at caret position (if ScintillaObject is passed) or at current pointer position */ -void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci) -{ - if (!sci) - gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); - else - { - GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(sci)); - gint pos = sci_get_current_position(sci); - gint line = sci_get_line_from_position(sci, pos); - gint line_height = SSM(sci, SCI_TEXTHEIGHT, line, 0); - gint x = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos); - gint y = SSM(sci, SCI_POINTYFROMPOSITION, 0, pos) + line_height; - GdkRectangle rect = {x, y, 0, 0}; - GdkGravity rect_anchor = gtk_widget_get_direction(GTK_WIDGET(menu)) == GTK_TEXT_DIR_RTL ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST; - gtk_menu_popup_at_rect(GTK_MENU(menu), window, &rect, rect_anchor, GDK_GRAVITY_NORTH_WEST, NULL); - } -}
Modified: src/ui_utils.h 2 lines changed, 0 insertions(+), 2 deletions(-) =================================================================== @@ -373,8 +373,6 @@ gchar *ui_get_project_directory(const gchar *path);
void ui_menu_sort_by_label(GtkMenu *menu);
-void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci); - #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); - ui_menu_popup(GTK_MENU(vte_config.menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(vte_config.menu), NULL); 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).