mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 07:57:29 +00:00
ui/key,ui/pointer: rename HandlerOp to InputOp
"Input" is more specific and reads better than "handler". Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -96,8 +96,8 @@ func (q *keyQueue) resolveFocus(events *handlerEvents) (input.Key, listenerPrior
|
||||
loop:
|
||||
for encOp, ok := q.reader.Decode(); ok; encOp, ok = q.reader.Decode() {
|
||||
switch opconst.OpType(encOp.Data[0]) {
|
||||
case opconst.TypeKeyHandler:
|
||||
op := decodeKeyHandlerOp(encOp.Data, encOp.Refs)
|
||||
case opconst.TypeKeyInput:
|
||||
op := decodeKeyInputOp(encOp.Data, encOp.Refs)
|
||||
var newPri listenerPriority
|
||||
switch {
|
||||
case op.Focus:
|
||||
@@ -139,11 +139,11 @@ func (p listenerPriority) replaces(p2 listenerPriority) bool {
|
||||
return p > p2 || p == p2 && p == priNewFocus
|
||||
}
|
||||
|
||||
func decodeKeyHandlerOp(d []byte, refs []interface{}) key.HandlerOp {
|
||||
if opconst.OpType(d[0]) != opconst.TypeKeyHandler {
|
||||
func decodeKeyInputOp(d []byte, refs []interface{}) key.InputOp {
|
||||
if opconst.OpType(d[0]) != opconst.TypeKeyInput {
|
||||
panic("invalid op")
|
||||
}
|
||||
return key.HandlerOp{
|
||||
return key.InputOp{
|
||||
Focus: d[1] != 0,
|
||||
Key: refs[0].(input.Key),
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ func (q *pointerQueue) collectHandlers(r *ops.Reader, events *handlerEvents, t u
|
||||
case opconst.TypeTransform:
|
||||
op := ops.DecodeTransformOp(encOp.Data)
|
||||
t = t.Multiply(ui.TransformOp(op))
|
||||
case opconst.TypePointerHandler:
|
||||
op := decodePointerHandlerOp(encOp.Data, encOp.Refs)
|
||||
case opconst.TypePointerInput:
|
||||
op := decodePointerInputOp(encOp.Data, encOp.Refs)
|
||||
q.hitTree = append(q.hitTree, hitNode{
|
||||
next: node,
|
||||
area: area,
|
||||
@@ -314,11 +314,11 @@ func (op *areaOp) Hit(pos f32.Point) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func decodePointerHandlerOp(d []byte, refs []interface{}) pointer.HandlerOp {
|
||||
if opconst.OpType(d[0]) != opconst.TypePointerHandler {
|
||||
func decodePointerInputOp(d []byte, refs []interface{}) pointer.InputOp {
|
||||
if opconst.OpType(d[0]) != opconst.TypePointerInput {
|
||||
panic("invalid op")
|
||||
}
|
||||
return pointer.HandlerOp{
|
||||
return pointer.InputOp{
|
||||
Grab: d[1] != 0,
|
||||
Key: refs[0].(input.Key),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user