Commit Graph

1539 Commits

Author SHA1 Message Date
Elias Naur e381ff40d6 app/internal/window: [Android] work around flickering on ChromeOS
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-22 21:14:35 +02:00
Elias Naur 9ac8c80d15 app/internal/window: fix typos
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-22 20:38:14 +02:00
Elias Naur 86c3fb2f0b app/internal/window: [Android] disable platform focus highlight
Gio apps use a single Android View for the entire UI, rendering the platform
focus highlight unsuitable.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-22 20:07:12 +02:00
Elias Naur 6ab43aba3e all: implement staticcheck suggestions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-19 10:47:17 +02:00
Elias Naur 39fd161bea app/internal/window: use GetDpiForWindow if available
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-19 10:41:47 +02:00
Chris Waldon ae07c5f470 widget/material: handle elliptical icon buttons
This commit changes the ink-drawing code so that IconButtons that
are not perfectly circular will still ink fully. Previously, an
elliptical icon would only animate a circular sub-region.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-07-18 08:46:38 +02:00
Elias Naur 40141e29f5 example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-16 14:54:37 +02:00
Elias Naur 47efa26cfc gpu: limit atlas textures to 8k x 8k
Fixes gio#131
Fixes gio#133

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-16 14:52:51 +02:00
Elias Naur f958f9512e cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-15 12:11:02 +02:00
Elias Naur e48b85f8d9 app/internal/window,app/internal/egl: replace deprecated MESA_EGL_NO_X11_HEADERS
Fixes gio#147

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-15 12:08:50 +02:00
Larry Clapp a54b460595 layout: refactor List.Layout and related functions
I found the interplay of List's Layout/init/next/more/end methods
somewhat confusing and hard to reason about, so I refactored them.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2020-07-12 22:40:02 +02:00
Elias Naur 773939fe1d widget/material: avoid excessive trigonometry in Loader.Layout
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-11 14:35:15 +02:00
Elias Naur 742e1f9e72 example: bump gio version
Tweak kitchen Border example as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 20:37:34 +02:00
Elias Naur 188bfa9a0b font/opentype: report valid bounds from layoutText for the empty string
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 20:35:19 +02:00
Elias Naur 713770f808 widget: defer op.StackOp in Editor.PaintCaret
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 20:34:15 +02:00
Elias Naur 39550f3239 example: add widget.Border example
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 20:00:38 +02:00
Elias Naur c76b42e486 op/clip,widget: add clip.Border and widget.Border
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 19:55:37 +02:00
Elias Naur 5a6ad65b85 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 18:33:56 +02:00
Elias Naur d572aa23ac op/clip: split Rect into pixel-aligned Rect and rounded RRect
The pixel-aligned Rect is more efficient and easier to use in the common case
of layout clipping.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 18:33:00 +02:00
Elias Naur 4818538ef8 op/clip: unexport Rect.Op
It wasn't used anywhere outside Rect.Add.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 17:29:31 +02:00
Elias Naur 29f820caaa widhet/material: change minimum Loader size to be a default
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-09 15:54:39 +02:00
Elias Naur de66aae152 example: add Loader example
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-08 22:54:54 +02:00
Elias Naur 692d6ab221 widget/material: add Loader for indeterminate progress widget
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-08 22:52:58 +02:00
Elias Naur a97fa3f1ac example: don't os.Exit unconditionally, hiding panics
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-08 22:30:13 +02:00
Elias Naur 659849bb82 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-08 16:18:40 +02:00
Elias Naur 96da6945a7 app/internal/window: [Wayland] initialize touchFoci map
Fixes gio#145 (I hope)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-08 16:16:44 +02:00
tainted-bit 6c8dcbdb4b font/opentype: add tests for Collection as a Face
Added tests to make sure that opentype.Collection can be used as a
text.Face, and that it correctly implements fallback behavior for
glyph lookups.

Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
2020-07-08 16:12:03 +02:00
tainted-bit a6afa86d85 font/opentype: support using Collection as a Face
This change allows font collection files (extensions .ttc or .otc)
to be used as a text.Face. These files contain an ordered list of
SFNT fonts, each supporting a maximum of 2^16 glyphs. When used as
a text.Face, each rune in the string to layout or render will be
assigned to the first font with a glyph for that rune, or to the
replacement character from the first font in the file otherwise.

With this change, it is possible to support multiple unicode planes
in a single text.Face by using a Collection with more than one
internal SFNT file. For example, it is now possible to display
characters from the basic multilingual plane and emoji in a single
widget.Label by loading an appropriate OTC file.

Fixes gio#104

Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
2020-07-08 16:11:50 +02:00
Elias Naur 7bbe0da0c7 text,font/opentype: make text layout and shaping safe for concurrent use
Implementations of text.Face are reused across multiple windows for efficiency.
Make the opentype implementation safe for concurrent use and document it.

Updates gio#104

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 17:55:25 +02:00
Elias Naur e2278b64c1 app/headless: avoid race between ReleaseCurrent and MakeCurrent
Release context on MakeCurrent failure paths as well.

Fixes gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 17:37:02 +02:00
Elias Naur 30ad63283b app/headless,internal/rendertest: report errors from headless renders
Updates gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 16:36:03 +02:00
Elias Naur d53c92791f app/headless: don't release context while it's current
Updates gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 16:35:58 +02:00
Elias Naur 1513348bf6 app/internal/egl: don't call eglTerminate
A single EGL display may be shared among several contexts. Don't
eglTerminate a context display when destroying the context.

Updates gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 16:26:16 +02:00
Elias Naur 8bd0e85f2e internal/rendertest: dump bad images immediately
Updates gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 14:50:43 +02:00
Elias Naur dff037a84e internal/rendertest: release GPU resources after test completion
Updates gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-04 14:29:41 +02:00
Elias Naur 223f8fd40a example/kitchen: bump gio version
Add explicit inset to ButtonLayout.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-30 20:46:02 +02:00
Elias Naur 6ef1ff7cfb widget/material: remove Inset from ButtonLayoutStyle
ButtonLayout is for custom button content; insets belong to the
custom content, not the button.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-30 20:44:35 +02:00
Elias Naur 958b19ae22 app/internal/window: [macOS] ignore result from CVDisplayLinkStart
Larry Clapp reported a panic from failing to start the display link.
Ignore the error and hope the error is transient.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-30 11:36:26 +02:00
Elias Naur 851255f7a6 widget: tolerate nil shader in Editor movement methods
Fixes gio#142

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-28 22:34:58 +02:00
Elias Naur 2f8833d985 app/internal/window: [X11] avoid -d=checkptr check failures
Casting a *XClientMessageEvent or *XSelectionEvent to *XEvent is
technically incorrect because the union XEvent is the larger structure.

Use an XEvent variable as the backing storage for the specialized
event types instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-27 15:29:42 +02:00
Elias Naur f5985b5e7d cmd,example: bump gio version
Add os.Exit to examples now that app.Main never returns.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 16:30:34 +02:00
Sebastien Binet 6a9a870462 app{,/internal/window}: make app.Main blocking on desktop platforms
This CL implements the app.Main function as a blocking-forever function
for JS, Wayland, Windows and X11.
This works better for applications that can now programmatically close
windows.
2020-06-26 16:20:42 +02:00
Elias Naur facf5cbb9d cmd,example: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 16:16:15 +02:00
Elias Naur 31e8339e1b app/internal/window: [Windows] fix min/max size
Fixes gio#141

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 16:14:41 +01:00
Elias Naur acc0424dd7 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 15:57:54 +02:00
Elias Naur d97f7f9093 app/internal/window,cmd/gogio: [iOS] export GioViewController
The Gio GioAppDelegate created the GioViewController programmatically.
When using gogio's -buildmode=archive users may want to use a different
method (for example storyboards) but there can only be one app delegate.

Move the GioAppDelegate to gogio's exe buildmode, and export the
GioViewController for embedding use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 15:47:00 +02:00
Elias Naur 79014a81d5 app/internal/window: [iOS] move logic out of GioAppDelegate
We'd like to remove GioAppDelegate when Gio is embedded with
gogio's -buildmode=archive. Minimize the code in GioAppDelegate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 15:25:40 +02:00
Elias Naur 913a780d64 text: remove Metrics from Face interface
It's not used in text shaping, so let's not require it.

Note that the concrete opentype package still retains the Metrics
implementation.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-26 10:44:19 +02:00
Elias Naur db03b0898d app/internal/window: run main on main thread on Android and iOS
Before this change, Android and iOS were special for two reasons:
app.Main would return immediately, and the program main was invoked from
a goroutine. We can reduce that to one special case by either

- run the program main from the main thread,
- or make app.Main block.

Choose to run main on the main thread.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-25 16:21:28 +02:00
Viktor Ogeman 7ff17453dd gpu: fix negative intersections
Fixes a bug due to that f32.Rect.Intersect will not return the
empty rectangle for non intersecting rectangles - but instead
a swapped rectangle. By removing the .Canon() call in gpu.go we
ensure that non overlapping clipping rects and paint rects will
lead to no painting.

The Canon() call is not needed since boundsForTransformedRect()
was previously updated to always return a canonical rectangle.

Test case added.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
2020-06-25 15:52:55 +02:00