This reverts commit 11f39582b8 that
introduced pacing of display link callbacks. Blocking the display link
callback introduced deadlocks with code that updates the display link
display.
Not pacing the display link may introduce extra view invalidations,
but invalidates are consolidated by the system and won't result in
extra redraws.
Fixes: https://todo.sr.ht/~eliasnaur/gio/370
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It's now possible to directly user pointer.Cursor to add to the ops.
pointer.CursorText.Add(gtx.Ops)
This is an API change. Use pointer.Cursor directly instead of CursorNameOp.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Add most of the common cursors defined by different systems.
Normalize cursor names to match CSS.
This is API change: some cursor names have changed, and the
underlying type is no longer a string.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Events such as system.CommandEvent may result in Invalidate being
called. Ensure animation state is properly updated.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Mapping it to key.NameReturn confuses widgets such as Editor that
treats clicks separate from return key presses.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This change solves an issue where an editor key press such as
backspace would apply before the IME had a chance to process it.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Apparently, a Wayland server such as Sway and River may not issue
a frame pacing callback created before a top level configure event.
This change ensures the frame pacing callback is always refreshed
when animating, regardless of the reason for the frame.
Fixes: https://todo.sr.ht/~eliasnaur/gio/364
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This change implements reporting of the caret position from Editor, as well
as Windows, macOS, Android support. As a result, the IME composition window
on Windows and macOS is now positioned correctly.
References: https://todo.sr.ht/~eliasnaur/gio/246
Signed-off-by: Elias Naur <mail@eliasnaur.com>
When a text range in the IME snippet is replaced, the replacement
is discarded if the range don't overlap with the snippet range. However,
the replacement is more relevant than whatever snippet is current.
This change discards the snippet in case of no overlap.
As a bonus, IMEs that leaves the snippet range at [0:0] will have the
snippet track the composing region now.
The FuzzIME test is adjusted to always generate replacements that overlap
Editor content; otherwise the IME snippet and editor state can't be expected
to match.
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>
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>
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>
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>
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>
As reported on slack by Rajiv Kanchan, when a WindowMode
is used with app.NewWindow, it does not get applied.
Delay the Configure method to make sure it is.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Add resize pointer cursor names for resize operations
in preparation for the window decorations patch.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Make sure that the title is set if changed while in
Maximized mode.
Don't overwrite the config.Size when going from
Minimized to Windowed mode.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Commit 11aec807b2 added a waiting flag to avoid
processing platform events recursively. However the flag was only true when the
window goroutine is blocked waiting for client events, so deferred window
functions such as Window.Option may still runs multiple times for recursive
events.
This change renames the flag to busy and sets it during the entire processing
of an event, including recursive events and deferred window functions.
Fixes: https://todo.sr.ht/~eliasnaur/gio/344
Signed-off-by: Elias Naur <mail@eliasnaur.com>