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>
Removed redundant XSelectInput and XChangeWindowAttributes as well as
obsolete screen parameter in x11DetectUIScale.
Signed-off-by: Denis Bernard <db047h@gmail.com>
When you press enter to "submit" an editor widget, don't also append the
newline to the editor text. Enter should be "submit" or "add newline"
but not both.
Also add parens to the Enter check: x && y || z => x && (y || z).
Signed-off-by: Larry Clapp <larry@theclapp.org>
This is a general fix where keys with names differing from their UTF8
representation could not be sent as EditEvents.
Signed-off-by: Denis Bernard <db047h@gmail.com>
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>
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>
This is effectively a revert of 60e4cca934, which
seems to have caused flickering problems on some versions of Windows.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The gioui.org/commit/74407a50d598bfd27e8f8e48b6832cc5df04de77
added a NewImageOp constructor that always copies the supplied
image. It does that for two reasons:
First, the image.Image reference is used in the image=>texture
map of cached textures. Without a copy, we wouldn't detect a
modified image even if a new ImageOp was created.
Second, we don't want the program to touch the image while the GPU
is uploading it.
The second reason was removed in a previous change that blocks
FrameEvent.Frame until we're done with the operations, including
uploading images to the GPU.
The first reason is easily fixed by using a unique per ImageOp,
as pointed out by Alessandro Arzilli.
This change switches to using the unique key. Alessandro's patch
avoids the copy when possible.
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>
Now that we use tip due to breaking changes in Go's JS APIs, let's
replace our hacky cleanup list code with 1.14's upcoming
testing.T.Cleanup.
Adding more deliberate uses of tip would ususally be best avoided, but
these will only affect developers working on gio's tests, not regular
users of gio.
While at it, remove some debug t.Logf calls I forgot to remove.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
WebAssembly builds require Go 1.14 since the breaking change in Go,
golang.org/cl/203600.
gofmt -w -s . as well.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This means we can deduplicate some of the logic, and keep it all in one
place.
Start expanding the logic too; the tests are slow, so they should be
skipped on 'go test -short'. The ones we have so far all run in a matter
of seconds on an average laptop today, but future tests will probably
require heavier work like wine or kvm.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>