diff --git a/input/key.go b/input/key.go index 6b9d7d37..22d9124d 100644 --- a/input/key.go +++ b/input/key.go @@ -254,22 +254,22 @@ func (k KeyUpEvent) String() string { // "shift+ctrl+alt+a". func (k Key) String() string { var s string - if k.Mod.IsCtrl() && k.Sym != KeyLeftCtrl && k.Sym != KeyRightCtrl { + if k.Mod.HasCtrl() && k.Sym != KeyLeftCtrl && k.Sym != KeyRightCtrl { s += "ctrl+" } - if k.Mod.IsAlt() && k.Sym != KeyLeftAlt && k.Sym != KeyRightAlt { + if k.Mod.HasAlt() && k.Sym != KeyLeftAlt && k.Sym != KeyRightAlt { s += "alt+" } - if k.Mod.IsShift() && k.Sym != KeyLeftShift && k.Sym != KeyRightShift { + if k.Mod.HasShift() && k.Sym != KeyLeftShift && k.Sym != KeyRightShift { s += "shift+" } - if k.Mod.IsMeta() && k.Sym != KeyLeftMeta && k.Sym != KeyRightMeta { + if k.Mod.HasMeta() && k.Sym != KeyLeftMeta && k.Sym != KeyRightMeta { s += "meta+" } - if k.Mod.IsHyper() && k.Sym != KeyLeftHyper && k.Sym != KeyRightHyper { + if k.Mod.HasHyper() && k.Sym != KeyLeftHyper && k.Sym != KeyRightHyper { s += "hyper+" } - if k.Mod.IsSuper() && k.Sym != KeyLeftSuper && k.Sym != KeyRightSuper { + if k.Mod.HasSuper() && k.Sym != KeyLeftSuper && k.Sym != KeyRightSuper { s += "super+" } diff --git a/input/mod.go b/input/mod.go index 1040d2fa..c029e382 100644 --- a/input/mod.go +++ b/input/mod.go @@ -24,33 +24,33 @@ const ( ScrollLock // Defined in Windows API only ) -// IsShift reports whether the Shift modifier is set. -func (m KeyMod) IsShift() bool { +// HasShift reports whether the Shift modifier is set. +func (m KeyMod) HasShift() bool { return m&Shift != 0 } -// IsAlt reports whether the Alt modifier is set. -func (m KeyMod) IsAlt() bool { +// HasAlt reports whether the Alt modifier is set. +func (m KeyMod) HasAlt() bool { return m&Alt != 0 } -// IsCtrl reports whether the Ctrl modifier is set. -func (m KeyMod) IsCtrl() bool { +// HasCtrl reports whether the Ctrl modifier is set. +func (m KeyMod) HasCtrl() bool { return m&Ctrl != 0 } -// IsMeta reports whether the Meta modifier is set. -func (m KeyMod) IsMeta() bool { +// HasMeta reports whether the Meta modifier is set. +func (m KeyMod) HasMeta() bool { return m&Meta != 0 } -// IsHyper reports whether the Hyper modifier is set. -func (m KeyMod) IsHyper() bool { +// HasHyper reports whether the Hyper modifier is set. +func (m KeyMod) HasHyper() bool { return m&Hyper != 0 } -// IsSuper reports whether the Super modifier is set. -func (m KeyMod) IsSuper() bool { +// HasSuper reports whether the Super modifier is set. +func (m KeyMod) HasSuper() bool { return m&Super != 0 } diff --git a/input/mouse.go b/input/mouse.go index 0e6eea93..de3c599a 100644 --- a/input/mouse.go +++ b/input/mouse.go @@ -65,13 +65,13 @@ type Mouse struct { // String implements fmt.Stringer. func (m Mouse) String() (s string) { - if m.Mod.IsCtrl() { + if m.Mod.HasCtrl() { s += "ctrl+" } - if m.Mod.IsAlt() { + if m.Mod.HasAlt() { s += "alt+" } - if m.Mod.IsShift() { + if m.Mod.HasShift() { s += "shift+" } diff --git a/input/parse.go b/input/parse.go index 219ff711..4625f63e 100644 --- a/input/parse.go +++ b/input/parse.go @@ -121,7 +121,7 @@ func ParseSequence(buf []byte) (n int, e Event) { return parseApc(buf) default: n, e := ParseSequence(buf[1:]) - if k, ok := e.(KeyDownEvent); ok && !k.Mod.IsAlt() { + if k, ok := e.(KeyDownEvent); ok && !k.Mod.HasAlt() { k.Mod |= Alt return n + 1, k }