diff --git a/app/internal/input/key.go b/app/internal/input/key.go index 13407e83..03b13476 100644 --- a/app/internal/input/key.go +++ b/app/internal/input/key.go @@ -3,10 +3,10 @@ package input import ( - "gioui.org/ui" "gioui.org/internal/opconst" "gioui.org/internal/ops" - "gioui.org/key" + "gioui.org/io/key" + "gioui.org/ui" ) type TextInputState uint8 diff --git a/app/internal/input/pointer.go b/app/internal/input/pointer.go index d5288a2c..b8442215 100644 --- a/app/internal/input/pointer.go +++ b/app/internal/input/pointer.go @@ -6,11 +6,11 @@ import ( "encoding/binary" "image" - "gioui.org/ui" "gioui.org/f32" "gioui.org/internal/opconst" "gioui.org/internal/ops" - "gioui.org/pointer" + "gioui.org/io/pointer" + "gioui.org/ui" ) type pointerQueue struct { diff --git a/app/internal/input/router.go b/app/internal/input/router.go index f1c16549..7a4b8320 100644 --- a/app/internal/input/router.go +++ b/app/internal/input/router.go @@ -6,12 +6,12 @@ import ( "encoding/binary" "time" - "gioui.org/ui" "gioui.org/internal/opconst" "gioui.org/internal/ops" - "gioui.org/key" - "gioui.org/pointer" - "gioui.org/system" + "gioui.org/io/key" + "gioui.org/io/pointer" + "gioui.org/io/profile" + "gioui.org/ui" ) // Router is a Queue implementation that routes events from @@ -98,7 +98,7 @@ func (q *Router) collect() { } } -func (q *Router) AddProfile(e system.ProfileEvent) { +func (q *Router) AddProfile(e profile.Event) { for _, h := range q.profHandlers { q.handlers.Add(h, e) } @@ -150,11 +150,11 @@ func (h *handlerEvents) Clear() { } } -func decodeProfileOp(d []byte, refs []interface{}) system.ProfileOp { +func decodeProfileOp(d []byte, refs []interface{}) profile.Op { if opconst.OpType(d[0]) != opconst.TypeProfile { panic("invalid op") } - return system.ProfileOp{ + return profile.Op{ Key: refs[0].(ui.Key), } } diff --git a/app/os_android.go b/app/os_android.go index b0b66cc5..e4c05685 100644 --- a/app/os_android.go +++ b/app/os_android.go @@ -24,10 +24,10 @@ import ( "time" "unsafe" - "gioui.org/ui" "gioui.org/f32" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" + "gioui.org/ui" ) type window struct { diff --git a/app/os_ios.go b/app/os_ios.go index e6b2b877..65f07906 100644 --- a/app/os_ios.go +++ b/app/os_ios.go @@ -22,10 +22,10 @@ import ( "sync/atomic" "time" - "gioui.org/ui" "gioui.org/f32" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" + "gioui.org/ui" ) type window struct { diff --git a/app/os_js.go b/app/os_js.go index e9b34159..68ab86d1 100644 --- a/app/os_js.go +++ b/app/os_js.go @@ -9,8 +9,8 @@ import ( "time" "gioui.org/f32" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" ) type window struct { diff --git a/app/os_macos.go b/app/os_macos.go index 3761ad99..b541c436 100644 --- a/app/os_macos.go +++ b/app/os_macos.go @@ -20,8 +20,8 @@ import ( "unsafe" "gioui.org/f32" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" ) func init() { diff --git a/app/os_wayland.go b/app/os_wayland.go index 8f4905db..bf3c17ae 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -18,8 +18,8 @@ import ( "gioui.org/f32" "gioui.org/internal/fling" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" syscall "golang.org/x/sys/unix" ) diff --git a/app/os_windows.go b/app/os_windows.go index 0e59dd4c..096fd98c 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -15,8 +15,8 @@ import ( syscall "golang.org/x/sys/windows" "gioui.org/f32" - "gioui.org/key" - "gioui.org/pointer" + "gioui.org/io/key" + "gioui.org/io/pointer" ) var winMap = make(map[syscall.Handle]*window) diff --git a/app/window.go b/app/window.go index 523cedd4..79da79c5 100644 --- a/app/window.go +++ b/app/window.go @@ -8,10 +8,10 @@ import ( "image" "time" - "gioui.org/ui" "gioui.org/app/internal/gpu" "gioui.org/app/internal/input" - "gioui.org/system" + "gioui.org/io/profile" + "gioui.org/ui" ) // WindowOption configures a Window. @@ -144,7 +144,7 @@ func (w *Window) draw(size image.Point, frame *ui.Ops) { if w.queue.q.Profiling() { q := 100 * time.Microsecond timings := fmt.Sprintf("tot:%7s cpu:%7s %s", frameDur.Round(q), drawDur.Round(q), w.gpu.Timings()) - w.queue.q.AddProfile(system.ProfileEvent{Timings: timings}) + w.queue.q.AddProfile(profile.Event{Timings: timings}) w.setNextFrame(time.Time{}) } if t, ok := w.queue.q.WakeupTime(); ok { diff --git a/app/xkb_linux.go b/app/xkb_linux.go index ca4d3017..7087b18c 100644 --- a/app/xkb_linux.go +++ b/app/xkb_linux.go @@ -22,7 +22,7 @@ import ( "unicode/utf8" "unsafe" - "gioui.org/key" + "gioui.org/io/key" ) type xkb struct { diff --git a/gesture/gesture.go b/gesture/gesture.go index cfae9d2e..1d6832c9 100644 --- a/gesture/gesture.go +++ b/gesture/gesture.go @@ -12,10 +12,10 @@ package gesture import ( "math" - "gioui.org/ui" "gioui.org/f32" "gioui.org/internal/fling" - "gioui.org/pointer" + "gioui.org/io/pointer" + "gioui.org/ui" ) // Click detects click gestures in the form diff --git a/key/key.go b/io/key/key.go similarity index 100% rename from key/key.go rename to io/key/key.go diff --git a/pointer/doc.go b/io/pointer/doc.go similarity index 100% rename from pointer/doc.go rename to io/pointer/doc.go diff --git a/pointer/pointer.go b/io/pointer/pointer.go similarity index 100% rename from pointer/pointer.go rename to io/pointer/pointer.go diff --git a/io/profile/profile.go b/io/profile/profile.go new file mode 100644 index 00000000..fc06ebb4 --- /dev/null +++ b/io/profile/profile.go @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: Unlicense OR MIT + +// Package profiles provides access to rendering +// profiles. +package profile + +import ( + "gioui.org/internal/opconst" + "gioui.org/ui" +) + +// Op registers a handler for receiving +// Events. +type Op struct { + Key ui.Key +} + +// Event contains profile data from a single +// rendered frame. +type Event struct { + // Timings. Very likely to change. + Timings string +} + +func (p Op) Add(o *ui.Ops) { + data := make([]byte, opconst.TypeProfileLen) + data[0] = byte(opconst.TypeProfile) + o.Write(data, p.Key) +} + +func (p Event) ImplementsEvent() {} diff --git a/layout/list.go b/layout/list.go index 2d53f266..6cd7b804 100644 --- a/layout/list.go +++ b/layout/list.go @@ -5,10 +5,10 @@ package layout import ( "image" - "gioui.org/ui" "gioui.org/gesture" + "gioui.org/io/pointer" "gioui.org/paint" - "gioui.org/pointer" + "gioui.org/ui" ) type scrollChild struct { diff --git a/system/system.go b/system/system.go deleted file mode 100644 index dc2bad1c..00000000 --- a/system/system.go +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: Unlicense OR MIT - -// Package system contain ops and types for -// system events. -package system - -import ( - "gioui.org/ui" - "gioui.org/internal/opconst" -) - -// ProfileOp registers a handler for receiving -// ProfileEvents. -type ProfileOp struct { - Key ui.Key -} - -// ProfileEvent contain profile data from a single -// rendered frame. -type ProfileEvent struct { - // String with timings. Very likely to change. - Timings string -} - -func (p ProfileOp) Add(o *ui.Ops) { - data := make([]byte, opconst.TypeProfileLen) - data[0] = byte(opconst.TypeProfile) - o.Write(data, p.Key) -} - -func (p ProfileEvent) ImplementsEvent() {} diff --git a/text/editor.go b/text/editor.go index 8a982e83..76c558c3 100644 --- a/text/editor.go +++ b/text/editor.go @@ -9,12 +9,12 @@ import ( "time" "unicode/utf8" - "gioui.org/ui" "gioui.org/gesture" - "gioui.org/key" + "gioui.org/io/key" + "gioui.org/io/pointer" "gioui.org/layout" "gioui.org/paint" - "gioui.org/pointer" + "gioui.org/ui" "golang.org/x/image/math/fixed" ) diff --git a/ui/doc.go b/ui/doc.go index 95e2265e..570e2f6f 100644 --- a/ui/doc.go +++ b/ui/doc.go @@ -101,7 +101,7 @@ the means for declaring handlers for specific event types. The following example declares a handler ready for key input: - import gioui.org/key + import gioui.org/io/key ops := new(ui.Ops) var h *Handler = ...