Commit c0477c2c authored by Carlos Garnacho's avatar Carlos Garnacho
Browse files

GtkNotebook: Use gdouble in coordinate calculations

Otherwise rounding errors fool the "tab under coordinates" checks on
crossing events, which will be triggered close enough to the window
rectangle if the pointer moves slowly enough.

With this, the tab_prelight() function correctly figures out we've
moved the pointer outside the tab area when called in
gtk_notebook_leave_notify().

https://bugzilla.gnome.org/show_bug.cgi?id=759091
parent 5088b493
......@@ -2873,8 +2873,8 @@ gtk_notebook_arrow_button_press (GtkNotebook *notebook,
static gboolean
get_widget_coordinates (GtkWidget *widget,
GdkEvent *event,
gint *x,
gint *y)
gdouble *x,
gdouble *y)
{
GdkWindow *window = ((GdkEventAny *)event)->window;
gdouble tx, ty;
......@@ -2905,7 +2905,9 @@ get_widget_coordinates (GtkWidget *widget,
}
static GList*
get_tab_at_pos (GtkNotebook *notebook, gint x, gint y)
get_tab_at_pos (GtkNotebook *notebook,
gdouble x,
gdouble y)
{
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
......@@ -2939,7 +2941,7 @@ gtk_notebook_button_press (GtkWidget *widget,
GtkNotebookPage *page;
GList *tab;
GtkNotebookArrow arrow;
gint x, y;
gdouble x, y;
if (event->type != GDK_BUTTON_PRESS || !priv->children ||
priv->button)
......@@ -3323,7 +3325,7 @@ tab_prelight (GtkNotebook *notebook,
{
GtkNotebookPrivate *priv = notebook->priv;
GList *tab;
gint x, y;
gdouble x, y;
if (get_widget_coordinates (GTK_WIDGET (notebook), (GdkEvent *)event, &x, &y))
{
......@@ -3354,7 +3356,7 @@ gtk_notebook_leave_notify (GtkWidget *widget,
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
gint x, y;
gdouble x, y;
if (get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment