curses: ncurses vs Ctrl+Click

Asking curses to report whether the Ctrl key was being pressed during
a mouse click was sending mouse position reports--even those aren't
being requested--and actual Ctrl+Left_click was reporting a pair of
duplicate Ctrl+Mouse_position_report events when a click was actually
performed.  So turn off Ctrl key reporting.

Mac with one-button mouse can be configured to send "secondary click"
for Ctrl+Click.  A laptop trackpad handles that differently (press the
button while two fingers are on the touchpad to send secondary click)
and doesn't support Ctrl+Click as an alternate way to do that.  If this
would work within curses then they could operate the same regardless
of how the user set the mouse or trackpad configuraiton.  But I wasn't
able to make it work right.
This commit is contained in:
PatR
2019-07-09 18:55:10 -07:00
parent 9eefeef5d2
commit 0e8163e341
2 changed files with 19 additions and 8 deletions
+14 -7
View File
@@ -877,13 +877,20 @@ curses_convert_keys(int key)
return ret;
}
/* we treat buttons 2 and 3 as equivalent so that it doesn't matter which
one is for right-click and which for middle-click; the core uses CLICK_2
for right-click ("not left" click) even though 2 might be middle button;
we also support Ctrl+left-click as another way to get "not left" click
since Mac is traditionally saddled with a one button mouse or trackpad */
#define MOUSEBUTTONS ((BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED) \
| BUTTON_CTRL)
/*
* We treat buttons 2 and 3 as equivalent so that it doesn't matter which
* one is for right-click and which for middle-click. The core uses CLICK_2
* for right-click ("not left"-click) even though 2 might be middle button.
*
* BUTTON_CTRL was enabled at one point but was not working as intended.
* Ctrl+left_click was generating pairs of duplicated events with Ctrl and
* Report_mouse_position bits set (even though Report_mouse_position wasn't
* enabled) but no button click bit set. (It sort of worked because Ctrl+
* Report_mouse_position wasn't a left click so passed along CLICK_2, but
* the duplication made that too annoying to use. Attempting to immediately
* drain the second one wasn't working as intended either.)
*/
#define MOUSEBUTTONS (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED)
/* Process mouse events. Mouse movement is processed until no further
mouse movement events are available. Returns 0 for a mouse click