aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/borders.go5
-rw-r--r--lib/ui/box.go6
-rw-r--r--lib/ui/grid.go3
-rw-r--r--lib/ui/interfaces.go6
-rw-r--r--lib/ui/popover.go4
-rw-r--r--lib/ui/tab.go3
-rw-r--r--lib/ui/textinput.go5
-rw-r--r--lib/ui/ui.go2
8 files changed, 18 insertions, 16 deletions
diff --git a/lib/ui/borders.go b/lib/ui/borders.go
index 81d5db61..fb3db6b1 100644
--- a/lib/ui/borders.go
+++ b/lib/ui/borders.go
@@ -1,9 +1,8 @@
package ui
import (
- "github.com/gdamore/tcell/v2"
-
"git.sr.ht/~rjarry/aerc/config"
+ "git.sr.ht/~rockorager/vaxis"
)
const (
@@ -69,7 +68,7 @@ func (bordered *Bordered) Draw(ctx *Context) {
bordered.content.Draw(subctx)
}
-func (bordered *Bordered) MouseEvent(localX int, localY int, event tcell.Event) {
+func (bordered *Bordered) MouseEvent(localX int, localY int, event vaxis.Event) {
if content, ok := bordered.content.(Mouseable); ok {
content.MouseEvent(localX, localY, event)
}
diff --git a/lib/ui/box.go b/lib/ui/box.go
index e13b70f3..fc833b72 100644
--- a/lib/ui/box.go
+++ b/lib/ui/box.go
@@ -4,7 +4,7 @@ import (
"strings"
"git.sr.ht/~rjarry/aerc/config"
- "github.com/gdamore/tcell/v2"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/mattn/go-runewidth"
)
@@ -58,13 +58,13 @@ func (b *Box) Invalidate() {
b.content.Invalidate()
}
-func (b *Box) MouseEvent(localX int, localY int, event tcell.Event) {
+func (b *Box) MouseEvent(localX int, localY int, event vaxis.Event) {
if content, ok := b.content.(Mouseable); ok {
content.MouseEvent(localX, localY, event)
}
}
-func (b *Box) Event(e tcell.Event) bool {
+func (b *Box) Event(e vaxis.Event) bool {
if content, ok := b.content.(Interactive); ok {
return content.Event(e)
}
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index 28640d03..00f759bf 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -4,6 +4,7 @@ import (
"math"
"sync"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/gdamore/tcell/v2"
)
@@ -128,7 +129,7 @@ func (grid *Grid) Draw(ctx *Context) {
}
}
-func (grid *Grid) MouseEvent(localX int, localY int, event tcell.Event) {
+func (grid *Grid) MouseEvent(localX int, localY int, event vaxis.Event) {
if event, ok := event.(*tcell.EventMouse); ok {
grid.mutex.RLock()
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index a8520ff5..8ed727cc 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -1,7 +1,7 @@
package ui
import (
- "github.com/gdamore/tcell/v2"
+ "git.sr.ht/~rockorager/vaxis"
)
// Drawable is a UI component that can draw. Unless specified, all methods must
@@ -24,7 +24,7 @@ type Visible interface {
type Interactive interface {
// Returns true if the event was handled by this component
- Event(event tcell.Event) bool
+ Event(event vaxis.Event) bool
// Indicates whether or not this control will receive input events
Focus(focus bool)
}
@@ -53,7 +53,7 @@ type Container interface {
type MouseHandler interface {
// Handle a mouse event which occurred at the local x and y positions
- MouseEvent(localX int, localY int, event tcell.Event)
+ MouseEvent(localX int, localY int, event vaxis.Event)
}
// A drawable that can be interacted with by the mouse
diff --git a/lib/ui/popover.go b/lib/ui/popover.go
index 9cc491da..5a6d0542 100644
--- a/lib/ui/popover.go
+++ b/lib/ui/popover.go
@@ -1,6 +1,6 @@
package ui
-import "github.com/gdamore/tcell/v2"
+import "git.sr.ht/~rockorager/vaxis"
type Popover struct {
x, y, width, height int
@@ -39,7 +39,7 @@ func (p *Popover) Draw(ctx *Context) {
p.content.Draw(subcontext)
}
-func (p *Popover) Event(e tcell.Event) bool {
+func (p *Popover) Event(e vaxis.Event) bool {
if di, ok := p.content.(DrawableInteractive); ok {
return di.Event(e)
}
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index f5e89064..704b01db 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -7,6 +7,7 @@ import (
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
+ "git.sr.ht/~rockorager/vaxis"
)
const tabRuneWidth int = 32 // TODO: make configurable
@@ -494,7 +495,7 @@ func (content *TabContent) Draw(ctx *Context) {
tab.Content.Draw(ctx)
}
-func (content *TabContent) MouseEvent(localX int, localY int, event tcell.Event) {
+func (content *TabContent) MouseEvent(localX int, localY int, event vaxis.Event) {
content.parent.m.Lock()
tab := content.tabs[content.curIndex]
content.parent.m.Unlock()
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index 32a177e1..0bdcd435 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -11,6 +11,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/log"
+ "git.sr.ht/~rockorager/vaxis"
)
// TODO: Attach history providers
@@ -332,7 +333,7 @@ func (ti *TextInput) OnFocusLost(onFocusLost func(ti *TextInput)) {
ti.focusLost = append(ti.focusLost, onFocusLost)
}
-func (ti *TextInput) Event(event tcell.Event) bool {
+func (ti *TextInput) Event(event vaxis.Event) bool {
ti.Lock()
defer ti.Unlock()
if event, ok := event.(*tcell.EventKey); ok {
@@ -480,7 +481,7 @@ func (c *completions) exec() {
Invalidate()
}
-func (c *completions) Event(e tcell.Event) bool {
+func (c *completions) Event(e vaxis.Event) bool {
if e, ok := e.(*tcell.EventKey); ok {
k := c.ti.completeKey
if k != nil && k.Key == e.Key() && k.Modifiers == e.Modifiers() {
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index b8030949..e13f4f5c 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -139,7 +139,7 @@ func EnableMouse() {
state.screen.EnableMouse()
}
-func HandleEvent(event tcell.Event) {
+func HandleEvent(event vaxis.Event) {
if event, ok := event.(*tcell.EventResize); ok {
state.screen.Clear()
width, height := event.Size()