Commit Graph

1819 Commits

Author SHA1 Message Date
Egon Elbre e66979a8c0 io/router: fix negative areas
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2021-02-24 17:12:36 +01:00
Elias Naur cfb6f477de gpu: [compute] remove even more unused commands
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-24 13:42:39 +01:00
Elias Naur 53763a3410 cmd/gogio: raise end-to-end test timeout
Windows tests often flake:

TestEndToEnd/Windows: e2e_test.go:113: last error: encountered 6 color mismatches:
          5,5   got 0xffffffffffff, want 0xdedeadadbebe
        395,5   got 0xffffffffffff, want 0xdedeadadbebe
          5,305 got 0xdedeadadbebe, want 0x000000000000
        395,305 got 0xdedeadadbebe, want 0x000000000000
        405,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb

Bump the timeout as a quick workaround.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-24 12:52:12 +01:00
pierre cfb16083a2 io/router: improve areaOp methods performance
name             old time/op  new time/op  delta
AreaOp_Decode-8  10.5ns ± 2%   6.2ns ± 3%  -41.50%  (p=0.000 n=10+10)
AreaOp_Hit-8     4.44ns ± 4%  3.57ns ± 2%  -19.59%  (p=0.000 n=10+10)

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-02-24 12:42:34 +01:00
Inkeliz 212f7809cb cmd/gogio: [android] allow custom signature-key
That change makes possible to provide custom PKCS#12 (JKS/PFX) using `-signkey` and the password with `-signpass`.

By default the gogio will use the `debug.keystore`, if no key is provided.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-24 12:34:43 +01:00
pierre 60d48014d4 io/router: avoid event copy for filtered events in pointerQueue
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-02-24 12:32:01 +01:00
pierre 14595dde9f internal/opconst: removed unused TypeLayer
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-02-24 10:11:50 +01:00
Elias Naur 51ba55071b gpu: [compute] remove more unused commands
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-24 10:04:34 +01:00
Elias Naur 284659d3ea gpu/shaders: [compute] remove unused command from kernel4
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-22 18:25:43 +01:00
Elias Naur c849c5b77f gpu: [compute] use correct usage flags for output image
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-22 17:19:15 +01:00
Inkeliz 2a7295750d cmd/gogio: fix icon/resources for Android
Previously that patch, gogio unzip the `link.apk` (generated by AAPT2) to an temporary folder and then compress it again to a new `app.ap_` file.

For some unknown reason, that unzip-then-zip doesn't work. The resources are included but is corrupted in somehow. That PR aims to fix that by avoid the extraction to an temporary folder.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-22 12:10:36 +01:00
Elias Naur 9d1e3370f4 app/internal/window: fix Wayland clipboard reading
The Wayland protocol implicitly dup(2)s the pipe write end descriptor passed to
wl_data_offer_receive. As long as we also have an open descriptor for the write
end, the pipe will not close and signal the completion of the clipboard read.

This change explicitly and immediately closes our write descriptor. Before this
change, reading the Wayland clipboard worked with some delay because the Go
garbage collector closed the write end of the transfer pipe after some time.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-21 14:36:36 +01:00
Elias Naur 2feec23561 gpu: [compute] fix path gaps by eliminating redundant path points
See https://github.com/linebender/piet-gpu/issues/62 for description
of the issue. The fix is the Gio copy of the piet-gpu fix.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 10:30:05 +01:00
Elias Naur b5d21b209c gpu: [compute] use array type for scene elements
All scene elements have a fixed size in uint32s. Model them accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 10:30:05 +01:00
Elias Naur c9a8265126 gpu: [compute] pre-transform images before rendering
We're about to change the last stage of the compute pipeline to only
accept images, not sampled textures. This change prepares materials
for pixel-aligned image copying by pre-rendering images to a texture,
applying transforms.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 10:30:05 +01:00
Elias Naur 87ffaaf8c4 gpu/shader: fix mem.h comments
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 10:30:05 +01:00
Elias Naur ffb56f42b9 cmd/gogio/testdata: always clear background to white
The webassembly port changed to use transparent black to allow content
below Gio to show through. However, the end-to-end tests expect a white
background.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 09:06:24 +01:00
Elias Naur 4f3f0fa50c .builds: enable headless rendering tests on FreeBSD
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 08:57:54 +01:00
Elias Naur b420fdf096 cmd/gogio: remove obsolete headless chrome workaround
The two listed issues are fixed, and the builders pass with the
workaround removed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 08:46:03 +01:00
Elias Naur 33a1c4722a .builds: don't set EGL_PLATFORM for chrome tests
EGL_PLATFORM=surfaceless allows rendering tests to complete in headless
mode. However, the headless chrome tests fail with that setting. Change
the linux builder to only set the variable when needed.

Enable verbose output of tests while here. We can keep an eye on skipped
tests that way.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 08:33:42 +01:00
Paulo Melo 3987815469 app: change background for js
Default window background is white.
JS default background is transparent black.

Signed-off-by: Paulo Melo <paulo.durrer.melo@gmail.com>
2021-02-18 08:07:08 +01:00
Elias Naur 29af250ac6 .builds: remove cross compiler arguments
A recent change to the native toolchain or system on the builder infrastructure
made the arguments for the apple cross compiler needed always, not just in
CGO_CFLAGS and CGO_LDFLAGS.

Remove them altogether and rely on a recent change to the giouiorg repository
for including them in the clang-ios and clang-macos wrappers.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-15 11:59:16 +01:00
vsariola a8a48bb809 widget: fix bug how f.pos is calculated in widget.Float
The order of subtraction when calculating f.pos from value was wrong,
so setting a minimum value for a Float never really worked, although
min = 0 worked as intended which is why this probably went unnoticed.

Signed-off-by: vsariola <5684185+vsariola@users.noreply.github.com>
2021-02-15 09:00:11 +01:00
Elias Naur 7286b075e2 internal/cmd/convertshaders: use wine for running the HLSL compiler
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-10 21:57:57 +01:00
Elias Naur 8ec47dcae3 gpu: give compute.atlas a more precise name, reset atlas efficiently
Refactor only, in preparation for adding another atlas with pre-processed
materials.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-09 11:08:40 +01:00
Elias Naur ebfb17ec6c gpu/gl: add support for read-only images to BindImageTexture
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-09 11:08:40 +01:00
Elias Naur d8b29e3420 gpu: replace toRectF with layout.FRect
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-08 16:07:13 +01:00
pierre a581acf3fd io/pointer: added the grab cursor
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-02-08 09:15:14 +01:00
Chris Waldon 6682f75db9 widget/material: use more readable editor default selection color
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2021-02-06 07:51:56 +01:00
Paulo Melo 403f01655a Programmatic Click function
Signed-off-by: Paulo Melo <paulo.durrer.melo@gmail.com>
2021-02-04 11:10:20 +01:00
Elias Naur bb56b8183c README.md: make the gioui.org link more prominent
The README is deliberately light; we want users to use the gioui.org site for
resources, not the site that happens to host the project Git repository.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 17:03:12 +01:00
Elias Naur d420654dbc cmd/gogio: fix argv passing from URL search fragment to Go program
Fixes the examples on gioui.org/doc/architecture.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 16:51:31 +01:00
Elias Naur e0033ce871 gpu/gl: explicitly clear buffers before replacing their content
The iOS GL implementation doesn't optimize BufferSubData of the entire
buffer, leading to GPU stalls. The workaround is to explicitly clear the
buffer before replacing it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 13:53:52 +01:00
Elias Naur 5dd3ce9923 cmd/gogio: [iOS] identify certificates by their SHA-1 fingerprint
Unlike the common name, the fingerprint is almost certainly unique.
Xcode uses the fingerprint as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 13:18:22 +01:00
pierre b698c8ed82 io/router: only calculate position if event is delivered in Router
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 22:21:31 +01:00
pierre 1100e03c1e io/router: support cursor changes on Frame events
Add support to Router so that the cursor can be changed with CursorNameOp without any mouse movement.
Enter and Leave events are also delivered as areas change.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 22:21:27 +01:00
pierre c3346680f4 io/router: merge cursor and delivery of Enter/Leave events in Router
Cursor and Enter/Leave events should follow the same rules, specifically:
when pointerInfo.pressed is true, Enter/Leave processing ignores
pointer.Areas not hit during the pointer.Press event.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 22:21:24 +01:00
pierre d604455582 app: added windows.TRUE for Windows
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 22:21:18 +01:00
pierre f7d1f46c1f app: make cursor support more robust on Windows
Post a dedicated message upon Window.SetCursor calls.
Make sure that the cursor is only changed if the cursor is in the window.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 17:51:45 +01:00
Elias Naur 57872856e8 internal/unsafe: fix SliceOf to return len equals to cap
Broken by gioui.org/commit/2dce8a0155ae192f54f74747d660b9f311e9e364,
found while debugging the dormant OpenGL backend for Windows.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-26 14:48:27 +01:00
pierre b11fd6ee8e io/router: fix default cursor in Router
Do not update the cursor was reset upon receiving Cancel events. Added more tests.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-25 17:41:47 +01:00
Larry Clapp f88a8216e9 widget: fix Editor panic
If you created an Editor and immediately SetCaret, it panicked because
e.lines was nil and it looked at e.lines[0].

- Add e.makeValid at the top of SetCaret.
- Add a test case for this situation.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2021-01-24 11:06:55 -05:00
Larry Clapp 34273940a0 widget,widget/material: add selection to the editor
- Allow dragging to be on both horizontal and vertical axes at once.
- Split Editor.caret.pos into caret.start and caret.stop. caret.start is
  the old caret.pos, and is both the position of the caret, and also the
  start of selected text. caret.end is the end of the selected text.
  Start can be after end, e.g. after after Shift-DownArrow.
- Update caret.end after a mouse drag, and various shifted keys
  (Shift-UpArrow, Shift-DownArrow, etc).
- Change Shortcut-C to copy only the selected text, not the whole editor
  text.
- Add Shortcut-X to copy and delete selected text, and Shortcut-A to
  select all text.
- The various Insert/Delete/etc functions now overwrite or delete the
  selection, as appropriate.
- Change MoveCaret to accept a distance for selection end, as well.
  Change SetCaret to accept a selection end offset.
- Add SelectionLen to get the selection length, Selection to get
  selection offsets, SelectedText to get the selected text, and
  ClearSelection to clear the selection.
- Add a rudimentary selection unit test, and extend the deleteWord unit
  test with some text selection cases.
- Add SelectionColor to material.EditorStyle, which defaults to
  Theme.Palette.ContrastBg.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2021-01-24 09:44:52 +01:00
Larry Clapp e78bd15564 widget: refactoring to prep for editor selection
- Move caret from editBuffer.caret to Editor.caret.pos.ofs and related
  refactoring. Move other fields in Editor.caret into Editor.caret.pos.
- Refactor several functions to change a position passed into them,
  rather than changing e.rr.caret directly.
- Add editBuffer.Seek().
- Remove editBuffer.dump().
- Change Editor.Move to MoveCaret.
- Add Editor.SetCaret.
- Updated tests.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2021-01-24 09:44:41 +01:00
Elias Naur cc63a3aeb7 io/router: don't send pointer.Cancel events to disappearing handlers
As a follow-up to gioui.org/commit/24f69bf4, this change makes it so
that merely adding a pointer.InputOp doesn't trigger redraws when
the pointer is hovered over its area.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-23 12:00:50 +01:00
Elias Naur 84b586ae6c gpu: don't automatically clear screen before rendering
Gio UI may be overlaid on top of custom graphics such as in the glfw example.
That will only work if Gio doesn't clear the screen (to white).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-22 18:33:34 +01:00
Elias Naur 686d680ea3 io/key,io/pointer: forbid nil tags for InputOps
Forcing a non-nil tag ensures that all handler tags are either unique,
or intentionally equal. Additionally, a nil tag has special meaning in
FocusOps.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-22 16:38:25 +01:00
Elias Naur 4f45d9a567 io/router: rename Router.Add to the more specific Queue
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-22 16:36:14 +01:00
Elias Naur 24f69bf4bb io/router: don't trigger redraw for handler reset events
key.InputOp and pointer.InputOp handlers are reset on first registration
through a key.FocusEvent{false} or pointer.Cancel, respectively.

However, the mere act of registering a handle shouldn't result in a
redraw. This is particularly true for misconfigured handlers where a new
tag is supplied every frame, resulting in continously redrawing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-22 16:34:51 +01:00
Elias Naur e70a16c345 io/router/key: add explicit tag to FocusOp; make last SoftKeyboardOp apply
The target of FocusOp is too subtle; be explicit instead and remove
any doubt.

Multiple SoftKeyboardOp in a single frame is rare, but if they do occur,
they should behave as if they were from separate frames: the last one
applies.

As a side-effect the key event router can be much simplified.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-01-22 16:34:51 +01:00