diff options
author | Milan Crha <mcrha@redhat.com> | 2014-03-24 23:21:49 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-03-24 23:22:23 +0800 |
commit | ec1862c1497ac44f89c1fe3d92d922b525da96d9 (patch) | |
tree | ffc0b976d290f211bb405c2570ac177387135db5 | |
parent | eee485721077c5043608a441e5d2f66f536b5ad0 (diff) | |
download | gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar.gz gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar.bz2 gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar.lz gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar.xz gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.tar.zst gsoc2013-evolution-ec1862c1497ac44f89c1fe3d92d922b525da96d9.zip |
Bug #726110 - Use gtk_drag_check_threshold() instead of hard-coded values
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 5 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 14 | ||||
-rw-r--r-- | e-util/e-table-field-chooser-item.c | 8 | ||||
-rw-r--r-- | e-util/e-table-header-item.c | 8 | ||||
-rw-r--r-- | e-util/e-table-item.c | 3 |
5 files changed, 14 insertions, 24 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index e48c5321a6..c1226653bc 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -630,8 +630,9 @@ e_minicard_event (GnomeCanvasItem *item, break; case GDK_MOTION_NOTIFY: if (e_minicard->drag_button_down && event->motion.state & GDK_BUTTON1_MASK) { - if (MAX (abs (e_minicard->button_x - event->motion.x), - abs (e_minicard->button_y - event->motion.y)) > 3) { + if (gtk_drag_check_threshold (GTK_WIDGET (item->canvas), + e_minicard->button_x, e_minicard->button_y, + event->motion.x, event->motion.y)) { gint ret_val; ret_val = e_minicard_drag_begin (e_minicard, event); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 304e02468e..919f1141c2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -75,10 +75,6 @@ /* The number of timeouts we skip before we start scrolling. */ #define E_DAY_VIEW_AUTO_SCROLL_DELAY 5 -/* The number of pixels the mouse has to be moved with the button down before - * we start a drag. */ -#define E_DAY_VIEW_DRAG_START_OFFSET 4 - /* The amount we scroll the main canvas when the Page Up/Down keys are pressed, * as a fraction of the page size. */ #define E_DAY_VIEW_PAGE_STEP 0.5 @@ -4669,10 +4665,7 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, return FALSE; if (!e_cal_util_component_has_recurrences (event->comp_data->icalcomp) - && (abs (canvas_x - day_view->drag_event_x) - > E_DAY_VIEW_DRAG_START_OFFSET - || abs (canvas_y - day_view->drag_event_y) - > E_DAY_VIEW_DRAG_START_OFFSET)) { + && gtk_drag_check_threshold (widget, day_view->drag_event_x, day_view->drag_event_y, canvas_x, canvas_y)) { day_view->drag_event_day = day_view->pressed_event_day; day_view->drag_event_num = day_view->pressed_event_num; day_view->pressed_event_day = -1; @@ -4781,10 +4774,7 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, && day_view->pressed_event_day != E_DAY_VIEW_LONG_EVENT) { GtkTargetList *target_list; - if ((abs (canvas_x - day_view->drag_event_x) - > E_DAY_VIEW_DRAG_START_OFFSET - || abs (canvas_y - day_view->drag_event_y) - > E_DAY_VIEW_DRAG_START_OFFSET)) { + if (gtk_drag_check_threshold (widget, day_view->drag_event_x, day_view->drag_event_y, canvas_x, canvas_y)) { day_view->drag_event_day = day_view->pressed_event_day; day_view->drag_event_num = day_view->pressed_event_num; day_view->pressed_event_day = -1; diff --git a/e-util/e-table-field-chooser-item.c b/e-util/e-table-field-chooser-item.c index a12ddc6ff7..d713bc3359 100644 --- a/e-util/e-table-field-chooser-item.c +++ b/e-util/e-table-field-chooser-item.c @@ -549,14 +549,14 @@ etfci_maybe_start_drag (ETableFieldChooserItem *etfci, gint x, gint y) { + GnomeCanvasItem *item; + if (!etfci->maybe_drag) return FALSE; - if (MAX (abs (etfci->click_x - x), - abs (etfci->click_y - y)) <= 3) - return FALSE; + item = GNOME_CANVAS_ITEM (etfci); - return TRUE; + return gtk_drag_check_threshold (GTK_WIDGET (item->canvas), etfci->click_x, etfci->click_y, x, y); } static void diff --git a/e-util/e-table-header-item.c b/e-util/e-table-header-item.c index 1f139a67f7..0b93d01433 100644 --- a/e-util/e-table-header-item.c +++ b/e-util/e-table-header-item.c @@ -1202,6 +1202,8 @@ static gboolean ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event) { + GnomeCanvasItem *item; + if (!ethi->maybe_drag) return FALSE; @@ -1210,11 +1212,9 @@ ethi_maybe_start_drag (ETableHeaderItem *ethi, return FALSE; } - if (MAX (abs (ethi->click_x - event->x), - abs (ethi->click_y - event->y)) <= 3) - return FALSE; + item = GNOME_CANVAS_ITEM (ethi); - return TRUE; + return gtk_drag_check_threshold (GTK_WIDGET (item->canvas), ethi->click_x, ethi->click_y, event->x, event->y); } static void diff --git a/e-util/e-table-item.c b/e-util/e-table-item.c index f48bd3eeb2..9066d6d1d6 100644 --- a/e-util/e-table-item.c +++ b/e-util/e-table-item.c @@ -2745,8 +2745,7 @@ eti_event (GnomeCanvasItem *item, gnome_canvas_item_w2i (item, &event_x_item, &event_y_item); if (eti->maybe_in_drag) { - if (abs (event_x_item - eti->drag_x) >= 3 || - abs (event_y_item - eti->drag_y) >= 3) { + if (gtk_drag_check_threshold (GTK_WIDGET (item->canvas), eti->drag_x, eti->drag_y, event_x_item, event_y_item)) { gboolean drag_handled; eti->maybe_in_drag = 0; |