mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
io/input,io/router: [API] rename package io/router to io/input
The input name better matches its purpose, in particular when we introduce input.Source. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-2
@@ -11,8 +11,8 @@ import (
|
|||||||
|
|
||||||
"gioui.org/font"
|
"gioui.org/font"
|
||||||
"gioui.org/font/gofont"
|
"gioui.org/font/gofont"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
"gioui.org/text"
|
"gioui.org/text"
|
||||||
@@ -33,7 +33,7 @@ func FuzzIME(f *testing.F) {
|
|||||||
e := new(widget.Editor)
|
e := new(widget.Editor)
|
||||||
e.Focus()
|
e.Focus()
|
||||||
|
|
||||||
var r router.Router
|
var r input.Router
|
||||||
gtx := layout.Context{Ops: new(op.Ops), Queue: &r}
|
gtx := layout.Context{Ops: new(op.Ops), Queue: &r}
|
||||||
// Layout once to register focus.
|
// Layout once to register focus.
|
||||||
e.Layout(gtx, cache, font.Font{}, unit.Sp(10), op.CallOp{}, op.CallOp{})
|
e.Layout(gtx, cache, font.Font{}, unit.Sp(10), op.CallOp{}, op.CallOp{})
|
||||||
|
|||||||
+10
-10
@@ -138,9 +138,9 @@ import (
|
|||||||
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
"gioui.org/io/clipboard"
|
"gioui.org/io/clipboard"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/semantic"
|
"gioui.org/io/semantic"
|
||||||
"gioui.org/io/system"
|
"gioui.org/io/system"
|
||||||
"gioui.org/unit"
|
"gioui.org/unit"
|
||||||
@@ -164,10 +164,10 @@ type window struct {
|
|||||||
config Config
|
config Config
|
||||||
|
|
||||||
semantic struct {
|
semantic struct {
|
||||||
hoverID router.SemanticID
|
hoverID input.SemanticID
|
||||||
rootID router.SemanticID
|
rootID input.SemanticID
|
||||||
focusID router.SemanticID
|
focusID input.SemanticID
|
||||||
diffs []router.SemanticID
|
diffs []input.SemanticID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,7 +661,7 @@ func Java_org_gioui_GioView_onClearA11yFocus(env *C.JNIEnv, class C.jclass, view
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) initAccessibilityNodeInfo(env *C.JNIEnv, sem router.SemanticNode, off image.Point, info C.jobject) error {
|
func (w *window) initAccessibilityNodeInfo(env *C.JNIEnv, sem input.SemanticNode, off image.Point, info C.jobject) error {
|
||||||
for _, ch := range sem.Children {
|
for _, ch := range sem.Children {
|
||||||
err := callVoidMethod(env, info, android.accessibilityNodeInfo.addChild, jvalue(w.view), jvalue(w.virtualIDFor(ch.ID)))
|
err := callVoidMethod(env, info, android.accessibilityNodeInfo.addChild, jvalue(w.view), jvalue(w.virtualIDFor(ch.ID)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -704,7 +704,7 @@ func (w *window) initAccessibilityNodeInfo(env *C.JNIEnv, sem router.SemanticNod
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d.Gestures&router.ClickGesture != 0 {
|
if d.Gestures&input.ClickGesture != 0 {
|
||||||
addAction(ACTION_CLICK)
|
addAction(ACTION_CLICK)
|
||||||
}
|
}
|
||||||
clsName := android.strings.androidViewView
|
clsName := android.strings.androidViewView
|
||||||
@@ -749,18 +749,18 @@ func (w *window) initAccessibilityNodeInfo(env *C.JNIEnv, sem router.SemanticNod
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) virtualIDFor(id router.SemanticID) C.jint {
|
func (w *window) virtualIDFor(id input.SemanticID) C.jint {
|
||||||
if id == w.semantic.rootID {
|
if id == w.semantic.rootID {
|
||||||
return HOST_VIEW_ID
|
return HOST_VIEW_ID
|
||||||
}
|
}
|
||||||
return C.jint(id)
|
return C.jint(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) semIDFor(virtID C.jint) router.SemanticID {
|
func (w *window) semIDFor(virtID C.jint) input.SemanticID {
|
||||||
if virtID == HOST_VIEW_ID {
|
if virtID == HOST_VIEW_ID {
|
||||||
return w.semantic.rootID
|
return w.semantic.rootID
|
||||||
}
|
}
|
||||||
return router.SemanticID(virtID)
|
return input.SemanticID(virtID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) detach(env *C.JNIEnv) {
|
func (w *window) detach(env *C.JNIEnv) {
|
||||||
|
|||||||
+26
-26
@@ -19,9 +19,9 @@ import (
|
|||||||
"gioui.org/internal/debug"
|
"gioui.org/internal/debug"
|
||||||
"gioui.org/internal/ops"
|
"gioui.org/internal/ops"
|
||||||
"gioui.org/io/event"
|
"gioui.org/io/event"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/system"
|
"gioui.org/io/system"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
@@ -76,7 +76,7 @@ type Window struct {
|
|||||||
// metric is the metric from the most recent frame.
|
// metric is the metric from the most recent frame.
|
||||||
metric unit.Metric
|
metric unit.Metric
|
||||||
|
|
||||||
queue router.Router
|
queue input.Router
|
||||||
cursor pointer.Cursor
|
cursor pointer.Cursor
|
||||||
decorations struct {
|
decorations struct {
|
||||||
op.Ops
|
op.Ops
|
||||||
@@ -101,10 +101,10 @@ type Window struct {
|
|||||||
semantic struct {
|
semantic struct {
|
||||||
// uptodate tracks whether the fields below are up to date.
|
// uptodate tracks whether the fields below are up to date.
|
||||||
uptodate bool
|
uptodate bool
|
||||||
root router.SemanticID
|
root input.SemanticID
|
||||||
prevTree []router.SemanticNode
|
prevTree []input.SemanticNode
|
||||||
tree []router.SemanticNode
|
tree []input.SemanticNode
|
||||||
ids map[router.SemanticID]router.SemanticNode
|
ids map[input.SemanticID]input.SemanticNode
|
||||||
}
|
}
|
||||||
|
|
||||||
imeState editorState
|
imeState editorState
|
||||||
@@ -121,7 +121,7 @@ type Window struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type editorState struct {
|
type editorState struct {
|
||||||
router.EditorState
|
input.EditorState
|
||||||
compose key.Range
|
compose key.Range
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ func NewWindow(options ...Option) *Window {
|
|||||||
w.decorations.enabled = cnf.Decorated
|
w.decorations.enabled = cnf.Decorated
|
||||||
w.decorations.height = decoHeight
|
w.decorations.height = decoHeight
|
||||||
w.imeState.compose = key.Range{Start: -1, End: -1}
|
w.imeState.compose = key.Range{Start: -1, End: -1}
|
||||||
w.semantic.ids = make(map[router.SemanticID]router.SemanticNode)
|
w.semantic.ids = make(map[input.SemanticID]input.SemanticNode)
|
||||||
w.callbacks.w = w
|
w.callbacks.w = w
|
||||||
w.eventState.initialOpts = options
|
w.eventState.initialOpts = options
|
||||||
return w
|
return w
|
||||||
@@ -308,9 +308,9 @@ func (w *Window) processFrame(d driver) {
|
|||||||
w.semantic.uptodate = false
|
w.semantic.uptodate = false
|
||||||
q := &w.queue
|
q := &w.queue
|
||||||
switch q.TextInputState() {
|
switch q.TextInputState() {
|
||||||
case router.TextInputOpen:
|
case input.TextInputOpen:
|
||||||
d.ShowTextInput(true)
|
d.ShowTextInput(true)
|
||||||
case router.TextInputClose:
|
case input.TextInputClose:
|
||||||
d.ShowTextInput(false)
|
d.ShowTextInput(false)
|
||||||
}
|
}
|
||||||
if hint, ok := q.TextInputHint(); ok {
|
if hint, ok := q.TextInputHint(); ok {
|
||||||
@@ -501,19 +501,19 @@ func (c *callbacks) Event(e event.Event) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SemanticRoot returns the ID of the semantic root.
|
// SemanticRoot returns the ID of the semantic root.
|
||||||
func (c *callbacks) SemanticRoot() router.SemanticID {
|
func (c *callbacks) SemanticRoot() input.SemanticID {
|
||||||
c.w.updateSemantics()
|
c.w.updateSemantics()
|
||||||
return c.w.semantic.root
|
return c.w.semantic.root
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupSemantic looks up a semantic node from an ID. The zero ID denotes the root.
|
// LookupSemantic looks up a semantic node from an ID. The zero ID denotes the root.
|
||||||
func (c *callbacks) LookupSemantic(semID router.SemanticID) (router.SemanticNode, bool) {
|
func (c *callbacks) LookupSemantic(semID input.SemanticID) (input.SemanticNode, bool) {
|
||||||
c.w.updateSemantics()
|
c.w.updateSemantics()
|
||||||
n, found := c.w.semantic.ids[semID]
|
n, found := c.w.semantic.ids[semID]
|
||||||
return n, found
|
return n, found
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *callbacks) AppendSemanticDiffs(diffs []router.SemanticID) []router.SemanticID {
|
func (c *callbacks) AppendSemanticDiffs(diffs []input.SemanticID) []input.SemanticID {
|
||||||
c.w.updateSemantics()
|
c.w.updateSemantics()
|
||||||
if tree := c.w.semantic.prevTree; len(tree) > 0 {
|
if tree := c.w.semantic.prevTree; len(tree) > 0 {
|
||||||
c.w.collectSemanticDiffs(&diffs, c.w.semantic.prevTree[0])
|
c.w.collectSemanticDiffs(&diffs, c.w.semantic.prevTree[0])
|
||||||
@@ -521,7 +521,7 @@ func (c *callbacks) AppendSemanticDiffs(diffs []router.SemanticID) []router.Sema
|
|||||||
return diffs
|
return diffs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *callbacks) SemanticAt(pos f32.Point) (router.SemanticID, bool) {
|
func (c *callbacks) SemanticAt(pos f32.Point) (input.SemanticID, bool) {
|
||||||
c.w.updateSemantics()
|
c.w.updateSemantics()
|
||||||
return c.w.queue.SemanticAt(pos)
|
return c.w.queue.SemanticAt(pos)
|
||||||
}
|
}
|
||||||
@@ -565,19 +565,19 @@ func (c *callbacks) SetEditorSnippet(r key.Range) {
|
|||||||
c.Event(key.SnippetEvent(r))
|
c.Event(key.SnippetEvent(r))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) moveFocus(dir router.FocusDirection, d driver) {
|
func (w *Window) moveFocus(dir input.FocusDirection, d driver) {
|
||||||
if w.queue.MoveFocus(dir) {
|
if w.queue.MoveFocus(dir) {
|
||||||
w.queue.RevealFocus(w.viewport)
|
w.queue.RevealFocus(w.viewport)
|
||||||
} else {
|
} else {
|
||||||
var v image.Point
|
var v image.Point
|
||||||
switch dir {
|
switch dir {
|
||||||
case router.FocusRight:
|
case input.FocusRight:
|
||||||
v = image.Pt(+1, 0)
|
v = image.Pt(+1, 0)
|
||||||
case router.FocusLeft:
|
case input.FocusLeft:
|
||||||
v = image.Pt(-1, 0)
|
v = image.Pt(-1, 0)
|
||||||
case router.FocusDown:
|
case input.FocusDown:
|
||||||
v = image.Pt(0, +1)
|
v = image.Pt(0, +1)
|
||||||
case router.FocusUp:
|
case input.FocusUp:
|
||||||
v = image.Pt(0, -1)
|
v = image.Pt(0, -1)
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
@@ -767,7 +767,7 @@ func (w *Window) updateSemantics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// collectSemanticDiffs traverses the previous semantic tree, noting changed nodes.
|
// collectSemanticDiffs traverses the previous semantic tree, noting changed nodes.
|
||||||
func (w *Window) collectSemanticDiffs(diffs *[]router.SemanticID, n router.SemanticNode) {
|
func (w *Window) collectSemanticDiffs(diffs *[]input.SemanticID, n input.SemanticNode) {
|
||||||
newNode, exists := w.semantic.ids[n.ID]
|
newNode, exists := w.semantic.ids[n.ID]
|
||||||
// Ignore deleted nodes, as their disappearance will be reported through an
|
// Ignore deleted nodes, as their disappearance will be reported through an
|
||||||
// ancestor node.
|
// ancestor node.
|
||||||
@@ -895,17 +895,17 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
|
|||||||
isMobile := runtime.GOOS == "ios" || runtime.GOOS == "android"
|
isMobile := runtime.GOOS == "ios" || runtime.GOOS == "android"
|
||||||
switch {
|
switch {
|
||||||
case e.Name == key.NameTab && e.Modifiers == 0:
|
case e.Name == key.NameTab && e.Modifiers == 0:
|
||||||
w.moveFocus(router.FocusForward, d)
|
w.moveFocus(input.FocusForward, d)
|
||||||
case e.Name == key.NameTab && e.Modifiers == key.ModShift:
|
case e.Name == key.NameTab && e.Modifiers == key.ModShift:
|
||||||
w.moveFocus(router.FocusBackward, d)
|
w.moveFocus(input.FocusBackward, d)
|
||||||
case e.Name == key.NameUpArrow && e.Modifiers == 0 && isMobile:
|
case e.Name == key.NameUpArrow && e.Modifiers == 0 && isMobile:
|
||||||
w.moveFocus(router.FocusUp, d)
|
w.moveFocus(input.FocusUp, d)
|
||||||
case e.Name == key.NameDownArrow && e.Modifiers == 0 && isMobile:
|
case e.Name == key.NameDownArrow && e.Modifiers == 0 && isMobile:
|
||||||
w.moveFocus(router.FocusDown, d)
|
w.moveFocus(input.FocusDown, d)
|
||||||
case e.Name == key.NameLeftArrow && e.Modifiers == 0 && isMobile:
|
case e.Name == key.NameLeftArrow && e.Modifiers == 0 && isMobile:
|
||||||
w.moveFocus(router.FocusLeft, d)
|
w.moveFocus(input.FocusLeft, d)
|
||||||
case e.Name == key.NameRightArrow && e.Modifiers == 0 && isMobile:
|
case e.Name == key.NameRightArrow && e.Modifiers == 0 && isMobile:
|
||||||
w.moveFocus(router.FocusRight, d)
|
w.moveFocus(input.FocusRight, d)
|
||||||
default:
|
default:
|
||||||
handled = false
|
handled = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
"gioui.org/io/event"
|
"gioui.org/io/event"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
"gioui.org/op/clip"
|
"gioui.org/op/clip"
|
||||||
)
|
)
|
||||||
@@ -22,7 +22,7 @@ func TestHover(t *testing.T) {
|
|||||||
stack := clip.Rect(rect).Push(ops)
|
stack := clip.Rect(rect).Push(ops)
|
||||||
h.Add(ops)
|
h.Add(ops)
|
||||||
stack.Pop()
|
stack.Pop()
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
r.Frame(ops)
|
r.Frame(ops)
|
||||||
|
|
||||||
r.Queue(
|
r.Queue(
|
||||||
@@ -71,7 +71,7 @@ func TestMouseClicks(t *testing.T) {
|
|||||||
var ops op.Ops
|
var ops op.Ops
|
||||||
click.Add(&ops)
|
click.Add(&ops)
|
||||||
|
|
||||||
var r router.Router
|
var r input.Router
|
||||||
r.Frame(&ops)
|
r.Frame(&ops)
|
||||||
r.Queue(tc.events...)
|
r.Queue(tc.events...)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gioui.org/io/event"
|
"gioui.org/io/event"
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
package router
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package router implements Router, a event.Queue implementation
|
Package input implements Router, an event.Queue implementation
|
||||||
that that disambiguates and routes events to handlers declared
|
that disambiguates and routes events to handlers declared
|
||||||
in operation lists.
|
in operation lists.
|
||||||
|
|
||||||
Router is used by app.Window and is otherwise only useful for
|
Router is used by app.Window and is otherwise only useful for
|
||||||
using Gio with external window implementations.
|
using Gio with external window implementations.
|
||||||
*/
|
*/
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package router
|
package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
+2
-2
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
"gioui.org/io/event"
|
"gioui.org/io/event"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ func TestListScrollToEnd(t *testing.T) {
|
|||||||
|
|
||||||
func TestListPosition(t *testing.T) {
|
func TestListPosition(t *testing.T) {
|
||||||
_s := func(e ...event.Event) []event.Event { return e }
|
_s := func(e ...event.Event) []event.Event { return e }
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := Context{
|
gtx := Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: Constraints{
|
Constraints: Constraints{
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gioui.org/app"
|
"gioui.org/app"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
"gioui.org/widget"
|
"gioui.org/widget"
|
||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
func TestClickable(t *testing.T) {
|
func TestClickable(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
ops op.Ops
|
ops op.Ops
|
||||||
r router.Router
|
r input.Router
|
||||||
b1 widget.Clickable
|
b1 widget.Clickable
|
||||||
b2 widget.Clickable
|
b2 widget.Clickable
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/transfer"
|
"gioui.org/io/transfer"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDraggable(t *testing.T) {
|
func TestDraggable(t *testing.T) {
|
||||||
var r router.Router
|
var r input.Router
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: &r,
|
Queue: &r,
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ import (
|
|||||||
"gioui.org/font"
|
"gioui.org/font"
|
||||||
"gioui.org/font/gofont"
|
"gioui.org/font/gofont"
|
||||||
"gioui.org/font/opentype"
|
"gioui.org/font/opentype"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/system"
|
"gioui.org/io/system"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
@@ -96,7 +96,7 @@ func assertContents(t *testing.T, e *Editor, contents string, selectionStart, se
|
|||||||
// TestEditorReadOnly ensures that mouse and keyboard interactions with readonly
|
// TestEditorReadOnly ensures that mouse and keyboard interactions with readonly
|
||||||
// editors do nothing but manipulate the text selection.
|
// editors do nothing but manipulate the text selection.
|
||||||
func TestEditorReadOnly(t *testing.T) {
|
func TestEditorReadOnly(t *testing.T) {
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Constraints{
|
Constraints: layout.Constraints{
|
||||||
@@ -501,7 +501,7 @@ func TestEditorLigature(t *testing.T) {
|
|||||||
|
|
||||||
func TestEditorDimensions(t *testing.T) {
|
func TestEditorDimensions(t *testing.T) {
|
||||||
e := new(Editor)
|
e := new(Editor)
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Constraints{Max: image.Pt(100, 100)},
|
Constraints: layout.Constraints{Max: image.Pt(100, 100)},
|
||||||
@@ -887,7 +887,7 @@ f 2 4 6 8 f
|
|||||||
g 2 4 6 8 g
|
g 2 4 6 8 g
|
||||||
`)
|
`)
|
||||||
|
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
@@ -987,7 +987,7 @@ func TestSelectMove(t *testing.T) {
|
|||||||
e := new(Editor)
|
e := new(Editor)
|
||||||
e.SetText(`0123456789`)
|
e.SetText(`0123456789`)
|
||||||
|
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
@@ -1076,7 +1076,7 @@ func TestEditor_MaxLen(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.SetText("2345678")
|
e.SetText("2345678")
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
@@ -1112,7 +1112,7 @@ func TestEditor_Filter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.SetText("2345678")
|
e.SetText("2345678")
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
@@ -1142,7 +1142,7 @@ func TestEditor_Submit(t *testing.T) {
|
|||||||
e := new(Editor)
|
e := new(Editor)
|
||||||
e.Submit = true
|
e.Submit = true
|
||||||
|
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/transfer"
|
"gioui.org/io/transfer"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
@@ -21,7 +21,7 @@ func ExampleClickable_passthrough() {
|
|||||||
// pointer events can be passed down for the underlying
|
// pointer events can be passed down for the underlying
|
||||||
// widgets to pick them up.
|
// widgets to pick them up.
|
||||||
var button1, button2 widget.Clickable
|
var button1, button2 widget.Clickable
|
||||||
var r router.Router
|
var r input.Router
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
@@ -71,7 +71,7 @@ func ExampleClickable_passthrough() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleDraggable_Layout() {
|
func ExampleDraggable_Layout() {
|
||||||
var r router.Router
|
var r input.Router
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"gioui.org/font"
|
"gioui.org/font"
|
||||||
"gioui.org/font/gofont"
|
"gioui.org/font/gofont"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
"gioui.org/text"
|
"gioui.org/text"
|
||||||
@@ -34,7 +34,7 @@ func TestSelectableZeroValue(t *testing.T) {
|
|||||||
|
|
||||||
// Verify that an existing selection is dismissed when you press arrow keys.
|
// Verify that an existing selection is dismissed when you press arrow keys.
|
||||||
func TestSelectableMove(t *testing.T) {
|
func TestSelectableMove(t *testing.T) {
|
||||||
r := new(router.Router)
|
r := new(input.Router)
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"gioui.org/app"
|
"gioui.org/app"
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
"gioui.org/io/router"
|
|
||||||
"gioui.org/io/semantic"
|
"gioui.org/io/semantic"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
func TestBool(t *testing.T) {
|
func TestBool(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
ops op.Ops
|
ops op.Ops
|
||||||
r router.Router
|
r input.Router
|
||||||
b widget.Bool
|
b widget.Bool
|
||||||
)
|
)
|
||||||
gtx := app.NewContext(&ops, app.FrameEvent{Queue: &r})
|
gtx := app.NewContext(&ops, app.FrameEvent{Queue: &r})
|
||||||
|
|||||||
Reference in New Issue
Block a user