window: Attach popup menus to their parent widgets
When running on Wayland, popup menus must have a parent widget to attach to. If a parent widget is not explicitly set, the GDK backend tries to guess what parent widget seems appropriate. In order to have more reliable popups, change the popups in the terminal window to set their parent widgets explicitly. https://bugzilla.gnome.org/show_bug.cgi?id=750755 taken from: https://git.gnome.org/browse/gnome-terminal/commit/?id=67afb95master-1.22
parent
c2ee31947b
commit
575fc201f0
|
@ -1533,6 +1533,9 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard,
|
||||||
if (info->button == 0)
|
if (info->button == 0)
|
||||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (popup_menu), FALSE);
|
gtk_menu_shell_select_first (GTK_MENU_SHELL (popup_menu), FALSE);
|
||||||
|
|
||||||
|
if (gtk_menu_get_attach_widget (GTK_MENU (popup_menu)))
|
||||||
|
gtk_menu_detach (GTK_MENU (popup_menu));
|
||||||
|
gtk_menu_attach_to_widget (GTK_MENU (popup_menu), GTK_WIDGET (screen), NULL);
|
||||||
gtk_menu_popup (GTK_MENU (popup_menu),
|
gtk_menu_popup (GTK_MENU (popup_menu),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
@ -2898,6 +2901,7 @@ notebook_button_press_cb (GtkWidget *widget,
|
||||||
TerminalWindowPrivate *priv = window->priv;
|
TerminalWindowPrivate *priv = window->priv;
|
||||||
TerminalScreen *active_screen = priv->active_screen;
|
TerminalScreen *active_screen = priv->active_screen;
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||||
|
GtkWidget *tab;
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
int tab_clicked;
|
int tab_clicked;
|
||||||
|
@ -2929,6 +2933,10 @@ notebook_button_press_cb (GtkWidget *widget,
|
||||||
gtk_action_activate (action);
|
gtk_action_activate (action);
|
||||||
|
|
||||||
menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
|
menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
|
||||||
|
if (gtk_menu_get_attach_widget (GTK_MENU (menu)))
|
||||||
|
gtk_menu_detach (GTK_MENU (menu));
|
||||||
|
tab = gtk_notebook_get_nth_page (notebook, tab_clicked);
|
||||||
|
gtk_menu_attach_to_widget (GTK_MENU (menu), tab, NULL);
|
||||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
event->button, event->time);
|
event->button, event->time);
|
||||||
|
@ -2959,6 +2967,9 @@ notebook_popup_menu_cb (GtkWidget *widget,
|
||||||
gtk_action_activate (action);
|
gtk_action_activate (action);
|
||||||
|
|
||||||
menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
|
menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
|
||||||
|
if (gtk_menu_get_attach_widget (GTK_MENU (menu)))
|
||||||
|
gtk_menu_detach (GTK_MENU (menu));
|
||||||
|
gtk_menu_attach_to_widget (GTK_MENU (menu), tab_label, NULL);
|
||||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||||
position_menu_under_widget, tab_label,
|
position_menu_under_widget, tab_label,
|
||||||
0, gtk_get_current_event_time ());
|
0, gtk_get_current_event_time ());
|
||||||
|
|
Loading…
Reference in New Issue