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:
Elias Naur
2019-08-26 18:05:04 +01:00
parent a112a580a7
commit 8700a8ffc3
9 changed files with 56 additions and 56 deletions
+8 -8
View File
@@ -5,14 +5,14 @@ Package pointer implements pointer events and operations.
A pointer is either a mouse controlled cursor or a touch
object such as a finger.
The HandlerOp operation is used to declare a handler ready
The InputOp operation is used to declare a handler ready
for pointer events. Use a Queue from package input to
receive events.
Areas
The area operations are used for specifying the area where
subsequent HandlerOps are active.
subsequent InputOp are active.
For example, to set up a rectangular hit area:
@@ -21,7 +21,7 @@ For example, to set up a rectangular hit area:
r := image.Rectangle{...}
pointer.RectAreaOp{Rect: r}.Add(ops)
pointer.HandlerOp{Key: h}.Add(ops)
pointer.InputOp{Key: h}.Add(ops)
Note that areas compound: the effective area of multiple area
operations is the intersection of the areas.
@@ -39,11 +39,11 @@ For example:
var h1, h2 *Handler
stack.Push(ops)
pointer.HandlerOp{Key: h1}.Add(Ops)
pointer.InputOp{Key: h1}.Add(Ops)
stack.Pop()
stack.Push(ops)
pointer.HandlerOp{Key: h2}.Add(ops)
pointer.InputOp{Key: h2}.Add(ops)
stack.Pop()
implies a tree of two inner nodes, each with one pointer handler.
@@ -64,7 +64,7 @@ handlers have the same area (the entire screen).
Pass-through
The PassOp operations controls the pass-through setting. A handler's
pass-through setting is recorded along with the HandlerOp.
pass-through setting is recorded along with the InputOp.
Pass-through handlers are useful for overlay widgets such as a hidden
side drawer. When the user touches the side, both the (transparent)
@@ -81,11 +81,11 @@ matching handlers receive all events.
When a pointer is pressed, the set of matching handlers is
recorded. The set is not updated according to the pointer position
and hit areas. Rather, handlers stay in the matching set until they
no longer appear in a HandlerOp or when another handler in the set
no longer appear in a InputOp or when another handler in the set
grabs the pointer.
A handler can exclude all other handler from its matching sets
by setting the Grab flag in its HandlerOp. The Grab flag is sticky
by setting the Grab flag in its InputOp. The Grab flag is sticky
and stays in effect until the handler no longer appears in any
matching sets.
+5 -5
View File
@@ -61,9 +61,9 @@ type areaOp struct {
rect image.Rectangle
}
// HandlerOp declares an input handler ready for pointer
// InputOp declares an input handler ready for pointer
// events.
type HandlerOp struct {
type InputOp struct {
Key input.Key
// Grab, if set, request that the handler get
// Grabbed priority.
@@ -150,9 +150,9 @@ func (op areaOp) add(o *ui.Ops) {
o.Write(data)
}
func (h HandlerOp) Add(o *ui.Ops) {
data := make([]byte, opconst.TypePointerHandlerLen)
data[0] = byte(opconst.TypePointerHandler)
func (h InputOp) Add(o *ui.Ops) {
data := make([]byte, opconst.TypePointerInputLen)
data[0] = byte(opconst.TypePointerInput)
if h.Grab {
data[1] = 1
}