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:05 UTC Commit: 956409479a4dda51e95357cbb28336c121724238 https://github.com/geany/geany/commit/956409479a4dda51e95357cbb28336c1217242...
Log Message: ----------- Drop support for GTK 3.21 and older
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, event->button, event->time); + ui_menu_popup(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, event->button, event->time); + ui_menu_popup(GTK_MENU(main_widgets.editor_menu), NULL); return TRUE; } return FALSE;
Modified: src/msgwindow.c 9 lines changed, 3 insertions(+), 6 deletions(-) =================================================================== @@ -1236,20 +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, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL); break; } case MSG_MESSAGE: { - ui_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL); break; } case MSG_COMPILER: { - ui_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL); break; } }
Modified: src/notebook.c 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -458,7 +458,7 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume }
-static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc) +static void show_tab_bar_popup_menu(GeanyDocument *doc) { GtkWidget *menu_item; static GtkWidget *menu = NULL; @@ -512,7 +512,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);
- ui_menu_popup(GTK_MENU(menu), NULL, event->button, event->time); + ui_menu_popup(GTK_MENU(menu), NULL); }
@@ -541,7 +541,7 @@ static gboolean notebook_tab_bar_click_cb(GtkWidget *widget, GdkEventButton *eve * on a tab directly */ else if (event->button == 3) { - show_tab_bar_popup_menu(event, NULL); + show_tab_bar_popup_menu(NULL); return TRUE; } return FALSE; @@ -676,7 +676,7 @@ static gboolean notebook_tab_click(GtkWidget *widget, GdkEventButton *event, gpo /* right-click is first handled here if it happened on a notebook tab */ if (event->button == 3) { - show_tab_bar_popup_menu(event, doc); + show_tab_bar_popup_menu(doc); return TRUE; }
Modified: src/plugins.c 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -1642,8 +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, - event->button, event->time); + ui_menu_popup(GTK_MENU(pm_widgets.popup_menu), NULL); } return FALSE; }
Modified: src/prefs.c 21 lines changed, 4 insertions(+), 17 deletions(-) =================================================================== @@ -211,11 +211,9 @@ static void kb_tree_view_change_button_clicked_cb(GtkWidget *button, KbData *kbd }
-static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton *event) +static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget) { static GtkWidget *menu = NULL; - guint button; - guint32 event_time;
if (menu == NULL) { @@ -236,24 +234,13 @@ static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton gtk_menu_attach_to_widget(GTK_MENU(menu), widget, NULL); }
- if (event != NULL) - { - button = event->button; - event_time = event->time; - } - else - { - button = 0; - event_time = gtk_get_current_event_time(); - } - - ui_menu_popup(GTK_MENU(menu), NULL, button, event_time); + ui_menu_popup(GTK_MENU(menu), NULL); }
static gboolean kb_popup_menu_cb(GtkWidget *widget, KbData *kbdata) { - kb_show_popup_menu(kbdata, widget, NULL); + kb_show_popup_menu(kbdata, widget); return TRUE; }
@@ -263,7 +250,7 @@ static gboolean kb_tree_view_button_press_event_cb(GtkWidget *widget, GdkEventBu { if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { - kb_show_popup_menu(kbdata, widget, event); + kb_show_popup_menu(kbdata, widget); return TRUE; } else if (event->type == GDK_2BUTTON_PRESS)
Modified: src/sidebar.c 8 lines changed, 3 insertions(+), 5 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, event->button, event->time); + ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL); return TRUE; } return FALSE; @@ -1513,13 +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, - event->button, event->time); + ui_menu_popup(GTK_MENU(openfiles_popup_menu), NULL); } else { - ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL, - event->button, event->time); + ui_menu_popup(GTK_MENU(tv.popup_taglist), NULL); } handled = TRUE; }
Modified: src/symbols.c 13 lines changed, 1 insertions(+), 12 deletions(-) =================================================================== @@ -1413,8 +1413,6 @@ 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; - GdkEventButton *button_event = NULL; TMTag *tmtag; guint i; gchar **short_names, **file_names; @@ -1480,16 +1478,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);
- event = gtk_get_current_event(); - if (event && event->type == GDK_BUTTON_PRESS) - button_event = (GdkEventButton *) event; - else - gdk_event_free(event); - - g_object_set_data_full(G_OBJECT(menu), "geany-button-event", button_event, - button_event ? (GDestroyNotify) gdk_event_free : NULL); - ui_menu_popup(GTK_MENU(menu), doc->editor->sci, - button_event ? button_event->button : 0, gtk_get_current_event_time ()); + ui_menu_popup(GTK_MENU(menu), doc->editor->sci);
g_object_unref(group); }
Modified: src/ui_utils.c 89 lines changed, 1 insertions(+), 88 deletions(-) =================================================================== @@ -3259,93 +3259,9 @@ gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc }
-#if GTK_CHECK_VERSION(3,22,0) -/* positions a popup at the caret from the ScintillaObject in @p data */ -static void position_at_caret(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) -{ - gint line_height; - GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(menu)); - gint monitor_num; - GdkRectangle monitor; - GtkRequisition req; - GdkEventButton *event_button = g_object_get_data(G_OBJECT(menu), "geany-button-event"); - - if (event_button) - { - /* if we got a mouse click, popup at that position */ - *x = (gint) event_button->x_root; - *y = (gint) event_button->y_root; - line_height = 0; /* we don't want to offset below the line or anything */ - } - else /* keyboard positioning */ - { - ScintillaObject *sci = data; - 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 pos_x = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos); - gint pos_y = SSM(sci, SCI_POINTYFROMPOSITION, 0, pos); - - line_height = SSM(sci, SCI_TEXTHEIGHT, line, 0); - - gdk_window_get_origin(window, x, y); - *x += pos_x; - *y += pos_y; - } - - monitor_num = gdk_screen_get_monitor_at_point(screen, *x, *y); - - gtk_widget_get_preferred_size(GTK_WIDGET(menu), NULL, &req); - -#if GTK_CHECK_VERSION(3, 4, 0) - gdk_screen_get_monitor_workarea(screen, monitor_num, &monitor); -#else - gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor); -#endif - - /* put on one size of the X position, but within the monitor */ - if (gtk_widget_get_direction(GTK_WIDGET(menu)) == GTK_TEXT_DIR_RTL) - { - if (*x - req.width - 1 >= monitor.x) - *x -= req.width + 1; - else if (*x + req.width > monitor.x + monitor.width) - *x = monitor.x; - else - *x += 1; - } - else - { - if (*x + req.width + 1 <= monitor.x + monitor.width) - *x = MAX(monitor.x, *x + 1); - else if (*x - req.width - 1 >= monitor.x) - *x -= req.width + 1; - else - *x = monitor.x + MAX(0, monitor.width - req.width); - } - - /* try to put, in order: - * 1. below the Y position, under the line - * 2. above the Y position - * 3. within the monitor */ - if (*y + line_height + req.height <= monitor.y + monitor.height) - *y = MAX(monitor.y, *y + line_height); - else if (*y - req.height >= monitor.y) - *y = *y - req.height; - else - *y = monitor.y + MAX(0, monitor.height - req.height); - - *push_in = FALSE; -} -#endif - - /* opens menu at caret position (if ScintillaObject is passed) or at current pointer position */ -void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci, guint button, guint32 activate_time) +void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci) { - /* 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) if (!sci) gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); else @@ -3360,7 +3276,4 @@ void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci, guint button, guint32 ac 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); } -#else - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, sci ? position_at_caret : NULL, sci, button, activate_time); -#endif }
Modified: src/ui_utils.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -373,7 +373,7 @@ gchar *ui_get_project_directory(const gchar *path);
void ui_menu_sort_by_label(GtkMenu *menu);
-void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci, guint button, guint32 activate_time); +void ui_menu_popup(GtkMenu* menu, ScintillaObject *sci);
#endif /* GEANY_PRIVATE */
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, event->button, event->time); + ui_menu_popup(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).