summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-09-20 01:11:42 -0400
committerLuke from DC <[email protected]>2023-09-23 21:41:07 +0000
commit97351f49ee3b9510f76b4e0c2a997ae334940de8 (patch)
tree6e831e3870c670cdc7a487169b85cb1a9349edf8
parent4d49c80310ba26f75854a1f7fcca79dff927cd4d (diff)
downloadmate-terminal-97351f49ee3b9510f76b4e0c2a997ae334940de8.tar.bz2
mate-terminal-97351f49ee3b9510f76b4e0c2a997ae334940de8.tar.xz
Tabs: only invoke naming dialog to doubleclick on tab header
Do not show the tab rename dialog when terminal window content is doubleclicked in terminal apps using the mouse
-rw-r--r--src/terminal-window.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 6517d8d..bcae49d 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -519,27 +519,23 @@ escape_underscores (const char *name)
}
static int
-find_tab_num_at_pos (GtkNotebook *notebook,
+find_tab_num_at_pos (GtkNotebook *nb,
int screen_x,
int screen_y)
{
- GtkPositionType tab_pos;
int page_num = 0;
- GtkNotebook *nb = GTK_NOTEBOOK (notebook);
GtkWidget *page;
GtkAllocation tab_allocation;
- tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));
-
while ((page = gtk_notebook_get_nth_page (nb, page_num)))
{
GtkWidget *tab;
- int max_x, max_y, x_root, y_root;
+ int x_root, y_root;
tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, -1);
- if (!gtk_widget_get_mapped (GTK_WIDGET (tab)))
+ if (!gtk_widget_get_mapped (tab))
{
page_num++;
continue;
@@ -548,13 +544,10 @@ find_tab_num_at_pos (GtkNotebook *notebook,
gdk_window_get_origin (gtk_widget_get_window (tab), &x_root, &y_root);
gtk_widget_get_allocation (tab, &tab_allocation);
- max_x = x_root + tab_allocation.x + tab_allocation.width;
- max_y = y_root + tab_allocation.y + tab_allocation.height;
-
- if ((tab_pos == GTK_POS_TOP || tab_pos == GTK_POS_BOTTOM) && screen_x <= max_x)
- return page_num;
-
- if ((tab_pos == GTK_POS_LEFT || tab_pos == GTK_POS_RIGHT) && screen_y <= max_y)
+ if (screen_x >= x_root + tab_allocation.x &&
+ screen_x <= x_root + tab_allocation.x + tab_allocation.width &&
+ screen_y >= y_root + tab_allocation.y &&
+ screen_y <= y_root + tab_allocation.y + tab_allocation.height)
return page_num;
page_num++;
@@ -3056,7 +3049,8 @@ notebook_button_press_cb (GtkWidget *widget,
}
/* If the event is a double click, display the set title dialog */
- if (event->type == GDK_DOUBLE_BUTTON_PRESS)
+ if (event->type == GDK_DOUBLE_BUTTON_PRESS &&
+ find_tab_num_at_pos (notebook, (int) event->x_root, (int) event->y_root) >= 0)
{
terminal_set_title_callback (NULL, window);