summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2017-01-03 20:01:58 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2017-01-03 20:01:58 +0000
commitd6f6326ce9b6e60fcf9865e726b718ccfbbbea65 (patch)
treed58c0a9c8b9baf397c685c6a3f127096b725ad5a /frontends
parent26b98ac51b2f5a7c3d35050fcf79f521bfdb05f8 (diff)
downloadnetsurf-d6f6326ce9b6e60fcf9865e726b718ccfbbbea65.tar.gz
netsurf-d6f6326ce9b6e60fcf9865e726b718ccfbbbea65.tar.bz2
it's not a double-click if the mouse has moved
Diffstat (limited to 'frontends')
-rw-r--r--frontends/amiga/corewindow.c20
-rw-r--r--frontends/amiga/corewindow.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 59fc3e16b..d3d55ec8f 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -34,6 +34,7 @@
#include "amiga/os3support.h"
#include <assert.h>
+#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -103,6 +104,17 @@ ami_cw_coord_amiga_to_ns(struct ami_corewindow *ami_cw, int *restrict x, int *re
*y = *y + ys;
}
+/**
+ * check if mouse has moved since position was stored
+ * @return true if it has, false otherwise
+ */
+static bool
+ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y)
+{
+ if(abs(x - ami_cw->mouse_x_click) > 5) return true;
+ if(abs(y - ami_cw->mouse_y_click) > 5) return true;
+ return false;
+}
/* get current mouse position in the draw area, adjusted for scroll.
* @return true if the mouse was in the draw area and co-ordinates updated
@@ -494,12 +506,16 @@ ami_cw_event(void *w)
ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
if(ami_cw->lastclick.tv_sec) {
- if(DoubleClick(ami_cw->lastclick.tv_sec,
+ if((ami_cw_mouse_moved(ami_cw, x, y) == false) &&
+ (DoubleClick(ami_cw->lastclick.tv_sec,
ami_cw->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec))
+ curtime.tv_sec, curtime.tv_usec)))
ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
}
+ ami_cw->mouse_x_click = x;
+ ami_cw->mouse_y_click = y;
+
if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
ami_cw->lastclick.tv_sec = 0;
ami_cw->lastclick.tv_usec = 0;
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 8d93882d7..2fa4a23bb 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -54,6 +54,8 @@ struct ami_corewindow {
struct Hook idcmp_hook;
struct timeval lastclick;
+ int mouse_x_click;
+ int mouse_y_click;
int mouse_state;
APTR deferred_rects_pool;