all: format comments with go fmt ./... using Go 1.19

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-08-06 12:26:03 +02:00
parent 3e9d4d966c
commit 61b2e37691
20 changed files with 83 additions and 89 deletions
+4 -5
View File
@@ -6,7 +6,7 @@ functionality for running graphical user interfaces.
See https://gioui.org for instructions to set up and run Gio programs.
Windows
# Windows
Create a new Window by calling NewWindow. On mobile platforms or when Gio
is embedded in another project, NewWindow merely connects with a previously
@@ -34,7 +34,7 @@ For example:
A program must keep receiving events from the event channel until
DestroyEvent is received.
Main
# Main
The Main function must be called from a program's main function, to hand over
control of the main thread to operating systems that need it.
@@ -56,14 +56,13 @@ For example, to display a blank but otherwise functional window:
app.Main()
}
Event queue
# Event queue
A FrameEvent's Queue method returns an event.Queue implementation that distributes
incoming events to the event handlers declared in the last frame.
See the gioui.org/io/event package for more information about event handlers.
Permissions
# Permissions
The packages under gioui.org/app/permission should be imported
by a Gio program or by one of its dependencies to indicate that specific
-3
View File
@@ -490,7 +490,6 @@ func (w *x11Window) destroy() {
// atom is a wrapper around XInternAtom. Callers should cache the result
// in order to limit round-trips to the X server.
//
func (w *x11Window) atom(name string, onlyIfExists bool) C.Atom {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
@@ -504,7 +503,6 @@ func (w *x11Window) atom(name string, onlyIfExists bool) C.Atom {
// x11EventHandler wraps static variables for the main event loop.
// Its sole purpose is to prevent heap allocation and reduce clutter
// in x11window.loop.
//
type x11EventHandler struct {
w *x11Window
text []byte
@@ -512,7 +510,6 @@ type x11EventHandler struct {
}
// handleEvents returns true if the window needs to be redrawn.
//
func (h *x11EventHandler) handleEvents() bool {
w := h.w
xev := h.xev
+1 -1
View File
@@ -4,7 +4,7 @@
Package bluetooth implements permissions to access Bluetooth and Bluetooth
Low Energy hardware, including the ability to discover and pair devices.
Android
# Android
The following entries will be added to AndroidManifest.xml:
+1 -1
View File
@@ -3,7 +3,7 @@
/*
Package camera implements permissions to access camera hardware.
Android
# Android
The following entries will be added to AndroidManifest.xml:
+1 -1
View File
@@ -34,7 +34,7 @@ program's source code:
_ "net"
)
Android -- Dangerous Permissions
# Android -- Dangerous Permissions
Certain permissions on Android are marked with a protection level of
"dangerous". This means that, in addition to including the relevant
+1 -2
View File
@@ -3,11 +3,10 @@
/*
Package networkstate implements permissions to access network connectivity information.
Android
# Android
The following entries will be added to AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
*/
package networkstate
+1 -1
View File
@@ -4,7 +4,7 @@
Package storage implements read and write storage permissions
on mobile devices.
Android
# Android
The following entries will be added to AndroidManifest.xml:
+1 -2
View File
@@ -4,11 +4,10 @@
Package wakelock implements permission to acquire locks that keep the system
from suspending.
Android
# Android
The following entries will be added to AndroidManifest.xml:
<uses-permission android:name="android.permission.WAKE_LOCK"/>
*/
package wakelock
+8 -8
View File
@@ -263,14 +263,14 @@ func paragraph(shaper Shaper, face font.Face, ppem fixed.Int26_6, maxWidth int,
// whenever it returns false.
//
// The parameters require some explanation:
// out - the shaping.Output that is being line-broken.
// runeToGlyph - a mapping where accessing the slice at the index of a rune
// int out will yield the index of the first glyph corresponding to that rune.
// lineStartRune - the index of the first rune in the line.
// b - the line break candidate under consideration.
// curLineWidth - the amount of space total in the current line.
// curLineUsed - the amount of space in the current line that is already used.
// nextLineWidth - the amount of space available on the next line.
// - out - the shaping.Output that is being line-broken.
// - runeToGlyph - a mapping where accessing the slice at the index of a rune
// into out will yield the index of the first glyph corresponding to that rune.
// - lineStartRune - the index of the first rune in the line.
// - b - the line break candidate under consideration.
// - curLineWidth - the amount of space total in the current line.
// - curLineUsed - the amount of space in the current line that is already used.
// - nextLineWidth - the amount of space available on the next line.
//
// This function returns both a valid shaping.Output broken at b and a boolean
// indicating whether the returned output should be used.
+6
View File
@@ -376,6 +376,7 @@ func strokePathCurv(beg, ctl, end f32.Point, t float32) float32 {
}
// quadBezierSample returns the point on the Bézier curve at t.
//
// B(t) = (1-t)^2 P0 + 2(1-t)t P1 + t^2 P2
func quadBezierSample(p0, p1, p2 f32.Point, t float32) f32.Point {
t1 := 1 - t
@@ -390,6 +391,7 @@ func quadBezierSample(p0, p1, p2 f32.Point, t float32) f32.Point {
}
// quadBezierD1 returns the first derivative of the Bézier curve with respect to t.
//
// B'(t) = 2(1-t)(P1 - P0) + 2t(P2 - P1)
func quadBezierD1(p0, p1, p2 f32.Point, t float32) f32.Point {
p10 := p1.Sub(p0).Mul(2 * (1 - t))
@@ -399,6 +401,7 @@ func quadBezierD1(p0, p1, p2 f32.Point, t float32) f32.Point {
}
// quadBezierD2 returns the second derivative of the Bézier curve with respect to t:
//
// B''(t) = 2(P2 - 2P1 + P0)
func quadBezierD2(p0, p1, p2 f32.Point, t float32) f32.Point {
p := p2.Sub(p1.Mul(2)).Add(p0)
@@ -534,9 +537,12 @@ func strokePathRoundCap(qs *StrokeQuads, hw float32, pivot, n0 f32.Point) {
// curve approximations for an arc.
//
// The math is extracted from the following paper:
//
// "Drawing an elliptical arc using polylines, quadratic or
// cubic Bezier curves", L. Maisonobe
//
// An electronic version may be found at:
//
// http://spaceroots.org/documents/ellipse/elliptical-arc.pdf
func ArcTransform(p, f1, f2 f32.Point, angle float32) (transform f32.Affine2D, segments int) {
const segmentsPerCircle = 16
-1
View File
@@ -26,7 +26,6 @@ The following example declares a handler ready for key input:
ops := new(op.Ops)
var h *Handler = ...
key.InputOp{Tag: h, Filter: ...}.Add(ops)
*/
package event
+6 -6
View File
@@ -8,7 +8,7 @@ object such as a finger.
The InputOp operation is used to declare a handler ready for pointer
events. Use an event.Queue to receive events.
Types
# Types
Only events that match a specified list of types are delivered to a handler.
@@ -25,7 +25,7 @@ Leave, or Scroll):
Cancel events are always delivered.
Hit areas
# Hit areas
Clip operations from package op/clip are used for specifying
hit areas where subsequent InputOps are active.
@@ -43,7 +43,7 @@ of multiple area operations is the intersection of the areas.
BUG: Clip operations other than clip.Rect and clip.Ellipse are approximated
with their bounding boxes.
Matching events
# Matching events
Areas form an implicit tree, with input handlers as leaves. The children of
an area is every area and handler added between its Push and corresponding Pop.
@@ -77,7 +77,7 @@ the matching repeats with the parent area.
In the example above, all events will go to h2 because it and h1 are siblings
and none are pass-through.
Pass-through
# Pass-through
The PassOp operations controls the pass-through setting. All handlers added
inside one or more PassOp scopes are marked pass-through.
@@ -87,7 +87,7 @@ the user touches the side, both the (transparent) drawer handle and the
interface below should receive pointer events. This effect is achieved by
marking the drawer handle pass-through.
Disambiguation
# Disambiguation
When more than one handler matches a pointer event, the event queue
follows a set of rules for distributing the event.
@@ -110,7 +110,7 @@ The losing handlers are notified by a Cancel event.
For multiple grabbing handlers, the foremost handler wins.
Priorities
# Priorities
Handlers know their position in a matching set of a pointer through
event priorities. The Shared priority is for matching sets with
+1 -2
View File
@@ -3,7 +3,7 @@
/*
Package layout implements layouts common to GUI programs.
Constraints and dimensions
# Constraints and dimensions
Constraints and dimensions form the interface between layouts and
interface child elements. This package operates on Widgets, functions
@@ -45,6 +45,5 @@ This example both aligns and insets a child:
More complex layouts such as Stack and Flex lay out multiple children,
and stateful layouts such as List accept user input.
*/
package layout
+1 -3
View File
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: Unlicense OR MIT
/*
Package op implements operations for updating a user interface.
Gio programs use operations, or ops, for describing their user
@@ -28,7 +27,7 @@ Drawing a colored square:
paint.PaintOp{Rect: ...}.Add(ops)
e.Frame(ops)
State
# State
An Ops list can be viewed as a very simple virtual machine: it has state such
as transformation and color and execution flow can be controlled with macros.
@@ -61,7 +60,6 @@ The MacroOp records a list of operations to be executed later:
// replay the recorded operations:
call.Add(ops)
*/
package op
-2
View File
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: Unlicense OR MIT
/*
Package unit implements device independent units.
Device independent pixel, or dp, is the unit for sizes independent of
@@ -16,7 +15,6 @@ size vary between platforms and displays.
To maintain a constant visual size across platforms and displays, always
use dps or sps to define user interfaces. Only use pixels for derived
values.
*/
package unit
+1 -1
View File
@@ -24,7 +24,7 @@
//
// material.Button(theme, "Click me!").Layout(gtx, button)
//
// Customization
// # Customization
//
// Quite often, a program needs to customize the theme-provided defaults. Several
// options are available, depending on the nature of the change.