From a098626ff1c87726551419448c8b01b05aff20b9 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 21 May 2015 13:04:29 +0100 Subject: Fix warnings about using integer absolute operations on floating point values --- gtk/treeview.c | 15 +++++++++------ gtk/window.c | 16 +++++++++------- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'gtk') diff --git a/gtk/treeview.c b/gtk/treeview.c index 71e63184f..9613f11fd 100644 --- a/gtk/treeview.c +++ b/gtk/treeview.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -330,14 +331,16 @@ nsgtk_tree_window_motion_notify_event(GtkWidget *widget, if (tw->mouse_pressed == false) return TRUE; - if ((abs(event->x - tw->last_x) < 5) && - (abs(event->y - tw->last_y) < 5)) { - /* Mouse hasn't moved far enough from press coordinate for this - * to be considered a drag. */ + if ((fabs(event->x - tw->last_x) < 5.0) && + (fabs(event->y - tw->last_y) < 5.0)) { + /* Mouse hasn't moved far enough from press coordinate + * for this to be considered a drag. + */ return FALSE; } else { - /* This is a drag, ensure it's always treated as such, even if - * we drag back over the press location */ + /* This is a drag, ensure it's always treated as such, + * even if we drag back over the press location. + */ tw->last_x = INT_MIN; tw->last_y = INT_MIN; } diff --git a/gtk/window.c b/gtk/window.c index 9acdb3d03..375f232a8 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -26,7 +26,7 @@ #include #include #include - +#include #include #include #include @@ -290,14 +290,16 @@ static gboolean nsgtk_window_motion_notify_event(GtkWidget *widget, bool shift = event->state & GDK_SHIFT_MASK; bool ctrl = event->state & GDK_CONTROL_MASK; - if ((abs(event->x - g->last_x) < 5) && - (abs(event->y - g->last_y) < 5)) { - /* Mouse hasn't moved far enough from press coordinate for this - * to be considered a drag. */ + if ((fabs(event->x - g->last_x) < 5.0) && + (fabs(event->y - g->last_y) < 5.0)) { + /* Mouse hasn't moved far enough from press coordinate + * for this to be considered a drag. + */ return FALSE; } else { - /* This is a drag, ensure it's always treated as such, even if - * we drag back over the press location */ + /* This is a drag, ensure it's always treated as such, + * even if we drag back over the press location. + */ g->last_x = INT_MIN; g->last_y = INT_MIN; } -- cgit v1.2.3