mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
ui,internal/ops,internal/opconst: move OpsReader to internal ops package
To avoid import cycles, move the op constants to its own package, internal/opconst. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-6
@@ -5,7 +5,7 @@ package key
|
||||
import (
|
||||
"gioui.org/ui"
|
||||
"gioui.org/ui/input"
|
||||
"gioui.org/ui/internal/ops"
|
||||
"gioui.org/ui/internal/opconst"
|
||||
)
|
||||
|
||||
type HandlerOp struct {
|
||||
@@ -56,8 +56,8 @@ func (m Modifiers) Contain(m2 Modifiers) bool {
|
||||
}
|
||||
|
||||
func (h HandlerOp) Add(o *ui.Ops) {
|
||||
data := make([]byte, ops.TypeKeyHandlerLen)
|
||||
data[0] = byte(ops.TypeKeyHandler)
|
||||
data := make([]byte, opconst.TypeKeyHandlerLen)
|
||||
data[0] = byte(opconst.TypeKeyHandler)
|
||||
if h.Focus {
|
||||
data[1] = 1
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func (h HandlerOp) Add(o *ui.Ops) {
|
||||
}
|
||||
|
||||
func (h *HandlerOp) Decode(d []byte, refs []interface{}) {
|
||||
if ops.OpType(d[0]) != ops.TypeKeyHandler {
|
||||
if opconst.OpType(d[0]) != opconst.TypeKeyHandler {
|
||||
panic("invalid op")
|
||||
}
|
||||
*h = HandlerOp{
|
||||
@@ -75,8 +75,8 @@ func (h *HandlerOp) Decode(d []byte, refs []interface{}) {
|
||||
}
|
||||
|
||||
func (h HideInputOp) Add(o *ui.Ops) {
|
||||
data := make([]byte, ops.TypeHideInputLen)
|
||||
data[0] = byte(ops.TypeHideInput)
|
||||
data := make([]byte, opconst.TypeHideInputLen)
|
||||
data[0] = byte(opconst.TypeHideInput)
|
||||
o.Write(data)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user