diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-05-31 18:38:01 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-05-31 18:38:01 +0000 |
| commit | a50a65120c3b4230b6a1b95a52c8b6d3299a43c7 (patch) | |
| tree | efc4109cb80592e582561805dd707f2f2a43f388 /midend.c | |
| parent | 437b69542fc34ae48bee14dc821ef9df1c71c62a (diff) | |
| download | puzzles-a50a65120c3b4230b6a1b95a52c8b6d3299a43c7.zip puzzles-a50a65120c3b4230b6a1b95a52c8b6d3299a43c7.tar.gz puzzles-a50a65120c3b4230b6a1b95a52c8b6d3299a43c7.tar.bz2 puzzles-a50a65120c3b4230b6a1b95a52c8b6d3299a43c7.tar.xz | |
Better mouse button handling in Mines:
- middle button now also triggers the clear-around-square action
- a special-case handler in midend_process_key() arranges that the
left button always trumps the right button if both are pressed
together, meaning that Windows Minesweeper players used to
pressing L+R to clear around a square should still be able to do
so without any strange behaviour.
(The latter touches all game backends, yet again, to add a field to
the game structure which is zero in everything except Mines.)
[originally from svn r5888]
Diffstat (limited to 'midend.c')
| -rw-r--r-- | midend.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -441,6 +441,14 @@ int midend_process_key(midend_data *me, int x, int y, int button) * pressed, invent a button-up for the first one and then * pass the button-down through as before. * + * 2005-05-31: An addendum to the above. Some games might want + * a `priority order' among buttons, such that if one button is + * pressed while another is down then a fixed one of the + * buttons takes priority no matter what order they're pressed + * in. Mines, in particular, wants to treat a left+right click + * like a left click for the benefit of users of other + * implementations. So the last of the above points is modified + * in the presence of an (optional) button priority order. */ if (IS_MOUSE_DRAG(button) || IS_MOUSE_RELEASE(button)) { if (me->pressed_mouse_button) { @@ -454,6 +462,14 @@ int midend_process_key(midend_data *me, int x, int y, int button) } else return ret; /* ignore it */ } else if (IS_MOUSE_DOWN(button) && me->pressed_mouse_button) { + /* + * If the new button has lower priority than the old one, + * don't bother doing this. + */ + if (me->ourgame->mouse_priorities & + BUTTON_BEATS(me->pressed_mouse_button, button)) + return ret; /* just ignore it */ + /* * Fabricate a button-up for the previously pressed button. */ |