Commit Graph

1559 Commits

Author SHA1 Message Date
Sebastien Binet f2cd504a9f op/clip: smoother implementation of Arc for large angles
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-29 17:36:37 +02:00
Elias Naur 1584f3a64a app/internal/window: [X11] use correct type for setting X properties
32-bit property values are transferred with the C type "long", which
may be 64 bit.

Fixes "invalid atoms" errors from Firefox and Gedit.

While here, add additional clipboard formats to please Gedit.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-28 13:34:10 +02:00
Sebastien Binet d57edbb49d widget/material: use clip.Path.Arc to draw loader
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 15:25:23 +02:00
Sebastien Binet 3fe0f62fa3 op/clip: export Path's current pen position
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 14:46:05 +02:00
Sebastien Binet 7054ba622a op/clip: implement arc path
Signed-off-by: Sebastien Binet <s@sbinet.org>
2020-08-27 14:46:02 +02:00
aarzilli 4821472ea1 app/internal/xkb: fix events sent when modifier keys are pressed
When modifier keys are active DispatchKey should not send a
key.EditEvent for the key that was pressed. For example when pressing
Ctrl+Alt+e DispatchEvent should not generate a key.EditEvent{Text:"e"}.

Signed-off-by: aarzilli <alessandro.arzilli@gmail.com>
2020-08-25 12:43:53 +02:00
Elias Naur 9543b5f8f3 .builds: add missing dependency
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:42:09 +02:00
Elias Naur 103c6a1911 .builds: replace ANDROID_HOME with ANDROID_SDK_ROOT
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:25:37 +02:00
Elias Naur e214191ff7 gpu: don't validate uniform locations
Sufficiently smart GPU drivers can eliminate unused uniforms across
shader types.

Fixes gio#158

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 19:22:59 +02:00
Elias Naur 7eff3f561f widget: report Enum.Changed only when actually changed
Fixes gio#159

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-24 18:49:54 +02:00
Elias Naur d3fffef861 app/internal/egl: adjust alpha bit depth to enable sRGB on some GPUs
On my setup:

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 530 (SKL GT2) (0x1912)
    Version: 20.1.5
    Accelerated: yes
    Video memory: 3072MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2

eglCreateWindowSurface with the sRGB flag fails with EGL_BAD_MATCH.
Bumping the ALPHA_SIZE from 1 to 8 seems to make the driver happy
again.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-20 14:25:50 +02:00
Elias Naur 3bb1450d0d app: release GPU renderer when done with it
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-17 12:14:35 +02:00
axel paulander edef73f580 cmd/gogio: add -icon flag for specifying the app icon file
Before users were limited to only use a appicon.png in the root directory.
Now the user is free to use any png anywhere on the system with the help of the -icon flag.

Signed-off-by: Axel Paulander <axel.paulander@gmail.com>
2020-08-16 10:52:42 +02:00
Elias Naur 17b5898dd3 go.mod: bump Go version to 1.14
Go 1.15 is out so let's bump the version to 1.14 to sidestep the annoying
webassembly syscall/js change from Go 1.13.

Go 1.13 (and warlier?) will still attempt to build, but when failing to
build a webassembly program the go tool will report the version mismatch.

Fixes gio#156

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-15 11:10:16 +02:00
Elias Naur 6c30c6386c app,app/internal: [Android] replace Window.Do with ViewEvent
An event reporting the most recent Android View attached to the Window is both
simpler to implement and automatically tracks the Activity lifecycle.

The downside is that buggy programs may hold on to a stale references.
Fortunately, JNI references are handles not pointers so the always-on Android
JNI checks will very likely catch stale references on use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-13 14:41:37 +02:00
Elias Naur c3574cdabd widget/material: Make checkbox/radio buttons icon modifiable
Signed-off-by: songpv <pvsong10@icloud.com>
2020-08-10 21:33:20 +02:00
Elias Naur a063febed9 cmd: use ANDROID_SDK_ROOT instead of ANDROID_HOME
ANDROID_HOME is deprecated and slowly being removed from Android
tools.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-08-09 18:17:02 +02:00
Elias Naur 83673ecb20 example,cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-26 11:03:39 +02:00
Elias Naur 3b95e29183 app/internal/window: [WebAssembly] fix touch event handling
Fixes gio#149

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-26 11:01:30 +02:00
Elias Naur 4a9d97784f app: [Android] don't block the main thread in Window.Do
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-24 19:33:11 +02:00
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