Like d951d07c93, calls to Window.updateCursor happens on the
evennt loop thread, and so must not go through Window.driverDefer.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The internal calls to ReadClipboard and WriteClipboard happen during a callback
from the event loop. This change avoids the roundtrip through driverDefer.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Running, for example, Window.Close during a FrameEvent processing doesn't end
well on platforms that immediately destroys the window. This change defers
callbacks to after the completing the current event.
Fixes: https://todo.sr.ht/~eliasnaur/gio/340
Signed-off-by: Elias Naur <mail@eliasnaur.com>
According to the Vulkan specification the pApplicationInfo member of
the VkInstanceCreateInfo structure may be NULL. However, the Android
emulator crashes on vkEnumeratePhysicalDevices if set to NULL.
This change adds a minimal info to please the emulator.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
On Android, a call to update soft keyboard state may result in focus events.
Before this change, the client would still be blocked in FrameEvent.Frame,
resulting in a deadlock.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For some reason, the Android emulator OpenGL implementation needs the output
framebuffer current when eglSwapBuffers is called; otherwise sRGB emulation
breaks. We used to restore the default FBO explicitly, 9b5e9ae607
restored it implicitly through automatic state restoring, but 30ecf75a0f
broke that by only saving and restoring shared context state. This change
restores the explicit behaviour for non-shared contexts.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
On macOS the display link that drives redraws runs on a separate thread, and
must switch to the main thread to invalidate its view. This change makes sure
the display link can never call invalidate faster than we can draw.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
If the client calls, say, Window.Configure during a frame which in turn results
in a ConfigEvent, the program deadlocks. This change implements a queue of
events to be delivered after processing another.
Fixes: https://todo.sr.ht/~eliasnaur/gio/337
Signed-off-by: Elias Naur <mail@eliasnaur.com>
When the position of the cursor is required while dragging
a widget around, the pointer's cannot be tracked as the drag
grabs the event priority. Therefore, this patch exposes
the drag's current position.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
OpenGL stores the current context in thread-local memory, but commit
4f5baa9a51 removed a runtime.LockOSThread from app.Window that ensured
the goroutine that drives the context stays on the operating thread that
has the context current. This change restores the thread lock.
As a bonus, this change makes the OpenGL contexts responsible for locking
the thread at MakeCurrent, thereby removing LockOSThread calls from GPU
backend-agnostic code.
Fixes: https://todo.sr.ht/~eliasnaur/gio/334
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit changes the way that gogio searches for build tools
so that it correctly identifies versions like '31' as equivalent
to '31.0.0'. The Android SDK appears to not provide version
components in the path name when the component is zero.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
When there were non ASCII characters (for exemple éèàçîï) in a deleted
selection or word, more characters were deleted because there was a
mismatch between runes and bytes in Delete and deleteWord
Fixes: https://todo.sr.ht/~eliasnaur/gio/330
Signed-off-by: Fabien Jansem <fabien@jansem.eu.org>
Before that patch the minimum iOS version was hardcoded. That patch makes possible
to change the minimum iOS version using `-minsdk`.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
The calculated value for maxDist (the maximum allowable error when
converting cubic Beziers to quadratics) was way too small when the
first control point was very close to the starting point of the segment.
(f32.Rectangle.Add does not expand the rectangle to include the new point;
it moves the rectangle by the point's X and Y coordinates.)
Splitting the curve into such small pieces was resulting in very ugly
output.
Fixes: https://todo.sr.ht/~eliasnaur/gio/331
Signed-off-by: Andy Balholm <andy@balholm.com>
Before this change, Window driver callbacks would all go through
channels to be processed by Window.run. However, Window.run may call
into the driver, which again may invoke a Window callback. These
re-entrant calls have been a source of deadlocks and subtle errors,
resulting in increasingly complex channel logic. This change eliminates
the goroutine split between Window and the driver, allowing callbacks
between Window and the driver without restrictions.
The goroutine split between Window and the driver is historical and
was meant to tame the complicated callback logic of drivers into a nice
for-select loop. However, the complexity isn't worth the gain, and there is
no concurrency concerns because there is always a 1:1 correspondance between
a driver goroutine and its Window object.
Fixes: https://todo.sr.ht/~eliasnaur/gio/329
Signed-off-by: Elias Naur <mail@eliasnaur.com>
On Android it's possible that the Activity/View must be restore. But,
before that patch, an new VkSurfaceKHR is created but never used and
that may lead to crash, in an attempt to destroy/use one invalid
surface.
Fixes: https://todo.sr.ht/~eliasnaur/gio/327
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
When an application goes into or out of fullscreen mode,
Gio now emits a ConfigEvent with the current window mode.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
With this change, the Shape function returns a clip.PathSpec
instead of a clip.Outline op. It is then possible to create
a clip.Outline or clip.Stroke op to fill the text path or
draw its stroke.
Signed-off-by: Christophe Meessen <meessen@cppm.in2p3.fr>
In commit 929e4dc12, the rules to send pointer.{Enter,Leave}
events were relaxed. Unfortunately, to be able to make use
of them was not straight forward as it required the transfer
target op to use the same handle as the hover one.
This patch eases this by allowing any handle for the target
as well as not requiring the hover op to be defined on the same
clip op as the target (then requiring a PassOp though), making
it much easier to use.
Also added a test for pointer.Enter events not being generated
if the target type does not match the source one.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
When extracting headless.Window's content via screenshots,
it can be useful to keep reusing the same image for output,
as well as specify which area of the Window is to be
extracted.
The updated Screenshot method does this by using the supplied
image.
API change: users must pass an existing image to Window.Screenshot.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Ever since commit 8ff654628, the headless implementation has used two
GPU backend (not renderer) instances, one for the renderer and one for
creating the offscreen texture to render into. This arrangment leaks
resources because the backends only clear temporary storage at
BeginFrame, which is not called when reading pixel data from renders.
This change adds an internal constructor, gpu.NewWithDevice, to allow
headless.Window to share its device with the renderer, fixing the leak.
It also makes the code simpler (took me a while to debug this issue); in
fact I'm surprised it even works.
This is not a great fix: it adds an exported yet internal constructor,
and the ownership transfer of the device is surprising enough to warrant
two comments.
Fixes gio#322
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This change is to augment the X11 clipboard write behaviour.
When writing to the clipboard both the primary and clipboard
selections are published so that non-GIO applications that read
the primary selection (i.e. such as terminal emulators using
middle-mouse clicks) can read the data from a GIO app.
Signed-off-by: Jeff Williams <kanobe@gmail.com>
When a drag and drop gesture is ongoing, let the potential target
handlers receive enter/leave events so that they can react to them (e.g.
highlight themselves when the dragged item is over them).
Fixes#321.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
When computing the set of Enter/Leave events to be
delivered to handlers, skip non mouse pointers
right away instead of processing hit events.
Also, remove use of pointer to slice use in opHit.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
For mixing native UI with Gio UI, the UIViewController is sometimes
needed, not just the UIView. This change replace the View field of
ViewEvent with ViewController.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This patch adds internal Drag and Drop support to app.Windows.
The new package io/transfer adds the ability to
define draggable and droppable targets, which
are leveraged by the new widget.Draggable type.
The API is generic and could handle future use
cases, such as external Drag and Drop.
Updates gio#153
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
When the Min constraints are set but the list
has no item to display, use those as the list
returned dimensions.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Previous changes added semantic API and semantic information to Gio
widgets. This change maps the information to Android accessibility
classes so that TalkBack can traverse and interact with Gio programs.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Some semantic information is automatically extracted, but some must be
provided by UI components. This change enriches the generic and material
widgets with such information.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Software such as screen readers require semantic descriptions of user
interfaces to effectively present and interact with them. Package
semantic, combined with the existing package clip provide the operations
for Gio programs to describe themselves.
This change implements the semantic package and the routing changes for
accessing semantic trees; follow-ups add semantic information to widgets
and implement mapping semantic tree to platform representations.
Signed-off-by: Elias Naur <mail@eliasnaur.com>