We are going to encourage a model where pointers to a central
(program global) Configs are passed to widgets at setup time, and
not pass Configs at every frame.
That way, the global Gonfig can change, but the pointers won't need
updating.
This change only switches the Draw event's Config pointer to a value
to avoid tempting programs to use the event Config instead of
updating their own central Configs.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Wayland requires its clients to handle key repeating themselves.
Our strategy is simple: start a timer on key down and fire key
events at regular intervals until another key event arrives.
However, if the program blocks the event loop while processing a
synchronous event, key repeats might pile up before the stopping
key event is processed.
This change use the timestamp of the stopping key event to only
dispatch the repeats queued up before the stop time.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We don't have full IME-aware editor yet. Fortunately, the BaseInputConnection
has a "dummy mode" setting to allow us to receive input from the fancier keyboards
without implementing the full IME interface.
Fixes gio#7 (I hope; I tested with SwiftKey that had the same symptoms)
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It seems that the iOS simulator can return NaN from texture2D, so
even though width == 0, the resulting cover is not.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With a <textarea> DOM element pressing the enter key will result in
a "Enter" key down event and a "\n" input event. We're only
interested in the key event, so switching to a single line <input>
avoids the extra "\n".
Signed-off-by: Elias Naur <mail@eliasnaur.com>
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>
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>
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>
In preparation for an OpColor (and future OpGradient and similar).
Label and Editor no longer take an explicit source image. They
draw with the current image.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The os and gl packages were separate in the past, which required
uintptr for cross-package CFTypeRefs. That's no longer needed.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Now that syscall/js.TypedArrayOf is going away in Go 1.13 (sse
https://golang.org/issue/31980), copying byte slices to JS before
use is necessary. To avoid garbage, re-use a single buffer for all
transfers.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
syscall/js.TypedArrayOf is going away in Go 1.13. Avoid it for
invalidateFramebuffer by using a buffer managed by JS.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The frame callback for macOS comes in from a different thread than
the UI thread. Serialize event handling to maintain the invariant
that only one event is processed at a time.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
GL_EXT_disjoint_timer_query_webgl2 is the WebGL 2 counterpart to
the WebGL 1 GL_EXT_disjoint_timer_query extension.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Some devices don't support floating point FBOs even though they
support OpenGL ES 3. Check support by creating a FBO and fail early
if no support is found.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
I found a convincing use case: stopping asynchronous activities
while paused. A follow up change will rename the stages and add
an example.
This reverts commit f9840b0963.
I'm not convinced the API is right. For exmaple, an event that
notifies a program when to save its state is both smaller and
might be sufficient.
Signed-off-by: Elias Naur <mail@eliasnaur.com>