op: add package op for operations

Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-09-30 15:41:15 +02:00
parent eba1b3a95f
commit 8cf35a1f97
27 changed files with 225 additions and 227 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ package key
import (
"gioui.org/internal/opconst"
"gioui.org/io/event"
"gioui.org/ui"
"gioui.org/op"
)
// InputOp declares a handler ready for key events.
@@ -86,7 +86,7 @@ func (m Modifiers) Contain(m2 Modifiers) bool {
return m&m2 == m2
}
func (h InputOp) Add(o *ui.Ops) {
func (h InputOp) Add(o *op.Ops) {
data := make([]byte, opconst.TypeKeyInputLen)
data[0] = byte(opconst.TypeKeyInput)
if h.Focus {
@@ -95,7 +95,7 @@ func (h InputOp) Add(o *ui.Ops) {
o.Write(data, h.Key)
}
func (h HideInputOp) Add(o *ui.Ops) {
func (h HideInputOp) Add(o *op.Ops) {
data := make([]byte, opconst.TypeHideInputLen)
data[0] = byte(opconst.TypeHideInput)
o.Write(data)