mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
io/key,io/pointer: forbid nil tags for InputOps
Forcing a non-nil tag ensures that all handler tags are either unique, or intentionally equal. Additionally, a nil tag has special meaning in FocusOps. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -121,6 +121,9 @@ func (m Modifiers) Contain(m2 Modifiers) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h InputOp) Add(o *op.Ops) {
|
func (h InputOp) Add(o *op.Ops) {
|
||||||
|
if h.Tag == nil {
|
||||||
|
panic("Tag must be non-nil")
|
||||||
|
}
|
||||||
data := o.Write1(opconst.TypeKeyInputLen, h.Tag)
|
data := o.Write1(opconst.TypeKeyInputLen, h.Tag)
|
||||||
data[0] = byte(opconst.TypeKeyInput)
|
data[0] = byte(opconst.TypeKeyInput)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,6 +189,9 @@ func (op CursorNameOp) Add(o *op.Ops) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h InputOp) Add(o *op.Ops) {
|
func (h InputOp) Add(o *op.Ops) {
|
||||||
|
if h.Tag == nil {
|
||||||
|
panic("Tag must be non-nil")
|
||||||
|
}
|
||||||
data := o.Write1(opconst.TypePointerInputLen, h.Tag)
|
data := o.Write1(opconst.TypePointerInputLen, h.Tag)
|
||||||
data[0] = byte(opconst.TypePointerInput)
|
data[0] = byte(opconst.TypePointerInput)
|
||||||
if h.Grab {
|
if h.Grab {
|
||||||
|
|||||||
Reference in New Issue
Block a user