mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 16:06:19 +00:00
7a259e68f7
Packages that provide support for external events such as pointer, key and system are only the beginning. Future packages are expected for clipboard access, drag and drop, gps positions and so on. To keep the number of top-level packages under control, move such I/O packages to the new `io` directory. The `system` package name was the previous solution to keeping the number of top-level packages under control: I named it `system` instead of the narrower `profile` because I expected to put all the less common events into it, turning `system` into a "package util" smell. With `io`, package system can be renamed to `profile`. Signed-off-by: Elias Naur <mail@eliasnaur.com>
32 lines
578 B
Go
32 lines
578 B
Go
// 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() {}
|