diff options
author | Debarshi Ray <debarshir@gnome.org> | 2018-04-03 18:51:30 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2018-04-04 08:59:09 +0200 |
commit | ebc2db30526c9a033c7d1de6292044cac1105b1c (patch) | |
tree | 888bce506a22e022d339137445052b12846b16fa | |
parent | 8aedb2713a9ffebefc44c5745eaed0385f3730cf (diff) | |
download | gnome-terminal-ebc2db30526c9a033c7d1de6292044cac1105b1c.tar.gz |
window: Don't misplace the notebook popup on Wayland
Fallout from 0820b3853a3b7c629a93fa820d5372eac1760686
https://bugzilla.gnome.org/show_bug.cgi?id=794935
-rw-r--r-- | src/terminal-window.c | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index 3e7f1fc6..40ddac94 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -1452,60 +1452,6 @@ find_tab_num_at_pos (GtkNotebook *notebook, } static void -position_menu_under_widget (GtkMenu *menu, - int *x, - int *y, - gboolean *push_in, - gpointer user_data) -{ - /* Adapted from gtktoolbar.c */ - GtkWidget *widget = GTK_WIDGET (user_data); - GdkWindow *widget_window; - GtkWidget *container; - GtkRequisition req; - GtkRequisition menu_req; - GdkRectangle monitor; - int monitor_num; - GdkScreen *screen; - GtkAllocation widget_allocation; - - widget_window = gtk_widget_get_window (widget); - gtk_widget_get_allocation (widget, &widget_allocation); - container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER); - - gtk_widget_get_preferred_size (widget, NULL, &req); - gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &menu_req); - - screen = gtk_widget_get_screen (GTK_WIDGET (menu)); - monitor_num = gdk_screen_get_monitor_at_window (screen, widget_window); - if (monitor_num < 0) - monitor_num = 0; - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - - gdk_window_get_origin (widget_window, x, y); - if (!gtk_widget_get_has_window (widget)) - { - *x += widget_allocation.x; - *y += widget_allocation.y; - } - if (gtk_widget_get_direction (container) == GTK_TEXT_DIR_LTR) - *x += widget_allocation.width - req.width; - else - *x += req.width - menu_req.width; - - if ((*y + widget_allocation.height + menu_req.height) <= monitor.y + monitor.height) - *y += widget_allocation.height; - else if ((*y - menu_req.height) >= monitor.y) - *y -= menu_req.height; - else if (monitor.y + monitor.height - (*y + widget_allocation.height) > *y) - *y += widget_allocation.height; - else - *y -= menu_req.height; - - *push_in = FALSE; -} - -static void terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window) { TerminalWindowPrivate *priv = window->priv; @@ -2761,15 +2707,6 @@ notebook_show_context_menu (TerminalWindow *window, guint button, guint32 timestamp) { - TerminalWindowPrivate *priv = window->priv; - GtkNotebook *notebook = GTK_NOTEBOOK (priv->mdi_container); - int page_num; - GtkWidget *tab, *tab_label; - - page_num = gtk_notebook_get_current_page (notebook); - tab = gtk_notebook_get_nth_page (notebook, page_num); - tab_label = gtk_notebook_get_tab_label (notebook, tab); - /* Load the UI */ gs_unref_object GMenu *menu; terminal_util_load_objects_resource ("/org/gnome/terminal/ui/notebook-menu.ui", @@ -2780,7 +2717,7 @@ notebook_show_context_menu (TerminalWindow *window, gtk_widget_set_halign (popup_menu, GTK_ALIGN_START); gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL, - position_menu_under_widget, tab_label, + NULL, NULL, button, timestamp); if (button == 0) |