~eliasnaur/gio

ref: 1efe68c1540b gio/io/key d---------
all: add //go:build lines

They're automatically added by Go 1.17 source formatters. This change
adds them all now.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
app, io: [wasm, android] add support for numeric/email keyboard mode

Previously, the on-screen keyboard always displays the text keyboard,
(QWERTY or equivalent).

For optimal user experience, it's possible to specify the keyboard type
using `InputHint`. The on-screen keyboard will provide shortcuts or
restrict what the user can input.

Due to some limitations (gio#116), only numeric and text keyboards are
supported on Android.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
io/key: add NameSpace, report it on Linux

Fixes gio#204.

Signed-off-by: pierre <pierre.curto@gmail.com>
io/key,io/pointer: forbid nil tags for InputOps

Forcing a non-nil tag ensures that all handler tags are either unique,
or intentionally equal. Additionally, a nil tag has special meaning in
FocusOps.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/router/key: add explicit tag to FocusOp; make last SoftKeyboardOp apply

The target of FocusOp is too subtle; be explicit instead and remove
any doubt.

Multiple SoftKeyboardOp in a single frame is rare, but if they do occur,
they should behave as if they were from separate frames: the last one
applies.

As a side-effect the key event router can be much simplified.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/key: improve InputOp focus and blur

The existing implementation cannot remove the focus of some widget,
doesn't have an option to focus without display the on-screen keyboard
and it automatically focuses the first InputOp, aggressively.

That change aims to make possible: remove focus from any widget. Add
focus without displaying the on-screen-keyboard/soft keyboard. Don't
automatically focus any widget. Don't recover focus when the widget is
visible again.

Fixes gio#180.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Many operations do not pass refs to Write. Similarly adding
...interface{} requires constructing a slice, which is slow.

This cuts about 100ns from RRect and Border benchmark.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
8a3ff4ab — Raffaele Sena 11 months ago
app/internal/window: implement key.Press and key.Release on macOS

Update key.State documentation and add State.String while here. Also
update Event.String to include State.

Signed-off-by: Raffaele Sena <raff367@gmail.com>
io/key: implement key.Release state

Implement key state for the following platforms:
js, wayland, windows, x11.

Unsupported platforms will continue to function as before, sending
key.Press for all key events.

Signed-off-by: Josiah Niedrauer <josiah@niedrauer.com>
all: rename io/event.Key to Tag

Key had an unfortunate association with keyboard input.

This is an API change. The following rewrites were run to fixup
Gio code:

        $ gofmt -r 'pointer.InputOp{Key:a} -> pointer.InputOp{Tag:a}' -w .
        $ gofmt -r 'pointer.InputOp{Key:a, Grab:b} -> pointer.InputOp{Tag:a, Grab:b}' -w .
        $ gofmt -r 'key.InputOp{Key:a} -> key.InputOp{Tag:a}' -w .
        $ gofmt -r 'key.InputOp{Key:a, Focus:b} -> key.InputOp{Tag:a, Focus:b}' -w .
        $ gofmt -r 'event.Key -> event.Tag' -w .

Signed-off-by: Elias Naur <mail@eliasnaur.com>
app/internal/window: allow punctuation as keycode events

Allows things like "ctrl-{" and ".".

All punctuation is returned as-is, e.g. "!" is "!", not "shift-1", and
"{" is "{", not "shift-[".

Also add the Enter key as a known key (fn-return on my Mac).

Signed-off-by: Larry Clapp <larry@theclapp.org>
io/key: add support for the Tab and Space keys

Fixes gio#62

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/key: switch Event.Name to be a string and add function keys

Function keys don't have a natural rune representation so switch
Event.Name to be a string to fit "F1"-"F12".

Fixes gio#59

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/key: add ModAlt, ModSuper

Signed-off-by: Elias Naur <mail@eliasnaur.com>
key: add ModCtrl, ModShortcut

ModCtrl is the physical Ctrl key, ModShortcut is the virtual
"shortcut" modifier, which is Ctrl on most platforms, Command on
Apple platforms.

Updates #59

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op: change signature of Ops.Write

By returning the allocated data buffer, Ops can become an interface
in a future change without forcing operations to allocate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/key: add String methods to Modifiers and Event

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op: add package op for operations

Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/event: move event types from package ui to its own package

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io: give event packages a common prefix

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>