merge: primary selection and data-control bindings
5 files · +1130 -0
A protocol/extdatacontrol/extdatacontrol.go +330 -0
| @@ -0,0 +1,330 @@ | |||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |
| 2 | + | package extdatacontrol | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "fmt" | |
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |
| 7 | + | "github.com/bnema/purego-libwayland/server" | |
| 8 | + | "runtime" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | var ExtDataControlManagerV1Interface *server.Interface | |
| 12 | + | var ExtDataControlDeviceV1Interface *server.Interface | |
| 13 | + | var ExtDataControlSourceV1Interface *server.Interface | |
| 14 | + | var ExtDataControlOfferV1Interface *server.Interface | |
| 15 | + | ||
| 16 | + | func init() { | |
| 17 | + | ExtDataControlManagerV1Interface = &server.Interface{Name: "ext_data_control_manager_v1", Version: 1} | |
| 18 | + | ExtDataControlDeviceV1Interface = &server.Interface{Name: "ext_data_control_device_v1", Version: 1} | |
| 19 | + | ExtDataControlSourceV1Interface = &server.Interface{Name: "ext_data_control_source_v1", Version: 1} | |
| 20 | + | ExtDataControlOfferV1Interface = &server.Interface{Name: "ext_data_control_offer_v1", Version: 1} | |
| 21 | + | ExtDataControlManagerV1Interface.Requests = []server.Message{ | |
| 22 | + | {Name: "create_data_source", Signature: "n", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |
| 23 | + | {Name: "get_data_device", Signature: "no", Types: []*server.Interface{ExtDataControlDeviceV1Interface, wayland.SeatInterface}}, | |
| 24 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 25 | + | } | |
| 26 | + | ExtDataControlManagerV1Interface.Events = []server.Message{} | |
| 27 | + | ExtDataControlDeviceV1Interface.Requests = []server.Message{ | |
| 28 | + | {Name: "set_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |
| 29 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 30 | + | {Name: "set_primary_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |
| 31 | + | } | |
| 32 | + | ExtDataControlDeviceV1Interface.Events = []server.Message{ | |
| 33 | + | {Name: "data_offer", Signature: "n", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |
| 34 | + | {Name: "selection", Signature: "?o", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |
| 35 | + | {Name: "finished", Signature: "", Types: []*server.Interface{}}, | |
| 36 | + | {Name: "primary_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |
| 37 | + | } | |
| 38 | + | ExtDataControlSourceV1Interface.Requests = []server.Message{ | |
| 39 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |
| 40 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 41 | + | } | |
| 42 | + | ExtDataControlSourceV1Interface.Events = []server.Message{ | |
| 43 | + | {Name: "send", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |
| 44 | + | {Name: "cancelled", Signature: "", Types: []*server.Interface{}}, | |
| 45 | + | } | |
| 46 | + | ExtDataControlOfferV1Interface.Requests = []server.Message{ | |
| 47 | + | {Name: "receive", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |
| 48 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 49 | + | } | |
| 50 | + | ExtDataControlOfferV1Interface.Events = []server.Message{ | |
| 51 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |
| 52 | + | } | |
| 53 | + | if err := server.NewInterfaces(ExtDataControlManagerV1Interface, ExtDataControlDeviceV1Interface, ExtDataControlSourceV1Interface, ExtDataControlOfferV1Interface); err != nil { | |
| 54 | + | panic(err) | |
| 55 | + | } | |
| 56 | + | } | |
| 57 | + | ||
| 58 | + | // ExtDataControlManagerV1 manager to control data devices. | |
| 59 | + | type ExtDataControlManagerV1 struct{ *server.Resource } | |
| 60 | + | ||
| 61 | + | func WrapExtDataControlManagerV1(r *server.Resource) *ExtDataControlManagerV1 { | |
| 62 | + | if r == nil { | |
| 63 | + | return nil | |
| 64 | + | } | |
| 65 | + | return &ExtDataControlManagerV1{r} | |
| 66 | + | } | |
| 67 | + | ||
| 68 | + | const ExtDataControlManagerV1RequestCreateDataSource uint32 = 0 | |
| 69 | + | const ExtDataControlManagerV1RequestGetDataDevice uint32 = 1 | |
| 70 | + | const ExtDataControlManagerV1RequestDestroy uint32 = 2 | |
| 71 | + | ||
| 72 | + | // ExtDataControlManagerV1Handler handles ext_data_control_manager_v1 requests. | |
| 73 | + | type ExtDataControlManagerV1Handler interface { | |
| 74 | + | CreateDataSource(self *ExtDataControlManagerV1, id uint32) | |
| 75 | + | GetDataDevice(self *ExtDataControlManagerV1, id uint32, seat *wayland.Seat) | |
| 76 | + | Destroy(self *ExtDataControlManagerV1) | |
| 77 | + | } | |
| 78 | + | ||
| 79 | + | func NewExtDataControlManagerV1(c server.Client, version int32, id uint32, h ExtDataControlManagerV1Handler) (*ExtDataControlManagerV1, error) { | |
| 80 | + | if h == nil { | |
| 81 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_manager_v1") | |
| 82 | + | } | |
| 83 | + | var self *ExtDataControlManagerV1 | |
| 84 | + | r, err := c.CreateResource(ExtDataControlManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 85 | + | switch opcode { | |
| 86 | + | case 0: | |
| 87 | + | h.CreateDataSource(self, args[0].NewID()) | |
| 88 | + | case 1: | |
| 89 | + | h.GetDataDevice(self, args[0].NewID(), wayland.WrapSeat(args[1].Resource())) | |
| 90 | + | case 2: | |
| 91 | + | h.Destroy(self) | |
| 92 | + | self.Destroy() | |
| 93 | + | } | |
| 94 | + | }) | |
| 95 | + | if err != nil { | |
| 96 | + | return nil, err | |
| 97 | + | } | |
| 98 | + | self = WrapExtDataControlManagerV1(r) | |
| 99 | + | r.Data = self | |
| 100 | + | return self, nil | |
| 101 | + | } | |
| 102 | + | func NewExtDataControlManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 103 | + | return d.CreateGlobal(ExtDataControlManagerV1Interface, version, bind) | |
| 104 | + | } | |
| 105 | + | ||
| 106 | + | // ExtDataControlDeviceV1 manage a data device for a seat. | |
| 107 | + | type ExtDataControlDeviceV1 struct{ *server.Resource } | |
| 108 | + | ||
| 109 | + | func WrapExtDataControlDeviceV1(r *server.Resource) *ExtDataControlDeviceV1 { | |
| 110 | + | if r == nil { | |
| 111 | + | return nil | |
| 112 | + | } | |
| 113 | + | return &ExtDataControlDeviceV1{r} | |
| 114 | + | } | |
| 115 | + | ||
| 116 | + | const ExtDataControlDeviceV1RequestSetSelection uint32 = 0 | |
| 117 | + | const ExtDataControlDeviceV1RequestDestroy uint32 = 1 | |
| 118 | + | const ExtDataControlDeviceV1RequestSetPrimarySelection uint32 = 2 | |
| 119 | + | const ExtDataControlDeviceV1EventDataOffer uint32 = 0 | |
| 120 | + | const ExtDataControlDeviceV1EventSelection uint32 = 1 | |
| 121 | + | const ExtDataControlDeviceV1EventFinished uint32 = 2 | |
| 122 | + | const ExtDataControlDeviceV1EventPrimarySelection uint32 = 3 | |
| 123 | + | ||
| 124 | + | // ExtDataControlDeviceV1Error . | |
| 125 | + | type ExtDataControlDeviceV1Error uint32 | |
| 126 | + | ||
| 127 | + | const ( | |
| 128 | + | ExtDataControlDeviceV1ErrorUsedSource ExtDataControlDeviceV1Error = 1 | |
| 129 | + | ) | |
| 130 | + | ||
| 131 | + | // ExtDataControlDeviceV1Handler handles ext_data_control_device_v1 requests. | |
| 132 | + | type ExtDataControlDeviceV1Handler interface { | |
| 133 | + | SetSelection(self *ExtDataControlDeviceV1, source *ExtDataControlSourceV1) | |
| 134 | + | Destroy(self *ExtDataControlDeviceV1) | |
| 135 | + | SetPrimarySelection(self *ExtDataControlDeviceV1, source *ExtDataControlSourceV1) | |
| 136 | + | } | |
| 137 | + | ||
| 138 | + | func NewExtDataControlDeviceV1(c server.Client, version int32, id uint32, h ExtDataControlDeviceV1Handler) (*ExtDataControlDeviceV1, error) { | |
| 139 | + | if h == nil { | |
| 140 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_device_v1") | |
| 141 | + | } | |
| 142 | + | var self *ExtDataControlDeviceV1 | |
| 143 | + | r, err := c.CreateResource(ExtDataControlDeviceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 144 | + | switch opcode { | |
| 145 | + | case 0: | |
| 146 | + | h.SetSelection(self, WrapExtDataControlSourceV1(args[0].Resource())) | |
| 147 | + | case 1: | |
| 148 | + | h.Destroy(self) | |
| 149 | + | self.Destroy() | |
| 150 | + | case 2: | |
| 151 | + | h.SetPrimarySelection(self, WrapExtDataControlSourceV1(args[0].Resource())) | |
| 152 | + | } | |
| 153 | + | }) | |
| 154 | + | if err != nil { | |
| 155 | + | return nil, err | |
| 156 | + | } | |
| 157 | + | self = WrapExtDataControlDeviceV1(r) | |
| 158 | + | r.Data = self | |
| 159 | + | return self, nil | |
| 160 | + | } | |
| 161 | + | ||
| 162 | + | // SendDataOffer introduce a new ext_data_control_offer. | |
| 163 | + | func (self *ExtDataControlDeviceV1) SendDataOffer(id *ExtDataControlOfferV1) { | |
| 164 | + | self.PostEvent(ExtDataControlDeviceV1EventDataOffer, server.NewID(resourceOf(id))) | |
| 165 | + | } | |
| 166 | + | ||
| 167 | + | // SendSelection advertise new selection. | |
| 168 | + | func (self *ExtDataControlDeviceV1) SendSelection(id *ExtDataControlOfferV1) { | |
| 169 | + | self.PostEvent(ExtDataControlDeviceV1EventSelection, server.Object(resourceOf(id))) | |
| 170 | + | } | |
| 171 | + | ||
| 172 | + | // SendFinished this data control is no longer valid. | |
| 173 | + | func (self *ExtDataControlDeviceV1) SendFinished() { | |
| 174 | + | self.PostEvent(ExtDataControlDeviceV1EventFinished) | |
| 175 | + | } | |
| 176 | + | ||
| 177 | + | // SendPrimarySelection advertise new primary selection. | |
| 178 | + | func (self *ExtDataControlDeviceV1) SendPrimarySelection(id *ExtDataControlOfferV1) { | |
| 179 | + | self.PostEvent(ExtDataControlDeviceV1EventPrimarySelection, server.Object(resourceOf(id))) | |
| 180 | + | } | |
| 181 | + | func NewExtDataControlDeviceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 182 | + | return d.CreateGlobal(ExtDataControlDeviceV1Interface, version, bind) | |
| 183 | + | } | |
| 184 | + | ||
| 185 | + | // ExtDataControlSourceV1 offer to transfer data. | |
| 186 | + | type ExtDataControlSourceV1 struct{ *server.Resource } | |
| 187 | + | ||
| 188 | + | func WrapExtDataControlSourceV1(r *server.Resource) *ExtDataControlSourceV1 { | |
| 189 | + | if r == nil { | |
| 190 | + | return nil | |
| 191 | + | } | |
| 192 | + | return &ExtDataControlSourceV1{r} | |
| 193 | + | } | |
| 194 | + | ||
| 195 | + | const ExtDataControlSourceV1RequestOffer uint32 = 0 | |
| 196 | + | const ExtDataControlSourceV1RequestDestroy uint32 = 1 | |
| 197 | + | const ExtDataControlSourceV1EventSend uint32 = 0 | |
| 198 | + | const ExtDataControlSourceV1EventCancelled uint32 = 1 | |
| 199 | + | ||
| 200 | + | // ExtDataControlSourceV1Error . | |
| 201 | + | type ExtDataControlSourceV1Error uint32 | |
| 202 | + | ||
| 203 | + | const ( | |
| 204 | + | ExtDataControlSourceV1ErrorInvalidOffer ExtDataControlSourceV1Error = 1 | |
| 205 | + | ) | |
| 206 | + | ||
| 207 | + | // ExtDataControlSourceV1Handler handles ext_data_control_source_v1 requests. | |
| 208 | + | type ExtDataControlSourceV1Handler interface { | |
| 209 | + | Offer(self *ExtDataControlSourceV1, mimeType string) | |
| 210 | + | Destroy(self *ExtDataControlSourceV1) | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | func NewExtDataControlSourceV1(c server.Client, version int32, id uint32, h ExtDataControlSourceV1Handler) (*ExtDataControlSourceV1, error) { | |
| 214 | + | if h == nil { | |
| 215 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_source_v1") | |
| 216 | + | } | |
| 217 | + | var self *ExtDataControlSourceV1 | |
| 218 | + | r, err := c.CreateResource(ExtDataControlSourceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 219 | + | switch opcode { | |
| 220 | + | case 0: | |
| 221 | + | h.Offer(self, args[0].String()) | |
| 222 | + | case 1: | |
| 223 | + | h.Destroy(self) | |
| 224 | + | self.Destroy() | |
| 225 | + | } | |
| 226 | + | }) | |
| 227 | + | if err != nil { | |
| 228 | + | return nil, err | |
| 229 | + | } | |
| 230 | + | self = WrapExtDataControlSourceV1(r) | |
| 231 | + | r.Data = self | |
| 232 | + | return self, nil | |
| 233 | + | } | |
| 234 | + | ||
| 235 | + | // SendSend send the data. | |
| 236 | + | func (self *ExtDataControlSourceV1) SendSend(mimeType string, fd int) { | |
| 237 | + | var p runtime.Pinner | |
| 238 | + | defer p.Unpin() | |
| 239 | + | self.PostEvent(ExtDataControlSourceV1EventSend, server.String(&p, mimeType, false), server.Fd(fd)) | |
| 240 | + | } | |
| 241 | + | ||
| 242 | + | // SendCancelled selection was cancelled. | |
| 243 | + | func (self *ExtDataControlSourceV1) SendCancelled() { | |
| 244 | + | self.PostEvent(ExtDataControlSourceV1EventCancelled) | |
| 245 | + | } | |
| 246 | + | func NewExtDataControlSourceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 247 | + | return d.CreateGlobal(ExtDataControlSourceV1Interface, version, bind) | |
| 248 | + | } | |
| 249 | + | ||
| 250 | + | // ExtDataControlOfferV1 offer to transfer data. | |
| 251 | + | type ExtDataControlOfferV1 struct{ *server.Resource } | |
| 252 | + | ||
| 253 | + | func WrapExtDataControlOfferV1(r *server.Resource) *ExtDataControlOfferV1 { | |
| 254 | + | if r == nil { | |
| 255 | + | return nil | |
| 256 | + | } | |
| 257 | + | return &ExtDataControlOfferV1{r} | |
| 258 | + | } | |
| 259 | + | ||
| 260 | + | const ExtDataControlOfferV1RequestReceive uint32 = 0 | |
| 261 | + | const ExtDataControlOfferV1RequestDestroy uint32 = 1 | |
| 262 | + | const ExtDataControlOfferV1EventOffer uint32 = 0 | |
| 263 | + | ||
| 264 | + | // ExtDataControlOfferV1Handler handles ext_data_control_offer_v1 requests. | |
| 265 | + | type ExtDataControlOfferV1Handler interface { | |
| 266 | + | Receive(self *ExtDataControlOfferV1, mimeType string, fd int) | |
| 267 | + | Destroy(self *ExtDataControlOfferV1) | |
| 268 | + | } | |
| 269 | + | ||
| 270 | + | func NewExtDataControlOfferV1(c server.Client, version int32, id uint32, h ExtDataControlOfferV1Handler) (*ExtDataControlOfferV1, error) { | |
| 271 | + | if h == nil { | |
| 272 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_offer_v1") | |
| 273 | + | } | |
| 274 | + | var self *ExtDataControlOfferV1 | |
| 275 | + | r, err := c.CreateResource(ExtDataControlOfferV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 276 | + | switch opcode { | |
| 277 | + | case 0: | |
| 278 | + | h.Receive(self, args[0].String(), args[1].Fd()) | |
| 279 | + | case 1: | |
| 280 | + | h.Destroy(self) | |
| 281 | + | self.Destroy() | |
| 282 | + | } | |
| 283 | + | }) | |
| 284 | + | if err != nil { | |
| 285 | + | return nil, err | |
| 286 | + | } | |
| 287 | + | self = WrapExtDataControlOfferV1(r) | |
| 288 | + | r.Data = self | |
| 289 | + | return self, nil | |
| 290 | + | } | |
| 291 | + | ||
| 292 | + | // SendOffer advertise offered MIME type. | |
| 293 | + | func (self *ExtDataControlOfferV1) SendOffer(mimeType string) { | |
| 294 | + | var p runtime.Pinner | |
| 295 | + | defer p.Unpin() | |
| 296 | + | self.PostEvent(ExtDataControlOfferV1EventOffer, server.String(&p, mimeType, false)) | |
| 297 | + | } | |
| 298 | + | func NewExtDataControlOfferV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 299 | + | return d.CreateGlobal(ExtDataControlOfferV1Interface, version, bind) | |
| 300 | + | } | |
| 301 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |
| 302 | + | if v == nil { | |
| 303 | + | return nil | |
| 304 | + | } | |
| 305 | + | return v.GetResource() | |
| 306 | + | } | |
| 307 | + | func (self *ExtDataControlManagerV1) GetResource() *server.Resource { | |
| 308 | + | if self == nil { | |
| 309 | + | return nil | |
| 310 | + | } | |
| 311 | + | return self.Resource | |
| 312 | + | } | |
| 313 | + | func (self *ExtDataControlDeviceV1) GetResource() *server.Resource { | |
| 314 | + | if self == nil { | |
| 315 | + | return nil | |
| 316 | + | } | |
| 317 | + | return self.Resource | |
| 318 | + | } | |
| 319 | + | func (self *ExtDataControlSourceV1) GetResource() *server.Resource { | |
| 320 | + | if self == nil { | |
| 321 | + | return nil | |
| 322 | + | } | |
| 323 | + | return self.Resource | |
| 324 | + | } | |
| 325 | + | func (self *ExtDataControlOfferV1) GetResource() *server.Resource { | |
| 326 | + | if self == nil { | |
| 327 | + | return nil | |
| 328 | + | } | |
| 329 | + | return self.Resource | |
| 330 | + | } | |
| @@ -0,0 +1,330 @@ | |||||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |||
| 2 | + | package extdatacontrol | |||
| 3 | + | ||||
| 4 | + | import ( | |||
| 5 | + | "fmt" | |||
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |||
| 7 | + | "github.com/bnema/purego-libwayland/server" | |||
| 8 | + | "runtime" | |||
| 9 | + | ) | |||
| 10 | + | ||||
| 11 | + | var ExtDataControlManagerV1Interface *server.Interface | |||
| 12 | + | var ExtDataControlDeviceV1Interface *server.Interface | |||
| 13 | + | var ExtDataControlSourceV1Interface *server.Interface | |||
| 14 | + | var ExtDataControlOfferV1Interface *server.Interface | |||
| 15 | + | ||||
| 16 | + | func init() { | |||
| 17 | + | ExtDataControlManagerV1Interface = &server.Interface{Name: "ext_data_control_manager_v1", Version: 1} | |||
| 18 | + | ExtDataControlDeviceV1Interface = &server.Interface{Name: "ext_data_control_device_v1", Version: 1} | |||
| 19 | + | ExtDataControlSourceV1Interface = &server.Interface{Name: "ext_data_control_source_v1", Version: 1} | |||
| 20 | + | ExtDataControlOfferV1Interface = &server.Interface{Name: "ext_data_control_offer_v1", Version: 1} | |||
| 21 | + | ExtDataControlManagerV1Interface.Requests = []server.Message{ | |||
| 22 | + | {Name: "create_data_source", Signature: "n", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |||
| 23 | + | {Name: "get_data_device", Signature: "no", Types: []*server.Interface{ExtDataControlDeviceV1Interface, wayland.SeatInterface}}, | |||
| 24 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 25 | + | } | |||
| 26 | + | ExtDataControlManagerV1Interface.Events = []server.Message{} | |||
| 27 | + | ExtDataControlDeviceV1Interface.Requests = []server.Message{ | |||
| 28 | + | {Name: "set_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |||
| 29 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 30 | + | {Name: "set_primary_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlSourceV1Interface}}, | |||
| 31 | + | } | |||
| 32 | + | ExtDataControlDeviceV1Interface.Events = []server.Message{ | |||
| 33 | + | {Name: "data_offer", Signature: "n", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |||
| 34 | + | {Name: "selection", Signature: "?o", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |||
| 35 | + | {Name: "finished", Signature: "", Types: []*server.Interface{}}, | |||
| 36 | + | {Name: "primary_selection", Signature: "?o", Types: []*server.Interface{ExtDataControlOfferV1Interface}}, | |||
| 37 | + | } | |||
| 38 | + | ExtDataControlSourceV1Interface.Requests = []server.Message{ | |||
| 39 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |||
| 40 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 41 | + | } | |||
| 42 | + | ExtDataControlSourceV1Interface.Events = []server.Message{ | |||
| 43 | + | {Name: "send", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |||
| 44 | + | {Name: "cancelled", Signature: "", Types: []*server.Interface{}}, | |||
| 45 | + | } | |||
| 46 | + | ExtDataControlOfferV1Interface.Requests = []server.Message{ | |||
| 47 | + | {Name: "receive", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |||
| 48 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 49 | + | } | |||
| 50 | + | ExtDataControlOfferV1Interface.Events = []server.Message{ | |||
| 51 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |||
| 52 | + | } | |||
| 53 | + | if err := server.NewInterfaces(ExtDataControlManagerV1Interface, ExtDataControlDeviceV1Interface, ExtDataControlSourceV1Interface, ExtDataControlOfferV1Interface); err != nil { | |||
| 54 | + | panic(err) | |||
| 55 | + | } | |||
| 56 | + | } | |||
| 57 | + | ||||
| 58 | + | // ExtDataControlManagerV1 manager to control data devices. | |||
| 59 | + | type ExtDataControlManagerV1 struct{ *server.Resource } | |||
| 60 | + | ||||
| 61 | + | func WrapExtDataControlManagerV1(r *server.Resource) *ExtDataControlManagerV1 { | |||
| 62 | + | if r == nil { | |||
| 63 | + | return nil | |||
| 64 | + | } | |||
| 65 | + | return &ExtDataControlManagerV1{r} | |||
| 66 | + | } | |||
| 67 | + | ||||
| 68 | + | const ExtDataControlManagerV1RequestCreateDataSource uint32 = 0 | |||
| 69 | + | const ExtDataControlManagerV1RequestGetDataDevice uint32 = 1 | |||
| 70 | + | const ExtDataControlManagerV1RequestDestroy uint32 = 2 | |||
| 71 | + | ||||
| 72 | + | // ExtDataControlManagerV1Handler handles ext_data_control_manager_v1 requests. | |||
| 73 | + | type ExtDataControlManagerV1Handler interface { | |||
| 74 | + | CreateDataSource(self *ExtDataControlManagerV1, id uint32) | |||
| 75 | + | GetDataDevice(self *ExtDataControlManagerV1, id uint32, seat *wayland.Seat) | |||
| 76 | + | Destroy(self *ExtDataControlManagerV1) | |||
| 77 | + | } | |||
| 78 | + | ||||
| 79 | + | func NewExtDataControlManagerV1(c server.Client, version int32, id uint32, h ExtDataControlManagerV1Handler) (*ExtDataControlManagerV1, error) { | |||
| 80 | + | if h == nil { | |||
| 81 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_manager_v1") | |||
| 82 | + | } | |||
| 83 | + | var self *ExtDataControlManagerV1 | |||
| 84 | + | r, err := c.CreateResource(ExtDataControlManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 85 | + | switch opcode { | |||
| 86 | + | case 0: | |||
| 87 | + | h.CreateDataSource(self, args[0].NewID()) | |||
| 88 | + | case 1: | |||
| 89 | + | h.GetDataDevice(self, args[0].NewID(), wayland.WrapSeat(args[1].Resource())) | |||
| 90 | + | case 2: | |||
| 91 | + | h.Destroy(self) | |||
| 92 | + | self.Destroy() | |||
| 93 | + | } | |||
| 94 | + | }) | |||
| 95 | + | if err != nil { | |||
| 96 | + | return nil, err | |||
| 97 | + | } | |||
| 98 | + | self = WrapExtDataControlManagerV1(r) | |||
| 99 | + | r.Data = self | |||
| 100 | + | return self, nil | |||
| 101 | + | } | |||
| 102 | + | func NewExtDataControlManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 103 | + | return d.CreateGlobal(ExtDataControlManagerV1Interface, version, bind) | |||
| 104 | + | } | |||
| 105 | + | ||||
| 106 | + | // ExtDataControlDeviceV1 manage a data device for a seat. | |||
| 107 | + | type ExtDataControlDeviceV1 struct{ *server.Resource } | |||
| 108 | + | ||||
| 109 | + | func WrapExtDataControlDeviceV1(r *server.Resource) *ExtDataControlDeviceV1 { | |||
| 110 | + | if r == nil { | |||
| 111 | + | return nil | |||
| 112 | + | } | |||
| 113 | + | return &ExtDataControlDeviceV1{r} | |||
| 114 | + | } | |||
| 115 | + | ||||
| 116 | + | const ExtDataControlDeviceV1RequestSetSelection uint32 = 0 | |||
| 117 | + | const ExtDataControlDeviceV1RequestDestroy uint32 = 1 | |||
| 118 | + | const ExtDataControlDeviceV1RequestSetPrimarySelection uint32 = 2 | |||
| 119 | + | const ExtDataControlDeviceV1EventDataOffer uint32 = 0 | |||
| 120 | + | const ExtDataControlDeviceV1EventSelection uint32 = 1 | |||
| 121 | + | const ExtDataControlDeviceV1EventFinished uint32 = 2 | |||
| 122 | + | const ExtDataControlDeviceV1EventPrimarySelection uint32 = 3 | |||
| 123 | + | ||||
| 124 | + | // ExtDataControlDeviceV1Error . | |||
| 125 | + | type ExtDataControlDeviceV1Error uint32 | |||
| 126 | + | ||||
| 127 | + | const ( | |||
| 128 | + | ExtDataControlDeviceV1ErrorUsedSource ExtDataControlDeviceV1Error = 1 | |||
| 129 | + | ) | |||
| 130 | + | ||||
| 131 | + | // ExtDataControlDeviceV1Handler handles ext_data_control_device_v1 requests. | |||
| 132 | + | type ExtDataControlDeviceV1Handler interface { | |||
| 133 | + | SetSelection(self *ExtDataControlDeviceV1, source *ExtDataControlSourceV1) | |||
| 134 | + | Destroy(self *ExtDataControlDeviceV1) | |||
| 135 | + | SetPrimarySelection(self *ExtDataControlDeviceV1, source *ExtDataControlSourceV1) | |||
| 136 | + | } | |||
| 137 | + | ||||
| 138 | + | func NewExtDataControlDeviceV1(c server.Client, version int32, id uint32, h ExtDataControlDeviceV1Handler) (*ExtDataControlDeviceV1, error) { | |||
| 139 | + | if h == nil { | |||
| 140 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_device_v1") | |||
| 141 | + | } | |||
| 142 | + | var self *ExtDataControlDeviceV1 | |||
| 143 | + | r, err := c.CreateResource(ExtDataControlDeviceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 144 | + | switch opcode { | |||
| 145 | + | case 0: | |||
| 146 | + | h.SetSelection(self, WrapExtDataControlSourceV1(args[0].Resource())) | |||
| 147 | + | case 1: | |||
| 148 | + | h.Destroy(self) | |||
| 149 | + | self.Destroy() | |||
| 150 | + | case 2: | |||
| 151 | + | h.SetPrimarySelection(self, WrapExtDataControlSourceV1(args[0].Resource())) | |||
| 152 | + | } | |||
| 153 | + | }) | |||
| 154 | + | if err != nil { | |||
| 155 | + | return nil, err | |||
| 156 | + | } | |||
| 157 | + | self = WrapExtDataControlDeviceV1(r) | |||
| 158 | + | r.Data = self | |||
| 159 | + | return self, nil | |||
| 160 | + | } | |||
| 161 | + | ||||
| 162 | + | // SendDataOffer introduce a new ext_data_control_offer. | |||
| 163 | + | func (self *ExtDataControlDeviceV1) SendDataOffer(id *ExtDataControlOfferV1) { | |||
| 164 | + | self.PostEvent(ExtDataControlDeviceV1EventDataOffer, server.NewID(resourceOf(id))) | |||
| 165 | + | } | |||
| 166 | + | ||||
| 167 | + | // SendSelection advertise new selection. | |||
| 168 | + | func (self *ExtDataControlDeviceV1) SendSelection(id *ExtDataControlOfferV1) { | |||
| 169 | + | self.PostEvent(ExtDataControlDeviceV1EventSelection, server.Object(resourceOf(id))) | |||
| 170 | + | } | |||
| 171 | + | ||||
| 172 | + | // SendFinished this data control is no longer valid. | |||
| 173 | + | func (self *ExtDataControlDeviceV1) SendFinished() { | |||
| 174 | + | self.PostEvent(ExtDataControlDeviceV1EventFinished) | |||
| 175 | + | } | |||
| 176 | + | ||||
| 177 | + | // SendPrimarySelection advertise new primary selection. | |||
| 178 | + | func (self *ExtDataControlDeviceV1) SendPrimarySelection(id *ExtDataControlOfferV1) { | |||
| 179 | + | self.PostEvent(ExtDataControlDeviceV1EventPrimarySelection, server.Object(resourceOf(id))) | |||
| 180 | + | } | |||
| 181 | + | func NewExtDataControlDeviceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 182 | + | return d.CreateGlobal(ExtDataControlDeviceV1Interface, version, bind) | |||
| 183 | + | } | |||
| 184 | + | ||||
| 185 | + | // ExtDataControlSourceV1 offer to transfer data. | |||
| 186 | + | type ExtDataControlSourceV1 struct{ *server.Resource } | |||
| 187 | + | ||||
| 188 | + | func WrapExtDataControlSourceV1(r *server.Resource) *ExtDataControlSourceV1 { | |||
| 189 | + | if r == nil { | |||
| 190 | + | return nil | |||
| 191 | + | } | |||
| 192 | + | return &ExtDataControlSourceV1{r} | |||
| 193 | + | } | |||
| 194 | + | ||||
| 195 | + | const ExtDataControlSourceV1RequestOffer uint32 = 0 | |||
| 196 | + | const ExtDataControlSourceV1RequestDestroy uint32 = 1 | |||
| 197 | + | const ExtDataControlSourceV1EventSend uint32 = 0 | |||
| 198 | + | const ExtDataControlSourceV1EventCancelled uint32 = 1 | |||
| 199 | + | ||||
| 200 | + | // ExtDataControlSourceV1Error . | |||
| 201 | + | type ExtDataControlSourceV1Error uint32 | |||
| 202 | + | ||||
| 203 | + | const ( | |||
| 204 | + | ExtDataControlSourceV1ErrorInvalidOffer ExtDataControlSourceV1Error = 1 | |||
| 205 | + | ) | |||
| 206 | + | ||||
| 207 | + | // ExtDataControlSourceV1Handler handles ext_data_control_source_v1 requests. | |||
| 208 | + | type ExtDataControlSourceV1Handler interface { | |||
| 209 | + | Offer(self *ExtDataControlSourceV1, mimeType string) | |||
| 210 | + | Destroy(self *ExtDataControlSourceV1) | |||
| 211 | + | } | |||
| 212 | + | ||||
| 213 | + | func NewExtDataControlSourceV1(c server.Client, version int32, id uint32, h ExtDataControlSourceV1Handler) (*ExtDataControlSourceV1, error) { | |||
| 214 | + | if h == nil { | |||
| 215 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_source_v1") | |||
| 216 | + | } | |||
| 217 | + | var self *ExtDataControlSourceV1 | |||
| 218 | + | r, err := c.CreateResource(ExtDataControlSourceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 219 | + | switch opcode { | |||
| 220 | + | case 0: | |||
| 221 | + | h.Offer(self, args[0].String()) | |||
| 222 | + | case 1: | |||
| 223 | + | h.Destroy(self) | |||
| 224 | + | self.Destroy() | |||
| 225 | + | } | |||
| 226 | + | }) | |||
| 227 | + | if err != nil { | |||
| 228 | + | return nil, err | |||
| 229 | + | } | |||
| 230 | + | self = WrapExtDataControlSourceV1(r) | |||
| 231 | + | r.Data = self | |||
| 232 | + | return self, nil | |||
| 233 | + | } | |||
| 234 | + | ||||
| 235 | + | // SendSend send the data. | |||
| 236 | + | func (self *ExtDataControlSourceV1) SendSend(mimeType string, fd int) { | |||
| 237 | + | var p runtime.Pinner | |||
| 238 | + | defer p.Unpin() | |||
| 239 | + | self.PostEvent(ExtDataControlSourceV1EventSend, server.String(&p, mimeType, false), server.Fd(fd)) | |||
| 240 | + | } | |||
| 241 | + | ||||
| 242 | + | // SendCancelled selection was cancelled. | |||
| 243 | + | func (self *ExtDataControlSourceV1) SendCancelled() { | |||
| 244 | + | self.PostEvent(ExtDataControlSourceV1EventCancelled) | |||
| 245 | + | } | |||
| 246 | + | func NewExtDataControlSourceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 247 | + | return d.CreateGlobal(ExtDataControlSourceV1Interface, version, bind) | |||
| 248 | + | } | |||
| 249 | + | ||||
| 250 | + | // ExtDataControlOfferV1 offer to transfer data. | |||
| 251 | + | type ExtDataControlOfferV1 struct{ *server.Resource } | |||
| 252 | + | ||||
| 253 | + | func WrapExtDataControlOfferV1(r *server.Resource) *ExtDataControlOfferV1 { | |||
| 254 | + | if r == nil { | |||
| 255 | + | return nil | |||
| 256 | + | } | |||
| 257 | + | return &ExtDataControlOfferV1{r} | |||
| 258 | + | } | |||
| 259 | + | ||||
| 260 | + | const ExtDataControlOfferV1RequestReceive uint32 = 0 | |||
| 261 | + | const ExtDataControlOfferV1RequestDestroy uint32 = 1 | |||
| 262 | + | const ExtDataControlOfferV1EventOffer uint32 = 0 | |||
| 263 | + | ||||
| 264 | + | // ExtDataControlOfferV1Handler handles ext_data_control_offer_v1 requests. | |||
| 265 | + | type ExtDataControlOfferV1Handler interface { | |||
| 266 | + | Receive(self *ExtDataControlOfferV1, mimeType string, fd int) | |||
| 267 | + | Destroy(self *ExtDataControlOfferV1) | |||
| 268 | + | } | |||
| 269 | + | ||||
| 270 | + | func NewExtDataControlOfferV1(c server.Client, version int32, id uint32, h ExtDataControlOfferV1Handler) (*ExtDataControlOfferV1, error) { | |||
| 271 | + | if h == nil { | |||
| 272 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for ext_data_control_offer_v1") | |||
| 273 | + | } | |||
| 274 | + | var self *ExtDataControlOfferV1 | |||
| 275 | + | r, err := c.CreateResource(ExtDataControlOfferV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 276 | + | switch opcode { | |||
| 277 | + | case 0: | |||
| 278 | + | h.Receive(self, args[0].String(), args[1].Fd()) | |||
| 279 | + | case 1: | |||
| 280 | + | h.Destroy(self) | |||
| 281 | + | self.Destroy() | |||
| 282 | + | } | |||
| 283 | + | }) | |||
| 284 | + | if err != nil { | |||
| 285 | + | return nil, err | |||
| 286 | + | } | |||
| 287 | + | self = WrapExtDataControlOfferV1(r) | |||
| 288 | + | r.Data = self | |||
| 289 | + | return self, nil | |||
| 290 | + | } | |||
| 291 | + | ||||
| 292 | + | // SendOffer advertise offered MIME type. | |||
| 293 | + | func (self *ExtDataControlOfferV1) SendOffer(mimeType string) { | |||
| 294 | + | var p runtime.Pinner | |||
| 295 | + | defer p.Unpin() | |||
| 296 | + | self.PostEvent(ExtDataControlOfferV1EventOffer, server.String(&p, mimeType, false)) | |||
| 297 | + | } | |||
| 298 | + | func NewExtDataControlOfferV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 299 | + | return d.CreateGlobal(ExtDataControlOfferV1Interface, version, bind) | |||
| 300 | + | } | |||
| 301 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |||
| 302 | + | if v == nil { | |||
| 303 | + | return nil | |||
| 304 | + | } | |||
| 305 | + | return v.GetResource() | |||
| 306 | + | } | |||
| 307 | + | func (self *ExtDataControlManagerV1) GetResource() *server.Resource { | |||
| 308 | + | if self == nil { | |||
| 309 | + | return nil | |||
| 310 | + | } | |||
| 311 | + | return self.Resource | |||
| 312 | + | } | |||
| 313 | + | func (self *ExtDataControlDeviceV1) GetResource() *server.Resource { | |||
| 314 | + | if self == nil { | |||
| 315 | + | return nil | |||
| 316 | + | } | |||
| 317 | + | return self.Resource | |||
| 318 | + | } | |||
| 319 | + | func (self *ExtDataControlSourceV1) GetResource() *server.Resource { | |||
| 320 | + | if self == nil { | |||
| 321 | + | return nil | |||
| 322 | + | } | |||
| 323 | + | return self.Resource | |||
| 324 | + | } | |||
| 325 | + | func (self *ExtDataControlOfferV1) GetResource() *server.Resource { | |||
| 326 | + | if self == nil { | |||
| 327 | + | return nil | |||
| 328 | + | } | |||
| 329 | + | return self.Resource | |||
| 330 | + | } | |||
M protocol/gen.go +2 -0
| @@ -12,3 +12,5 @@ package protocol | |||
| 12 | 12 | //go:generate go run ../cmd/wlgen -package kdedecoration -out kdedecoration/kdedecoration.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/server-decoration.xml | |
| 13 | 13 | //go:generate go run ../cmd/wlgen -package tabletv2 -out tabletv2/tabletv2.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/tablet-v2.xml | |
| 14 | 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | |
| 15 | + | //go:generate go run ../cmd/wlgen -package primaryselection -out primaryselection/primaryselection.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/primary-selection-unstable-v1.xml | |
| 16 | + | //go:generate go run ../cmd/wlgen -package extdatacontrol -out extdatacontrol/extdatacontrol.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/ext-data-control-v1.xml | |
| @@ -12,3 +12,5 @@ package protocol | |||||
| 12 | //go:generate go run ../cmd/wlgen -package kdedecoration -out kdedecoration/kdedecoration.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/server-decoration.xml | 12 | //go:generate go run ../cmd/wlgen -package kdedecoration -out kdedecoration/kdedecoration.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/server-decoration.xml | ||
| 13 | //go:generate go run ../cmd/wlgen -package tabletv2 -out tabletv2/tabletv2.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/tablet-v2.xml | 13 | //go:generate go run ../cmd/wlgen -package tabletv2 -out tabletv2/tabletv2.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/tablet-v2.xml | ||
| 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | ||
| 15 | + | //go:generate go run ../cmd/wlgen -package primaryselection -out primaryselection/primaryselection.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/primary-selection-unstable-v1.xml | |||
| 16 | + | //go:generate go run ../cmd/wlgen -package extdatacontrol -out extdatacontrol/extdatacontrol.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/ext-data-control-v1.xml | |||
A protocol/primaryselection/primaryselection.go +297 -0
| @@ -0,0 +1,297 @@ | |||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |
| 2 | + | package primaryselection | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "fmt" | |
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |
| 7 | + | "github.com/bnema/purego-libwayland/server" | |
| 8 | + | "runtime" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | var ZwpPrimarySelectionDeviceManagerV1Interface *server.Interface | |
| 12 | + | var ZwpPrimarySelectionDeviceV1Interface *server.Interface | |
| 13 | + | var ZwpPrimarySelectionOfferV1Interface *server.Interface | |
| 14 | + | var ZwpPrimarySelectionSourceV1Interface *server.Interface | |
| 15 | + | ||
| 16 | + | func init() { | |
| 17 | + | ZwpPrimarySelectionDeviceManagerV1Interface = &server.Interface{Name: "zwp_primary_selection_device_manager_v1", Version: 1} | |
| 18 | + | ZwpPrimarySelectionDeviceV1Interface = &server.Interface{Name: "zwp_primary_selection_device_v1", Version: 1} | |
| 19 | + | ZwpPrimarySelectionOfferV1Interface = &server.Interface{Name: "zwp_primary_selection_offer_v1", Version: 1} | |
| 20 | + | ZwpPrimarySelectionSourceV1Interface = &server.Interface{Name: "zwp_primary_selection_source_v1", Version: 1} | |
| 21 | + | ZwpPrimarySelectionDeviceManagerV1Interface.Requests = []server.Message{ | |
| 22 | + | {Name: "create_source", Signature: "n", Types: []*server.Interface{ZwpPrimarySelectionSourceV1Interface}}, | |
| 23 | + | {Name: "get_device", Signature: "no", Types: []*server.Interface{ZwpPrimarySelectionDeviceV1Interface, wayland.SeatInterface}}, | |
| 24 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 25 | + | } | |
| 26 | + | ZwpPrimarySelectionDeviceManagerV1Interface.Events = []server.Message{} | |
| 27 | + | ZwpPrimarySelectionDeviceV1Interface.Requests = []server.Message{ | |
| 28 | + | {Name: "set_selection", Signature: "?ou", Types: []*server.Interface{ZwpPrimarySelectionSourceV1Interface, nil}}, | |
| 29 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 30 | + | } | |
| 31 | + | ZwpPrimarySelectionDeviceV1Interface.Events = []server.Message{ | |
| 32 | + | {Name: "data_offer", Signature: "n", Types: []*server.Interface{ZwpPrimarySelectionOfferV1Interface}}, | |
| 33 | + | {Name: "selection", Signature: "?o", Types: []*server.Interface{ZwpPrimarySelectionOfferV1Interface}}, | |
| 34 | + | } | |
| 35 | + | ZwpPrimarySelectionOfferV1Interface.Requests = []server.Message{ | |
| 36 | + | {Name: "receive", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |
| 37 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 38 | + | } | |
| 39 | + | ZwpPrimarySelectionOfferV1Interface.Events = []server.Message{ | |
| 40 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |
| 41 | + | } | |
| 42 | + | ZwpPrimarySelectionSourceV1Interface.Requests = []server.Message{ | |
| 43 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |
| 44 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 45 | + | } | |
| 46 | + | ZwpPrimarySelectionSourceV1Interface.Events = []server.Message{ | |
| 47 | + | {Name: "send", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |
| 48 | + | {Name: "cancelled", Signature: "", Types: []*server.Interface{}}, | |
| 49 | + | } | |
| 50 | + | if err := server.NewInterfaces(ZwpPrimarySelectionDeviceManagerV1Interface, ZwpPrimarySelectionDeviceV1Interface, ZwpPrimarySelectionOfferV1Interface, ZwpPrimarySelectionSourceV1Interface); err != nil { | |
| 51 | + | panic(err) | |
| 52 | + | } | |
| 53 | + | } | |
| 54 | + | ||
| 55 | + | // ZwpPrimarySelectionDeviceManagerV1 X primary selection emulation. | |
| 56 | + | type ZwpPrimarySelectionDeviceManagerV1 struct{ *server.Resource } | |
| 57 | + | ||
| 58 | + | func WrapZwpPrimarySelectionDeviceManagerV1(r *server.Resource) *ZwpPrimarySelectionDeviceManagerV1 { | |
| 59 | + | if r == nil { | |
| 60 | + | return nil | |
| 61 | + | } | |
| 62 | + | return &ZwpPrimarySelectionDeviceManagerV1{r} | |
| 63 | + | } | |
| 64 | + | ||
| 65 | + | const ZwpPrimarySelectionDeviceManagerV1RequestCreateSource uint32 = 0 | |
| 66 | + | const ZwpPrimarySelectionDeviceManagerV1RequestGetDevice uint32 = 1 | |
| 67 | + | const ZwpPrimarySelectionDeviceManagerV1RequestDestroy uint32 = 2 | |
| 68 | + | ||
| 69 | + | // ZwpPrimarySelectionDeviceManagerV1Handler handles zwp_primary_selection_device_manager_v1 requests. | |
| 70 | + | type ZwpPrimarySelectionDeviceManagerV1Handler interface { | |
| 71 | + | CreateSource(self *ZwpPrimarySelectionDeviceManagerV1, id uint32) | |
| 72 | + | GetDevice(self *ZwpPrimarySelectionDeviceManagerV1, id uint32, seat *wayland.Seat) | |
| 73 | + | Destroy(self *ZwpPrimarySelectionDeviceManagerV1) | |
| 74 | + | } | |
| 75 | + | ||
| 76 | + | func NewZwpPrimarySelectionDeviceManagerV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionDeviceManagerV1Handler) (*ZwpPrimarySelectionDeviceManagerV1, error) { | |
| 77 | + | if h == nil { | |
| 78 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_device_manager_v1") | |
| 79 | + | } | |
| 80 | + | var self *ZwpPrimarySelectionDeviceManagerV1 | |
| 81 | + | r, err := c.CreateResource(ZwpPrimarySelectionDeviceManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 82 | + | switch opcode { | |
| 83 | + | case 0: | |
| 84 | + | h.CreateSource(self, args[0].NewID()) | |
| 85 | + | case 1: | |
| 86 | + | h.GetDevice(self, args[0].NewID(), wayland.WrapSeat(args[1].Resource())) | |
| 87 | + | case 2: | |
| 88 | + | h.Destroy(self) | |
| 89 | + | self.Destroy() | |
| 90 | + | } | |
| 91 | + | }) | |
| 92 | + | if err != nil { | |
| 93 | + | return nil, err | |
| 94 | + | } | |
| 95 | + | self = WrapZwpPrimarySelectionDeviceManagerV1(r) | |
| 96 | + | r.Data = self | |
| 97 | + | return self, nil | |
| 98 | + | } | |
| 99 | + | func NewZwpPrimarySelectionDeviceManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 100 | + | return d.CreateGlobal(ZwpPrimarySelectionDeviceManagerV1Interface, version, bind) | |
| 101 | + | } | |
| 102 | + | ||
| 103 | + | // ZwpPrimarySelectionDeviceV1 . | |
| 104 | + | type ZwpPrimarySelectionDeviceV1 struct{ *server.Resource } | |
| 105 | + | ||
| 106 | + | func WrapZwpPrimarySelectionDeviceV1(r *server.Resource) *ZwpPrimarySelectionDeviceV1 { | |
| 107 | + | if r == nil { | |
| 108 | + | return nil | |
| 109 | + | } | |
| 110 | + | return &ZwpPrimarySelectionDeviceV1{r} | |
| 111 | + | } | |
| 112 | + | ||
| 113 | + | const ZwpPrimarySelectionDeviceV1RequestSetSelection uint32 = 0 | |
| 114 | + | const ZwpPrimarySelectionDeviceV1RequestDestroy uint32 = 1 | |
| 115 | + | const ZwpPrimarySelectionDeviceV1EventDataOffer uint32 = 0 | |
| 116 | + | const ZwpPrimarySelectionDeviceV1EventSelection uint32 = 1 | |
| 117 | + | ||
| 118 | + | // ZwpPrimarySelectionDeviceV1Handler handles zwp_primary_selection_device_v1 requests. | |
| 119 | + | type ZwpPrimarySelectionDeviceV1Handler interface { | |
| 120 | + | SetSelection(self *ZwpPrimarySelectionDeviceV1, source *ZwpPrimarySelectionSourceV1, serial uint32) | |
| 121 | + | Destroy(self *ZwpPrimarySelectionDeviceV1) | |
| 122 | + | } | |
| 123 | + | ||
| 124 | + | func NewZwpPrimarySelectionDeviceV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionDeviceV1Handler) (*ZwpPrimarySelectionDeviceV1, error) { | |
| 125 | + | if h == nil { | |
| 126 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_device_v1") | |
| 127 | + | } | |
| 128 | + | var self *ZwpPrimarySelectionDeviceV1 | |
| 129 | + | r, err := c.CreateResource(ZwpPrimarySelectionDeviceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 130 | + | switch opcode { | |
| 131 | + | case 0: | |
| 132 | + | h.SetSelection(self, WrapZwpPrimarySelectionSourceV1(args[0].Resource()), args[1].Uint()) | |
| 133 | + | case 1: | |
| 134 | + | h.Destroy(self) | |
| 135 | + | self.Destroy() | |
| 136 | + | } | |
| 137 | + | }) | |
| 138 | + | if err != nil { | |
| 139 | + | return nil, err | |
| 140 | + | } | |
| 141 | + | self = WrapZwpPrimarySelectionDeviceV1(r) | |
| 142 | + | r.Data = self | |
| 143 | + | return self, nil | |
| 144 | + | } | |
| 145 | + | ||
| 146 | + | // SendDataOffer introduce a new wp_primary_selection_offer. | |
| 147 | + | func (self *ZwpPrimarySelectionDeviceV1) SendDataOffer(offer *ZwpPrimarySelectionOfferV1) { | |
| 148 | + | self.PostEvent(ZwpPrimarySelectionDeviceV1EventDataOffer, server.NewID(resourceOf(offer))) | |
| 149 | + | } | |
| 150 | + | ||
| 151 | + | // SendSelection advertise a new primary selection. | |
| 152 | + | func (self *ZwpPrimarySelectionDeviceV1) SendSelection(id *ZwpPrimarySelectionOfferV1) { | |
| 153 | + | self.PostEvent(ZwpPrimarySelectionDeviceV1EventSelection, server.Object(resourceOf(id))) | |
| 154 | + | } | |
| 155 | + | func NewZwpPrimarySelectionDeviceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 156 | + | return d.CreateGlobal(ZwpPrimarySelectionDeviceV1Interface, version, bind) | |
| 157 | + | } | |
| 158 | + | ||
| 159 | + | // ZwpPrimarySelectionOfferV1 offer to transfer primary selection contents. | |
| 160 | + | type ZwpPrimarySelectionOfferV1 struct{ *server.Resource } | |
| 161 | + | ||
| 162 | + | func WrapZwpPrimarySelectionOfferV1(r *server.Resource) *ZwpPrimarySelectionOfferV1 { | |
| 163 | + | if r == nil { | |
| 164 | + | return nil | |
| 165 | + | } | |
| 166 | + | return &ZwpPrimarySelectionOfferV1{r} | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | const ZwpPrimarySelectionOfferV1RequestReceive uint32 = 0 | |
| 170 | + | const ZwpPrimarySelectionOfferV1RequestDestroy uint32 = 1 | |
| 171 | + | const ZwpPrimarySelectionOfferV1EventOffer uint32 = 0 | |
| 172 | + | ||
| 173 | + | // ZwpPrimarySelectionOfferV1Handler handles zwp_primary_selection_offer_v1 requests. | |
| 174 | + | type ZwpPrimarySelectionOfferV1Handler interface { | |
| 175 | + | Receive(self *ZwpPrimarySelectionOfferV1, mimeType string, fd int) | |
| 176 | + | Destroy(self *ZwpPrimarySelectionOfferV1) | |
| 177 | + | } | |
| 178 | + | ||
| 179 | + | func NewZwpPrimarySelectionOfferV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionOfferV1Handler) (*ZwpPrimarySelectionOfferV1, error) { | |
| 180 | + | if h == nil { | |
| 181 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_offer_v1") | |
| 182 | + | } | |
| 183 | + | var self *ZwpPrimarySelectionOfferV1 | |
| 184 | + | r, err := c.CreateResource(ZwpPrimarySelectionOfferV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 185 | + | switch opcode { | |
| 186 | + | case 0: | |
| 187 | + | h.Receive(self, args[0].String(), args[1].Fd()) | |
| 188 | + | case 1: | |
| 189 | + | h.Destroy(self) | |
| 190 | + | self.Destroy() | |
| 191 | + | } | |
| 192 | + | }) | |
| 193 | + | if err != nil { | |
| 194 | + | return nil, err | |
| 195 | + | } | |
| 196 | + | self = WrapZwpPrimarySelectionOfferV1(r) | |
| 197 | + | r.Data = self | |
| 198 | + | return self, nil | |
| 199 | + | } | |
| 200 | + | ||
| 201 | + | // SendOffer advertise offered mime type. | |
| 202 | + | func (self *ZwpPrimarySelectionOfferV1) SendOffer(mimeType string) { | |
| 203 | + | var p runtime.Pinner | |
| 204 | + | defer p.Unpin() | |
| 205 | + | self.PostEvent(ZwpPrimarySelectionOfferV1EventOffer, server.String(&p, mimeType, false)) | |
| 206 | + | } | |
| 207 | + | func NewZwpPrimarySelectionOfferV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 208 | + | return d.CreateGlobal(ZwpPrimarySelectionOfferV1Interface, version, bind) | |
| 209 | + | } | |
| 210 | + | ||
| 211 | + | // ZwpPrimarySelectionSourceV1 offer to replace the contents of the primary selection. | |
| 212 | + | type ZwpPrimarySelectionSourceV1 struct{ *server.Resource } | |
| 213 | + | ||
| 214 | + | func WrapZwpPrimarySelectionSourceV1(r *server.Resource) *ZwpPrimarySelectionSourceV1 { | |
| 215 | + | if r == nil { | |
| 216 | + | return nil | |
| 217 | + | } | |
| 218 | + | return &ZwpPrimarySelectionSourceV1{r} | |
| 219 | + | } | |
| 220 | + | ||
| 221 | + | const ZwpPrimarySelectionSourceV1RequestOffer uint32 = 0 | |
| 222 | + | const ZwpPrimarySelectionSourceV1RequestDestroy uint32 = 1 | |
| 223 | + | const ZwpPrimarySelectionSourceV1EventSend uint32 = 0 | |
| 224 | + | const ZwpPrimarySelectionSourceV1EventCancelled uint32 = 1 | |
| 225 | + | ||
| 226 | + | // ZwpPrimarySelectionSourceV1Handler handles zwp_primary_selection_source_v1 requests. | |
| 227 | + | type ZwpPrimarySelectionSourceV1Handler interface { | |
| 228 | + | Offer(self *ZwpPrimarySelectionSourceV1, mimeType string) | |
| 229 | + | Destroy(self *ZwpPrimarySelectionSourceV1) | |
| 230 | + | } | |
| 231 | + | ||
| 232 | + | func NewZwpPrimarySelectionSourceV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionSourceV1Handler) (*ZwpPrimarySelectionSourceV1, error) { | |
| 233 | + | if h == nil { | |
| 234 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_source_v1") | |
| 235 | + | } | |
| 236 | + | var self *ZwpPrimarySelectionSourceV1 | |
| 237 | + | r, err := c.CreateResource(ZwpPrimarySelectionSourceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 238 | + | switch opcode { | |
| 239 | + | case 0: | |
| 240 | + | h.Offer(self, args[0].String()) | |
| 241 | + | case 1: | |
| 242 | + | h.Destroy(self) | |
| 243 | + | self.Destroy() | |
| 244 | + | } | |
| 245 | + | }) | |
| 246 | + | if err != nil { | |
| 247 | + | return nil, err | |
| 248 | + | } | |
| 249 | + | self = WrapZwpPrimarySelectionSourceV1(r) | |
| 250 | + | r.Data = self | |
| 251 | + | return self, nil | |
| 252 | + | } | |
| 253 | + | ||
| 254 | + | // SendSend send the primary selection contents. | |
| 255 | + | func (self *ZwpPrimarySelectionSourceV1) SendSend(mimeType string, fd int) { | |
| 256 | + | var p runtime.Pinner | |
| 257 | + | defer p.Unpin() | |
| 258 | + | self.PostEvent(ZwpPrimarySelectionSourceV1EventSend, server.String(&p, mimeType, false), server.Fd(fd)) | |
| 259 | + | } | |
| 260 | + | ||
| 261 | + | // SendCancelled request for primary selection contents was canceled. | |
| 262 | + | func (self *ZwpPrimarySelectionSourceV1) SendCancelled() { | |
| 263 | + | self.PostEvent(ZwpPrimarySelectionSourceV1EventCancelled) | |
| 264 | + | } | |
| 265 | + | func NewZwpPrimarySelectionSourceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 266 | + | return d.CreateGlobal(ZwpPrimarySelectionSourceV1Interface, version, bind) | |
| 267 | + | } | |
| 268 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |
| 269 | + | if v == nil { | |
| 270 | + | return nil | |
| 271 | + | } | |
| 272 | + | return v.GetResource() | |
| 273 | + | } | |
| 274 | + | func (self *ZwpPrimarySelectionDeviceManagerV1) GetResource() *server.Resource { | |
| 275 | + | if self == nil { | |
| 276 | + | return nil | |
| 277 | + | } | |
| 278 | + | return self.Resource | |
| 279 | + | } | |
| 280 | + | func (self *ZwpPrimarySelectionDeviceV1) GetResource() *server.Resource { | |
| 281 | + | if self == nil { | |
| 282 | + | return nil | |
| 283 | + | } | |
| 284 | + | return self.Resource | |
| 285 | + | } | |
| 286 | + | func (self *ZwpPrimarySelectionOfferV1) GetResource() *server.Resource { | |
| 287 | + | if self == nil { | |
| 288 | + | return nil | |
| 289 | + | } | |
| 290 | + | return self.Resource | |
| 291 | + | } | |
| 292 | + | func (self *ZwpPrimarySelectionSourceV1) GetResource() *server.Resource { | |
| 293 | + | if self == nil { | |
| 294 | + | return nil | |
| 295 | + | } | |
| 296 | + | return self.Resource | |
| 297 | + | } | |
| @@ -0,0 +1,297 @@ | |||||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |||
| 2 | + | package primaryselection | |||
| 3 | + | ||||
| 4 | + | import ( | |||
| 5 | + | "fmt" | |||
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |||
| 7 | + | "github.com/bnema/purego-libwayland/server" | |||
| 8 | + | "runtime" | |||
| 9 | + | ) | |||
| 10 | + | ||||
| 11 | + | var ZwpPrimarySelectionDeviceManagerV1Interface *server.Interface | |||
| 12 | + | var ZwpPrimarySelectionDeviceV1Interface *server.Interface | |||
| 13 | + | var ZwpPrimarySelectionOfferV1Interface *server.Interface | |||
| 14 | + | var ZwpPrimarySelectionSourceV1Interface *server.Interface | |||
| 15 | + | ||||
| 16 | + | func init() { | |||
| 17 | + | ZwpPrimarySelectionDeviceManagerV1Interface = &server.Interface{Name: "zwp_primary_selection_device_manager_v1", Version: 1} | |||
| 18 | + | ZwpPrimarySelectionDeviceV1Interface = &server.Interface{Name: "zwp_primary_selection_device_v1", Version: 1} | |||
| 19 | + | ZwpPrimarySelectionOfferV1Interface = &server.Interface{Name: "zwp_primary_selection_offer_v1", Version: 1} | |||
| 20 | + | ZwpPrimarySelectionSourceV1Interface = &server.Interface{Name: "zwp_primary_selection_source_v1", Version: 1} | |||
| 21 | + | ZwpPrimarySelectionDeviceManagerV1Interface.Requests = []server.Message{ | |||
| 22 | + | {Name: "create_source", Signature: "n", Types: []*server.Interface{ZwpPrimarySelectionSourceV1Interface}}, | |||
| 23 | + | {Name: "get_device", Signature: "no", Types: []*server.Interface{ZwpPrimarySelectionDeviceV1Interface, wayland.SeatInterface}}, | |||
| 24 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 25 | + | } | |||
| 26 | + | ZwpPrimarySelectionDeviceManagerV1Interface.Events = []server.Message{} | |||
| 27 | + | ZwpPrimarySelectionDeviceV1Interface.Requests = []server.Message{ | |||
| 28 | + | {Name: "set_selection", Signature: "?ou", Types: []*server.Interface{ZwpPrimarySelectionSourceV1Interface, nil}}, | |||
| 29 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 30 | + | } | |||
| 31 | + | ZwpPrimarySelectionDeviceV1Interface.Events = []server.Message{ | |||
| 32 | + | {Name: "data_offer", Signature: "n", Types: []*server.Interface{ZwpPrimarySelectionOfferV1Interface}}, | |||
| 33 | + | {Name: "selection", Signature: "?o", Types: []*server.Interface{ZwpPrimarySelectionOfferV1Interface}}, | |||
| 34 | + | } | |||
| 35 | + | ZwpPrimarySelectionOfferV1Interface.Requests = []server.Message{ | |||
| 36 | + | {Name: "receive", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |||
| 37 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 38 | + | } | |||
| 39 | + | ZwpPrimarySelectionOfferV1Interface.Events = []server.Message{ | |||
| 40 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |||
| 41 | + | } | |||
| 42 | + | ZwpPrimarySelectionSourceV1Interface.Requests = []server.Message{ | |||
| 43 | + | {Name: "offer", Signature: "s", Types: []*server.Interface{nil}}, | |||
| 44 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 45 | + | } | |||
| 46 | + | ZwpPrimarySelectionSourceV1Interface.Events = []server.Message{ | |||
| 47 | + | {Name: "send", Signature: "sh", Types: []*server.Interface{nil, nil}}, | |||
| 48 | + | {Name: "cancelled", Signature: "", Types: []*server.Interface{}}, | |||
| 49 | + | } | |||
| 50 | + | if err := server.NewInterfaces(ZwpPrimarySelectionDeviceManagerV1Interface, ZwpPrimarySelectionDeviceV1Interface, ZwpPrimarySelectionOfferV1Interface, ZwpPrimarySelectionSourceV1Interface); err != nil { | |||
| 51 | + | panic(err) | |||
| 52 | + | } | |||
| 53 | + | } | |||
| 54 | + | ||||
| 55 | + | // ZwpPrimarySelectionDeviceManagerV1 X primary selection emulation. | |||
| 56 | + | type ZwpPrimarySelectionDeviceManagerV1 struct{ *server.Resource } | |||
| 57 | + | ||||
| 58 | + | func WrapZwpPrimarySelectionDeviceManagerV1(r *server.Resource) *ZwpPrimarySelectionDeviceManagerV1 { | |||
| 59 | + | if r == nil { | |||
| 60 | + | return nil | |||
| 61 | + | } | |||
| 62 | + | return &ZwpPrimarySelectionDeviceManagerV1{r} | |||
| 63 | + | } | |||
| 64 | + | ||||
| 65 | + | const ZwpPrimarySelectionDeviceManagerV1RequestCreateSource uint32 = 0 | |||
| 66 | + | const ZwpPrimarySelectionDeviceManagerV1RequestGetDevice uint32 = 1 | |||
| 67 | + | const ZwpPrimarySelectionDeviceManagerV1RequestDestroy uint32 = 2 | |||
| 68 | + | ||||
| 69 | + | // ZwpPrimarySelectionDeviceManagerV1Handler handles zwp_primary_selection_device_manager_v1 requests. | |||
| 70 | + | type ZwpPrimarySelectionDeviceManagerV1Handler interface { | |||
| 71 | + | CreateSource(self *ZwpPrimarySelectionDeviceManagerV1, id uint32) | |||
| 72 | + | GetDevice(self *ZwpPrimarySelectionDeviceManagerV1, id uint32, seat *wayland.Seat) | |||
| 73 | + | Destroy(self *ZwpPrimarySelectionDeviceManagerV1) | |||
| 74 | + | } | |||
| 75 | + | ||||
| 76 | + | func NewZwpPrimarySelectionDeviceManagerV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionDeviceManagerV1Handler) (*ZwpPrimarySelectionDeviceManagerV1, error) { | |||
| 77 | + | if h == nil { | |||
| 78 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_device_manager_v1") | |||
| 79 | + | } | |||
| 80 | + | var self *ZwpPrimarySelectionDeviceManagerV1 | |||
| 81 | + | r, err := c.CreateResource(ZwpPrimarySelectionDeviceManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 82 | + | switch opcode { | |||
| 83 | + | case 0: | |||
| 84 | + | h.CreateSource(self, args[0].NewID()) | |||
| 85 | + | case 1: | |||
| 86 | + | h.GetDevice(self, args[0].NewID(), wayland.WrapSeat(args[1].Resource())) | |||
| 87 | + | case 2: | |||
| 88 | + | h.Destroy(self) | |||
| 89 | + | self.Destroy() | |||
| 90 | + | } | |||
| 91 | + | }) | |||
| 92 | + | if err != nil { | |||
| 93 | + | return nil, err | |||
| 94 | + | } | |||
| 95 | + | self = WrapZwpPrimarySelectionDeviceManagerV1(r) | |||
| 96 | + | r.Data = self | |||
| 97 | + | return self, nil | |||
| 98 | + | } | |||
| 99 | + | func NewZwpPrimarySelectionDeviceManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 100 | + | return d.CreateGlobal(ZwpPrimarySelectionDeviceManagerV1Interface, version, bind) | |||
| 101 | + | } | |||
| 102 | + | ||||
| 103 | + | // ZwpPrimarySelectionDeviceV1 . | |||
| 104 | + | type ZwpPrimarySelectionDeviceV1 struct{ *server.Resource } | |||
| 105 | + | ||||
| 106 | + | func WrapZwpPrimarySelectionDeviceV1(r *server.Resource) *ZwpPrimarySelectionDeviceV1 { | |||
| 107 | + | if r == nil { | |||
| 108 | + | return nil | |||
| 109 | + | } | |||
| 110 | + | return &ZwpPrimarySelectionDeviceV1{r} | |||
| 111 | + | } | |||
| 112 | + | ||||
| 113 | + | const ZwpPrimarySelectionDeviceV1RequestSetSelection uint32 = 0 | |||
| 114 | + | const ZwpPrimarySelectionDeviceV1RequestDestroy uint32 = 1 | |||
| 115 | + | const ZwpPrimarySelectionDeviceV1EventDataOffer uint32 = 0 | |||
| 116 | + | const ZwpPrimarySelectionDeviceV1EventSelection uint32 = 1 | |||
| 117 | + | ||||
| 118 | + | // ZwpPrimarySelectionDeviceV1Handler handles zwp_primary_selection_device_v1 requests. | |||
| 119 | + | type ZwpPrimarySelectionDeviceV1Handler interface { | |||
| 120 | + | SetSelection(self *ZwpPrimarySelectionDeviceV1, source *ZwpPrimarySelectionSourceV1, serial uint32) | |||
| 121 | + | Destroy(self *ZwpPrimarySelectionDeviceV1) | |||
| 122 | + | } | |||
| 123 | + | ||||
| 124 | + | func NewZwpPrimarySelectionDeviceV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionDeviceV1Handler) (*ZwpPrimarySelectionDeviceV1, error) { | |||
| 125 | + | if h == nil { | |||
| 126 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_device_v1") | |||
| 127 | + | } | |||
| 128 | + | var self *ZwpPrimarySelectionDeviceV1 | |||
| 129 | + | r, err := c.CreateResource(ZwpPrimarySelectionDeviceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 130 | + | switch opcode { | |||
| 131 | + | case 0: | |||
| 132 | + | h.SetSelection(self, WrapZwpPrimarySelectionSourceV1(args[0].Resource()), args[1].Uint()) | |||
| 133 | + | case 1: | |||
| 134 | + | h.Destroy(self) | |||
| 135 | + | self.Destroy() | |||
| 136 | + | } | |||
| 137 | + | }) | |||
| 138 | + | if err != nil { | |||
| 139 | + | return nil, err | |||
| 140 | + | } | |||
| 141 | + | self = WrapZwpPrimarySelectionDeviceV1(r) | |||
| 142 | + | r.Data = self | |||
| 143 | + | return self, nil | |||
| 144 | + | } | |||
| 145 | + | ||||
| 146 | + | // SendDataOffer introduce a new wp_primary_selection_offer. | |||
| 147 | + | func (self *ZwpPrimarySelectionDeviceV1) SendDataOffer(offer *ZwpPrimarySelectionOfferV1) { | |||
| 148 | + | self.PostEvent(ZwpPrimarySelectionDeviceV1EventDataOffer, server.NewID(resourceOf(offer))) | |||
| 149 | + | } | |||
| 150 | + | ||||
| 151 | + | // SendSelection advertise a new primary selection. | |||
| 152 | + | func (self *ZwpPrimarySelectionDeviceV1) SendSelection(id *ZwpPrimarySelectionOfferV1) { | |||
| 153 | + | self.PostEvent(ZwpPrimarySelectionDeviceV1EventSelection, server.Object(resourceOf(id))) | |||
| 154 | + | } | |||
| 155 | + | func NewZwpPrimarySelectionDeviceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 156 | + | return d.CreateGlobal(ZwpPrimarySelectionDeviceV1Interface, version, bind) | |||
| 157 | + | } | |||
| 158 | + | ||||
| 159 | + | // ZwpPrimarySelectionOfferV1 offer to transfer primary selection contents. | |||
| 160 | + | type ZwpPrimarySelectionOfferV1 struct{ *server.Resource } | |||
| 161 | + | ||||
| 162 | + | func WrapZwpPrimarySelectionOfferV1(r *server.Resource) *ZwpPrimarySelectionOfferV1 { | |||
| 163 | + | if r == nil { | |||
| 164 | + | return nil | |||
| 165 | + | } | |||
| 166 | + | return &ZwpPrimarySelectionOfferV1{r} | |||
| 167 | + | } | |||
| 168 | + | ||||
| 169 | + | const ZwpPrimarySelectionOfferV1RequestReceive uint32 = 0 | |||
| 170 | + | const ZwpPrimarySelectionOfferV1RequestDestroy uint32 = 1 | |||
| 171 | + | const ZwpPrimarySelectionOfferV1EventOffer uint32 = 0 | |||
| 172 | + | ||||
| 173 | + | // ZwpPrimarySelectionOfferV1Handler handles zwp_primary_selection_offer_v1 requests. | |||
| 174 | + | type ZwpPrimarySelectionOfferV1Handler interface { | |||
| 175 | + | Receive(self *ZwpPrimarySelectionOfferV1, mimeType string, fd int) | |||
| 176 | + | Destroy(self *ZwpPrimarySelectionOfferV1) | |||
| 177 | + | } | |||
| 178 | + | ||||
| 179 | + | func NewZwpPrimarySelectionOfferV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionOfferV1Handler) (*ZwpPrimarySelectionOfferV1, error) { | |||
| 180 | + | if h == nil { | |||
| 181 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_offer_v1") | |||
| 182 | + | } | |||
| 183 | + | var self *ZwpPrimarySelectionOfferV1 | |||
| 184 | + | r, err := c.CreateResource(ZwpPrimarySelectionOfferV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 185 | + | switch opcode { | |||
| 186 | + | case 0: | |||
| 187 | + | h.Receive(self, args[0].String(), args[1].Fd()) | |||
| 188 | + | case 1: | |||
| 189 | + | h.Destroy(self) | |||
| 190 | + | self.Destroy() | |||
| 191 | + | } | |||
| 192 | + | }) | |||
| 193 | + | if err != nil { | |||
| 194 | + | return nil, err | |||
| 195 | + | } | |||
| 196 | + | self = WrapZwpPrimarySelectionOfferV1(r) | |||
| 197 | + | r.Data = self | |||
| 198 | + | return self, nil | |||
| 199 | + | } | |||
| 200 | + | ||||
| 201 | + | // SendOffer advertise offered mime type. | |||
| 202 | + | func (self *ZwpPrimarySelectionOfferV1) SendOffer(mimeType string) { | |||
| 203 | + | var p runtime.Pinner | |||
| 204 | + | defer p.Unpin() | |||
| 205 | + | self.PostEvent(ZwpPrimarySelectionOfferV1EventOffer, server.String(&p, mimeType, false)) | |||
| 206 | + | } | |||
| 207 | + | func NewZwpPrimarySelectionOfferV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 208 | + | return d.CreateGlobal(ZwpPrimarySelectionOfferV1Interface, version, bind) | |||
| 209 | + | } | |||
| 210 | + | ||||
| 211 | + | // ZwpPrimarySelectionSourceV1 offer to replace the contents of the primary selection. | |||
| 212 | + | type ZwpPrimarySelectionSourceV1 struct{ *server.Resource } | |||
| 213 | + | ||||
| 214 | + | func WrapZwpPrimarySelectionSourceV1(r *server.Resource) *ZwpPrimarySelectionSourceV1 { | |||
| 215 | + | if r == nil { | |||
| 216 | + | return nil | |||
| 217 | + | } | |||
| 218 | + | return &ZwpPrimarySelectionSourceV1{r} | |||
| 219 | + | } | |||
| 220 | + | ||||
| 221 | + | const ZwpPrimarySelectionSourceV1RequestOffer uint32 = 0 | |||
| 222 | + | const ZwpPrimarySelectionSourceV1RequestDestroy uint32 = 1 | |||
| 223 | + | const ZwpPrimarySelectionSourceV1EventSend uint32 = 0 | |||
| 224 | + | const ZwpPrimarySelectionSourceV1EventCancelled uint32 = 1 | |||
| 225 | + | ||||
| 226 | + | // ZwpPrimarySelectionSourceV1Handler handles zwp_primary_selection_source_v1 requests. | |||
| 227 | + | type ZwpPrimarySelectionSourceV1Handler interface { | |||
| 228 | + | Offer(self *ZwpPrimarySelectionSourceV1, mimeType string) | |||
| 229 | + | Destroy(self *ZwpPrimarySelectionSourceV1) | |||
| 230 | + | } | |||
| 231 | + | ||||
| 232 | + | func NewZwpPrimarySelectionSourceV1(c server.Client, version int32, id uint32, h ZwpPrimarySelectionSourceV1Handler) (*ZwpPrimarySelectionSourceV1, error) { | |||
| 233 | + | if h == nil { | |||
| 234 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_primary_selection_source_v1") | |||
| 235 | + | } | |||
| 236 | + | var self *ZwpPrimarySelectionSourceV1 | |||
| 237 | + | r, err := c.CreateResource(ZwpPrimarySelectionSourceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 238 | + | switch opcode { | |||
| 239 | + | case 0: | |||
| 240 | + | h.Offer(self, args[0].String()) | |||
| 241 | + | case 1: | |||
| 242 | + | h.Destroy(self) | |||
| 243 | + | self.Destroy() | |||
| 244 | + | } | |||
| 245 | + | }) | |||
| 246 | + | if err != nil { | |||
| 247 | + | return nil, err | |||
| 248 | + | } | |||
| 249 | + | self = WrapZwpPrimarySelectionSourceV1(r) | |||
| 250 | + | r.Data = self | |||
| 251 | + | return self, nil | |||
| 252 | + | } | |||
| 253 | + | ||||
| 254 | + | // SendSend send the primary selection contents. | |||
| 255 | + | func (self *ZwpPrimarySelectionSourceV1) SendSend(mimeType string, fd int) { | |||
| 256 | + | var p runtime.Pinner | |||
| 257 | + | defer p.Unpin() | |||
| 258 | + | self.PostEvent(ZwpPrimarySelectionSourceV1EventSend, server.String(&p, mimeType, false), server.Fd(fd)) | |||
| 259 | + | } | |||
| 260 | + | ||||
| 261 | + | // SendCancelled request for primary selection contents was canceled. | |||
| 262 | + | func (self *ZwpPrimarySelectionSourceV1) SendCancelled() { | |||
| 263 | + | self.PostEvent(ZwpPrimarySelectionSourceV1EventCancelled) | |||
| 264 | + | } | |||
| 265 | + | func NewZwpPrimarySelectionSourceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 266 | + | return d.CreateGlobal(ZwpPrimarySelectionSourceV1Interface, version, bind) | |||
| 267 | + | } | |||
| 268 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |||
| 269 | + | if v == nil { | |||
| 270 | + | return nil | |||
| 271 | + | } | |||
| 272 | + | return v.GetResource() | |||
| 273 | + | } | |||
| 274 | + | func (self *ZwpPrimarySelectionDeviceManagerV1) GetResource() *server.Resource { | |||
| 275 | + | if self == nil { | |||
| 276 | + | return nil | |||
| 277 | + | } | |||
| 278 | + | return self.Resource | |||
| 279 | + | } | |||
| 280 | + | func (self *ZwpPrimarySelectionDeviceV1) GetResource() *server.Resource { | |||
| 281 | + | if self == nil { | |||
| 282 | + | return nil | |||
| 283 | + | } | |||
| 284 | + | return self.Resource | |||
| 285 | + | } | |||
| 286 | + | func (self *ZwpPrimarySelectionOfferV1) GetResource() *server.Resource { | |||
| 287 | + | if self == nil { | |||
| 288 | + | return nil | |||
| 289 | + | } | |||
| 290 | + | return self.Resource | |||
| 291 | + | } | |||
| 292 | + | func (self *ZwpPrimarySelectionSourceV1) GetResource() *server.Resource { | |||
| 293 | + | if self == nil { | |||
| 294 | + | return nil | |||
| 295 | + | } | |||
| 296 | + | return self.Resource | |||
| 297 | + | } | |||
A protocols/ext-data-control-v1.xml +276 -0
| @@ -0,0 +1,276 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <protocol name="ext_data_control_v1"> | |
| 3 | + | <copyright> | |
| 4 | + | Copyright © 2018 Simon Ser | |
| 5 | + | Copyright © 2019 Ivan Molodetskikh | |
| 6 | + | Copyright © 2024 Neal Gompa | |
| 7 | + | ||
| 8 | + | Permission to use, copy, modify, distribute, and sell this | |
| 9 | + | software and its documentation for any purpose is hereby granted | |
| 10 | + | without fee, provided that the above copyright notice appear in | |
| 11 | + | all copies and that both that copyright notice and this permission | |
| 12 | + | notice appear in supporting documentation, and that the name of | |
| 13 | + | the copyright holders not be used in advertising or publicity | |
| 14 | + | pertaining to distribution of the software without specific, | |
| 15 | + | written prior permission. The copyright holders make no | |
| 16 | + | representations about the suitability of this software for any | |
| 17 | + | purpose. It is provided "as is" without express or implied | |
| 18 | + | warranty. | |
| 19 | + | ||
| 20 | + | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | |
| 21 | + | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 22 | + | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 23 | + | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 24 | + | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |
| 25 | + | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
| 26 | + | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | |
| 27 | + | THIS SOFTWARE. | |
| 28 | + | </copyright> | |
| 29 | + | ||
| 30 | + | <description summary="control data devices"> | |
| 31 | + | This protocol allows a privileged client to control data devices. In | |
| 32 | + | particular, the client will be able to manage the current selection and take | |
| 33 | + | the role of a clipboard manager. | |
| 34 | + | ||
| 35 | + | Warning! The protocol described in this file is currently in the testing | |
| 36 | + | phase. Backward compatible changes may be added together with the | |
| 37 | + | corresponding interface version bump. Backward incompatible changes can | |
| 38 | + | only be done by creating a new major version of the extension. | |
| 39 | + | </description> | |
| 40 | + | ||
| 41 | + | <interface name="ext_data_control_manager_v1" version="1"> | |
| 42 | + | <description summary="manager to control data devices"> | |
| 43 | + | This interface is a manager that allows creating per-seat data device | |
| 44 | + | controls. | |
| 45 | + | </description> | |
| 46 | + | ||
| 47 | + | <request name="create_data_source"> | |
| 48 | + | <description summary="create a new data source"> | |
| 49 | + | Create a new data source. | |
| 50 | + | </description> | |
| 51 | + | <arg name="id" type="new_id" interface="ext_data_control_source_v1" | |
| 52 | + | summary="data source to create"/> | |
| 53 | + | </request> | |
| 54 | + | ||
| 55 | + | <request name="get_data_device"> | |
| 56 | + | <description summary="get a data device for a seat"> | |
| 57 | + | Create a data device that can be used to manage a seat's selection. | |
| 58 | + | </description> | |
| 59 | + | <arg name="id" type="new_id" interface="ext_data_control_device_v1"/> | |
| 60 | + | <arg name="seat" type="object" interface="wl_seat"/> | |
| 61 | + | </request> | |
| 62 | + | ||
| 63 | + | <request name="destroy" type="destructor"> | |
| 64 | + | <description summary="destroy the manager"> | |
| 65 | + | All objects created by the manager will still remain valid, until their | |
| 66 | + | appropriate destroy request has been called. | |
| 67 | + | </description> | |
| 68 | + | </request> | |
| 69 | + | </interface> | |
| 70 | + | ||
| 71 | + | <interface name="ext_data_control_device_v1" version="1"> | |
| 72 | + | <description summary="manage a data device for a seat"> | |
| 73 | + | This interface allows a client to manage a seat's selection. | |
| 74 | + | ||
| 75 | + | When the seat is destroyed, this object becomes inert. | |
| 76 | + | </description> | |
| 77 | + | ||
| 78 | + | <request name="set_selection"> | |
| 79 | + | <description summary="copy data to the selection"> | |
| 80 | + | This request asks the compositor to set the selection to the data from | |
| 81 | + | the source on behalf of the client. | |
| 82 | + | ||
| 83 | + | The given source may not be used in any further set_selection or | |
| 84 | + | set_primary_selection requests. Attempting to use a previously used | |
| 85 | + | source triggers the used_source protocol error. | |
| 86 | + | ||
| 87 | + | To unset the selection, set the source to NULL. | |
| 88 | + | </description> | |
| 89 | + | <arg name="source" type="object" interface="ext_data_control_source_v1" | |
| 90 | + | allow-null="true"/> | |
| 91 | + | </request> | |
| 92 | + | ||
| 93 | + | <request name="destroy" type="destructor"> | |
| 94 | + | <description summary="destroy this data device"> | |
| 95 | + | Destroys the data device object. | |
| 96 | + | </description> | |
| 97 | + | </request> | |
| 98 | + | ||
| 99 | + | <event name="data_offer"> | |
| 100 | + | <description summary="introduce a new ext_data_control_offer"> | |
| 101 | + | The data_offer event introduces a new ext_data_control_offer object, | |
| 102 | + | which will subsequently be used in either the | |
| 103 | + | ext_data_control_device.selection event (for the regular clipboard | |
| 104 | + | selections) or the ext_data_control_device.primary_selection event (for | |
| 105 | + | the primary clipboard selections). Immediately following the | |
| 106 | + | ext_data_control_device.data_offer event, the new data_offer object | |
| 107 | + | will send out ext_data_control_offer.offer events to describe the MIME | |
| 108 | + | types it offers. | |
| 109 | + | </description> | |
| 110 | + | <arg name="id" type="new_id" interface="ext_data_control_offer_v1"/> | |
| 111 | + | </event> | |
| 112 | + | ||
| 113 | + | <event name="selection"> | |
| 114 | + | <description summary="advertise new selection"> | |
| 115 | + | The selection event is sent out to notify the client of a new | |
| 116 | + | ext_data_control_offer for the selection for this device. The | |
| 117 | + | ext_data_control_device.data_offer and the ext_data_control_offer.offer | |
| 118 | + | events are sent out immediately before this event to introduce the data | |
| 119 | + | offer object. The selection event is sent to a client when a new | |
| 120 | + | selection is set. The ext_data_control_offer is valid until a new | |
| 121 | + | ext_data_control_offer or NULL is received. The client must destroy the | |
| 122 | + | previous selection ext_data_control_offer, if any, upon receiving this | |
| 123 | + | event. Regardless, the previous selection will be ignored once a new | |
| 124 | + | selection ext_data_control_offer is received. | |
| 125 | + | ||
| 126 | + | The first selection event is sent upon binding the | |
| 127 | + | ext_data_control_device object. | |
| 128 | + | </description> | |
| 129 | + | <arg name="id" type="object" interface="ext_data_control_offer_v1" | |
| 130 | + | allow-null="true"/> | |
| 131 | + | </event> | |
| 132 | + | ||
| 133 | + | <event name="finished"> | |
| 134 | + | <description summary="this data control is no longer valid"> | |
| 135 | + | This data control object is no longer valid and should be destroyed by | |
| 136 | + | the client. | |
| 137 | + | </description> | |
| 138 | + | </event> | |
| 139 | + | ||
| 140 | + | <event name="primary_selection"> | |
| 141 | + | <description summary="advertise new primary selection"> | |
| 142 | + | The primary_selection event is sent out to notify the client of a new | |
| 143 | + | ext_data_control_offer for the primary selection for this device. The | |
| 144 | + | ext_data_control_device.data_offer and the ext_data_control_offer.offer | |
| 145 | + | events are sent out immediately before this event to introduce the data | |
| 146 | + | offer object. The primary_selection event is sent to a client when a | |
| 147 | + | new primary selection is set. The ext_data_control_offer is valid until | |
| 148 | + | a new ext_data_control_offer or NULL is received. The client must | |
| 149 | + | destroy the previous primary selection ext_data_control_offer, if any, | |
| 150 | + | upon receiving this event. Regardless, the previous primary selection | |
| 151 | + | will be ignored once a new primary selection ext_data_control_offer is | |
| 152 | + | received. | |
| 153 | + | ||
| 154 | + | If the compositor supports primary selection, the first | |
| 155 | + | primary_selection event is sent upon binding the | |
| 156 | + | ext_data_control_device object. | |
| 157 | + | </description> | |
| 158 | + | <arg name="id" type="object" interface="ext_data_control_offer_v1" | |
| 159 | + | allow-null="true"/> | |
| 160 | + | </event> | |
| 161 | + | ||
| 162 | + | <request name="set_primary_selection"> | |
| 163 | + | <description summary="copy data to the primary selection"> | |
| 164 | + | This request asks the compositor to set the primary selection to the | |
| 165 | + | data from the source on behalf of the client. | |
| 166 | + | ||
| 167 | + | The given source may not be used in any further set_selection or | |
| 168 | + | set_primary_selection requests. Attempting to use a previously used | |
| 169 | + | source triggers the used_source protocol error. | |
| 170 | + | ||
| 171 | + | To unset the primary selection, set the source to NULL. | |
| 172 | + | ||
| 173 | + | The compositor will ignore this request if it does not support primary | |
| 174 | + | selection. | |
| 175 | + | </description> | |
| 176 | + | <arg name="source" type="object" interface="ext_data_control_source_v1" | |
| 177 | + | allow-null="true"/> | |
| 178 | + | </request> | |
| 179 | + | ||
| 180 | + | <enum name="error"> | |
| 181 | + | <entry name="used_source" value="1" | |
| 182 | + | summary="source given to set_selection or set_primary_selection was already used before"/> | |
| 183 | + | </enum> | |
| 184 | + | </interface> | |
| 185 | + | ||
| 186 | + | <interface name="ext_data_control_source_v1" version="1"> | |
| 187 | + | <description summary="offer to transfer data"> | |
| 188 | + | The ext_data_control_source object is the source side of a | |
| 189 | + | ext_data_control_offer. It is created by the source client in a data | |
| 190 | + | transfer and provides a way to describe the offered data and a way to | |
| 191 | + | respond to requests to transfer the data. | |
| 192 | + | </description> | |
| 193 | + | ||
| 194 | + | <enum name="error"> | |
| 195 | + | <entry name="invalid_offer" value="1" | |
| 196 | + | summary="offer sent after ext_data_control_device.set_selection"/> | |
| 197 | + | </enum> | |
| 198 | + | ||
| 199 | + | <request name="offer"> | |
| 200 | + | <description summary="add an offered MIME type"> | |
| 201 | + | This request adds a MIME type to the set of MIME types advertised to | |
| 202 | + | targets. Can be called several times to offer multiple types. | |
| 203 | + | ||
| 204 | + | Calling this after ext_data_control_device.set_selection is a protocol | |
| 205 | + | error. | |
| 206 | + | </description> | |
| 207 | + | <arg name="mime_type" type="string" | |
| 208 | + | summary="MIME type offered by the data source"/> | |
| 209 | + | </request> | |
| 210 | + | ||
| 211 | + | <request name="destroy" type="destructor"> | |
| 212 | + | <description summary="destroy this source"> | |
| 213 | + | Destroys the data source object. | |
| 214 | + | </description> | |
| 215 | + | </request> | |
| 216 | + | ||
| 217 | + | <event name="send"> | |
| 218 | + | <description summary="send the data"> | |
| 219 | + | Request for data from the client. Send the data as the specified MIME | |
| 220 | + | type over the passed file descriptor, then close it. | |
| 221 | + | </description> | |
| 222 | + | <arg name="mime_type" type="string" summary="MIME type for the data"/> | |
| 223 | + | <arg name="fd" type="fd" summary="file descriptor for the data"/> | |
| 224 | + | </event> | |
| 225 | + | ||
| 226 | + | <event name="cancelled"> | |
| 227 | + | <description summary="selection was cancelled"> | |
| 228 | + | This data source is no longer valid. The data source has been replaced | |
| 229 | + | by another data source. | |
| 230 | + | ||
| 231 | + | The client should clean up and destroy this data source. | |
| 232 | + | </description> | |
| 233 | + | </event> | |
| 234 | + | </interface> | |
| 235 | + | ||
| 236 | + | <interface name="ext_data_control_offer_v1" version="1"> | |
| 237 | + | <description summary="offer to transfer data"> | |
| 238 | + | A ext_data_control_offer represents a piece of data offered for transfer | |
| 239 | + | by another client (the source client). The offer describes the different | |
| 240 | + | MIME types that the data can be converted to and provides the mechanism | |
| 241 | + | for transferring the data directly from the source client. | |
| 242 | + | </description> | |
| 243 | + | ||
| 244 | + | <request name="receive"> | |
| 245 | + | <description summary="request that the data is transferred"> | |
| 246 | + | To transfer the offered data, the client issues this request and | |
| 247 | + | indicates the MIME type it wants to receive. The transfer happens | |
| 248 | + | through the passed file descriptor (typically created with the pipe | |
| 249 | + | system call). The source client writes the data in the MIME type | |
| 250 | + | representation requested and then closes the file descriptor. | |
| 251 | + | ||
| 252 | + | The receiving client reads from the read end of the pipe until EOF and | |
| 253 | + | then closes its end, at which point the transfer is complete. | |
| 254 | + | ||
| 255 | + | This request may happen multiple times for different MIME types. | |
| 256 | + | </description> | |
| 257 | + | <arg name="mime_type" type="string" | |
| 258 | + | summary="MIME type desired by receiver"/> | |
| 259 | + | <arg name="fd" type="fd" summary="file descriptor for data transfer"/> | |
| 260 | + | </request> | |
| 261 | + | ||
| 262 | + | <request name="destroy" type="destructor"> | |
| 263 | + | <description summary="destroy this offer"> | |
| 264 | + | Destroys the data offer object. | |
| 265 | + | </description> | |
| 266 | + | </request> | |
| 267 | + | ||
| 268 | + | <event name="offer"> | |
| 269 | + | <description summary="advertise offered MIME type"> | |
| 270 | + | Sent immediately after creating the ext_data_control_offer object. | |
| 271 | + | One event per offered MIME type. | |
| 272 | + | </description> | |
| 273 | + | <arg name="mime_type" type="string" summary="offered MIME type"/> | |
| 274 | + | </event> | |
| 275 | + | </interface> | |
| 276 | + | </protocol> | |
| @@ -0,0 +1,276 @@ | |||||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |||
| 2 | + | <protocol name="ext_data_control_v1"> | |||
| 3 | + | <copyright> | |||
| 4 | + | Copyright © 2018 Simon Ser | |||
| 5 | + | Copyright © 2019 Ivan Molodetskikh | |||
| 6 | + | Copyright © 2024 Neal Gompa | |||
| 7 | + | ||||
| 8 | + | Permission to use, copy, modify, distribute, and sell this | |||
| 9 | + | software and its documentation for any purpose is hereby granted | |||
| 10 | + | without fee, provided that the above copyright notice appear in | |||
| 11 | + | all copies and that both that copyright notice and this permission | |||
| 12 | + | notice appear in supporting documentation, and that the name of | |||
| 13 | + | the copyright holders not be used in advertising or publicity | |||
| 14 | + | pertaining to distribution of the software without specific, | |||
| 15 | + | written prior permission. The copyright holders make no | |||
| 16 | + | representations about the suitability of this software for any | |||
| 17 | + | purpose. It is provided "as is" without express or implied | |||
| 18 | + | warranty. | |||
| 19 | + | ||||
| 20 | + | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | |||
| 21 | + | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
| 22 | + | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | |||
| 23 | + | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |||
| 24 | + | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |||
| 25 | + | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |||
| 26 | + | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | |||
| 27 | + | THIS SOFTWARE. | |||
| 28 | + | </copyright> | |||
| 29 | + | ||||
| 30 | + | <description summary="control data devices"> | |||
| 31 | + | This protocol allows a privileged client to control data devices. In | |||
| 32 | + | particular, the client will be able to manage the current selection and take | |||
| 33 | + | the role of a clipboard manager. | |||
| 34 | + | ||||
| 35 | + | Warning! The protocol described in this file is currently in the testing | |||
| 36 | + | phase. Backward compatible changes may be added together with the | |||
| 37 | + | corresponding interface version bump. Backward incompatible changes can | |||
| 38 | + | only be done by creating a new major version of the extension. | |||
| 39 | + | </description> | |||
| 40 | + | ||||
| 41 | + | <interface name="ext_data_control_manager_v1" version="1"> | |||
| 42 | + | <description summary="manager to control data devices"> | |||
| 43 | + | This interface is a manager that allows creating per-seat data device | |||
| 44 | + | controls. | |||
| 45 | + | </description> | |||
| 46 | + | ||||
| 47 | + | <request name="create_data_source"> | |||
| 48 | + | <description summary="create a new data source"> | |||
| 49 | + | Create a new data source. | |||
| 50 | + | </description> | |||
| 51 | + | <arg name="id" type="new_id" interface="ext_data_control_source_v1" | |||
| 52 | + | summary="data source to create"/> | |||
| 53 | + | </request> | |||
| 54 | + | ||||
| 55 | + | <request name="get_data_device"> | |||
| 56 | + | <description summary="get a data device for a seat"> | |||
| 57 | + | Create a data device that can be used to manage a seat's selection. | |||
| 58 | + | </description> | |||
| 59 | + | <arg name="id" type="new_id" interface="ext_data_control_device_v1"/> | |||
| 60 | + | <arg name="seat" type="object" interface="wl_seat"/> | |||
| 61 | + | </request> | |||
| 62 | + | ||||
| 63 | + | <request name="destroy" type="destructor"> | |||
| 64 | + | <description summary="destroy the manager"> | |||
| 65 | + | All objects created by the manager will still remain valid, until their | |||
| 66 | + | appropriate destroy request has been called. | |||
| 67 | + | </description> | |||
| 68 | + | </request> | |||
| 69 | + | </interface> | |||
| 70 | + | ||||
| 71 | + | <interface name="ext_data_control_device_v1" version="1"> | |||
| 72 | + | <description summary="manage a data device for a seat"> | |||
| 73 | + | This interface allows a client to manage a seat's selection. | |||
| 74 | + | ||||
| 75 | + | When the seat is destroyed, this object becomes inert. | |||
| 76 | + | </description> | |||
| 77 | + | ||||
| 78 | + | <request name="set_selection"> | |||
| 79 | + | <description summary="copy data to the selection"> | |||
| 80 | + | This request asks the compositor to set the selection to the data from | |||
| 81 | + | the source on behalf of the client. | |||
| 82 | + | ||||
| 83 | + | The given source may not be used in any further set_selection or | |||
| 84 | + | set_primary_selection requests. Attempting to use a previously used | |||
| 85 | + | source triggers the used_source protocol error. | |||
| 86 | + | ||||
| 87 | + | To unset the selection, set the source to NULL. | |||
| 88 | + | </description> | |||
| 89 | + | <arg name="source" type="object" interface="ext_data_control_source_v1" | |||
| 90 | + | allow-null="true"/> | |||
| 91 | + | </request> | |||
| 92 | + | ||||
| 93 | + | <request name="destroy" type="destructor"> | |||
| 94 | + | <description summary="destroy this data device"> | |||
| 95 | + | Destroys the data device object. | |||
| 96 | + | </description> | |||
| 97 | + | </request> | |||
| 98 | + | ||||
| 99 | + | <event name="data_offer"> | |||
| 100 | + | <description summary="introduce a new ext_data_control_offer"> | |||
| 101 | + | The data_offer event introduces a new ext_data_control_offer object, | |||
| 102 | + | which will subsequently be used in either the | |||
| 103 | + | ext_data_control_device.selection event (for the regular clipboard | |||
| 104 | + | selections) or the ext_data_control_device.primary_selection event (for | |||
| 105 | + | the primary clipboard selections). Immediately following the | |||
| 106 | + | ext_data_control_device.data_offer event, the new data_offer object | |||
| 107 | + | will send out ext_data_control_offer.offer events to describe the MIME | |||
| 108 | + | types it offers. | |||
| 109 | + | </description> | |||
| 110 | + | <arg name="id" type="new_id" interface="ext_data_control_offer_v1"/> | |||
| 111 | + | </event> | |||
| 112 | + | ||||
| 113 | + | <event name="selection"> | |||
| 114 | + | <description summary="advertise new selection"> | |||
| 115 | + | The selection event is sent out to notify the client of a new | |||
| 116 | + | ext_data_control_offer for the selection for this device. The | |||
| 117 | + | ext_data_control_device.data_offer and the ext_data_control_offer.offer | |||
| 118 | + | events are sent out immediately before this event to introduce the data | |||
| 119 | + | offer object. The selection event is sent to a client when a new | |||
| 120 | + | selection is set. The ext_data_control_offer is valid until a new | |||
| 121 | + | ext_data_control_offer or NULL is received. The client must destroy the | |||
| 122 | + | previous selection ext_data_control_offer, if any, upon receiving this | |||
| 123 | + | event. Regardless, the previous selection will be ignored once a new | |||
| 124 | + | selection ext_data_control_offer is received. | |||
| 125 | + | ||||
| 126 | + | The first selection event is sent upon binding the | |||
| 127 | + | ext_data_control_device object. | |||
| 128 | + | </description> | |||
| 129 | + | <arg name="id" type="object" interface="ext_data_control_offer_v1" | |||
| 130 | + | allow-null="true"/> | |||
| 131 | + | </event> | |||
| 132 | + | ||||
| 133 | + | <event name="finished"> | |||
| 134 | + | <description summary="this data control is no longer valid"> | |||
| 135 | + | This data control object is no longer valid and should be destroyed by | |||
| 136 | + | the client. | |||
| 137 | + | </description> | |||
| 138 | + | </event> | |||
| 139 | + | ||||
| 140 | + | <event name="primary_selection"> | |||
| 141 | + | <description summary="advertise new primary selection"> | |||
| 142 | + | The primary_selection event is sent out to notify the client of a new | |||
| 143 | + | ext_data_control_offer for the primary selection for this device. The | |||
| 144 | + | ext_data_control_device.data_offer and the ext_data_control_offer.offer | |||
| 145 | + | events are sent out immediately before this event to introduce the data | |||
| 146 | + | offer object. The primary_selection event is sent to a client when a | |||
| 147 | + | new primary selection is set. The ext_data_control_offer is valid until | |||
| 148 | + | a new ext_data_control_offer or NULL is received. The client must | |||
| 149 | + | destroy the previous primary selection ext_data_control_offer, if any, | |||
| 150 | + | upon receiving this event. Regardless, the previous primary selection | |||
| 151 | + | will be ignored once a new primary selection ext_data_control_offer is | |||
| 152 | + | received. | |||
| 153 | + | ||||
| 154 | + | If the compositor supports primary selection, the first | |||
| 155 | + | primary_selection event is sent upon binding the | |||
| 156 | + | ext_data_control_device object. | |||
| 157 | + | </description> | |||
| 158 | + | <arg name="id" type="object" interface="ext_data_control_offer_v1" | |||
| 159 | + | allow-null="true"/> | |||
| 160 | + | </event> | |||
| 161 | + | ||||
| 162 | + | <request name="set_primary_selection"> | |||
| 163 | + | <description summary="copy data to the primary selection"> | |||
| 164 | + | This request asks the compositor to set the primary selection to the | |||
| 165 | + | data from the source on behalf of the client. | |||
| 166 | + | ||||
| 167 | + | The given source may not be used in any further set_selection or | |||
| 168 | + | set_primary_selection requests. Attempting to use a previously used | |||
| 169 | + | source triggers the used_source protocol error. | |||
| 170 | + | ||||
| 171 | + | To unset the primary selection, set the source to NULL. | |||
| 172 | + | ||||
| 173 | + | The compositor will ignore this request if it does not support primary | |||
| 174 | + | selection. | |||
| 175 | + | </description> | |||
| 176 | + | <arg name="source" type="object" interface="ext_data_control_source_v1" | |||
| 177 | + | allow-null="true"/> | |||
| 178 | + | </request> | |||
| 179 | + | ||||
| 180 | + | <enum name="error"> | |||
| 181 | + | <entry name="used_source" value="1" | |||
| 182 | + | summary="source given to set_selection or set_primary_selection was already used before"/> | |||
| 183 | + | </enum> | |||
| 184 | + | </interface> | |||
| 185 | + | ||||
| 186 | + | <interface name="ext_data_control_source_v1" version="1"> | |||
| 187 | + | <description summary="offer to transfer data"> | |||
| 188 | + | The ext_data_control_source object is the source side of a | |||
| 189 | + | ext_data_control_offer. It is created by the source client in a data | |||
| 190 | + | transfer and provides a way to describe the offered data and a way to | |||
| 191 | + | respond to requests to transfer the data. | |||
| 192 | + | </description> | |||
| 193 | + | ||||
| 194 | + | <enum name="error"> | |||
| 195 | + | <entry name="invalid_offer" value="1" | |||
| 196 | + | summary="offer sent after ext_data_control_device.set_selection"/> | |||
| 197 | + | </enum> | |||
| 198 | + | ||||
| 199 | + | <request name="offer"> | |||
| 200 | + | <description summary="add an offered MIME type"> | |||
| 201 | + | This request adds a MIME type to the set of MIME types advertised to | |||
| 202 | + | targets. Can be called several times to offer multiple types. | |||
| 203 | + | ||||
| 204 | + | Calling this after ext_data_control_device.set_selection is a protocol | |||
| 205 | + | error. | |||
| 206 | + | </description> | |||
| 207 | + | <arg name="mime_type" type="string" | |||
| 208 | + | summary="MIME type offered by the data source"/> | |||
| 209 | + | </request> | |||
| 210 | + | ||||
| 211 | + | <request name="destroy" type="destructor"> | |||
| 212 | + | <description summary="destroy this source"> | |||
| 213 | + | Destroys the data source object. | |||
| 214 | + | </description> | |||
| 215 | + | </request> | |||
| 216 | + | ||||
| 217 | + | <event name="send"> | |||
| 218 | + | <description summary="send the data"> | |||
| 219 | + | Request for data from the client. Send the data as the specified MIME | |||
| 220 | + | type over the passed file descriptor, then close it. | |||
| 221 | + | </description> | |||
| 222 | + | <arg name="mime_type" type="string" summary="MIME type for the data"/> | |||
| 223 | + | <arg name="fd" type="fd" summary="file descriptor for the data"/> | |||
| 224 | + | </event> | |||
| 225 | + | ||||
| 226 | + | <event name="cancelled"> | |||
| 227 | + | <description summary="selection was cancelled"> | |||
| 228 | + | This data source is no longer valid. The data source has been replaced | |||
| 229 | + | by another data source. | |||
| 230 | + | ||||
| 231 | + | The client should clean up and destroy this data source. | |||
| 232 | + | </description> | |||
| 233 | + | </event> | |||
| 234 | + | </interface> | |||
| 235 | + | ||||
| 236 | + | <interface name="ext_data_control_offer_v1" version="1"> | |||
| 237 | + | <description summary="offer to transfer data"> | |||
| 238 | + | A ext_data_control_offer represents a piece of data offered for transfer | |||
| 239 | + | by another client (the source client). The offer describes the different | |||
| 240 | + | MIME types that the data can be converted to and provides the mechanism | |||
| 241 | + | for transferring the data directly from the source client. | |||
| 242 | + | </description> | |||
| 243 | + | ||||
| 244 | + | <request name="receive"> | |||
| 245 | + | <description summary="request that the data is transferred"> | |||
| 246 | + | To transfer the offered data, the client issues this request and | |||
| 247 | + | indicates the MIME type it wants to receive. The transfer happens | |||
| 248 | + | through the passed file descriptor (typically created with the pipe | |||
| 249 | + | system call). The source client writes the data in the MIME type | |||
| 250 | + | representation requested and then closes the file descriptor. | |||
| 251 | + | ||||
| 252 | + | The receiving client reads from the read end of the pipe until EOF and | |||
| 253 | + | then closes its end, at which point the transfer is complete. | |||
| 254 | + | ||||
| 255 | + | This request may happen multiple times for different MIME types. | |||
| 256 | + | </description> | |||
| 257 | + | <arg name="mime_type" type="string" | |||
| 258 | + | summary="MIME type desired by receiver"/> | |||
| 259 | + | <arg name="fd" type="fd" summary="file descriptor for data transfer"/> | |||
| 260 | + | </request> | |||
| 261 | + | ||||
| 262 | + | <request name="destroy" type="destructor"> | |||
| 263 | + | <description summary="destroy this offer"> | |||
| 264 | + | Destroys the data offer object. | |||
| 265 | + | </description> | |||
| 266 | + | </request> | |||
| 267 | + | ||||
| 268 | + | <event name="offer"> | |||
| 269 | + | <description summary="advertise offered MIME type"> | |||
| 270 | + | Sent immediately after creating the ext_data_control_offer object. | |||
| 271 | + | One event per offered MIME type. | |||
| 272 | + | </description> | |||
| 273 | + | <arg name="mime_type" type="string" summary="offered MIME type"/> | |||
| 274 | + | </event> | |||
| 275 | + | </interface> | |||
| 276 | + | </protocol> | |||
A protocols/primary-selection-unstable-v1.xml +225 -0
| @@ -0,0 +1,225 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <protocol name="wp_primary_selection_unstable_v1"> | |
| 3 | + | <copyright> | |
| 4 | + | Copyright © 2015, 2016 Red Hat | |
| 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 | + | </copyright> | |
| 25 | + | ||
| 26 | + | <description summary="Primary selection protocol"> | |
| 27 | + | This protocol provides the ability to have a primary selection device to | |
| 28 | + | match that of the X server. This primary selection is a shortcut to the | |
| 29 | + | common clipboard selection, where text just needs to be selected in order | |
| 30 | + | to allow copying it elsewhere. The de facto way to perform this action | |
| 31 | + | is the middle mouse button, although it is not limited to this one. | |
| 32 | + | ||
| 33 | + | Clients wishing to honor primary selection should create a primary | |
| 34 | + | selection source and set it as the selection through | |
| 35 | + | wp_primary_selection_device.set_selection whenever the text selection | |
| 36 | + | changes. In order to minimize calls in pointer-driven text selection, | |
| 37 | + | it should happen only once after the operation finished. Similarly, | |
| 38 | + | a NULL source should be set when text is unselected. | |
| 39 | + | ||
| 40 | + | wp_primary_selection_offer objects are first announced through the | |
| 41 | + | wp_primary_selection_device.data_offer event. Immediately after this event, | |
| 42 | + | the primary data offer will emit wp_primary_selection_offer.offer events | |
| 43 | + | to let know of the mime types being offered. | |
| 44 | + | ||
| 45 | + | When the primary selection changes, the client with the keyboard focus | |
| 46 | + | will receive wp_primary_selection_device.selection events. Only the client | |
| 47 | + | with the keyboard focus will receive such events with a non-NULL | |
| 48 | + | wp_primary_selection_offer. Across keyboard focus changes, previously | |
| 49 | + | focused clients will receive wp_primary_selection_device.events with a | |
| 50 | + | NULL wp_primary_selection_offer. | |
| 51 | + | ||
| 52 | + | In order to request the primary selection data, the client must pass | |
| 53 | + | a recent serial pertaining to the press event that is triggering the | |
| 54 | + | operation, if the compositor deems the serial valid and recent, the | |
| 55 | + | wp_primary_selection_source.send event will happen in the other end | |
| 56 | + | to let the transfer begin. The client owning the primary selection | |
| 57 | + | should write the requested data, and close the file descriptor | |
| 58 | + | immediately. | |
| 59 | + | ||
| 60 | + | If the primary selection owner client disappeared during the transfer, | |
| 61 | + | the client reading the data will receive a | |
| 62 | + | wp_primary_selection_device.selection event with a NULL | |
| 63 | + | wp_primary_selection_offer, the client should take this as a hint | |
| 64 | + | to finish the reads related to the no longer existing offer. | |
| 65 | + | ||
| 66 | + | The primary selection owner should be checking for errors during | |
| 67 | + | writes, merely cancelling the ongoing transfer if any happened. | |
| 68 | + | </description> | |
| 69 | + | ||
| 70 | + | <interface name="zwp_primary_selection_device_manager_v1" version="1"> | |
| 71 | + | <description summary="X primary selection emulation"> | |
| 72 | + | The primary selection device manager is a singleton global object that | |
| 73 | + | provides access to the primary selection. It allows to create | |
| 74 | + | wp_primary_selection_source objects, as well as retrieving the per-seat | |
| 75 | + | wp_primary_selection_device objects. | |
| 76 | + | </description> | |
| 77 | + | ||
| 78 | + | <request name="create_source"> | |
| 79 | + | <description summary="create a new primary selection source"> | |
| 80 | + | Create a new primary selection source. | |
| 81 | + | </description> | |
| 82 | + | <arg name="id" type="new_id" interface="zwp_primary_selection_source_v1"/> | |
| 83 | + | </request> | |
| 84 | + | ||
| 85 | + | <request name="get_device"> | |
| 86 | + | <description summary="create a new primary selection device"> | |
| 87 | + | Create a new data device for a given seat. | |
| 88 | + | </description> | |
| 89 | + | <arg name="id" type="new_id" interface="zwp_primary_selection_device_v1"/> | |
| 90 | + | <arg name="seat" type="object" interface="wl_seat"/> | |
| 91 | + | </request> | |
| 92 | + | ||
| 93 | + | <request name="destroy" type="destructor"> | |
| 94 | + | <description summary="destroy the primary selection device manager"> | |
| 95 | + | Destroy the primary selection device manager. | |
| 96 | + | </description> | |
| 97 | + | </request> | |
| 98 | + | </interface> | |
| 99 | + | ||
| 100 | + | <interface name="zwp_primary_selection_device_v1" version="1"> | |
| 101 | + | <request name="set_selection"> | |
| 102 | + | <description summary="set the primary selection"> | |
| 103 | + | Replaces the current selection. The previous owner of the primary | |
| 104 | + | selection will receive a wp_primary_selection_source.cancelled event. | |
| 105 | + | ||
| 106 | + | To unset the selection, set the source to NULL. | |
| 107 | + | </description> | |
| 108 | + | <arg name="source" type="object" interface="zwp_primary_selection_source_v1" allow-null="true"/> | |
| 109 | + | <arg name="serial" type="uint" summary="serial of the event that triggered this request"/> | |
| 110 | + | </request> | |
| 111 | + | ||
| 112 | + | <event name="data_offer"> | |
| 113 | + | <description summary="introduce a new wp_primary_selection_offer"> | |
| 114 | + | Introduces a new wp_primary_selection_offer object that may be used | |
| 115 | + | to receive the current primary selection. Immediately following this | |
| 116 | + | event, the new wp_primary_selection_offer object will send | |
| 117 | + | wp_primary_selection_offer.offer events to describe the offered mime | |
| 118 | + | types. | |
| 119 | + | </description> | |
| 120 | + | <arg name="offer" type="new_id" interface="zwp_primary_selection_offer_v1"/> | |
| 121 | + | </event> | |
| 122 | + | ||
| 123 | + | <event name="selection"> | |
| 124 | + | <description summary="advertise a new primary selection"> | |
| 125 | + | The wp_primary_selection_device.selection event is sent to notify the | |
| 126 | + | client of a new primary selection. This event is sent after the | |
| 127 | + | wp_primary_selection.data_offer event introducing this object, and after | |
| 128 | + | the offer has announced its mimetypes through | |
| 129 | + | wp_primary_selection_offer.offer. | |
| 130 | + | ||
| 131 | + | The data_offer is valid until a new offer or NULL is received | |
| 132 | + | or until the client loses keyboard focus. The client must destroy the | |
| 133 | + | previous selection data_offer, if any, upon receiving this event. | |
| 134 | + | </description> | |
| 135 | + | <arg name="id" type="object" interface="zwp_primary_selection_offer_v1" allow-null="true"/> | |
| 136 | + | </event> | |
| 137 | + | ||
| 138 | + | <request name="destroy" type="destructor"> | |
| 139 | + | <description summary="destroy the primary selection device"> | |
| 140 | + | Destroy the primary selection device. | |
| 141 | + | </description> | |
| 142 | + | </request> | |
| 143 | + | </interface> | |
| 144 | + | ||
| 145 | + | <interface name="zwp_primary_selection_offer_v1" version="1"> | |
| 146 | + | <description summary="offer to transfer primary selection contents"> | |
| 147 | + | A wp_primary_selection_offer represents an offer to transfer the contents | |
| 148 | + | of the primary selection clipboard to the client. Similar to | |
| 149 | + | wl_data_offer, the offer also describes the mime types that the data can | |
| 150 | + | be converted to and provides the mechanisms for transferring the data | |
| 151 | + | directly to the client. | |
| 152 | + | </description> | |
| 153 | + | ||
| 154 | + | <request name="receive"> | |
| 155 | + | <description summary="request that the data is transferred"> | |
| 156 | + | To transfer the contents of the primary selection clipboard, the client | |
| 157 | + | issues this request and indicates the mime type that it wants to | |
| 158 | + | receive. The transfer happens through the passed file descriptor | |
| 159 | + | (typically created with the pipe system call). The source client writes | |
| 160 | + | the data in the mime type representation requested and then closes the | |
| 161 | + | file descriptor. | |
| 162 | + | ||
| 163 | + | The receiving client reads from the read end of the pipe until EOF and | |
| 164 | + | closes its end, at which point the transfer is complete. | |
| 165 | + | </description> | |
| 166 | + | <arg name="mime_type" type="string"/> | |
| 167 | + | <arg name="fd" type="fd"/> | |
| 168 | + | </request> | |
| 169 | + | ||
| 170 | + | <request name="destroy" type="destructor"> | |
| 171 | + | <description summary="destroy the primary selection offer"> | |
| 172 | + | Destroy the primary selection offer. | |
| 173 | + | </description> | |
| 174 | + | </request> | |
| 175 | + | ||
| 176 | + | <event name="offer"> | |
| 177 | + | <description summary="advertise offered mime type"> | |
| 178 | + | Sent immediately after creating announcing the | |
| 179 | + | wp_primary_selection_offer through | |
| 180 | + | wp_primary_selection_device.data_offer. One event is sent per offered | |
| 181 | + | mime type. | |
| 182 | + | </description> | |
| 183 | + | <arg name="mime_type" type="string"/> | |
| 184 | + | </event> | |
| 185 | + | </interface> | |
| 186 | + | ||
| 187 | + | <interface name="zwp_primary_selection_source_v1" version="1"> | |
| 188 | + | <description summary="offer to replace the contents of the primary selection"> | |
| 189 | + | The source side of a wp_primary_selection_offer, it provides a way to | |
| 190 | + | describe the offered data and respond to requests to transfer the | |
| 191 | + | requested contents of the primary selection clipboard. | |
| 192 | + | </description> | |
| 193 | + | ||
| 194 | + | <request name="offer"> | |
| 195 | + | <description summary="add an offered mime type"> | |
| 196 | + | This request adds a mime type to the set of mime types advertised to | |
| 197 | + | targets. Can be called several times to offer multiple types. | |
| 198 | + | </description> | |
| 199 | + | <arg name="mime_type" type="string"/> | |
| 200 | + | </request> | |
| 201 | + | ||
| 202 | + | <request name="destroy" type="destructor"> | |
| 203 | + | <description summary="destroy the primary selection source"> | |
| 204 | + | Destroy the primary selection source. | |
| 205 | + | </description> | |
| 206 | + | </request> | |
| 207 | + | ||
| 208 | + | <event name="send"> | |
| 209 | + | <description summary="send the primary selection contents"> | |
| 210 | + | Request for the current primary selection contents from the client. | |
| 211 | + | Send the specified mime type over the passed file descriptor, then | |
| 212 | + | close it. | |
| 213 | + | </description> | |
| 214 | + | <arg name="mime_type" type="string"/> | |
| 215 | + | <arg name="fd" type="fd"/> | |
| 216 | + | </event> | |
| 217 | + | ||
| 218 | + | <event name="cancelled"> | |
| 219 | + | <description summary="request for primary selection contents was canceled"> | |
| 220 | + | This primary selection source is no longer valid. The client should | |
| 221 | + | clean up and destroy this primary selection source. | |
| 222 | + | </description> | |
| 223 | + | </event> | |
| 224 | + | </interface> | |
| 225 | + | </protocol> | |
| @@ -0,0 +1,225 @@ | |||||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |||
| 2 | + | <protocol name="wp_primary_selection_unstable_v1"> | |||
| 3 | + | <copyright> | |||
| 4 | + | Copyright © 2015, 2016 Red Hat | |||
| 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 | + | </copyright> | |||
| 25 | + | ||||
| 26 | + | <description summary="Primary selection protocol"> | |||
| 27 | + | This protocol provides the ability to have a primary selection device to | |||
| 28 | + | match that of the X server. This primary selection is a shortcut to the | |||
| 29 | + | common clipboard selection, where text just needs to be selected in order | |||
| 30 | + | to allow copying it elsewhere. The de facto way to perform this action | |||
| 31 | + | is the middle mouse button, although it is not limited to this one. | |||
| 32 | + | ||||
| 33 | + | Clients wishing to honor primary selection should create a primary | |||
| 34 | + | selection source and set it as the selection through | |||
| 35 | + | wp_primary_selection_device.set_selection whenever the text selection | |||
| 36 | + | changes. In order to minimize calls in pointer-driven text selection, | |||
| 37 | + | it should happen only once after the operation finished. Similarly, | |||
| 38 | + | a NULL source should be set when text is unselected. | |||
| 39 | + | ||||
| 40 | + | wp_primary_selection_offer objects are first announced through the | |||
| 41 | + | wp_primary_selection_device.data_offer event. Immediately after this event, | |||
| 42 | + | the primary data offer will emit wp_primary_selection_offer.offer events | |||
| 43 | + | to let know of the mime types being offered. | |||
| 44 | + | ||||
| 45 | + | When the primary selection changes, the client with the keyboard focus | |||
| 46 | + | will receive wp_primary_selection_device.selection events. Only the client | |||
| 47 | + | with the keyboard focus will receive such events with a non-NULL | |||
| 48 | + | wp_primary_selection_offer. Across keyboard focus changes, previously | |||
| 49 | + | focused clients will receive wp_primary_selection_device.events with a | |||
| 50 | + | NULL wp_primary_selection_offer. | |||
| 51 | + | ||||
| 52 | + | In order to request the primary selection data, the client must pass | |||
| 53 | + | a recent serial pertaining to the press event that is triggering the | |||
| 54 | + | operation, if the compositor deems the serial valid and recent, the | |||
| 55 | + | wp_primary_selection_source.send event will happen in the other end | |||
| 56 | + | to let the transfer begin. The client owning the primary selection | |||
| 57 | + | should write the requested data, and close the file descriptor | |||
| 58 | + | immediately. | |||
| 59 | + | ||||
| 60 | + | If the primary selection owner client disappeared during the transfer, | |||
| 61 | + | the client reading the data will receive a | |||
| 62 | + | wp_primary_selection_device.selection event with a NULL | |||
| 63 | + | wp_primary_selection_offer, the client should take this as a hint | |||
| 64 | + | to finish the reads related to the no longer existing offer. | |||
| 65 | + | ||||
| 66 | + | The primary selection owner should be checking for errors during | |||
| 67 | + | writes, merely cancelling the ongoing transfer if any happened. | |||
| 68 | + | </description> | |||
| 69 | + | ||||
| 70 | + | <interface name="zwp_primary_selection_device_manager_v1" version="1"> | |||
| 71 | + | <description summary="X primary selection emulation"> | |||
| 72 | + | The primary selection device manager is a singleton global object that | |||
| 73 | + | provides access to the primary selection. It allows to create | |||
| 74 | + | wp_primary_selection_source objects, as well as retrieving the per-seat | |||
| 75 | + | wp_primary_selection_device objects. | |||
| 76 | + | </description> | |||
| 77 | + | ||||
| 78 | + | <request name="create_source"> | |||
| 79 | + | <description summary="create a new primary selection source"> | |||
| 80 | + | Create a new primary selection source. | |||
| 81 | + | </description> | |||
| 82 | + | <arg name="id" type="new_id" interface="zwp_primary_selection_source_v1"/> | |||
| 83 | + | </request> | |||
| 84 | + | ||||
| 85 | + | <request name="get_device"> | |||
| 86 | + | <description summary="create a new primary selection device"> | |||
| 87 | + | Create a new data device for a given seat. | |||
| 88 | + | </description> | |||
| 89 | + | <arg name="id" type="new_id" interface="zwp_primary_selection_device_v1"/> | |||
| 90 | + | <arg name="seat" type="object" interface="wl_seat"/> | |||
| 91 | + | </request> | |||
| 92 | + | ||||
| 93 | + | <request name="destroy" type="destructor"> | |||
| 94 | + | <description summary="destroy the primary selection device manager"> | |||
| 95 | + | Destroy the primary selection device manager. | |||
| 96 | + | </description> | |||
| 97 | + | </request> | |||
| 98 | + | </interface> | |||
| 99 | + | ||||
| 100 | + | <interface name="zwp_primary_selection_device_v1" version="1"> | |||
| 101 | + | <request name="set_selection"> | |||
| 102 | + | <description summary="set the primary selection"> | |||
| 103 | + | Replaces the current selection. The previous owner of the primary | |||
| 104 | + | selection will receive a wp_primary_selection_source.cancelled event. | |||
| 105 | + | ||||
| 106 | + | To unset the selection, set the source to NULL. | |||
| 107 | + | </description> | |||
| 108 | + | <arg name="source" type="object" interface="zwp_primary_selection_source_v1" allow-null="true"/> | |||
| 109 | + | <arg name="serial" type="uint" summary="serial of the event that triggered this request"/> | |||
| 110 | + | </request> | |||
| 111 | + | ||||
| 112 | + | <event name="data_offer"> | |||
| 113 | + | <description summary="introduce a new wp_primary_selection_offer"> | |||
| 114 | + | Introduces a new wp_primary_selection_offer object that may be used | |||
| 115 | + | to receive the current primary selection. Immediately following this | |||
| 116 | + | event, the new wp_primary_selection_offer object will send | |||
| 117 | + | wp_primary_selection_offer.offer events to describe the offered mime | |||
| 118 | + | types. | |||
| 119 | + | </description> | |||
| 120 | + | <arg name="offer" type="new_id" interface="zwp_primary_selection_offer_v1"/> | |||
| 121 | + | </event> | |||
| 122 | + | ||||
| 123 | + | <event name="selection"> | |||
| 124 | + | <description summary="advertise a new primary selection"> | |||
| 125 | + | The wp_primary_selection_device.selection event is sent to notify the | |||
| 126 | + | client of a new primary selection. This event is sent after the | |||
| 127 | + | wp_primary_selection.data_offer event introducing this object, and after | |||
| 128 | + | the offer has announced its mimetypes through | |||
| 129 | + | wp_primary_selection_offer.offer. | |||
| 130 | + | ||||
| 131 | + | The data_offer is valid until a new offer or NULL is received | |||
| 132 | + | or until the client loses keyboard focus. The client must destroy the | |||
| 133 | + | previous selection data_offer, if any, upon receiving this event. | |||
| 134 | + | </description> | |||
| 135 | + | <arg name="id" type="object" interface="zwp_primary_selection_offer_v1" allow-null="true"/> | |||
| 136 | + | </event> | |||
| 137 | + | ||||
| 138 | + | <request name="destroy" type="destructor"> | |||
| 139 | + | <description summary="destroy the primary selection device"> | |||
| 140 | + | Destroy the primary selection device. | |||
| 141 | + | </description> | |||
| 142 | + | </request> | |||
| 143 | + | </interface> | |||
| 144 | + | ||||
| 145 | + | <interface name="zwp_primary_selection_offer_v1" version="1"> | |||
| 146 | + | <description summary="offer to transfer primary selection contents"> | |||
| 147 | + | A wp_primary_selection_offer represents an offer to transfer the contents | |||
| 148 | + | of the primary selection clipboard to the client. Similar to | |||
| 149 | + | wl_data_offer, the offer also describes the mime types that the data can | |||
| 150 | + | be converted to and provides the mechanisms for transferring the data | |||
| 151 | + | directly to the client. | |||
| 152 | + | </description> | |||
| 153 | + | ||||
| 154 | + | <request name="receive"> | |||
| 155 | + | <description summary="request that the data is transferred"> | |||
| 156 | + | To transfer the contents of the primary selection clipboard, the client | |||
| 157 | + | issues this request and indicates the mime type that it wants to | |||
| 158 | + | receive. The transfer happens through the passed file descriptor | |||
| 159 | + | (typically created with the pipe system call). The source client writes | |||
| 160 | + | the data in the mime type representation requested and then closes the | |||
| 161 | + | file descriptor. | |||
| 162 | + | ||||
| 163 | + | The receiving client reads from the read end of the pipe until EOF and | |||
| 164 | + | closes its end, at which point the transfer is complete. | |||
| 165 | + | </description> | |||
| 166 | + | <arg name="mime_type" type="string"/> | |||
| 167 | + | <arg name="fd" type="fd"/> | |||
| 168 | + | </request> | |||
| 169 | + | ||||
| 170 | + | <request name="destroy" type="destructor"> | |||
| 171 | + | <description summary="destroy the primary selection offer"> | |||
| 172 | + | Destroy the primary selection offer. | |||
| 173 | + | </description> | |||
| 174 | + | </request> | |||
| 175 | + | ||||
| 176 | + | <event name="offer"> | |||
| 177 | + | <description summary="advertise offered mime type"> | |||
| 178 | + | Sent immediately after creating announcing the | |||
| 179 | + | wp_primary_selection_offer through | |||
| 180 | + | wp_primary_selection_device.data_offer. One event is sent per offered | |||
| 181 | + | mime type. | |||
| 182 | + | </description> | |||
| 183 | + | <arg name="mime_type" type="string"/> | |||
| 184 | + | </event> | |||
| 185 | + | </interface> | |||
| 186 | + | ||||
| 187 | + | <interface name="zwp_primary_selection_source_v1" version="1"> | |||
| 188 | + | <description summary="offer to replace the contents of the primary selection"> | |||
| 189 | + | The source side of a wp_primary_selection_offer, it provides a way to | |||
| 190 | + | describe the offered data and respond to requests to transfer the | |||
| 191 | + | requested contents of the primary selection clipboard. | |||
| 192 | + | </description> | |||
| 193 | + | ||||
| 194 | + | <request name="offer"> | |||
| 195 | + | <description summary="add an offered mime type"> | |||
| 196 | + | This request adds a mime type to the set of mime types advertised to | |||
| 197 | + | targets. Can be called several times to offer multiple types. | |||
| 198 | + | </description> | |||
| 199 | + | <arg name="mime_type" type="string"/> | |||
| 200 | + | </request> | |||
| 201 | + | ||||
| 202 | + | <request name="destroy" type="destructor"> | |||
| 203 | + | <description summary="destroy the primary selection source"> | |||
| 204 | + | Destroy the primary selection source. | |||
| 205 | + | </description> | |||
| 206 | + | </request> | |||
| 207 | + | ||||
| 208 | + | <event name="send"> | |||
| 209 | + | <description summary="send the primary selection contents"> | |||
| 210 | + | Request for the current primary selection contents from the client. | |||
| 211 | + | Send the specified mime type over the passed file descriptor, then | |||
| 212 | + | close it. | |||
| 213 | + | </description> | |||
| 214 | + | <arg name="mime_type" type="string"/> | |||
| 215 | + | <arg name="fd" type="fd"/> | |||
| 216 | + | </event> | |||
| 217 | + | ||||
| 218 | + | <event name="cancelled"> | |||
| 219 | + | <description summary="request for primary selection contents was canceled"> | |||
| 220 | + | This primary selection source is no longer valid. The client should | |||
| 221 | + | clean up and destroy this primary selection source. | |||
| 222 | + | </description> | |||
| 223 | + | </event> | |||
| 224 | + | </interface> | |||
| 225 | + | </protocol> | |||