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>
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>
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>
...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>
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>
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>
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>
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>
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>
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>
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>
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>