MCPcopy Create free account
hub / github.com/cogentcore/core / eventLoop

Method eventLoop

core/renderwindow.go:392–418  ·  view source on GitHub ↗

eventLoop runs the event processing loop for the RenderWindow -- grabs system events for the window and dispatches them to receiving nodes, and manages other state etc (popups, etc).

()

Source from the content-addressed store, hash-verified

390// events for the window and dispatches them to receiving nodes, and manages
391// other state etc (popups, etc).
392func (w *renderWindow) eventLoop() {
393 defer func() { system.HandleRecover(recover()) }()
394
395 d := &w.SystemWindow.Events().Deque
396
397 for {
398 if w.stopEventLoop {
399 w.stopEventLoop = false
400 break
401 }
402 e := d.NextEvent()
403 if w.stopEventLoop {
404 w.stopEventLoop = false
405 break
406 }
407 w.handleEvent(e)
408 if w.noEventsChan != nil && len(d.Back) == 0 && len(d.Front) == 0 {
409 w.noEventsChan <- struct{}{}
410 }
411 }
412 if DebugSettings.WinEventTrace {
413 fmt.Printf("Win: %v out of event loop\n", w.name)
414 }
415 windowWait.Done()
416 // our last act must be self destruction!
417 w.mains.deleteAll()
418}
419
420// handleEvent processes given events.Event.
421// All event processing operates under a RenderContext.Lock

Callers 1

goStartEventLoopMethod · 0.95

Calls 6

handleEventMethod · 0.95
NextEventMethod · 0.80
DoneMethod · 0.80
EventsMethod · 0.65
PrintfMethod · 0.45
deleteAllMethod · 0.45

Tested by

no test coverage detected