Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 12 Oct 2023 21:45:30 UTC
Commit: d10cfb503d30ee9bb7848f171dc857e2e90f0de5
https://github.com/geany/geany/commit/d10cfb503d30ee9bb7848f171dc857e2e90f0…
Log Message:
-----------
Position goto popup at the mouse when triggered with it
Recent changes made it always popup at the caret, which is almost OK as
the caret is moved to the click location, but it is still better to
actually popup at the pointer when a click triggered it so the position
relative to the pointer is always the same.
Modified Paths:
--------------
src/symbols.c
Modified: src/symbols.c
9 lines changed, 8 insertions(+), 1 deletions(-)
===================================================================
@@ -1432,6 +1432,7 @@ static void show_goto_popup(GeanyDocument *doc, GPtrArray *tags, gboolean have_b
GtkWidget *first = NULL;
GtkWidget *menu;
GtkSizeGroup *group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ GdkEvent *event;
TMTag *tmtag;
guint i;
gchar **short_names, **file_names;
@@ -1497,7 +1498,13 @@ 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);
- show_menu_at_caret(GTK_MENU(menu), doc->editor->sci);
+ event = gtk_get_current_event();
+ if (event && event->type == GDK_BUTTON_PRESS)
+ gtk_menu_popup_at_pointer(GTK_MENU(menu), event);
+ else
+ show_menu_at_caret(GTK_MENU(menu), doc->editor->sci);
+ if (event)
+ gdk_event_free(event);
g_object_unref(group);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 12 Oct 2023 20:46:40 UTC
Commit: 3498fe12a3be953511b810e568991e4149f2613a
https://github.com/geany/geany/commit/3498fe12a3be953511b810e568991e4149f26…
Log Message:
-----------
Fix popup position on a wrapping corner case
Modified Paths:
--------------
src/symbols.c
Modified: src/symbols.c
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -1419,7 +1419,8 @@ static void show_menu_at_caret(GtkMenu* menu, ScintillaObject *sci)
gint y = SSM(sci, SCI_POINTYFROMPOSITION, 0, pos);
gint pos_next = sci_get_position_after(sci, pos);
gint char_width = 0;
- if (sci_get_line_from_position(sci, pos_next) == line)
+ /* if next pos is on the same Y (same line and not after wrapping), diff the X */
+ if (pos_next > pos && SSM(sci, SCI_POINTYFROMPOSITION, 0, pos_next) == y)
char_width = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos_next) - x;
GdkRectangle rect = {x, y, char_width, line_height};
gtk_menu_popup_at_rect(GTK_MENU(menu), window, &rect, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).