all: remove unused fields, functions and add missing error handling

Credit to staticcheck.io.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-27 22:26:54 +01:00
parent 4b7387369b
commit bfb50cef5d
10 changed files with 19 additions and 53 deletions
+5 -6
View File
@@ -36,12 +36,11 @@ type eglContext struct {
}
var (
nilEGLDisplay _EGLDisplay
nilEGLSurface _EGLSurface
nilEGLContext _EGLContext
nilEGLConfig _EGLConfig
nilEGLNativeWindowType NativeWindowType
EGL_DEFAULT_DISPLAY NativeDisplayType
nilEGLDisplay _EGLDisplay
nilEGLSurface _EGLSurface
nilEGLContext _EGLContext
nilEGLConfig _EGLConfig
EGL_DEFAULT_DISPLAY NativeDisplayType
)
const (
-7
View File
@@ -1001,13 +1001,6 @@ func (w *window) isAnimating() bool {
return w.animating || w.fling.anim.Active()
}
func (w *window) kill(err error) {
if w.pendingErr == nil {
w.pendingErr = err
}
w.dead = true
}
func (w *window) draw(sync bool) {
w.flushScroll()
w.mu.Lock()
+3 -5
View File
@@ -203,11 +203,9 @@ func (w *x11Window) atom(name string, onlyIfExists bool) C.Atom {
// in x11window.loop.
//
type x11EventHandler struct {
w *x11Window
text []byte
xev *C.XEvent
status C.Status
keysym C.KeySym
w *x11Window
text []byte
xev *C.XEvent
}
// handleEvents returns true if the window needs to be redrawn.
-5
View File
@@ -272,11 +272,6 @@ const (
materialTexture
)
const (
attribPos = 0
attribUV = 1
)
func New(ctx backend.Device) (*GPU, error) {
defFBO := ctx.CurrentFramebuffer()
g := &GPU{
+3 -8
View File
@@ -107,14 +107,6 @@ const (
pathBatchSize = 10000
)
const (
attribPathCorner = 0
attribPathMaxY = 1
attribPathFrom = 2
attribPathCtrl = 3
attribPathTo = 4
)
func newPather(ctx backend.Device) *pather {
return &pather{
ctx: ctx,
@@ -217,6 +209,9 @@ func (s *fboSet) resize(ctx backend.Device, sizes []image.Point) {
}
tex, err := ctx.NewTexture(backend.TextureFormatFloat, sz.X, sz.Y, backend.FilterNearest, backend.FilterNearest,
backend.BufferBindingTexture|backend.BufferBindingFramebuffer)
if err != nil {
panic(err)
}
fbo, err := ctx.NewFramebuffer(tex, 0)
if err != nil {
panic(err)
+4 -7
View File
@@ -23,9 +23,6 @@ type FrameEvent struct {
// Frame replaces the window's frame with the new
// frame.
Frame func(frame *op.Ops)
// Whether this draw is system generated and needs a complete
// frame before proceeding.
sync bool
}
// Config defines the essential properties of
@@ -96,7 +93,7 @@ func (l Stage) String() string {
}
}
func (_ FrameEvent) ImplementsEvent() {}
func (_ StageEvent) ImplementsEvent() {}
func (_ *CommandEvent) ImplementsEvent() {}
func (_ DestroyEvent) ImplementsEvent() {}
func (FrameEvent) ImplementsEvent() {}
func (StageEvent) ImplementsEvent() {}
func (*CommandEvent) ImplementsEvent() {}
func (DestroyEvent) ImplementsEvent() {}
-2
View File
@@ -36,8 +36,6 @@ type FlexChild struct {
// Spacing determine the spacing mode for a Flex.
type Spacing uint8
type flexMode uint8
const (
// SpaceEnd leaves space at the end.
SpaceEnd Spacing = iota
+4 -5
View File
@@ -95,11 +95,10 @@ type Ops struct {
// StackOp saves and restores the operation state
// in a stack-like manner.
type StackOp struct {
stackDepth int
id stackID
macroID int
active bool
ops *Ops
id stackID
macroID int
active bool
ops *Ops
}
// MacroOp records a list of operations for later use.
-7
View File
@@ -132,13 +132,6 @@ func toPointF(p image.Point) f32.Point {
return f32.Point{X: float32(p.X), Y: float32(p.Y)}
}
func toRectF(r image.Rectangle) f32.Rectangle {
return f32.Rectangle{
Min: toPointF(r.Min),
Max: toPointF(r.Max),
}
}
func drawInk(gtx *layout.Context, c widget.Click) {
d := gtx.Now().Sub(c.Time)
t := float32(d.Seconds())
-1
View File
@@ -17,7 +17,6 @@ import (
type Icon struct {
Color color.RGBA
src []byte
size unit.Value
// Cached values.
op paint.ImageOp
imgSize int