// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2015 Martin Gräßlin // Copyright © 2022 Simon Ser // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice (including the next // paragraph) shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. package extidlenotify import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var ExtIdleNotifierV1Interface *server.Interface var ExtIdleNotificationV1Interface *server.Interface func init() { ExtIdleNotifierV1Interface = &server.Interface{Name: "ext_idle_notifier_v1", Version: 2} ExtIdleNotificationV1Interface = &server.Interface{Name: "ext_idle_notification_v1", Version: 2} ExtIdleNotifierV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "get_idle_notification", Signature: "nuo", Types: []*server.Interface{ExtIdleNotificationV1Interface, nil, wayland.SeatInterface}}, {Name: "get_input_idle_notification", Signature: "2nuo", Types: []*server.Interface{ExtIdleNotificationV1Interface, nil, wayland.SeatInterface}}, } ExtIdleNotifierV1Interface.Events = []server.Message{} ExtIdleNotificationV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ExtIdleNotificationV1Interface.Events = []server.Message{ {Name: "idled", Signature: "", Types: []*server.Interface{}}, {Name: "resumed", Signature: "", Types: []*server.Interface{}}, } if err := server.NewInterfaces(ExtIdleNotifierV1Interface, ExtIdleNotificationV1Interface); err != nil { panic(err) } } // ExtIdleNotifierV1 idle notification manager. type ExtIdleNotifierV1 struct{ *server.Resource } func WrapExtIdleNotifierV1(r *server.Resource) *ExtIdleNotifierV1 { if r == nil { return nil } return &ExtIdleNotifierV1{r} } const ExtIdleNotifierV1RequestDestroy uint32 = 0 const ExtIdleNotifierV1RequestGetIdleNotification uint32 = 1 const ExtIdleNotifierV1RequestGetInputIdleNotification uint32 = 2 // ExtIdleNotifierV1Handler handles ext_idle_notifier_v1 requests. type ExtIdleNotifierV1Handler interface { Destroy(self *ExtIdleNotifierV1) GetIdleNotification(self *ExtIdleNotifierV1, id uint32, timeout uint32, seat *wayland.Seat) GetInputIdleNotification(self *ExtIdleNotifierV1, id uint32, timeout uint32, seat *wayland.Seat) } func NewExtIdleNotifierV1(c server.Client, version int32, id uint32, h ExtIdleNotifierV1Handler) (*ExtIdleNotifierV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for ext_idle_notifier_v1") } var self *ExtIdleNotifierV1 r, err := c.CreateResource(ExtIdleNotifierV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.GetIdleNotification(self, args[0].NewID(), args[1].Uint(), wayland.WrapSeat(args[2].Resource())) case 2: h.GetInputIdleNotification(self, args[0].NewID(), args[1].Uint(), wayland.WrapSeat(args[2].Resource())) } }) if err != nil { return nil, err } self = WrapExtIdleNotifierV1(r) r.Data = self return self, nil } func NewExtIdleNotifierV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ExtIdleNotifierV1Interface, version, bind) } // ExtIdleNotificationV1 idle notification. type ExtIdleNotificationV1 struct{ *server.Resource } func WrapExtIdleNotificationV1(r *server.Resource) *ExtIdleNotificationV1 { if r == nil { return nil } return &ExtIdleNotificationV1{r} } const ExtIdleNotificationV1RequestDestroy uint32 = 0 const ExtIdleNotificationV1EventIdled uint32 = 0 const ExtIdleNotificationV1EventResumed uint32 = 1 // ExtIdleNotificationV1Handler handles ext_idle_notification_v1 requests. type ExtIdleNotificationV1Handler interface { Destroy(self *ExtIdleNotificationV1) } func NewExtIdleNotificationV1(c server.Client, version int32, id uint32, h ExtIdleNotificationV1Handler) (*ExtIdleNotificationV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for ext_idle_notification_v1") } var self *ExtIdleNotificationV1 r, err := c.CreateResource(ExtIdleNotificationV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapExtIdleNotificationV1(r) r.Data = self return self, nil } // SendIdled notification object is idle. func (self *ExtIdleNotificationV1) SendIdled() { self.PostEvent(ExtIdleNotificationV1EventIdled) } // SendResumed notification object is no longer idle. func (self *ExtIdleNotificationV1) SendResumed() { self.PostEvent(ExtIdleNotificationV1EventResumed) } func NewExtIdleNotificationV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ExtIdleNotificationV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *ExtIdleNotifierV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ExtIdleNotificationV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }