4ec8ea1db3
Rebase transparency, command-notify and translation patches.
106 lines
3.5 KiB
Diff
106 lines
3.5 KiB
Diff
From 42b10bb35c1615e4fb0164200ff65535b8e7f29a Mon Sep 17 00:00:00 2001
|
|
From: Debarshi Ray <debarshir@gnome.org>
|
|
Date: Tue, 3 Apr 2018 18:51:30 +0200
|
|
Subject: [PATCH] window: Don't misplace the notebook popup on Wayland
|
|
|
|
Fallout from 0820b3853a3b7c629a93fa820d5372eac1760686
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=794935
|
|
---
|
|
src/terminal-window.c | 65 +--------------------------------------------------
|
|
1 file changed, 1 insertion(+), 64 deletions(-)
|
|
|
|
diff --git a/src/terminal-window.c b/src/terminal-window.c
|
|
index 663f7f335650..46625c514956 100644
|
|
--- a/src/terminal-window.c
|
|
+++ b/src/terminal-window.c
|
|
@@ -1449,60 +1449,6 @@ find_tab_num_at_pos (GtkNotebook *notebook,
|
|
return -1;
|
|
}
|
|
|
|
-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)
|
|
{
|
|
@@ -2762,15 +2708,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",
|
|
@@ -2781,7 +2718,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)
|
|
--
|
|
2.14.3
|
|
|