diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2017-01-03 20:01:58 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2017-01-03 20:01:58 +0000 |
commit | d6f6326ce9b6e60fcf9865e726b718ccfbbbea65 (patch) | |
tree | d58c0a9c8b9baf397c685c6a3f127096b725ad5a /frontends/amiga/corewindow.c | |
parent | 26b98ac51b2f5a7c3d35050fcf79f521bfdb05f8 (diff) | |
download | netsurf-d6f6326ce9b6e60fcf9865e726b718ccfbbbea65.tar.gz netsurf-d6f6326ce9b6e60fcf9865e726b718ccfbbbea65.tar.bz2 |
it's not a double-click if the mouse has moved
Diffstat (limited to 'frontends/amiga/corewindow.c')
-rw-r--r-- | frontends/amiga/corewindow.c | 20 |
1 files changed, 18 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; |