aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/grid.go3
-rw-r--r--lib/ui/stack.go5
-rw-r--r--lib/ui/tab.go15
-rw-r--r--lib/ui/textinput.go7
4 files changed, 13 insertions, 17 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index 00f759bf..ce3d37d6 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -5,7 +5,6 @@ import (
"sync"
"git.sr.ht/~rockorager/vaxis"
- "github.com/gdamore/tcell/v2"
)
type Grid struct {
@@ -130,7 +129,7 @@ func (grid *Grid) Draw(ctx *Context) {
}
func (grid *Grid) MouseEvent(localX int, localY int, event vaxis.Event) {
- if event, ok := event.(*tcell.EventMouse); ok {
+ if event, ok := event.(vaxis.Mouse); ok {
grid.mutex.RLock()
defer grid.mutex.RUnlock()
diff --git a/lib/ui/stack.go b/lib/ui/stack.go
index a4017007..890ab272 100644
--- a/lib/ui/stack.go
+++ b/lib/ui/stack.go
@@ -4,8 +4,7 @@ import (
"fmt"
"git.sr.ht/~rjarry/aerc/config"
-
- "github.com/gdamore/tcell/v2"
+ "git.sr.ht/~rockorager/vaxis"
)
type Stack struct {
@@ -34,7 +33,7 @@ func (stack *Stack) Draw(ctx *Context) {
}
}
-func (stack *Stack) MouseEvent(localX int, localY int, event tcell.Event) {
+func (stack *Stack) MouseEvent(localX int, localY int, event vaxis.Event) {
if len(stack.children) > 0 {
if element, ok := stack.Peek().(Mouseable); ok {
element.MouseEvent(localX, localY, event)
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
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index d52ee07a..a01184f2 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -6,7 +6,6 @@ import (
"sync"
"time"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
@@ -144,9 +143,9 @@ func (ti *TextInput) drawPopover(ctx *Context) {
ctx.Popover(pos, 0, width, height, cmp)
}
-func (ti *TextInput) MouseEvent(localX int, localY int, event tcell.Event) {
- if event, ok := event.(*tcell.EventMouse); ok {
- if event.Buttons() == tcell.Button1 {
+func (ti *TextInput) MouseEvent(localX int, localY int, event vaxis.Event) {
+ if event, ok := event.(vaxis.Mouse); ok {
+ if event.Button == vaxis.MouseLeftButton {
if localX >= len(ti.prompt)+1 && localX <= len(ti.text[ti.scroll:])+len(ti.prompt)+1 {
ti.index = localX - len(ti.prompt) - 1
ti.ensureScroll()