forked from joejulian/gio
io/pointer: added CursorNameOp
The cursor can now be customized for a given area. Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
@@ -49,6 +49,11 @@ type AreaOp struct {
|
||||
rect image.Rectangle
|
||||
}
|
||||
|
||||
// CursorNameOp sets the cursor for the current area.
|
||||
type CursorNameOp struct {
|
||||
Name CursorName
|
||||
}
|
||||
|
||||
// InputOp declares an input handler ready for pointer
|
||||
// events.
|
||||
type InputOp struct {
|
||||
@@ -178,6 +183,11 @@ func (op AreaOp) Add(o *op.Ops) {
|
||||
bo.PutUint32(data[14:], uint32(op.rect.Max.Y))
|
||||
}
|
||||
|
||||
func (op CursorNameOp) Add(o *op.Ops) {
|
||||
data := o.Write1(opconst.TypeCursorLen, op.Name)
|
||||
data[0] = byte(opconst.TypeCursor)
|
||||
}
|
||||
|
||||
func (h InputOp) Add(o *op.Ops) {
|
||||
data := o.Write1(opconst.TypePointerInputLen, h.Tag)
|
||||
data[0] = byte(opconst.TypePointerInput)
|
||||
|
||||
Reference in New Issue
Block a user