1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2015 Samsung Electronics Co., Ltd
5//
6// Permission is hereby granted, free of charge, to any person obtaining a
7// copy of this software and associated documentation files (the "Software"),
8// to deal in the Software without restriction, including without limitation
9// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10// and/or sell copies of the Software, and to permit persons to whom the
11// Software is furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice (including the next
14// paragraph) shall be included in all copies or substantial portions of the
15// Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25package idleinhibit
26
27import (
28 "fmt"
29 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
30 "github.com/bnema/purego-libwayland/server"
31)
32
33var ZwpIdleInhibitManagerV1Interface *server.Interface
34var ZwpIdleInhibitorV1Interface *server.Interface
35
36func init() {
37 ZwpIdleInhibitManagerV1Interface = &server.Interface{Name: "zwp_idle_inhibit_manager_v1", Version: 1}
38 ZwpIdleInhibitorV1Interface = &server.Interface{Name: "zwp_idle_inhibitor_v1", Version: 1}
39 ZwpIdleInhibitManagerV1Interface.Requests = []server.Message{
40 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
41 {Name: "create_inhibitor", Signature: "no", Types: []*server.Interface{ZwpIdleInhibitorV1Interface, wayland.SurfaceInterface}},
42 }
43 ZwpIdleInhibitManagerV1Interface.Events = []server.Message{}
44 ZwpIdleInhibitorV1Interface.Requests = []server.Message{
45 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
46 }
47 ZwpIdleInhibitorV1Interface.Events = []server.Message{}
48 if err := server.NewInterfaces(ZwpIdleInhibitManagerV1Interface, ZwpIdleInhibitorV1Interface); err != nil {
49 panic(err)
50 }
51}
52
53// ZwpIdleInhibitManagerV1 control behavior when display idles.
54type ZwpIdleInhibitManagerV1 struct{ *server.Resource }
55
56func WrapZwpIdleInhibitManagerV1(r *server.Resource) *ZwpIdleInhibitManagerV1 {
57 if r == nil {
58 return nil
59 }
60 return &ZwpIdleInhibitManagerV1{r}
61}
62
63const ZwpIdleInhibitManagerV1RequestDestroy uint32 = 0
64const ZwpIdleInhibitManagerV1RequestCreateInhibitor uint32 = 1
65
66// ZwpIdleInhibitManagerV1Handler handles zwp_idle_inhibit_manager_v1 requests.
67type ZwpIdleInhibitManagerV1Handler interface {
68 Destroy(self *ZwpIdleInhibitManagerV1)
69 CreateInhibitor(self *ZwpIdleInhibitManagerV1, id uint32, surface *wayland.Surface)
70}
71
72func NewZwpIdleInhibitManagerV1(c server.Client, version int32, id uint32, h ZwpIdleInhibitManagerV1Handler) (*ZwpIdleInhibitManagerV1, error) {
73 if h == nil {
74 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_idle_inhibit_manager_v1")
75 }
76 var self *ZwpIdleInhibitManagerV1
77 r, err := c.CreateResource(ZwpIdleInhibitManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
78 switch opcode {
79 case 0:
80 h.Destroy(self)
81 self.Destroy()
82 case 1:
83 h.CreateInhibitor(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
84 }
85 })
86 if err != nil {
87 return nil, err
88 }
89 self = WrapZwpIdleInhibitManagerV1(r)
90 r.Data = self
91 return self, nil
92}
93func NewZwpIdleInhibitManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
94 return d.CreateGlobal(ZwpIdleInhibitManagerV1Interface, version, bind)
95}
96
97// ZwpIdleInhibitorV1 context object for inhibiting idle behavior.
98type ZwpIdleInhibitorV1 struct{ *server.Resource }
99
100func WrapZwpIdleInhibitorV1(r *server.Resource) *ZwpIdleInhibitorV1 {
101 if r == nil {
102 return nil
103 }
104 return &ZwpIdleInhibitorV1{r}
105}
106
107const ZwpIdleInhibitorV1RequestDestroy uint32 = 0
108
109// ZwpIdleInhibitorV1Handler handles zwp_idle_inhibitor_v1 requests.
110type ZwpIdleInhibitorV1Handler interface {
111 Destroy(self *ZwpIdleInhibitorV1)
112}
113
114func NewZwpIdleInhibitorV1(c server.Client, version int32, id uint32, h ZwpIdleInhibitorV1Handler) (*ZwpIdleInhibitorV1, error) {
115 if h == nil {
116 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_idle_inhibitor_v1")
117 }
118 var self *ZwpIdleInhibitorV1
119 r, err := c.CreateResource(ZwpIdleInhibitorV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
120 switch opcode {
121 case 0:
122 h.Destroy(self)
123 self.Destroy()
124 }
125 })
126 if err != nil {
127 return nil, err
128 }
129 self = WrapZwpIdleInhibitorV1(r)
130 r.Data = self
131 return self, nil
132}
133func NewZwpIdleInhibitorV1Global(d *server.Display, version int32, bind server.BindFunc) error {
134 return d.CreateGlobal(ZwpIdleInhibitorV1Interface, version, bind)
135}
136func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
137 if v == nil {
138 return nil
139 }
140 return v.GetResource()
141}
142func (self *ZwpIdleInhibitManagerV1) GetResource() *server.Resource {
143 if self == nil {
144 return nil
145 }
146 return self.Resource
147}
148func (self *ZwpIdleInhibitorV1) GetResource() *server.Resource {
149 if self == nil {
150 return nil
151 }
152 return self.Resource
153}