gioui.org/ui@v0.0.0-20190926171558-ce74bc0cbaea/system/system.go (about)

     1  // SPDX-License-Identifier: Unlicense OR MIT
     2  
     3  // Package system contain ops and types for
     4  // system events.
     5  package system
     6  
     7  import (
     8  	"gioui.org/ui"
     9  	"gioui.org/ui/internal/opconst"
    10  )
    11  
    12  // ProfileOp registers a handler for receiving
    13  // ProfileEvents.
    14  type ProfileOp struct {
    15  	Key ui.Key
    16  }
    17  
    18  // ProfileEvent contain profile data from a single
    19  // rendered frame.
    20  type ProfileEvent struct {
    21  	// String with timings. Very likely to change.
    22  	Timings string
    23  }
    24  
    25  func (p ProfileOp) Add(o *ui.Ops) {
    26  	data := make([]byte, opconst.TypeProfileLen)
    27  	data[0] = byte(opconst.TypeProfile)
    28  	o.Write(data, p.Key)
    29  }
    30  
    31  func (p ProfileEvent) ImplementsEvent() {}