Skip to content

Commit

Permalink
fix context menus on wayland (#3009)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolik-rce committed Aug 16, 2022
1 parent 34ce172 commit 85de036
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/callbacks.c
Expand Up @@ -634,7 +634,11 @@ gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer u
{
if (event->button == 3)
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(ui_widgets.toolbar_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
#endif
return TRUE;
}
return FALSE;
Expand Down
5 changes: 4 additions & 1 deletion src/editor.c
Expand Up @@ -346,9 +346,12 @@ 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);

#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(main_widgets.editor_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(main_widgets.editor_menu),
NULL, NULL, NULL, NULL, event->button, event->time);

#endif
return TRUE;
}
return FALSE;
Expand Down
12 changes: 12 additions & 0 deletions src/msgwindow.c
Expand Up @@ -1236,20 +1236,32 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *
{
case MSG_STATUS:
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_status_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
break;
}
case MSG_MESSAGE:
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_msg_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
break;
}
case MSG_COMPILER:
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(msgwindow.popup_compiler_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
break;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/notebook.c
Expand Up @@ -508,7 +508,11 @@ 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);

#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, NULL, NULL, event->button, event->time);
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions src/plugins.c
Expand Up @@ -1642,8 +1642,12 @@ static gboolean pm_treeview_button_press_cb(GtkWidget *widget, GdkEventButton *e
{
if (event->button == 3)
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(pm_widgets.popup_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(pm_widgets.popup_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
}
return FALSE;
}
Expand Down
4 changes: 4 additions & 0 deletions src/prefs.c
Expand Up @@ -246,7 +246,11 @@ static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton
event_time = gtk_get_current_event_time();
}

#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, NULL, NULL, button, event_time);
#endif
}


Expand Down
12 changes: 12 additions & 0 deletions src/sidebar.c
Expand Up @@ -145,8 +145,12 @@ on_default_tag_tree_button_press_event(GtkWidget *widget, GdkEventButton *event,
{
if (event->button == 3)
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(tv.popup_taglist), NULL);
#else
gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
return TRUE;
}
return FALSE;
Expand Down Expand Up @@ -1488,13 +1492,21 @@ static gboolean sidebar_button_press_cb(GtkWidget *widget, GdkEventButton *event

/* update menu item sensitivity */
documents_menu_update(selection);
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(openfiles_popup_menu), NULL);
#else
gtk_menu_popup(GTK_MENU(openfiles_popup_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
}
else
{
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(tv.popup_taglist), NULL);
#else
gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL,
event->button, event->time);
#endif
}
handled = TRUE;
}
Expand Down
4 changes: 4 additions & 0 deletions src/symbols.c
Expand Up @@ -1536,8 +1536,12 @@ 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);
#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, goto_popup_position_func, doc->editor->sci,
button_event ? button_event->button : 0, gtk_get_current_event_time ());
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions src/vte.c
Expand Up @@ -526,7 +526,11 @@ static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpo
if (event->button == 3)
{
gtk_widget_grab_focus(vte_config.vte);
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(vte_config.menu), NULL);
#else
gtk_menu_popup(GTK_MENU(vte_config.menu), NULL, NULL, NULL, NULL, event->button, event->time);
#endif
return TRUE;
}
else if (event->button == 2)
Expand Down

0 comments on commit 85de036

Please sign in to comment.