First, let the handlers know they're dropping with a cancel event.
Second, reset the grab flag of dropped handlers.
Fixes issues when drag-scrolling and then clicking and another with two nested
drag gestures where the grab flag is kept for the second handler even after it
is pushed out by the first handler grabbing.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Go 1.14 disables the use of `go run` in module mode outside a module,
see https://golang.org/issue/32027.
Suggest initializing a module in the current directory instead; that
enables module mode (in Go 1.13) and enables `go run`.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
While we're here, replace Height and Width options with just a Size; the value
of separate width and height options is not clear to me.
Finally, leave out the wrapping struct from the Option type, the
function is enough.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With Context containing all the necessary information, separate
Init methods no longer makes much sense. Delete them and thereby
remove a source of runtime panics.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The sfnt.Buffer embedded in the opentype type caused instances of
it to escape. Move the buffer to Family to avoid that.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It was easy to forget Family.Reset, and the per-frame caching strategy is
probably too aggressive. Use a static size for the caches and evict
according to a least recently used policy.
Reset is then no longer required, and we can delete it.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Only the Wayland backend needs an wl_egl_window between the wl_surface
and EGL. Move code dealing with the indirection to Wayland specific
code.
Then, introduce the eglDriver interface instead of referencing the
native window type directly. This will help when multiple backends are
supported at runtime (e.g. Wayland+X11).
Finally, move the eglDriver implementation methods from GOOS-specific
code to separate EGL-specific files, allowing EGL types to be used
directly instead of unsafe.Pointer and uinptr.
The result is simpler generic EGL code, and easier path towards X11
support.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Taking a constraint in Reset smells too much of a layout operation,
whereas a size is simpler and only serves to set the context constraints
to something sensible.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Text shaping is a common name for what package measure does. Rename
it to "shape" and move it below the text package.
Signed-off-by: Elias Naur <mail@eliasnaur.com>