[Xfce4-commits] <terminal:master> Make tab right/middle-click work again when they are not the first widget.
Nick Schermer
noreply at xfce.org
Wed Oct 7 17:44:02 CEST 2009
Updating branch refs/heads/master
to 276c6cfbe332e95c5d20c4fb9932325f656dd60e (commit)
from 2ede7225f703718ffdbccedd79fdc122324367b0 (commit)
commit 276c6cfbe332e95c5d20c4fb9932325f656dd60e
Author: Nick Schermer <nick at xfce.org>
Date: Wed Oct 7 17:17:06 2009 +0200
Make tab right/middle-click work again when they are not the first widget.
It turned out the coordinates were emitted from another window
then the main window and thus the x and/or y coordinates were
wrong when the tab were shown below or right of the vte screen or
the menu/icon-bar was visible.
terminal/terminal-window.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index ffef53b..895a1d0 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -937,11 +937,11 @@ terminal_window_notebook_page_removed (GtkNotebook *notebook,
-#define EVENT_IN_ALLOCATION(event,widget) \
- ((widget)->allocation.x <= (event)->x \
- && (widget)->allocation.x + (widget)->allocation.width >= (event)->x \
- && (widget)->allocation.y <= (event)->y \
- && (widget)->allocation.y + (widget)->allocation.height >= (event)->y)
+#define EVENT_IN_ALLOCATION(event_x,event_y,widget) \
+ ((event_x) >= (widget)->allocation.x \
+ && (event_x) <= (widget)->allocation.x + (widget)->allocation.width \
+ && (event_y) >= (widget)->allocation.y \
+ && (event_y) <= (widget)->allocation.y + (widget)->allocation.height)
@@ -953,17 +953,22 @@ terminal_window_notebook_button_press_event (GtkNotebook *notebook,
GtkWidget *page, *label, *menu;
gint page_num = 0;
gboolean close_middle_click;
+ gint x, y;
terminal_return_val_if_fail (TERMINAL_IS_WINDOW (window), FALSE);
terminal_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
+ gdk_window_get_position (event->window, &x, &y);
+ x += event->x;
+ y += event->y;
+
if (event->button == 1)
{
if (event->type == GDK_2BUTTON_PRESS)
{
/* check if the user double-clicked on the label */
label = gtk_notebook_get_tab_label (notebook, GTK_WIDGET (window->active));
- if (EVENT_IN_ALLOCATION (event, label))
+ if (EVENT_IN_ALLOCATION (x, y, label))
{
terminal_window_action_set_title (NULL, window);
return TRUE;
@@ -976,7 +981,7 @@ terminal_window_notebook_button_press_event (GtkNotebook *notebook,
while ((page = gtk_notebook_get_nth_page (notebook, page_num)) != NULL)
{
label = gtk_notebook_get_tab_label (notebook, page);
- if (EVENT_IN_ALLOCATION (event, label))
+ if (EVENT_IN_ALLOCATION (x, y, label))
break;
page_num++;
}
More information about the Xfce4-commits
mailing list