From: Dana Jansens Date: Wed, 19 Mar 2003 19:25:31 +0000 (+0000) Subject: add a drag threshold X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=1588c852ec33d395834a4c30a5a4ddebc42489b7;p=chaz%2Fopenbox add a drag threshold --- diff --git a/plugins/mouse/mouse.c b/plugins/mouse/mouse.c index 0cb6b5c0..cd2320a1 100644 --- a/plugins/mouse/mouse.c +++ b/plugins/mouse/mouse.c @@ -9,6 +9,8 @@ #include "mouse.h" #include +static int drag_threshold = 3; + /* GData of GSList*s of PointerBinding*s. */ static GData *bound_contexts; @@ -270,14 +272,17 @@ static void event(ObEvent *e, void *foo) case Event_X_MotionNotify: if (button) { - drag = TRUE; dx = e->data.x.e->xmotion.x_root - px; dy = e->data.x.e->xmotion.y_root - py; - context = engine_get_context(e->data.x.client, - e->data.x.e->xbutton.window); - fire_motion(MouseAction_Motion, context, - e->data.x.client, e->data.x.e->xmotion.state, - button, cx, cy, cw, ch, dx, dy, FALSE, corner); + if (ABS(dx) >= drag_threshold || ABS(dy) >= drag_threshold) + drag = TRUE; + if (drag) { + context = engine_get_context(e->data.x.client, + e->data.x.e->xbutton.window); + fire_motion(MouseAction_Motion, context, + e->data.x.client, e->data.x.e->xmotion.state, + button, cx, cy, cw, ch, dx, dy, FALSE, corner); + } } break;