Change gioui.org/commit/0e70fbc1262920a69c60409285795b6bb8701b09
added a note that app.Window.Queue must only be used during the
processing of a FrameEvent. The change was added because a Gio
user took the existence of app.Window.Queue to mean it was always
available.
This change reduces the scope of window Queues by moving it from Window
to FrameEvent, and minimizes the risk of misuse by not offering
Window.Queue at all.
Note that the gioui.org/commit/a937a7653439333b8c6fc30c7a6039b717339766
change moved Window's Frame method (named Update) to FrameEvent for the
same reason.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Some GPU APIs such as Direct3D can return an error after drawing
a frame indicating a transient device error. Recreate device and
retry if it happens.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For integrating with external window implementations (replacing
package app), access to the event router is required. Extract it
and put it into the new package router.
Router may belong in package io/event, but can't without introducing
import cycles.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The policy of rendering on a separate goroutine is separate from
the actual rendering. Reflect that by introducing the RenderLoop
type for driving a GPU from a separate goroutine.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
RegisterFragment creates an instance of a Java class and registers
it as a Fragment in the window's Context.
Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
The DestroyEvent ack allows the backend to release the window.
Ensure that the GPU associated with the window is done before that
happens.
Updates gio#67
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A frame ops buffers is tracersed twice: once for GPU commands,
and once for everything else. There is already a GPU goroutine for
concurrentl issuing of GPU commands; move the frame ops processing
to the goroutine as well. Both frame ops passed can then proceed
in parallel.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Record the time for generating a frame and submitting it as well
as the time for issuing the frame to the GPU and swapping buffers.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Sometimes it's useful to profile yet not continously re-draw. If the programs
wants the old behaviour, it can issue an InvalidateOp or call
Window.Invalidate.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It was already true that the GPU wouldn't touch the frame after
calling GPU.Draw. This change makes FrameEvent.Frame block until
GPU.Draw is complete.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
If creating a GPU instance fails for some reason, we need to
receive the incoming frame from the application before reporting
the error in a DestroyEvent. If we don't, the a deadlock will occur
where the app is waiting for FrameEvent.Frame to complete, while
the Window waits for the app the receive a DestroyEvent.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It matters for end-to-end tests that rely on the window contents.
Before this change, tests had to wait for 2 extra frames. This change
ensures that the first completed FrameEvent.Frame call guarantees
the previous frame is complete.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package app is the only package that depends on native libraries and
Cgo. Minimize its API, thereby minimizing Gio clients' dependency on
it. In the future, a headless, testing or remote "Window" should be
very easy to replace app.Window.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
While "DrawEvent" was too specific (op.Ops contains non-draw events),
"Update" is too vague: it's a common word, and could be misunderstood
to mean update parts of a window, not replace it.
"FrameEvent" is more specific, and is the usual way to refer to immediate
mode drawing.
While we're here, unexport Window.Update and add a Frame function to
FrameEvent, to emphasize that updating the window frame is only
appropriate during the handling of a FrameEvent.
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>
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>
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>