io/router: support cursor changes on Frame events

Add support to Router so that the cursor can be changed with CursorNameOp without any mouse movement.
Enter and Leave events are also delivered as areas change.

Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
pierre
2021-01-27 19:56:47 +01:00
committed by Elias Naur
parent c3346680f4
commit 1100e03c1e
3 changed files with 47 additions and 5 deletions
+9 -4
View File
@@ -409,6 +409,7 @@ func (w *Window) run(opts *window.Options) {
w.destroy(err)
return
}
w.updateCursor()
case *system.CommandEvent:
w.out <- e
w.waitAck()
@@ -424,10 +425,7 @@ func (w *Window) run(opts *window.Options) {
w.setNextFrame(time.Time{})
w.updateAnimation()
}
if c := w.queue.q.Cursor(); c != w.cursor {
w.cursor = c
w.SetCursorName(c)
}
w.updateCursor()
w.out <- e
}
w.ack <- struct{}{}
@@ -435,6 +433,13 @@ func (w *Window) run(opts *window.Options) {
}
}
func (w *Window) updateCursor() {
if c := w.queue.q.Cursor(); c != w.cursor {
w.cursor = c
w.SetCursorName(c)
}
}
func (q *queue) Events(k event.Tag) []event.Event {
return q.q.Events(k)
}