Commit Graph

1451 Commits

Author SHA1 Message Date
Elias Naur e2f3bbdfc3 cmd/gogio: [Android] disable ChromeOS input emulation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-19 20:07:44 +02:00
Elias Naur b9f6543cf5 gesture: always drag scroll on Android
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>
2020-06-19 20:05:01 +02:00
Egon Elbre 88ced59dad example/windows: add Window.Close example 2020-06-19 14:15:58 +02:00
Egon Elbre 7c98e679ef example,cmd: bump gio version
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-06-19 14:15:55 +02:00
Egon Elbre 0b713032fb app/internal: [Windows] support Window.Close
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-06-19 12:37:21 +02:00
Elias Naur c35d81e828 cmd/gogio: mention that Android builds include jar class files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-19 11:17:24 +02:00
Larry Clapp 602d54dc5e app,app/internal/window: [macOS] add app.Window.Close for closing a window
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>
2020-06-18 14:46:58 +02:00
Elias Naur 7f836fa627 go.*: update golang.org/x/image
For the font fix: https://go-review.googlesource.com/c/image/+/237900

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-18 14:38:15 +02:00
Elias Naur dd225d5d07 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-17 12:08:08 +02:00
Elias Naur 596e321610 all: make unit.Converter concrete and rename to Metric
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>
2020-06-17 11:47:14 +02:00
Elias Naur 1603a6f3ee op: add note that Ops.Reset invalidates recorded macros.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-17 09:59:15 +02:00
Elias Naur 3b54c665ca layout: add WeightSum to Flex for overriding the Flexed total weight
Updates gio#139

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-17 09:43:11 +02:00
Jason a3f7eaae08 app/internal/window: set WM_CLASS to binary name
WM_CLASS is used by Linux desktops to provide hints for window
grouping, icons to show and startup notifications.

https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

This patch set the WM_CLASS to the binary name.

Signed-off-by: Jason <sourcehut@sweatyballs.es>
2020-06-16 16:15:36 +02:00
Elias Naur 1eedd19231 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-15 18:16:35 +02:00
Elias Naur c2f99fb0e9 app/internal/egl: [Android] fix sRGB on Samsung S9
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>
2020-06-15 18:06:48 +02:00
Elias Naur 04e605c1b2 app/internal/window: [Android] implement scroll factor fallback for < API 26
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-15 13:40:13 +02:00
Chris Waldon 5214b26731 example/kitchen: add flag to draw all widgets disabled
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>
2020-06-15 09:55:37 +02:00
Chris Waldon 9f6e09317d widget/material: add disabled state support to all widgets
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>
2020-06-15 09:53:49 +02:00
Elias Naur feacd1e2df app/internal/window: [Android] implement mouse scrolling
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 18:52:29 +02:00
Elias Naur 8688ed95c2 app/internal/window: [Android] replace RegisterFragment with Do
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>
2020-06-13 17:47:58 +02:00
Elias Naur f36674ddb3 app/internal/window: [Android] make runOnThread independent of a valid GioView
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 17:47:58 +02:00
Elias Naur d045f492b4 cmd/gogio: [Android] mark GioActivity ready for multi-window configuration changes
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 17:47:50 +02:00
Elias Naur 2f521899c9 app/internal/window: [Android] use app context for clipboard access
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>
2020-06-13 16:41:28 +02:00
Elias Naur 65d9a9d1f1 app/internal/window: [Android] skip redraw for destroyed views
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 16:41:28 +02:00
Elias Naur fda6fbcf84 app: drop Go 1.12 support
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 16:41:28 +02:00
Elias Naur 8a5f3f3dd5 cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 11:49:55 +02:00
Elias Naur 1b944c8e65 app/internal/d3d11: tolerate padded row pitches from D3DDeviceContext::Map
Fixes gio#136 (I think)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-13 11:46:20 +02:00
tainted-bit 2dc19a3695 widget: use byte length when comparing with caret position
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>
2020-06-12 17:14:31 +02:00
Elias Naur 4c28369aa2 example/kitchen: ensure widgets are enabled when taking a screenshot
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-12 16:59:12 +02:00
Elias Naur 6d5fbcba3f app/internal/window: [Android] unregister focus listener on destroy
Updates github.com/tailscale/tailscale/issues/431

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-11 15:39:33 +02:00
Elias Naur 5fe3785bbd widget/material: make Switch disabled color configurable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-10 20:20:36 +02:00
Elias Naur bb8bb504d8 cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-10 11:29:23 +02:00
Elias Naur 5272dc9fa5 layout: make Flexed weight a weight, not a ratio
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>
2020-06-10 11:25:25 +02:00
Elias Naur b1df2a61a9 cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 23:24:12 +02:00
Elias Naur 6380baacb6 all: move Now from system.Config to system.FrameEvent
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>
2020-06-09 23:23:08 +02:00
Elias Naur 81a84d874b example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 23:03:36 +02:00
Elias Naur d1ea9339d5 layout: change NewContext to take the FrameEvent directly
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>
2020-06-09 22:57:19 +02:00
Elias Naur 566132b4f5 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 22:32:24 +02:00
Elias Naur a24a2c9fb6 widget/material: fade out inkwells a little longer than their expansions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 22:29:43 +02:00
Elias Naur 0715c801e2 widget,widget/material: convert Switch to use Clickable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 22:12:41 +02:00
Elias Naur f7fea02312 widget: immediately fade out cancelled button press inkwells
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 21:51:39 +02:00
Elias Naur 5e37a64ff1 gesture: remove Click.State and cancel Click gesture on outside Release
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 00:12:05 +02:00
Elias Naur 1c6809142f io/router: report Enter events for touch press events
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-09 00:10:49 +02:00
Elias Naur ce56464923 widget,gesture: fade out cancelled inkwells
While here, adjust inkwell sizes to match gtx.Constraints.Min.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-08 23:50:00 +02:00
Elias Naur 36f4267a6c widget/material: fade in inkwells
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>
2020-06-08 22:07:02 +02:00
Elias Naur 0444caa9e3 gesture,widget: drop press markers on gesture cancel
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-08 21:44:57 +02:00
Elias Naur 652f1ecd47 io/router: deliver Release before Leave
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>
2020-06-08 21:31:23 +02:00
Elias Naur 1ace1392d6 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-08 17:55:40 +02:00
Elias Naur 6f15275e22 app/internal/window: [macOS] retain NSWindow instance
Updates (maybe fixes) #130

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-08 17:54:44 +02:00
Elias Naur ab9b6383a4 Partially revert "gpu: saturate instead of overflowing depth buffer"
This reverts commit 504664e014.

Reason: Doesn't work.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-08 16:59:11 +02:00