mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
app: remove unused types and func arguments
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
// package app implements platform specific windows
|
|
||||||
// and GPU contexts.
|
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -17,11 +15,6 @@ import (
|
|||||||
"gioui.org/unit"
|
"gioui.org/unit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type size struct {
|
|
||||||
Width unit.Value
|
|
||||||
Height unit.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
// errOutOfDate is reported when the GPU surface dimensions or properties no
|
// errOutOfDate is reported when the GPU surface dimensions or properties no
|
||||||
// longer match the window.
|
// longer match the window.
|
||||||
var errOutOfDate = errors.New("app: GPU surface out of date")
|
var errOutOfDate = errors.New("app: GPU surface out of date")
|
||||||
|
|||||||
+9
-14
@@ -80,11 +80,6 @@ type Window struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type semanticResult struct {
|
|
||||||
found bool
|
|
||||||
node router.SemanticNode
|
|
||||||
}
|
|
||||||
|
|
||||||
type callbacks struct {
|
type callbacks struct {
|
||||||
w *Window
|
w *Window
|
||||||
d driver
|
d driver
|
||||||
@@ -142,7 +137,7 @@ func (w *Window) Events() <-chan event.Event {
|
|||||||
return w.out
|
return w.out
|
||||||
}
|
}
|
||||||
|
|
||||||
// update updates the window contents, input operations declare input handlers,
|
// update the window contents, input operations declare input handlers,
|
||||||
// and so on. The supplied operations list completely replaces the window state
|
// and so on. The supplied operations list completely replaces the window state
|
||||||
// from previous calls.
|
// from previous calls.
|
||||||
func (w *Window) update(frame *op.Ops) {
|
func (w *Window) update(frame *op.Ops) {
|
||||||
@@ -150,7 +145,7 @@ func (w *Window) update(frame *op.Ops) {
|
|||||||
<-w.frameAck
|
<-w.frameAck
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) validateAndProcess(d driver, frameStart time.Time, size image.Point, sync bool, frame *op.Ops) error {
|
func (w *Window) validateAndProcess(d driver, size image.Point, sync bool, frame *op.Ops) error {
|
||||||
for {
|
for {
|
||||||
if w.gpu == nil && !w.nocontext {
|
if w.gpu == nil && !w.nocontext {
|
||||||
var err error
|
var err error
|
||||||
@@ -463,7 +458,7 @@ func (c *callbacks) SemanticAt(pos f32.Point) (router.SemanticID, bool) {
|
|||||||
return c.w.queue.q.SemanticAt(pos)
|
return c.w.queue.q.SemanticAt(pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) waitAck(d driver) {
|
func (w *Window) waitAck() {
|
||||||
w.waiting = true
|
w.waiting = true
|
||||||
defer func() {
|
defer func() {
|
||||||
w.waiting = false
|
w.waiting = false
|
||||||
@@ -498,7 +493,7 @@ func (w *Window) destroyGPU() {
|
|||||||
// waitFrame waits for the client to either call FrameEvent.Frame
|
// waitFrame waits for the client to either call FrameEvent.Frame
|
||||||
// or to continue event handling. It returns whether the client
|
// or to continue event handling. It returns whether the client
|
||||||
// called Frame or not.
|
// called Frame or not.
|
||||||
func (w *Window) waitFrame(d driver) (*op.Ops, bool) {
|
func (w *Window) waitFrame() (*op.Ops, bool) {
|
||||||
w.waiting = true
|
w.waiting = true
|
||||||
defer func() {
|
defer func() {
|
||||||
w.waiting = false
|
w.waiting = false
|
||||||
@@ -588,7 +583,7 @@ func (w *Window) processEvent(d driver, e event.Event) {
|
|||||||
w.stage = e2.Stage
|
w.stage = e2.Stage
|
||||||
w.updateAnimation(d)
|
w.updateAnimation(d)
|
||||||
w.out <- e
|
w.out <- e
|
||||||
w.waitAck(d)
|
w.waitAck()
|
||||||
case frameEvent:
|
case frameEvent:
|
||||||
if e2.Size == (image.Point{}) {
|
if e2.Size == (image.Point{}) {
|
||||||
panic(errors.New("internal error: zero-sized Draw"))
|
panic(errors.New("internal error: zero-sized Draw"))
|
||||||
@@ -602,8 +597,8 @@ func (w *Window) processEvent(d driver, e event.Event) {
|
|||||||
e2.Frame = w.update
|
e2.Frame = w.update
|
||||||
e2.Queue = &w.queue
|
e2.Queue = &w.queue
|
||||||
w.out <- e2.FrameEvent
|
w.out <- e2.FrameEvent
|
||||||
frame, gotFrame := w.waitFrame(d)
|
frame, gotFrame := w.waitFrame()
|
||||||
err := w.validateAndProcess(d, frameStart, e2.Size, e2.Sync, frame)
|
err := w.validateAndProcess(d, e2.Size, e2.Sync, frame)
|
||||||
if gotFrame {
|
if gotFrame {
|
||||||
// We're done with frame, let the client continue.
|
// We're done with frame, let the client continue.
|
||||||
w.frameAck <- struct{}{}
|
w.frameAck <- struct{}{}
|
||||||
@@ -619,7 +614,7 @@ func (w *Window) processEvent(d driver, e event.Event) {
|
|||||||
w.updateCursor(d)
|
w.updateCursor(d)
|
||||||
case *system.CommandEvent:
|
case *system.CommandEvent:
|
||||||
w.out <- e
|
w.out <- e
|
||||||
w.waitAck(d)
|
w.waitAck()
|
||||||
case system.DestroyEvent:
|
case system.DestroyEvent:
|
||||||
w.destroyGPU()
|
w.destroyGPU()
|
||||||
w.out <- e2
|
w.out <- e2
|
||||||
@@ -627,7 +622,7 @@ func (w *Window) processEvent(d driver, e event.Event) {
|
|||||||
close(w.out)
|
close(w.out)
|
||||||
case ViewEvent:
|
case ViewEvent:
|
||||||
w.out <- e2
|
w.out <- e2
|
||||||
w.waitAck(d)
|
w.waitAck()
|
||||||
case wakeupEvent:
|
case wakeupEvent:
|
||||||
case event.Event:
|
case event.Event:
|
||||||
if w.queue.q.Queue(e2) {
|
if w.queue.q.Queue(e2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user