diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2018-12-18 18:22:50 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2018-12-20 14:32:18 +0300 |
| commit | b1f5639d8cbc9b0a8525e1fcc76a4000f7852ded (patch) | |
| tree | 0f9bdbe27e1359f0655cf31ab01dc1695578f715 /src/keys.cc | |
| parent | cb798fa369cbf58e8373c1c3afc10995835eb367 (diff) | |
src: Add support for right click events
The current implementation treats left mouse button clicks as a
generic "mouse press" modifier, this commit extends the list of
modifiers by adding a "right mouse click" one.
The proper way to implement this would be to ship the coordinates
of mouse key press events in each `Key` object, and pass whichever
button was clicked as a codepoint value (instead of coordinates
currently), but this would require more work.
This commit allows:
* right clicks to set the cursor of the main selection
* control-right clicks to merge all the selections, and then set
its cursor
Fixes #843
Diffstat (limited to 'src/keys.cc')
| -rw-r--r-- | src/keys.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/keys.cc b/src/keys.cc index e4318707..e624767c 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -152,10 +152,14 @@ String key_to_str(Key key) { case Key::Modifiers::MousePos: return format("<mouse:move:{}.{}>", coord.line, coord.column); - case Key::Modifiers::MousePress: - return format("<mouse:press:{}.{}>", coord.line, coord.column); - case Key::Modifiers::MouseRelease: - return format("<mouse:release:{}.{}>", coord.line, coord.column); + case Key::Modifiers::MousePressLeft: + return format("<mouse:press_left:{}.{}>", coord.line, coord.column); + case Key::Modifiers::MousePressRight: + return format("<mouse:press_right:{}.{}>", coord.line, coord.column); + case Key::Modifiers::MouseReleaseLeft: + return format("<mouse:release_left:{}.{}>", coord.line, coord.column); + case Key::Modifiers::MouseReleaseRight: + return format("<mouse:release_right:{}.{}>", coord.line, coord.column); case Key::Modifiers::MouseWheelDown: return "<mouse:wheel_down>"; case Key::Modifiers::MouseWheelUp: |
