Skip to content

Commit

Permalink
Allow more mouse modifiers and include them on mousewheel events
Browse files Browse the repository at this point in the history
  • Loading branch information
Kavantix committed Dec 27, 2021
1 parent 5799ff9 commit 80d357f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions keybinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ const (

// Modifiers.
const (
ModNone Modifier = Modifier(0)
ModAlt = Modifier(tcell.ModAlt)
// ModCtrl doesn't work with keyboard keys. Use CtrlKey in Key and ModNone. This is was for mouse clicks only (tcell.v1)
// ModCtrl = Modifier(tcell.ModCtrl)
ModNone Modifier = Modifier(0)
ModAlt = Modifier(tcell.ModAlt)
ModMouseAlt = Modifier(tcell.ModAlt)
ModMouseShift = Modifier(tcell.ModShift)
ModMouseCtrl = Modifier(tcell.ModCtrl)
)
4 changes: 4 additions & 0 deletions tcell_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,19 @@ func pollEvent() gocuiEvent {
// process mouse wheel
if button&tcell.WheelUp != 0 {
mouseKey = MouseWheelUp
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelDown != 0 {
mouseKey = MouseWheelDown
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelLeft != 0 {
mouseKey = MouseWheelLeft
mouseMod = Modifier(tev.Modifiers())
}
if button&tcell.WheelRight != 0 {
mouseKey = MouseWheelRight
mouseMod = Modifier(tev.Modifiers())
}

// process button events (not wheel events)
Expand Down

0 comments on commit 80d357f

Please sign in to comment.