Commit Graph

26 Commits

Author SHA1 Message Date
Elias Naur 8700a8ffc3 ui/key,ui/pointer: rename HandlerOp to InputOp
"Input" is more specific and reads better than "handler".

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-26 18:07:48 +01:00
Elias Naur 842d29373f ui: documentation tweaks
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 19:36:46 +02:00
Elias Naur 9cc6757da9 ui/pointer: expand documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 16:46:03 +02:00
Elias Naur 1a9e03bf68 ui/key: expand documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 13:09:55 +02:00
Elias Naur 340fff9814 ui/key: rename ChordEvent to just Event
Event is like pointer.Event and we don't want the stuttering of
key.KeyEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 12:50:40 +02:00
Elias Naur 2a41ff9a59 ui/key: expand documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 12:41:24 +02:00
Elias Naur 6e26c92c75 all: remove exported Decode methods on operations
Add decode functions to the packages that need them instead. For
TransformOp that is used in multiple packages, add the decode
function to the internal ops package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:34 +02:00
Elias Naur b3517a365e 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>
2019-08-07 17:21:26 +02:00
Elias Naur cb312c8d32 ui/app: drop Event
input.Event is enough if we stretch "input" to mean both input
devices and other events such as profiling events and system
commands.

The pointer and key packages are separate already, so I don't
expanding the meaning is unreasonable.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-01 15:27:14 +02:00
Elias Naur 9e0e4af8c6 ui/app,ui/key: move TextInputState from key to internal package
Clients have no need for the TextInputState type.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-21 13:12:24 +02:00
Elias Naur c7eb9be9f3 ui/key,ui/pointer: replace Key types with input.Key
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-12 14:53:45 +02:00
Elias Naur 31418eefbe ui/key: rename TextInputClosed to TextInputClose
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 15:52:09 +02:00
Elias Naur 0b6dd4efd9 ui: change events to have "Event" suffixed, not prefixed
Match the Go error naming convention (FooError).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:14:16 +02:00
Elias Naur 7aa7bb3be4 ui: rename ops to have Op suffixed, not prefixed
Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:01:45 +02:00
Elias Naur 474b1e8e17 ui/key: add Modifiers.Contain
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 21:10:01 +02:00
Elias Naur e24f19ecba ui/key,ui/app: introduce ModShift modifier
And add desktop implementations.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-18 20:20:57 +02:00
Elias Naur a35118d522 ui: add package input for merged input
To avoid passing a queue type for each kind of input (pointer, key),
introduce package input for mapping a handler key to all input events.

Future input sources can be added without changes to programs, and
as an added bonus, event ordering is preserved across input sources.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 10:58:57 +02:00
Elias Naur 28dd25736f ui/key: make the computed text input state available as a method
When merging the key and pointers input sources, we can't return
the text input state as a side effect of the Frame method.

Expose it as a method in the key event queue instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-07 20:59:20 +02:00
Elias Naur bb6ee05d95 ui/key: don't drop handlers that haven't had their events read
Similar to the previous change for pointers, only determine the
activeness of a handler from its presence in the ops list.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-07 20:27:22 +02:00
Elias Naur 955fe1bc77 ui: make the reference list argument to Ops.Write variadic
Makes the code nicer.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 15:22:11 +02:00
Elias Naur 1e38eec0ab ui: build paths as ops
Instead of allocating and constructing a clip path, store path data
directly in op lists. Use separate op lists for cached text layout
paths.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:18:04 +02:00
Elias Naur 0d2cffe196 ui: let OpsReader keep track of references
Instead of exposing the entire reference slice, return the relevant
references from Next.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 5966aab77e ui: move ops reader to ui package
To prepare support for cached OpBlock to refer to other Ops lists.

The exposure of OpsReader is alleviated by the removal of the Refs
and Data accessors for Ops.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 20f55a4ad7 all: delete the ui.Op type
It's no longer used.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:27:50 +02:00
Elias Naur 252e058766 all: serialize ops
Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering

Cons:
- Slightly clumsier API

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:19:34 +02:00
Elias Naur 0f05231c35 all: initial import
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-03-31 10:47:22 +02:00