// Code generated by wlgen; DO NOT EDIT. package presentationtime import ( "fmt" wayland "github.com/bnema/purego-libwayland/protocol/wayland" "github.com/bnema/purego-libwayland/server" ) var WpPresentationInterface *server.Interface var WpPresentationFeedbackInterface *server.Interface func init() { WpPresentationInterface = &server.Interface{Name: "wp_presentation", Version: 2} WpPresentationFeedbackInterface = &server.Interface{Name: "wp_presentation_feedback", Version: 2} WpPresentationInterface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "feedback", Signature: "on", Types: []*server.Interface{wayland.SurfaceInterface, WpPresentationFeedbackInterface}}, } WpPresentationInterface.Events = []server.Message{ {Name: "clock_id", Signature: "u", Types: []*server.Interface{nil}}, } WpPresentationFeedbackInterface.Requests = []server.Message{} WpPresentationFeedbackInterface.Events = []server.Message{ {Name: "sync_output", Signature: "o", Types: []*server.Interface{wayland.OutputInterface}}, {Name: "presented", Signature: "uuuuuuu", Types: []*server.Interface{nil, nil, nil, nil, nil, nil, nil}}, {Name: "discarded", Signature: "", Types: []*server.Interface{}}, } if err := server.NewInterfaces(WpPresentationInterface, WpPresentationFeedbackInterface); err != nil { panic(err) } } // WpPresentation timed presentation related wl_surface requests. type WpPresentation struct{ *server.Resource } func WrapWpPresentation(r *server.Resource) *WpPresentation { if r == nil { return nil } return &WpPresentation{r} } const WpPresentationRequestDestroy uint32 = 0 const WpPresentationRequestFeedback uint32 = 1 const WpPresentationEventClockId uint32 = 0 // WpPresentationError fatal presentation errors. type WpPresentationError uint32 const ( WpPresentationErrorInvalidTimestamp WpPresentationError = 0 WpPresentationErrorInvalidFlag WpPresentationError = 1 ) // WpPresentationHandler handles wp_presentation requests. type WpPresentationHandler interface { Destroy(self *WpPresentation) Feedback(self *WpPresentation, surface *wayland.Surface, callback uint32) } func NewWpPresentation(c server.Client, version int32, id uint32, h WpPresentationHandler) (*WpPresentation, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_presentation") } var self *WpPresentation r, err := c.CreateResource(WpPresentationInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.Feedback(self, wayland.WrapSurface(args[0].Resource()), args[1].NewID()) } }) if err != nil { return nil, err } self = WrapWpPresentation(r) r.Data = self return self, nil } // SendClockId clock ID for timestamps. func (self *WpPresentation) SendClockId(clkId uint32) { self.PostEvent(WpPresentationEventClockId, server.Uint(clkId)) } func NewWpPresentationGlobal(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpPresentationInterface, version, bind) } // WpPresentationFeedback presentation time feedback event. type WpPresentationFeedback struct{ *server.Resource } func WrapWpPresentationFeedback(r *server.Resource) *WpPresentationFeedback { if r == nil { return nil } return &WpPresentationFeedback{r} } const WpPresentationFeedbackEventSyncOutput uint32 = 0 const WpPresentationFeedbackEventPresented uint32 = 1 const WpPresentationFeedbackEventDiscarded uint32 = 2 // WpPresentationFeedbackKind bitmask of flags in presented event (bitfield). type WpPresentationFeedbackKind uint32 const ( WpPresentationFeedbackKindVsync WpPresentationFeedbackKind = 0x1 WpPresentationFeedbackKindHwClock WpPresentationFeedbackKind = 0x2 WpPresentationFeedbackKindHwCompletion WpPresentationFeedbackKind = 0x4 WpPresentationFeedbackKindZeroCopy WpPresentationFeedbackKind = 0x8 ) // WpPresentationFeedbackHandler handles wp_presentation_feedback requests. type WpPresentationFeedbackHandler interface { } func NewWpPresentationFeedback(c server.Client, version int32, id uint32, h WpPresentationFeedbackHandler) (*WpPresentationFeedback, error) { var self *WpPresentationFeedback r, err := c.CreateResource(WpPresentationFeedbackInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { } }) if err != nil { return nil, err } self = WrapWpPresentationFeedback(r) r.Data = self return self, nil } // SendSyncOutput presentation synchronized to this output. func (self *WpPresentationFeedback) SendSyncOutput(output *wayland.Output) { self.PostEvent(WpPresentationFeedbackEventSyncOutput, server.Object(resourceOf(output))) } // SendPresented the content update was displayed. func (self *WpPresentationFeedback) SendPresented(tvSecHi uint32, tvSecLo uint32, tvNsec uint32, refresh uint32, seqHi uint32, seqLo uint32, flags uint32) { self.PostEvent(WpPresentationFeedbackEventPresented, server.Uint(tvSecHi), server.Uint(tvSecLo), server.Uint(tvNsec), server.Uint(refresh), server.Uint(seqHi), server.Uint(seqLo), server.Uint(flags)) } // SendDiscarded the content update was not displayed. func (self *WpPresentationFeedback) SendDiscarded() { self.PostEvent(WpPresentationFeedbackEventDiscarded) } func NewWpPresentationFeedbackGlobal(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpPresentationFeedbackInterface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpPresentation) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *WpPresentationFeedback) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }