add a drag threshold
This commit is contained in:
parent
e442c6cc56
commit
1588c852ec
1 changed files with 11 additions and 6 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
static int drag_threshold = 3;
|
||||||
|
|
||||||
/* GData of GSList*s of PointerBinding*s. */
|
/* GData of GSList*s of PointerBinding*s. */
|
||||||
static GData *bound_contexts;
|
static GData *bound_contexts;
|
||||||
|
|
||||||
|
@ -270,14 +272,17 @@ static void event(ObEvent *e, void *foo)
|
||||||
|
|
||||||
case Event_X_MotionNotify:
|
case Event_X_MotionNotify:
|
||||||
if (button) {
|
if (button) {
|
||||||
drag = TRUE;
|
|
||||||
dx = e->data.x.e->xmotion.x_root - px;
|
dx = e->data.x.e->xmotion.x_root - px;
|
||||||
dy = e->data.x.e->xmotion.y_root - py;
|
dy = e->data.x.e->xmotion.y_root - py;
|
||||||
context = engine_get_context(e->data.x.client,
|
if (ABS(dx) >= drag_threshold || ABS(dy) >= drag_threshold)
|
||||||
e->data.x.e->xbutton.window);
|
drag = TRUE;
|
||||||
fire_motion(MouseAction_Motion, context,
|
if (drag) {
|
||||||
e->data.x.client, e->data.x.e->xmotion.state,
|
context = engine_get_context(e->data.x.client,
|
||||||
button, cx, cy, cw, ch, dx, dy, FALSE, corner);
|
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;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue