aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2024-02-12 06:26:15 -0600
committerRobin Jarry <robin@jarry.cc>2024-02-12 13:48:42 +0100
commit63b9706441719b53b3504733c51c2387fce9019d (patch)
treed541ead04cfe5082631c7bfd6bd019128cc8cc0b /app
parent4e26faf498b84b90ecd1af3bd6c6e1f2f3e44a6e (diff)
downloadaerc-63b9706441719b53b3504733c51c2387fce9019d.tar.gz
aerc: change event interfaces to vaxis events
Modify the function signature of Event and MouseEvent interfaces to accept vaxis events. Note that because a vaxis event is an empty interface, the implementations are not affected and the events are delivered as they were before Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r--app/account-wizard.go3
-rw-r--r--app/account.go5
-rw-r--r--app/aerc.go3
-rw-r--r--app/compose.go11
-rw-r--r--app/dirlist.go3
-rw-r--r--app/dirtree.go3
-rw-r--r--app/exline.go3
-rw-r--r--app/getpasswd.go3
-rw-r--r--app/listbox.go3
-rw-r--r--app/msglist.go3
-rw-r--r--app/msgviewer.go7
-rw-r--r--app/partswitcher.go5
-rw-r--r--app/selector.go5
-rw-r--r--app/terminal.go7
14 files changed, 37 insertions, 27 deletions
diff --git a/app/account-wizard.go b/app/account-wizard.go
index 9ee69627..e47acc53 100644
--- a/app/account-wizard.go
+++ b/app/account-wizard.go
@@ -22,6 +22,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/lib/xdg"
"git.sr.ht/~rjarry/aerc/log"
+ "git.sr.ht/~rockorager/vaxis"
)
const (
@@ -747,7 +748,7 @@ func (wizard *AccountWizard) Focus(focus bool) {
}
}
-func (wizard *AccountWizard) Event(event tcell.Event) bool {
+func (wizard *AccountWizard) Event(event vaxis.Event) bool {
interactive := wizard.getInteractive()
if event, ok := event.(*tcell.EventKey); ok {
switch event.Key() {
diff --git a/app/account.go b/app/account.go
index 5b540523..4b5fa30b 100644
--- a/app/account.go
+++ b/app/account.go
@@ -7,8 +7,6 @@ import (
"sync"
"time"
- "github.com/gdamore/tcell/v2"
-
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/hooks"
@@ -21,6 +19,7 @@ import (
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rockorager/vaxis"
)
var _ ProvidesMessages = (*AccountView)(nil)
@@ -168,7 +167,7 @@ func (acct *AccountView) Draw(ctx *ui.Context) {
acct.grid.Draw(ctx)
}
-func (acct *AccountView) MouseEvent(localX int, localY int, event tcell.Event) {
+func (acct *AccountView) MouseEvent(localX int, localY int, event vaxis.Event) {
acct.grid.MouseEvent(localX, localY, event)
}
diff --git a/app/aerc.go b/app/aerc.go
index 261e1af7..f4ad531a 100644
--- a/app/aerc.go
+++ b/app/aerc.go
@@ -11,6 +11,7 @@ import (
"time"
"git.sr.ht/~rjarry/go-opt"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/emersion/go-message/mail"
"github.com/gdamore/tcell/v2"
@@ -308,7 +309,7 @@ func (aerc *Aerc) simulate(strokes []config.KeyStroke) {
}
}
-func (aerc *Aerc) Event(event tcell.Event) bool {
+func (aerc *Aerc) Event(event vaxis.Event) bool {
if aerc.dialog != nil {
return aerc.dialog.Event(event)
}
diff --git a/app/compose.go b/app/compose.go
index d7a0b1c8..7bc3fd66 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -31,6 +31,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rockorager/vaxis"
)
type Composer struct {
@@ -751,7 +752,7 @@ func (c *Composer) focusActiveWidget(focus bool) {
}
}
-func (c *Composer) Event(event tcell.Event) bool {
+func (c *Composer) Event(event vaxis.Event) bool {
c.Lock()
defer c.Unlock()
if w := c.focusedWidget(); c.editor != nil && w != nil {
@@ -760,7 +761,7 @@ func (c *Composer) Event(event tcell.Event) bool {
return false
}
-func (c *Composer) MouseEvent(localX int, localY int, event tcell.Event) {
+func (c *Composer) MouseEvent(localX int, localY int, event vaxis.Event) {
c.Lock()
for _, e := range c.focusable {
he, ok := e.(*headerEditor)
@@ -1147,7 +1148,7 @@ func (c *Composer) resetReview() {
}
}
-func (c *Composer) termEvent(event tcell.Event) bool {
+func (c *Composer) termEvent(event vaxis.Event) bool {
if event, ok := event.(*tcell.EventMouse); ok {
if event.Buttons() == tcell.Button1 {
c.FocusTerminal()
@@ -1566,7 +1567,7 @@ func (he *headerEditor) Draw(ctx *ui.Context) {
he.input.Draw(ctx.Subcontext(size, 0, ctx.Width()-size, 1))
}
-func (he *headerEditor) MouseEvent(localX int, localY int, event tcell.Event) {
+func (he *headerEditor) MouseEvent(localX int, localY int, event vaxis.Event) {
if event, ok := event.(*tcell.EventMouse); ok {
if event.Buttons() == tcell.Button1 {
he.focused = true
@@ -1588,7 +1589,7 @@ func (he *headerEditor) Focus(focused bool) {
he.input.Focus(focused)
}
-func (he *headerEditor) Event(event tcell.Event) bool {
+func (he *headerEditor) Event(event vaxis.Event) bool {
return he.input.Event(event)
}
diff --git a/app/dirlist.go b/app/dirlist.go
index d260d7c1..53aeed9d 100644
--- a/app/dirlist.go
+++ b/app/dirlist.go
@@ -19,6 +19,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rockorager/vaxis"
)
type DirectoryLister interface {
@@ -374,7 +375,7 @@ func (dirlist *DirectoryList) drawScrollbar(ctx *ui.Context) {
ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle)
}
-func (dirlist *DirectoryList) MouseEvent(localX int, localY int, event tcell.Event) {
+func (dirlist *DirectoryList) MouseEvent(localX int, localY int, event vaxis.Event) {
if event, ok := event.(*tcell.EventMouse); ok {
switch event.Buttons() {
case tcell.Button1:
diff --git a/app/dirtree.go b/app/dirtree.go
index ce9bd27e..30ef2480 100644
--- a/app/dirtree.go
+++ b/app/dirtree.go
@@ -14,6 +14,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/gdamore/tcell/v2"
)
@@ -166,7 +167,7 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
}
}
-func (dt *DirectoryTree) MouseEvent(localX int, localY int, event tcell.Event) {
+func (dt *DirectoryTree) MouseEvent(localX int, localY int, event vaxis.Event) {
if event, ok := event.(*tcell.EventMouse); ok {
switch event.Buttons() {
case tcell.Button1:
diff --git a/app/exline.go b/app/exline.go
index 61fc340a..7eb6fde3 100644
--- a/app/exline.go
+++ b/app/exline.go
@@ -6,6 +6,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/ui"
+ "git.sr.ht/~rockorager/vaxis"
)
type ExLine struct {
@@ -81,7 +82,7 @@ func (ex *ExLine) Focus(focus bool) {
ex.input.Focus(focus)
}
-func (ex *ExLine) Event(event tcell.Event) bool {
+func (ex *ExLine) Event(event vaxis.Event) bool {
if event, ok := event.(*tcell.EventKey); ok {
switch event.Key() {
case tcell.KeyEnter, tcell.KeyCtrlJ:
diff --git a/app/getpasswd.go b/app/getpasswd.go
index 9a3dbf3b..8781bce7 100644
--- a/app/getpasswd.go
+++ b/app/getpasswd.go
@@ -7,6 +7,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
+ "git.sr.ht/~rockorager/vaxis"
)
type GetPasswd struct {
@@ -44,7 +45,7 @@ func (gp *GetPasswd) Invalidate() {
ui.Invalidate()
}
-func (gp *GetPasswd) Event(event tcell.Event) bool {
+func (gp *GetPasswd) Event(event vaxis.Event) bool {
switch event := event.(type) {
case *tcell.EventKey:
switch event.Key() {
diff --git a/app/listbox.go b/app/listbox.go
index 7d1a4f27..d22eea1b 100644
--- a/app/listbox.go
+++ b/app/listbox.go
@@ -9,6 +9,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
)
@@ -228,7 +229,7 @@ func (lb *ListBox) Invalidate() {
ui.Invalidate()
}
-func (lb *ListBox) Event(event tcell.Event) bool {
+func (lb *ListBox) Event(event vaxis.Event) bool {
showFilter := lb.showFilterField()
if event, ok := event.(*tcell.EventKey); ok {
switch event.Key() {
diff --git a/app/msglist.go b/app/msglist.go
index 38970123..49529811 100644
--- a/app/msglist.go
+++ b/app/msglist.go
@@ -17,6 +17,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rockorager/vaxis"
)
type MessageList struct {
@@ -270,7 +271,7 @@ func (ml *MessageList) drawScrollbar(ctx *ui.Context) {
ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle)
}
-func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
+func (ml *MessageList) MouseEvent(localX int, localY int, event vaxis.Event) {
if event, ok := event.(*tcell.EventMouse); ok {
switch event.Buttons() {
case tcell.Button1:
diff --git a/app/msgviewer.go b/app/msgviewer.go
index 8d2e380a..a22d2c15 100644
--- a/app/msgviewer.go
+++ b/app/msgviewer.go
@@ -13,7 +13,6 @@ import (
"github.com/danwakefield/fnmatch"
"github.com/emersion/go-message/textproto"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
@@ -286,7 +285,7 @@ func (mv *MessageViewer) Draw(ctx *ui.Context) {
mv.grid.Draw(ctx)
}
-func (mv *MessageViewer) MouseEvent(localX int, localY int, event tcell.Event) {
+func (mv *MessageViewer) MouseEvent(localX int, localY int, event vaxis.Event) {
if mv.err != nil {
return
}
@@ -398,7 +397,7 @@ func (mv *MessageViewer) Close() {
}
}
-func (mv *MessageViewer) Event(event tcell.Event) bool {
+func (mv *MessageViewer) Event(event vaxis.Event) bool {
return mv.switcher.Event(event)
}
@@ -824,7 +823,7 @@ func (pv *PartViewer) resized(ctx *ui.Context) bool {
return false
}
-func (pv *PartViewer) Event(event tcell.Event) bool {
+func (pv *PartViewer) Event(event vaxis.Event) bool {
if pv.term != nil {
return pv.term.Event(event)
}
diff --git a/app/partswitcher.go b/app/partswitcher.go
index 3f070c44..8552d32b 100644
--- a/app/partswitcher.go
+++ b/app/partswitcher.go
@@ -5,6 +5,7 @@ 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"
)
@@ -79,7 +80,7 @@ func (ps *PartSwitcher) Show(visible bool) {
}
}
-func (ps *PartSwitcher) Event(event tcell.Event) bool {
+func (ps *PartSwitcher) Event(event vaxis.Event) bool {
return ps.parts[ps.selected].Event(event)
}
@@ -161,7 +162,7 @@ func (ps *PartSwitcher) drawScrollbar(ctx *ui.Context) {
ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle)
}
-func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
+func (ps *PartSwitcher) MouseEvent(localX int, localY int, event vaxis.Event) {
if localY < ps.offset && ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
return
diff --git a/app/selector.go b/app/selector.go
index 7f4730d0..fe8c4d96 100644
--- a/app/selector.go
+++ b/app/selector.go
@@ -9,6 +9,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
+ "git.sr.ht/~rockorager/vaxis"
)
type Selector struct {
@@ -143,7 +144,7 @@ func (sel *Selector) Focus(focus bool) {
sel.Invalidate()
}
-func (sel *Selector) Event(event tcell.Event) bool {
+func (sel *Selector) Event(event vaxis.Event) bool {
if event, ok := event.(*tcell.EventKey); ok {
switch event.Key() {
case tcell.KeyCtrlH:
@@ -239,7 +240,7 @@ func (gp *SelectorDialog) Invalidate() {
ui.Invalidate()
}
-func (gp *SelectorDialog) Event(event tcell.Event) bool {
+func (gp *SelectorDialog) Event(event vaxis.Event) bool {
switch event := event.(type) {
case *tcell.EventKey:
switch event.Key() {
diff --git a/app/terminal.go b/app/terminal.go
index f0335de3..c99af26a 100644
--- a/app/terminal.go
+++ b/app/terminal.go
@@ -8,6 +8,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
tcellterm "git.sr.ht/~rockorager/tcell-term"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/gdamore/tcell/v2"
)
@@ -26,7 +27,7 @@ type Terminal struct {
running bool
OnClose func(err error)
- OnEvent func(event tcell.Event) bool
+ OnEvent func(event vaxis.Event) bool
OnStart func()
OnTitle func(title string)
}
@@ -124,7 +125,7 @@ func (term *Terminal) Terminal() *Terminal {
return term
}
-func (term *Terminal) MouseEvent(localX int, localY int, event tcell.Event) {
+func (term *Terminal) MouseEvent(localX int, localY int, event vaxis.Event) {
ev, ok := event.(*tcell.EventMouse)
if !ok {
return
@@ -176,7 +177,7 @@ func (term *Terminal) HandleEvent(ev tcell.Event) {
}
}
-func (term *Terminal) Event(event tcell.Event) bool {
+func (term *Terminal) Event(event vaxis.Event) bool {
if term.OnEvent != nil {
if term.OnEvent(event) {
return true