aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/aerc.go6
-rw-r--r--app/compose.go9
-rw-r--r--app/dirlist.go12
-rw-r--r--app/dirtree.go11
-rw-r--r--app/msglist.go11
-rw-r--r--app/partswitcher.go11
-rw-r--r--app/terminal.go9
7 files changed, 30 insertions, 39 deletions
diff --git a/app/aerc.go b/app/aerc.go
index 2d7ca2e9..fd36b72b 100644
--- a/app/aerc.go
+++ b/app/aerc.go
@@ -15,7 +15,6 @@ import (
"git.sr.ht/~rockorager/vaxis"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/emersion/go-message/mail"
- "github.com/gdamore/tcell/v2"
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
@@ -395,9 +394,8 @@ func (aerc *Aerc) Event(event vaxis.Event) bool {
}
return false
}
- case *tcell.EventMouse:
- x, y := event.Position()
- aerc.grid.MouseEvent(x, y, event)
+ case vaxis.Mouse:
+ aerc.grid.MouseEvent(event.Col, event.Row, event)
return true
case vaxis.PasteStartEvent:
aerc.pasting = true
diff --git a/app/compose.go b/app/compose.go
index 7bc3fd66..be8e5563 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -17,7 +17,6 @@ import (
"time"
"github.com/emersion/go-message/mail"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"github.com/pkg/errors"
@@ -1149,8 +1148,8 @@ func (c *Composer) resetReview() {
}
func (c *Composer) termEvent(event vaxis.Event) bool {
- if event, ok := event.(*tcell.EventMouse); ok {
- if event.Buttons() == tcell.Button1 {
+ if event, ok := event.(vaxis.Mouse); ok {
+ if event.Button == vaxis.MouseLeftButton {
c.FocusTerminal()
return true
}
@@ -1568,8 +1567,8 @@ func (he *headerEditor) Draw(ctx *ui.Context) {
}
func (he *headerEditor) MouseEvent(localX int, localY int, event vaxis.Event) {
- if event, ok := event.(*tcell.EventMouse); ok {
- if event.Buttons() == tcell.Button1 {
+ if event, ok := event.(vaxis.Mouse); ok {
+ if event.Button == vaxis.MouseLeftButton {
he.focused = true
}
diff --git a/app/dirlist.go b/app/dirlist.go
index e9228374..71db2b6a 100644
--- a/app/dirlist.go
+++ b/app/dirlist.go
@@ -8,8 +8,6 @@ import (
"sort"
"time"
- "github.com/gdamore/tcell/v2"
-
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/parse"
@@ -376,16 +374,16 @@ func (dirlist *DirectoryList) drawScrollbar(ctx *ui.Context) {
}
func (dirlist *DirectoryList) MouseEvent(localX int, localY int, event vaxis.Event) {
- 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:
clickedDir, ok := dirlist.Clicked(localX, localY)
if ok {
dirlist.Select(clickedDir)
}
- case tcell.WheelDown:
+ case vaxis.MouseWheelDown:
dirlist.Next()
- case tcell.WheelUp:
+ case vaxis.MouseWheelUp:
dirlist.Prev()
}
}
diff --git a/app/dirtree.go b/app/dirtree.go
index 30ef2480..995c8889 100644
--- a/app/dirtree.go
+++ b/app/dirtree.go
@@ -15,7 +15,6 @@ import (
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
"git.sr.ht/~rockorager/vaxis"
- "github.com/gdamore/tcell/v2"
)
type DirectoryTree struct {
@@ -168,16 +167,16 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
}
func (dt *DirectoryTree) MouseEvent(localX int, localY int, event vaxis.Event) {
- 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:
clickedDir, ok := dt.Clicked(localX, localY)
if ok {
dt.Select(clickedDir)
}
- case tcell.WheelDown:
+ case vaxis.MouseWheelDown:
dt.NextPrev(1)
- case tcell.WheelUp:
+ case vaxis.MouseWheelUp:
dt.NextPrev(-1)
}
}
diff --git a/app/msglist.go b/app/msglist.go
index ac0012b4..e46f3f24 100644
--- a/app/msglist.go
+++ b/app/msglist.go
@@ -7,7 +7,6 @@ import (
sortthread "github.com/emersion/go-imap-sortthread"
"github.com/emersion/go-message/mail"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
@@ -272,9 +271,9 @@ func (ml *MessageList) drawScrollbar(ctx *ui.Context) {
}
func (ml *MessageList) MouseEvent(localX int, localY int, event vaxis.Event) {
- 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:
selectedMsg, ok := ml.Clicked(localX, localY)
if ok {
ml.Select(selectedMsg)
@@ -298,12 +297,12 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event vaxis.Event) {
NewTab(viewer, msg.Envelope.Subject)
})
}
- case tcell.WheelDown:
+ case vaxis.MouseWheelDown:
if ml.store != nil {
ml.store.Next()
}
ml.Invalidate()
- case tcell.WheelUp:
+ case vaxis.MouseWheelUp:
if ml.store != nil {
ml.store.Prev()
}
diff --git a/app/partswitcher.go b/app/partswitcher.go
index 5dc996f7..5a935a8c 100644
--- a/app/partswitcher.go
+++ b/app/partswitcher.go
@@ -6,7 +6,6 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rockorager/vaxis"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
)
@@ -168,7 +167,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event vaxis.Event) {
return
}
- e, ok := event.(*tcell.EventMouse)
+ e, ok := event.(vaxis.Mouse)
if !ok {
return
}
@@ -177,8 +176,8 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event vaxis.Event) {
ps.parts[ps.selected].term.Focus(false)
}
- switch e.Buttons() {
- case tcell.Button1:
+ switch e.Button {
+ case vaxis.MouseLeftButton:
i := localY - ps.offset + ps.Scroll()
if i < 0 || i >= len(ps.parts) {
break
@@ -188,10 +187,10 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event vaxis.Event) {
}
ps.selected = i
ps.Invalidate()
- case tcell.WheelDown:
+ case vaxis.MouseWheelDown:
ps.NextPart()
ps.Invalidate()
- case tcell.WheelUp:
+ case vaxis.MouseWheelUp:
ps.PreviousPart()
ps.Invalidate()
}
diff --git a/app/terminal.go b/app/terminal.go
index c4ec374e..4814ff29 100644
--- a/app/terminal.go
+++ b/app/terminal.go
@@ -9,8 +9,6 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rockorager/vaxis"
"git.sr.ht/~rockorager/vaxis/widgets/term"
-
- "github.com/gdamore/tcell/v2"
)
type HasTerminal interface {
@@ -108,7 +106,7 @@ func (term *Terminal) Terminal() *Terminal {
}
func (term *Terminal) MouseEvent(localX int, localY int, event vaxis.Event) {
- ev, ok := event.(*tcell.EventMouse)
+ ev, ok := event.(vaxis.Mouse)
if !ok {
return
}
@@ -118,8 +116,9 @@ func (term *Terminal) MouseEvent(localX int, localY int, event vaxis.Event) {
if term.isClosed() {
return
}
- e := tcell.NewEventMouse(localX, localY, ev.Buttons(), ev.Modifiers())
- term.vterm.Update(e)
+ ev.Row = localY
+ ev.Col = localX
+ term.vterm.Update(ev)
}
func (term *Terminal) Focus(focus bool) {