Commit Graph

196 Commits

Author SHA1 Message Date
Elias Naur 52dd762405 ui/app: (wayland) define WL_EGL_PLATFORM=1 to force EGL in Wayland mode
Including wayland-egl.h will also set WL_EGL_PLATFORM, but generic
egl code in egl_linux.go cannot do that.

For gio#35

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-02 15:13:36 +02:00
Elias Naur dc62058bce ui/app: (wayland) ensure DestroyEvent is the last event
A ToplevelClose event could end in the same batch of events as
another event, which will result in the other event being sent
after a DestroyEvent. Window assumes no event will arrive after
DestroyEvent, so ensure that property for the Wayland backend.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-01 14:33:33 +02:00
Elias Naur 110da804a0 ui/app: (wayland) expand comments for double server roundtrip
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-30 13:38:58 +02:00
Kenshi Kamata ea2ee1abcc ui/app: fix example code in document
Signed-off-by: Kenshi Kamata <kenshi.kamata@gmail.com>
2019-08-29 17:49:27 +02:00
Elias Naur 069bb0e7cd ui/app: merge goString implementations and add test
Fixes gio#30

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-26 21:19:58 +01:00
Elias Naur 8700a8ffc3 ui/key,ui/pointer: rename HandlerOp to InputOp
"Input" is more specific and reads better than "handler".

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-26 18:07:48 +01:00
Elias Naur a112a580a7 ui/app(internal/gpu: remove unused parameters
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-25 23:58:19 +01:00
Daniel Martí 2542c55e9d all: fix some issues spotted by static analysis
First, vet was upset by two incorrect fmt verbs. One was an extra %x,
when there was just one argument, so remove it. Another was a %p with a
non-pointer. It's a struct, so for now simply use %#v.

Second, staticcheck found some unused or unnecessary bits of code;
remove the obvious ones.

Finally, staticcheck also complained about some error strings which were
capitalized or had periods. Adjust those, which also makes all error
messages more consistent.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-08-25 22:41:05 +01:00
Elias Naur c3f30188a5 all: delete unused variables
Found by Daniel Martí.

Fixes gio#24

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-24 18:25:37 +01:00
Elias Naur 9520a9278f ui/app/internal/gpu: set the default material to black
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-22 11:25:11 +02:00
Elias Naur 6a7e38eb32 ui/app: go fmt
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-21 14:59:35 +02:00
Elias Naur bff8b64e5a ui/app: replace WindowOptions with WindowOption
Thanks to Larry Clapp for noticing the opportunity for improvement.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-21 10:31:16 +02:00
Elias Naur e140f2a1c0 ui/app: (iOS) check for first responder status before changing focus
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 17:30:19 +02:00
Elias Naur ac6f0c3f18 ui/app: (iOS) move memory pressure callback to view controller
With multiple GioViewControllers we might invoke the garbage collector
more than once, but in return we simplify the GioAppDelegate which will
become the interface to native widgets.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 16:50:35 +02:00
Elias Naur e6a68db4c0 ui/app: (iOS) resize window when the software keyboard is shown
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 16:48:00 +02:00
Elias Naur 46ecbb86d2 ui/app: remove unused method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 12:57:35 +02:00
Elias Naur 9c9656e729 ui/app: fix indent
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 12:51:13 +02:00
Elias Naur d2132fce3b ui/app: remove debug line
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 11:14:48 +02:00
Elias Naur 4b3b8fa413 ui/app: (iOS) move UIWindow notifications to GioView
Simplifies GioAppDelegate and allows for proper deregistering of
listener.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 09:04:00 +02:00
Larry Clapp 56926a0449 ui/app: fix init() appending '' to os.Args
init() says

  args := strings.Split(extraArgs, "|")
  os.Args = append(os.Args, args...)

strings.Split says

  If s does not contain sep and sep is not empty, Split returns a slice
  of length 1 whose only element is s.

which means init() adds a blank arg to the end of os.Args when extraArgs
is empty.  This fixes that.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2019-08-14 10:35:08 +02:00
Elias Naur 7c197cc666 ui/app: support EGL versions >= 2.0
Versions with major > 1 don't exists, but let's handle the version
correctly in any case.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-12 00:29:18 +02:00
Elias Naur 5605919555 ui/app: (windows) don't fail eglChooseConfig just because no configs were found
The resulting eglGetError will return a confusing EGL_SUCCESS.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-12 00:05:57 +02:00
Elias Naur 842d29373f ui: documentation tweaks
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 19:36:46 +02:00
Elias Naur 340fff9814 ui/key: rename ChordEvent to just Event
Event is like pointer.Event and we don't want the stuttering of
key.KeyEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 12:50:40 +02:00
Elias Naur 2a0b0077da ui/app: (wasm) add checks for required extensions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-10 00:49:28 +02:00
Elias Naur 7bc18c0139 ui/app: more documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 22:27:33 +02:00
Elias Naur a8f42cd567 ui/app: expand package documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 22:16:52 +02:00
Elias Naur 657c40e4bb ui/app: support 0 for window width and height
The zero value means that the client don't care and a sensible
default is chosen.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 22:01:25 +02:00
Elias Naur e5738481f8 ui/app: add package documentation and document Main
Split Main into the common Main function and platform specific
main functions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 21:34:29 +02:00
Elias Naur 87f8fd4152 ui/app: update documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 21:17:33 +02:00
Elias Naur 4e005f2bfa ui/app: rename DrawEvent to UpdateEvent and Window.Draw to Window.Update
Window.Draw is not the right name for a method that does more than
just drawing. Rename to Update instead, and rename the DrawEvent
accordingly for symmetry.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 20:35:37 +02:00
Elias Naur dd35a48a61 ui/paint: rename the draw package
The draw package name clashes with the standard library draw package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 20:11:53 +02:00
Elias Naur 6e26c92c75 all: remove exported Decode methods on operations
Add decode functions to the packages that need them instead. For
TransformOp that is used in multiple packages, add the decode
function to the internal ops package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:34 +02:00
Elias Naur 4d66669a9e app/internal/gpu: rename opClip to clipOp
To better match ClipOp, which was renamed from OpClip.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:34 +02:00
Elias Naur eaa4efe5af all: add missing licence headers
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:34 +02:00
Elias Naur b3517a365e ui,internal/ops,internal/opconst: move OpsReader to internal ops package
To avoid import cycles, move the op constants to its own package,
internal/opconst.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:26 +02:00
Elias Naur fe20cde393 ui: rename TransformOp.Mul to Multiply and split InvTransform
Multiply is a bit longer but more clear. InvTransform was really
two operations: Invert and Transform.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 14:47:14 +02:00
Larry Clapp a14e818299 draw: Fix spelling of Bezier
Sometimes it was "bezier", sometimes "beziér".  Capitalize and put
accent on first e.  https://en.wikipedia.org/wiki/Bézier_curve

Signed-off-by: Larry Clapp <larry@theclapp.org>
2019-08-05 19:18:10 +02:00
Elias Naur 8472bbc78b ui/app,cmd/gio: move running of main from driver to GioAppDelegate
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-05 15:38:34 +02:00
Elias Naur 15dc714d40 ui/app: add darwin build tag to ios files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-03 21:25:34 +02:00
Elias Naur eee497f22a ui/app: (wasm) create and add container div if one is not provided
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-02 09:04:00 +02:00
Elias Naur 28bd97f877 ui/app: delete unused field
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-02 08:59:54 +02:00
Elias Naur 0be3492e07 ui/app: (wasm) avoid deadlock from focus changes
showTextInput is called from the window loop in window.go, but
could result in an immediate event which then deadlocks waiting for
the window loop to handle it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-02 08:54:21 +02:00
Elias Naur 73b1e64209 ui/input: change Queue to return Events one at a time
By returning all events, widgets that might return early from its
event loop might throw away subsequent events. Instead of requiring
those widgets to store the event list, convert input.Queue to step
through the available events one at a time.

Functional revert of 1735d5ced8.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-01 18:56:49 +02:00
Elias Naur b15a32065f ui/app: (wasm) fix typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-01 17:48:53 +02:00
Elias Naur cb312c8d32 ui/app: drop Event
input.Event is enough if we stretch "input" to mean both input
devices and other events such as profiling events and system
commands.

The pointer and key packages are separate already, so I don't
expanding the meaning is unreasonable.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-01 15:27:14 +02:00
Elias Naur bfece0beba ui: change area ops to use rectangles, not sizes
And then use the more general rectangles to add a buffer around
text.Editor click and scroll area.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-01 10:06:19 +02:00
Elias Naur 46b9e7b9ab ui/app: (macOS, iOS) ignore SIGPIPE
Work around golang.org/issue/33384

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-31 22:53:30 +02:00
Elias Naur 5f2adf9b2f ui: get rid of Inf
It's not worth the special cases. Use a large value where needed
(layout.List, text.Editor...) instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 12:12:51 +02:00
Elias Naur 5e1f078b12 ui: merge Transform into TransformOp
The separate Transform type is not worth its weight.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 02:50:55 -07:00