forked from joejulian/gio
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:
+9
-4
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user