Mice drags scroll on Android by convention. Further, ChromeOS converts
two-finger touchpad scroll gestures to press-drag with Source == Mouse.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Recently support was added for multiple top-level windows. Add support
for closing those windows.
macOS only; all others stubbed out.
Signed-off-by: Larry Clapp <larry@theclapp.org>
An interface for scaling dp and sp is overkill, at least for all
current uses. Make it a concrete struct type, and rename it to the
shorter and more precise Metric.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
At least one Samsung S9 device ignores the sRGB setting if the context
wasn't created with alpha in its attributes.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This adds a --disable flag to the kitchen example so that it's easy
to preview what all widgets look like when they are disabled.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit configures all remaining widgets to draw themselves in a disabled state
when their layout.Context is disabled. A description of the
strategy employed by each follows:
- Checkbox and RadioButton: Draws the icon component in a lighter color. Currently the label text is left
in its default color.
- ProgressBar: The "progress" color is lightened, but not as much as the background color. This makes the current progress value still readable.
- Editor: The cursor is no longer drawn and the text is lightened.
- Switch: The track is unchanged, but the circular "thumb" component is lightened.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Do is a function for accessing the underlying Android View in a safe
context, the main thread. Do is
- more general than RegisterFragment and may be expanded to other platforms
- simpler to implement (from the Gio side)
and as a bonus, the Do implementation avoids a race condition where
a call to RegisterFragment during an Activity re-create would be ignored.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The Activity context may not be available, so it's safer and simpler
to use the always available app context.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Fixes misaligned carets when the Editor text contains code points
represented by multiple UTF-8 bytes. Line lengths should be
measured in bytes instead of glyphs for caret positioning.
Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
It's more intuitive to specify the weight as a ratio of the total
weight of all Flexed children than to specify the ratio of the
flexable space.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Then, make layout.Context.Now a field, copied from FrameEvent.Now.
API change:
gofmt -r 'gtx.Now() -> gtx.Now'
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The layout package imports io/system anyway, so depending on
FrameEvent does not introduce new dependencies.
API change. Use gofmt to adjust your code:
gofmt -r 'layout.NewContext(a, b, c, d) -> layout.NewContext(a, e)'
Signed-off-by: Elias Naur <mail@eliasnaur.com>
When a clickable is pressed and dragged any enclosing List will grab and
cancels the press. To minimize visual dicontinuity, smoothly fade in the
inkwell.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Fixes a problem where a touch Release would signal gesture.Click
that it had left just before click would complete.
Signed-off-by: Elias Naur <mail@eliasnaur.com>