From 8b91de196c8cb21c57763fe80010edb889a7a8f6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 25 Jan 2005 14:07:46 +0000 Subject: Include code in midend.c to sanitise streams of mouse events so that back ends can be assured of always receiving them in a sensible sequence (button-down, followed by zero or more drags, followed by button-up, and never changing button in the middle of such a sequence). I have a suspicion this issue was the cause of the mysterious Pattern grid updates seen by Dan during testing last night. [originally from svn r5208] --- puzzles.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'puzzles.h') diff --git a/puzzles.h b/puzzles.h index 4de81a7..c80f69b 100644 --- a/puzzles.h +++ b/puzzles.h @@ -34,6 +34,13 @@ enum { CURSOR_DOWN_RIGHT }; +#define IS_MOUSE_DOWN(m) ( (unsigned)((m) - LEFT_BUTTON) <= \ + (unsigned)(RIGHT_BUTTON - LEFT_BUTTON)) +#define IS_MOUSE_DRAG(m) ( (unsigned)((m) - LEFT_DRAG) <= \ + (unsigned)(RIGHT_DRAG - LEFT_DRAG)) +#define IS_MOUSE_RELEASE(m) ( (unsigned)((m) - LEFT_RELEASE) <= \ + (unsigned)(RIGHT_RELEASE - LEFT_RELEASE)) + #define IGNOREARG(x) ( (x) = (x) ) typedef struct frontend frontend; -- cgit v1.1