aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui/tab.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2024-02-12 06:26:23 -0600
committerRobin Jarry <robin@jarry.cc>2024-02-12 13:48:56 +0100
commit58f94fa0a1333dfccfb24f90b22506b29a64397b (patch)
treeb2b9d4e89560f3c022807f6e1e66cc83f2c58de9 /lib/ui/tab.go
parent4d14efc470926b3e0ab61efa6b7cdabae3cf1763 (diff)
downloadaerc-58f94fa0a1333dfccfb24f90b22506b29a64397b.tar.gz
mouse: use vaxis mouse events
Replace all tcell.EventMouse events with vaxis mouse events Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/ui/tab.go')
-rw-r--r--lib/ui/tab.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index 704b01db..5d824955 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -3,7 +3,6 @@ package ui
import (
"sync"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
@@ -407,7 +406,7 @@ func (strip *TabStrip) Invalidate() {
Invalidate()
}
-func (strip *TabStrip) MouseEvent(localX int, localY int, event tcell.Event) {
+func (strip *TabStrip) MouseEvent(localX int, localY int, event vaxis.Event) {
strip.parent.m.Lock()
defer strip.parent.m.Unlock()
changeFocus := func(focus bool) {
@@ -418,9 +417,9 @@ func (strip *TabStrip) MouseEvent(localX int, localY int, event tcell.Event) {
}
unfocus := func() { changeFocus(false) }
refocus := func() { changeFocus(true) }
- if event, ok := event.(*tcell.EventMouse); ok {
- switch event.Buttons() {
- case tcell.Button1:
+ if event, ok := event.(vaxis.Mouse); ok {
+ switch event.Button {
+ case vaxis.MouseLeftButton:
selectedTab, ok := strip.clicked(localX, localY)
if !ok || selectedTab == strip.parent.curIndex {
return
@@ -428,7 +427,7 @@ func (strip *TabStrip) MouseEvent(localX int, localY int, event tcell.Event) {
unfocus()
strip.parent.selectPriv(selectedTab)
refocus()
- case tcell.WheelDown:
+ case vaxis.MouseWheelDown:
unfocus()
index := strip.parent.curIndex + 1
if index >= len(strip.parent.tabs) {
@@ -436,7 +435,7 @@ func (strip *TabStrip) MouseEvent(localX int, localY int, event tcell.Event) {
}
strip.parent.selectPriv(index)
refocus()
- case tcell.WheelUp:
+ case vaxis.MouseWheelUp:
unfocus()
index := strip.parent.curIndex - 1
if index < 0 {
@@ -444,7 +443,7 @@ func (strip *TabStrip) MouseEvent(localX int, localY int, event tcell.Event) {
}
strip.parent.selectPriv(index)
refocus()
- case tcell.Button3:
+ case vaxis.MouseMiddleButton:
selectedTab, ok := strip.clicked(localX, localY)
if !ok {
return