Backend.queryState sets GL_ACTIVE_TEXTURE to access texture bindings; this change
makes sure GL_ACTIVE_TEXTURE is restored.
Also, make sure GL state changes made in Backend.restoreState is reflected
in Backend.glstate. Backend.glstate is not used after restoreState, so this
is just for clarity.
This is an alternative to https://github.com/gioui/gio/pull/77.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
They're easier to test and can be re-used for macOS/Windows.
While here, add a Go 1.18 build tag to app/ime_test.go; it relies
on Go 1.18 fuzzing.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
UTF8String is lossy in the presence of nul (\x00) runes.
While here, don't CFRelease the input to nsstringToString; leave it
up to the caller.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit ensures that the edit buffer used by widget.Editor
does not get EOF when trying to read zero bytes from the
underlying buffer, which eliminates a panic when calling
Editor.SelectedText().
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Only rune positions are tracked for carets, and they only need adjusting
when changing Editor content, not just for re-layout.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A range loop may not see all items in a slice that is appended to during
iteration. Convert range loop to popping each event off the queue until
it is empty.
Fixes: https://todo.sr.ht/~eliasnaur/gio/356
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This change uncovered and fixes a bug in nullLayout.
This is an API change; the methods operated in bytes before.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Needed for efficient implementation of the upcoming IME interface.
Also introduce Editor.replace, seek methods for easier caret navigation
and editing.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
app.Window.Event is no longer safe to call for goroutines outside the event
loop. This change ensures that clipboard reads happen on the even loop.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit changes the definition of app.ViewEvent on Unix systems
to be an interface implemented by two different concrete types:
X11ViewEvent and WaylandViewEvent. Each provides the necessary fields
for custom rendering on its display protocol.
This is a breaking change for all users of app.ViewEvent on
Linux/BSD, as it now is an interface instead of a concrete type.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This new method performs user related actions on the Window, supporting custom window decorations.
It supersedes the Close and Raise methods as well as the Centered window option.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Tools such as the Android SDK `d8` looks for Java tools in JAVA_HOME
before PATH. We should match so we use the same tools, in particular to
make sure our Java version check report the version actually used.
Fixes: https://todo.sr.ht/~eliasnaur/gio/349
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
According to the d8 documentation[0] `--lib` should be used to specify
the path to android.jar, not `--classpath`. Also specify minimum SDK version
to allow d8 to perform version-specific optimizations.
May fix#349.
References: https://todo.sr.ht/~eliasnaur/gio/349
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Move Decorations to the widget package and
rename material.Decorate to material.Decorations.
This makes decorations in line with how the
other widgets are used.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
There's no reason xdg_surface_ack_configure can't be called immediate,
do that. Then, replace calls to window wlWindow.draw with a redraw
field, to ensure only one redraw per event loop iteration.
References: https://todo.sr.ht/~eliasnaur/gio/351
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The fix for #340, b2a99fddca, deferred
all driver functions until after event processing. Deferring functions
breaks Window.Run which expects to complete during event processing.
This change is an alternative, more targeted fix, namely deferring just
Window.Close until after event processing.
A follow-up will revert the previous fix.
References: https://todo.sr.ht/~eliasnaur/gio/340
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Fix actions not processed and move the Layout method from
Decorations to DecorationsStyle.
Also clarify the comment for the app.Window.Decorated option.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This patch implements a mechanism for customizing window
decorations.
If a window is configured with app.Decorated(true), then
the widget/material.Decorations are applied. On Wayland,
the option is automatically set when the server does not
provide window decorations.
Server side decorations are no longer requested.
The Decorated flag is set according to the
server's requests.
Wayland is now the default driver for UNIX platforms.
References: https://todo.sr.ht/~eliasnaur/gio/318
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
According to
https://gioui.org/issue/347 and
https://github.com/godotengine/godot/issues/43714
choosing the integrated Intel GPU on a multi-GPU system with NVIDIA
doesn't work well in X11. According to Godot, forcing the use of the
discrete (NVIDIA) GPU works around the problem. This change disables
Vulkan on X11 instead, which is a more conservative and targeted fix.
Disabling Vulkan on X11 will reduce testing of Vulkan, but
- Pierre is making Wayland the default driver on Linux, where Vulkan
is enabled.
- The OpenGL driver will be exercized more.
Fixes: https://todo.sr.ht/~eliasnaur/gio/347
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For some reason, the Mesa OpenGL software renderer fails to correctly
render some of the tests in gpu/internal/rendertest. The Linux builder
uses the Vulkan software renderer, so only the FreeBSD builders fails.
The root cause may be a Gio issue, but since all the other backends work,
including hardware OpenGL, there is a likelyhood the issue is in Mesa.
I don't have the temperament to debug Mesa issues, so this change disables
software OpenGL on FreeBSD, which will cause the rendertests to skip.
Running Vulkan tests under FreeBSD is blocked on
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257303
In practice it won't matter: FreeBSD and Linux use the same software
for software renderers.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
pointer.Cancel event is ignored, resulting in Hovered returning true
even though the pointer is no longer hovering over the region.
This change fixes it.
Signed-off-by: Rajiv Kanchan <rajiivkanchan@gmail.com>
Add the Decorations material widget and the related system
elements in preparation for the automatic window decoration
patch.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
When a window goes from the Minimized state to Windowed
as the user brings it back up, the internal state needs
to reflect that change and generate the corresponding
Config event.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>