[gtk+/gtk-3-18] GtkNotebook: Use gdouble in coordinate calculations
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] GtkNotebook: Use gdouble in coordinate calculations
- Date: Mon, 7 Dec 2015 16:42:49 +0000 (UTC)
commit 7859628b22f6b869013aaab2257aa3632e15b6c5
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 7 16:32:15 2015 +0100
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
gtk/gtknotebook.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 8048dab..cfa68bb 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2837,8 +2837,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;
@@ -2869,7 +2869,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;
@@ -2903,7 +2905,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)
@@ -3282,7 +3284,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))
{
@@ -3313,7 +3315,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))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]