forked from joejulian/gio
layout,io/input: [API] change Context.Disabled to only disable events
Also unexport Source.Enabled because the nil-ness of its embedded router is now an implementation detail. Fixes: https://todo.sr.ht/~eliasnaur/gio/605 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-5
@@ -171,22 +171,22 @@ func (q *Router) Source() Source {
|
||||
|
||||
// Execute a command.
|
||||
func (s Source) Execute(c Command) {
|
||||
if !s.Enabled() {
|
||||
if !s.enabled() {
|
||||
return
|
||||
}
|
||||
s.r.execute(c)
|
||||
}
|
||||
|
||||
// Enabled reports whether the source is enabled. Only enabled
|
||||
// enabled reports whether the source is enabled. Only enabled
|
||||
// Sources deliver events and respond to commands.
|
||||
func (s Source) Enabled() bool {
|
||||
func (s Source) enabled() bool {
|
||||
return s.r != nil
|
||||
}
|
||||
|
||||
// Focused reports whether tag is focused, according to the most recent
|
||||
// [key.FocusEvent] delivered.
|
||||
func (s Source) Focused(tag event.Tag) bool {
|
||||
if !s.Enabled() {
|
||||
if !s.enabled() {
|
||||
return false
|
||||
}
|
||||
return s.r.state().keyState.focus == tag
|
||||
@@ -194,7 +194,7 @@ func (s Source) Focused(tag event.Tag) bool {
|
||||
|
||||
// Event returns the next event that matches at least one of filters.
|
||||
func (s Source) Event(filters ...event.Filter) (event.Event, bool) {
|
||||
if !s.Enabled() {
|
||||
if !s.enabled() {
|
||||
return nil, false
|
||||
}
|
||||
return s.r.Event(filters...)
|
||||
|
||||
Reference in New Issue
Block a user