This change makes material.Clickable propagate the constraints it is
invoked with to the widget being made clickable. Without this, the
internal use of layout.Stack resets the minimum constraints to zero.
This has the confusing effect of breaking a working layout when you
decide to wrap one element in a Clickable, which I think is sufficiently
surprising that we should eliminate the footgun.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit adds a check that caret coordinates never exceed
the max constraints of the editor.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.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>
This commit fixes the position returned by Editor.CaretCoords
to account for the scroll position of the editor. Without this
change, the returned coordinates can easily overflow the boundaries
of the editor widget when it has been scrolled on either axis.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
For some reason, widget.Editor had a Seek method that ignored
the supplied offset and always seeked to offset zero. This
made it impossible to use it like any other io.Seeker. This
commit simply honors the requested offset.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Pointer padding was introduced in bfece0beba.
I don't remember why, and its commit message doesn't say. Regardless, adding
padding outside a widget's reported dimensions doesn't seem like a good idea
(see #365), and this change removes it.
Fixes: https://todo.sr.ht/~eliasnaur/gio/365
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We'd like to re-use the Editor.closestPosition seeking for
segmentIterator.Next; this change extracts the state-less logic
into functions.
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>
This commit adds a testcase to catch unexpected panics in the
editor's scroll offset logic introduced by using different
setting combinations that affect editor layout. It also fixes
a panic for single-line editors with alignments other than
text.Start.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.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>
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>
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>
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>
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 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>
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>
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>
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>
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>
Switch needs a semantic description, but doesn't have a text label
attached. This change adds a description argument to the constructor.
Signed-off-by: Elias Naur <mail@eliasnaur.com>