diff options
| author | Jonas Kölker <jonaskoelker@yahoo.com> | 2015-09-22 11:18:31 +0200 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2015-10-03 16:59:04 +0100 |
| commit | 8e35087e093876cd12b1a5800c16a068473e9bff (patch) | |
| tree | e862c40d1882ca1e9d943afad9152d9b6cd78c03 | |
| parent | 11a394f69b43ce36e4b0119699a4ae9461d252ee (diff) | |
| download | puzzles-8e35087e093876cd12b1a5800c16a068473e9bff.zip puzzles-8e35087e093876cd12b1a5800c16a068473e9bff.tar.gz puzzles-8e35087e093876cd12b1a5800c16a068473e9bff.tar.bz2 puzzles-8e35087e093876cd12b1a5800c16a068473e9bff.tar.xz | |
Refactor modifier handling in Pearl's cursor code.
| -rw-r--r-- | pearl.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1998,6 +1998,9 @@ static char *interpret_move(const game_state *state, game_ui *ui, int release = FALSE; char tmpbuf[80]; + int shift = button & MOD_SHFT, control = button & MOD_CTRL; + button &= ~MOD_MASK; + if (IS_MOUSE_DOWN(button)) { ui->cursor_active = FALSE; @@ -2020,10 +2023,10 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (IS_MOUSE_RELEASE(button)) release = TRUE; - if (IS_CURSOR_MOVE(button & ~MOD_MASK)) { + if (IS_CURSOR_MOVE(button)) { if (!ui->cursor_active) { ui->cursor_active = TRUE; - } else if (button & (MOD_SHFT | MOD_CTRL)) { + } else if (control | shift) { if (ui->ndragcoords > 0) return NULL; ui->ndragcoords = -1; return mark_in_direction(state, ui->curx, ui->cury, @@ -2037,7 +2040,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, return ""; } - if (IS_CURSOR_SELECT(button & ~MOD_MASK)) { + if (IS_CURSOR_SELECT(button)) { if (!ui->cursor_active) { ui->cursor_active = TRUE; return ""; |