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>
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>
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>
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>
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>
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>
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>
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>
Android can only run c-shared libraries which means that every
Gio program must create its window and event loop from an init
function.
The same applies to iOS but for a more benign reason: the gio tool
builds programs in c-archive mode for iOS and links the binary with
a Objective-C driver.
Allow Gio programs to run off its main function by linking to and
invoking main even from Android libraries and iOS ditto.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The app data dir is not set until after Go's init functions have
run, which means that DataDir is inherently racy. Avoid that race
by blocking in DataDir until it is set from Java.
In other words, trade a race condition with a deadlock.
Signed-off-by: Elias Naur <mail@eliasnaur.com>