From 78080f80bb684d920019391cd277614a4221d308 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Wed, 22 Jun 2016 18:08:19 -0400 Subject: [PATCH] xed-notebook.c: check vertical mouse position when determining whether a tab is being manipulated. We were just checking horizontal position, which meant that depending on where you start a drag-and-drop, it might think you're trying to drag a tab instead, causing undesirable behavior. --- xed/xed-notebook.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/xed/xed-notebook.c b/xed/xed-notebook.c index cb38539..46b9589 100644 --- a/xed/xed-notebook.c +++ b/xed/xed-notebook.c @@ -253,6 +253,7 @@ find_tab_num_at_pos (XedNotebook *notebook, { GtkAllocation allocation; GtkWidget *tab; + gint min_x, min_y; gint max_x, max_y; gint x_root, y_root; @@ -270,21 +271,27 @@ find_tab_num_at_pos (XedNotebook *notebook, gtk_widget_get_allocation(tab, &allocation); - max_x = x_root + allocation.x + allocation.width; - max_y = y_root + allocation.y + allocation.height; + min_x = x_root + allocation.x; + max_x = x_root + allocation.x + allocation.width; + min_y = y_root + allocation.y; + max_y = y_root + allocation.y + allocation.height; - if (((tab_pos == GTK_POS_TOP) || - (tab_pos == GTK_POS_BOTTOM)) && - (abs_x <= max_x)) - { - return page_num; - } - else if (((tab_pos == GTK_POS_LEFT) || - (tab_pos == GTK_POS_RIGHT)) && - (abs_y <= max_y)) - { - return page_num; - } + if (((tab_pos == GTK_POS_TOP) || + (tab_pos == GTK_POS_BOTTOM)) && + (abs_x <= max_x) && + (abs_y >= min_y) && + (abs_y <= max_y)) + { + return page_num; + } + else if (((tab_pos == GTK_POS_LEFT) || + (tab_pos == GTK_POS_RIGHT)) && + (abs_y <= max_y) && + (abs_x >= min_x) && + (abs_x <= max_x)) + { + return page_num; + } ++page_num; }