ref: 8e35087e093876cd12b1a5800c16a068473e9bff
parent: 11a394f69b43ce36e4b0119699a4ae9461d252ee
author: Jonas Kölker <jonaskoelker@yahoo.com>
date: Tue Sep 22 07:18:31 EDT 2015
Refactor modifier handling in Pearl's cursor code.
--- a/pearl.c
+++ b/pearl.c
@@ -1998,6 +1998,9 @@
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 @@
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 @@
return "";
}
- if (IS_CURSOR_SELECT(button & ~MOD_MASK)) {
+ if (IS_CURSOR_SELECT(button)) {
if (!ui->cursor_active) {
ui->cursor_active = TRUE;
return "";