The example module is moving to git.sr.ht/~eliasnaur/gio-example.
We still need some main package for testing gogio, so update reference
to use the module path (gioui.org/example).
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This introduces a new material.Palette type that captures the color information
necessary to render a widget. This type is embedded in the material.Theme to
make it easier to swap to a different palette for part of the UI by reassinging
the Palette field.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Commit gioui.org/commit/94d242d18c9245 broke Editor and Label clipping,
most visible for single-line Editors. Restore the correct clipping.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The Editor will handle CTRL+C and CTRL+V. The CTRL+V will paste the
content on the Editor, and CTRL+C will copy all the Editor content.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Previously, the only way to manipulate the clipboard (read or write) is
using the `app.Window`.
The new `clipboard.ReadOp` and `clipboard.WriteOp`makes possible to
read/write from the widget.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Move the replacing to Editor.prepend to fix SetText, and replace with
space instead of nothing to keep lines separated even in single-line
Editors.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
API change. Update your code with gofmt rule and goimports:
gofmt -r "system.ClipboardEvent -> clipboard.Event"
goimports
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
As a consequence, most API is gone from gpu/gl, and embedding Gio in
foreign frameworks don't need to provide an OpenGL implementation.
The next change simplifies the GLFW embedding example accordingly.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Building an iOS results in errors about missing NSCursor:
$ gogio -target ios -o app.app ./kitchen
gogio: go build -ldflags=-s -w -X gioui.org/app/internal/log.appID=org.gioui.kitchen -buildmode=c-archive -o /var/folders/_7/lnt35k555hl2bs7fjygkhgx00000gp/T/gogio-770783182/gio-amd64 -tags ./kitchen failed: # gioui.org/app/internal/window
os_darwin.m:26:10: error: use of undeclared identifier 'NSCursor'
os_darwin.m:32:10: error: use of undeclared identifier 'NSCursor'
os_darwin.m:40:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:43:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:46:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:49:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:52:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:55:14: error: use of undeclared identifier 'NSCursor'
os_darwin.m:58:14: error: use of undeclared identifier 'NSCursor'
NSCursor is supported under mac catalyst; disable NSCursor support while
figuring out how.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The existing implementation cannot remove the focus of some widget,
doesn't have an option to focus without display the on-screen keyboard
and it automatically focuses the first InputOp, aggressively.
That change aims to make possible: remove focus from any widget. Add
focus without displaying the on-screen-keyboard/soft keyboard. Don't
automatically focus any widget. Don't recover focus when the widget is
visible again.
Fixes gio#180.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
The removal of getError significantly improves performance on js/wasm:
Opera 72 (w/ AMD Ryzen 3900X): ~12.29ms per frame to ~8.09ms;
Chrome 87 (w/ Snapdragon 435): ~156.34ms per frame to ~94.31ms;
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
A previous change converted the package argument to gogio to an absolute path.
However, gogio supports all package paths that may appear in Go import statements.
For example, the path "gioui.org/cmd/example/kitchen" should not be converted.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Currently this comes up with RRect/Border that has zero corners. It
improves them from ~250ns to ~170ns. While it's possible to check this
in RRect implementation, however it'll slow down calls with non-zero
corners.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Currently BCE is unable to understand that the accesses in the code are
safe. Added an explicit slice to make the length bounds obvious.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
...interface{} requires constructing a slice, which is slow.
This cuts about 100ns from RRect and Border benchmark.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Using delta position with Line and Quad can drift over successive calls.
Also, in some cases it's much more convenient to use absolute
coordinates rather than relative.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
To get the `popstate` we need to create a new entry into
the browser history. Then, Gio will handle the "back" and
"forward" of the page.
In some browsers (Chrome 87/Edge 87): The user must
click inside the window/page at least one time. It will not
work if the user leaves the page (clicking back button)
without interaction with Gio.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Update key.State documentation and add State.String while here. Also
update Event.String to include State.
Signed-off-by: Raffaele Sena <raff367@gmail.com>
That change mitigates the issue gio#150 and gio#166. The
iOS can only `focus()` as a response to touchstart/click
events. We can't `focus()` at random, without user interaction.
The `w.requestFocus` will try to focus on the next `touchstart`,
which may need some "double click" in some cases. That mitigates
the issue, but doesn't fixes completely, but open the keyboard. (:
I didn't notice any side-effect of that change on Android and on
Windows.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
The context-menu seems useless. The only action available, on the
context-menu is to "Save image": which gives a black image.
I think it's better to remove it. The right-click still work and still
provide `pointer.Event`.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
As suggested by Chris Waldon, this will catch pushes to master and
also during automatic testing of patches sent to the mailing list.
Signed-off-by: Elias Naur <mail@eliasnaur.com>