Merge pull request #20 from mtwebster/dnd

xed-notebook.c: check vertical mouse position when determining
This commit is contained in:
Clement Lefebvre 2016-06-23 01:17:47 +01:00 committed by GitHub
commit 4d2c51a965
1 changed files with 21 additions and 14 deletions

View File

@ -253,6 +253,7 @@ find_tab_num_at_pos (XedNotebook *notebook,
{ {
GtkAllocation allocation; GtkAllocation allocation;
GtkWidget *tab; GtkWidget *tab;
gint min_x, min_y;
gint max_x, max_y; gint max_x, max_y;
gint x_root, y_root; gint x_root, y_root;
@ -270,21 +271,27 @@ find_tab_num_at_pos (XedNotebook *notebook,
gtk_widget_get_allocation(tab, &allocation); gtk_widget_get_allocation(tab, &allocation);
max_x = x_root + allocation.x + allocation.width; min_x = x_root + allocation.x;
max_y = y_root + allocation.y + allocation.height; 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) || if (((tab_pos == GTK_POS_TOP) ||
(tab_pos == GTK_POS_BOTTOM)) && (tab_pos == GTK_POS_BOTTOM)) &&
(abs_x <= max_x)) (abs_x <= max_x) &&
{ (abs_y >= min_y) &&
return page_num; (abs_y <= max_y))
} {
else if (((tab_pos == GTK_POS_LEFT) || return page_num;
(tab_pos == GTK_POS_RIGHT)) && }
(abs_y <= max_y)) else if (((tab_pos == GTK_POS_LEFT) ||
{ (tab_pos == GTK_POS_RIGHT)) &&
return page_num; (abs_y <= max_y) &&
} (abs_x >= min_x) &&
(abs_x <= max_x))
{
return page_num;
}
++page_num; ++page_num;
} }