refactor(scanner): send generated requests through Context.Request
Context.Request now owns the whole request lifecycle: proxy and version checks, child ID allocation, version inheritance and registration, the send (destructor-claiming when needed), child cleanup on failure and FD close on success. Generated methods only build the child and pass one Request value, so these rules live in tested hand-written code instead of being repeated in every generated method (about 650 fewer generated lines).
- commit
- 1a9db3bbdf4ddd9ff5470aa197bef78e720a1240
- author
- brice · · 2026-09-29 15:54 UTC
- parent
- 53f48a7
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
14 files · +267 -892
M core.go +52 -0
| @@ -96,6 +96,58 @@ func (c *Context) CheckProxy(proxy Proxy) error { | |||
| 96 | 96 | return nil | |
| 97 | 97 | } | |
| 98 | 98 | ||
| 99 | + | // Request describes one protocol request for Context.Request. | |
| 100 | + | type Request struct { | |
| 101 | + | Proxy Proxy | |
| 102 | + | Opcode uint32 | |
| 103 | + | Name string // interface.request, used in errors | |
| 104 | + | Since uint32 // version that introduced the request; 0 or 1 means always | |
| 105 | + | Destructor bool // claim the proxy exactly once, as SendDestructor does | |
| 106 | + | Child Proxy // new_id object created by this request, or nil | |
| 107 | + | FDs []int // descriptors to attach; closed after a successful send | |
| 108 | + | } | |
| 109 | + | ||
| 110 | + | // Request runs one request with its whole lifecycle: it checks the proxy and | |
| 111 | + | // version, allocates and registers Child (inheriting the parent's version), | |
| 112 | + | // sends, and then either closes the sent descriptors or, on error, | |
| 113 | + | // unregisters Child and leaves the descriptors with the caller. Child must | |
| 114 | + | // already have this context; it is passed in args at its wire position. | |
| 115 | + | func (c *Context) Request(r Request, args ...interface{}) error { | |
| 116 | + | if err := c.CheckProxy(r.Proxy); err != nil { | |
| 117 | + | return err | |
| 118 | + | } | |
| 119 | + | if v, ok := r.Proxy.(interface{ Version() uint32 }); ok { | |
| 120 | + | if err := CheckVersion(v.Version(), r.Since, r.Name); err != nil { | |
| 121 | + | return err | |
| 122 | + | } | |
| 123 | + | } | |
| 124 | + | if r.Child != nil { | |
| 125 | + | r.Child.SetID(c.AllocateID()) | |
| 126 | + | if v, ok := r.Proxy.(interface{ Version() uint32 }); ok { | |
| 127 | + | if s, ok := r.Child.(interface{ SetVersion(uint32) }); ok { | |
| 128 | + | s.SetVersion(v.Version()) | |
| 129 | + | } | |
| 130 | + | } | |
| 131 | + | c.Register(r.Child) | |
| 132 | + | } | |
| 133 | + | var err error | |
| 134 | + | if r.Destructor { | |
| 135 | + | err = c.SendDestructorWithFDs(r.Proxy, r.Opcode, r.FDs, args...) | |
| 136 | + | } else { | |
| 137 | + | err = c.SendRequestWithFDs(r.Proxy, r.Opcode, r.FDs, args...) | |
| 138 | + | } | |
| 139 | + | if err != nil { | |
| 140 | + | if r.Child != nil { | |
| 141 | + | c.Unregister(r.Child) | |
| 142 | + | } | |
| 143 | + | return err | |
| 144 | + | } | |
| 145 | + | for _, fd := range r.FDs { | |
| 146 | + | _ = CloseSentFD(fd) | |
| 147 | + | } | |
| 148 | + | return nil | |
| 149 | + | } | |
| 150 | + | ||
| 99 | 151 | // SendDestructor sends a destructor request exactly once. The proxy is | |
| 100 | 152 | // claimed (unregistered) under the connection send lock, after marshaling | |
| 101 | 153 | // and immediately before the write: concurrent destructors and later requests | |
| @@ -96,6 +96,58 @@ func (c *Context) CheckProxy(proxy Proxy) error { | |||||
| 96 | return nil | 96 | return nil | ||
| 97 | } | 97 | } | ||
| 98 | 98 | ||||
| 99 | + | // Request describes one protocol request for Context.Request. | |||
| 100 | + | type Request struct { | |||
| 101 | + | Proxy Proxy | |||
| 102 | + | Opcode uint32 | |||
| 103 | + | Name string // interface.request, used in errors | |||
| 104 | + | Since uint32 // version that introduced the request; 0 or 1 means always | |||
| 105 | + | Destructor bool // claim the proxy exactly once, as SendDestructor does | |||
| 106 | + | Child Proxy // new_id object created by this request, or nil | |||
| 107 | + | FDs []int // descriptors to attach; closed after a successful send | |||
| 108 | + | } | |||
| 109 | + | ||||
| 110 | + | // Request runs one request with its whole lifecycle: it checks the proxy and | |||
| 111 | + | // version, allocates and registers Child (inheriting the parent's version), | |||
| 112 | + | // sends, and then either closes the sent descriptors or, on error, | |||
| 113 | + | // unregisters Child and leaves the descriptors with the caller. Child must | |||
| 114 | + | // already have this context; it is passed in args at its wire position. | |||
| 115 | + | func (c *Context) Request(r Request, args ...interface{}) error { | |||
| 116 | + | if err := c.CheckProxy(r.Proxy); err != nil { | |||
| 117 | + | return err | |||
| 118 | + | } | |||
| 119 | + | if v, ok := r.Proxy.(interface{ Version() uint32 }); ok { | |||
| 120 | + | if err := CheckVersion(v.Version(), r.Since, r.Name); err != nil { | |||
| 121 | + | return err | |||
| 122 | + | } | |||
| 123 | + | } | |||
| 124 | + | if r.Child != nil { | |||
| 125 | + | r.Child.SetID(c.AllocateID()) | |||
| 126 | + | if v, ok := r.Proxy.(interface{ Version() uint32 }); ok { | |||
| 127 | + | if s, ok := r.Child.(interface{ SetVersion(uint32) }); ok { | |||
| 128 | + | s.SetVersion(v.Version()) | |||
| 129 | + | } | |||
| 130 | + | } | |||
| 131 | + | c.Register(r.Child) | |||
| 132 | + | } | |||
| 133 | + | var err error | |||
| 134 | + | if r.Destructor { | |||
| 135 | + | err = c.SendDestructorWithFDs(r.Proxy, r.Opcode, r.FDs, args...) | |||
| 136 | + | } else { | |||
| 137 | + | err = c.SendRequestWithFDs(r.Proxy, r.Opcode, r.FDs, args...) | |||
| 138 | + | } | |||
| 139 | + | if err != nil { | |||
| 140 | + | if r.Child != nil { | |||
| 141 | + | c.Unregister(r.Child) | |||
| 142 | + | } | |||
| 143 | + | return err | |||
| 144 | + | } | |||
| 145 | + | for _, fd := range r.FDs { | |||
| 146 | + | _ = CloseSentFD(fd) | |||
| 147 | + | } | |||
| 148 | + | return nil | |||
| 149 | + | } | |||
| 150 | + | ||||
| 99 | // SendDestructor sends a destructor request exactly once. The proxy is | 151 | // SendDestructor sends a destructor request exactly once. The proxy is | ||
| 100 | // claimed (unregistered) under the connection send lock, after marshaling | 152 | // claimed (unregistered) under the connection send lock, after marshaling | ||
| 101 | // and immediately before the write: concurrent destructors and later requests | 153 | // and immediately before the write: concurrent destructors and later requests | ||
M hardening_test.go +35 -0
| @@ -177,3 +177,38 @@ func TestUnregisterKeepsZombie(t *testing.T) { | |||
| 177 | 177 | t.Fatalf("object = %T, want *zombie", obj) | |
| 178 | 178 | } | |
| 179 | 179 | } | |
| 180 | + | ||
| 181 | + | // Context.Request owns the request lifecycle generated code relies on. | |
| 182 | + | func TestContextRequestLifecycle(t *testing.T) { | |
| 183 | + | d := newDisplay(&chunkConn{}) | |
| 184 | + | parent := &BaseProxy{id: d.AllocateID(), context: d.context, version: 2} | |
| 185 | + | d.context.Register(parent) | |
| 186 | + | ||
| 187 | + | child := &BaseProxy{context: d.context} | |
| 188 | + | if err := d.context.Request(Request{Proxy: parent, Opcode: 0, Name: "x.make", Child: child}, child); err != nil { | |
| 189 | + | t.Fatal(err) | |
| 190 | + | } | |
| 191 | + | if child.ID() == 0 || child.Version() != 2 { | |
| 192 | + | t.Fatalf("child id=%d version=%d, want allocated id and version 2", child.ID(), child.Version()) | |
| 193 | + | } | |
| 194 | + | if _, ok := d.objects.Load(child.ID()); !ok { | |
| 195 | + | t.Fatal("child not registered") | |
| 196 | + | } | |
| 197 | + | ||
| 198 | + | late := &BaseProxy{context: d.context} | |
| 199 | + | err := d.context.Request(Request{Proxy: parent, Opcode: 1, Name: "x.late", Since: 3, Child: late}, late) | |
| 200 | + | if !errors.Is(err, ErrVersionTooLow) { | |
| 201 | + | t.Fatalf("since=3 on v2 = %v, want ErrVersionTooLow", err) | |
| 202 | + | } | |
| 203 | + | if late.ID() != 0 { | |
| 204 | + | t.Fatal("child allocated for a refused request") | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | bad := &BaseProxy{context: d.context} | |
| 208 | + | if err := d.context.Request(Request{Proxy: parent, Opcode: 2, Name: "x.bad", Child: bad}, bad, 42); err == nil { | |
| 209 | + | t.Fatal("marshal error not reported") | |
| 210 | + | } | |
| 211 | + | if _, ok := d.objects.Load(bad.ID()); ok { | |
| 212 | + | t.Fatal("child left registered after a failed send") | |
| 213 | + | } | |
| 214 | + | } | |
| @@ -177,3 +177,38 @@ func TestUnregisterKeepsZombie(t *testing.T) { | |||||
| 177 | t.Fatalf("object = %T, want *zombie", obj) | 177 | t.Fatalf("object = %T, want *zombie", obj) | ||
| 178 | } | 178 | } | ||
| 179 | } | 179 | } | ||
| 180 | + | ||||
| 181 | + | // Context.Request owns the request lifecycle generated code relies on. | |||
| 182 | + | func TestContextRequestLifecycle(t *testing.T) { | |||
| 183 | + | d := newDisplay(&chunkConn{}) | |||
| 184 | + | parent := &BaseProxy{id: d.AllocateID(), context: d.context, version: 2} | |||
| 185 | + | d.context.Register(parent) | |||
| 186 | + | ||||
| 187 | + | child := &BaseProxy{context: d.context} | |||
| 188 | + | if err := d.context.Request(Request{Proxy: parent, Opcode: 0, Name: "x.make", Child: child}, child); err != nil { | |||
| 189 | + | t.Fatal(err) | |||
| 190 | + | } | |||
| 191 | + | if child.ID() == 0 || child.Version() != 2 { | |||
| 192 | + | t.Fatalf("child id=%d version=%d, want allocated id and version 2", child.ID(), child.Version()) | |||
| 193 | + | } | |||
| 194 | + | if _, ok := d.objects.Load(child.ID()); !ok { | |||
| 195 | + | t.Fatal("child not registered") | |||
| 196 | + | } | |||
| 197 | + | ||||
| 198 | + | late := &BaseProxy{context: d.context} | |||
| 199 | + | err := d.context.Request(Request{Proxy: parent, Opcode: 1, Name: "x.late", Since: 3, Child: late}, late) | |||
| 200 | + | if !errors.Is(err, ErrVersionTooLow) { | |||
| 201 | + | t.Fatalf("since=3 on v2 = %v, want ErrVersionTooLow", err) | |||
| 202 | + | } | |||
| 203 | + | if late.ID() != 0 { | |||
| 204 | + | t.Fatal("child allocated for a refused request") | |||
| 205 | + | } | |||
| 206 | + | ||||
| 207 | + | bad := &BaseProxy{context: d.context} | |||
| 208 | + | if err := d.context.Request(Request{Proxy: parent, Opcode: 2, Name: "x.bad", Child: bad}, bad, 42); err == nil { | |||
| 209 | + | t.Fatal("marshal error not reported") | |||
| 210 | + | } | |||
| 211 | + | if _, ok := d.objects.Load(bad.ID()); ok { | |||
| 212 | + | t.Fatal("child left registered after a failed send") | |||
| 213 | + | } | |||
| 214 | + | } | |||
M internal/scanner/scanner.go +8 -17
| @@ -191,15 +191,14 @@ type requestData struct { | |||
| 191 | 191 | Params string | |
| 192 | 192 | Results string | |
| 193 | 193 | ArgPreparations []string | |
| 194 | - | ArgExprs []string | |
| 195 | 194 | CreatesChild bool | |
| 196 | 195 | ChildVar string | |
| 197 | 196 | ChildType string | |
| 198 | 197 | ChildFactory string | |
| 199 | 198 | ErrorReturn string | |
| 200 | - | FDArgs []string | |
| 201 | 199 | HasFDs bool | |
| 202 | - | SendCall string | |
| 200 | + | FDList string | |
| 201 | + | ArgList string | |
| 203 | 202 | } | |
| 204 | 203 | ||
| 205 | 204 | // argSlot is one positional argument of a request, in declaration order. A | |
| @@ -457,7 +456,6 @@ func (s *Scanner) processRequest(iface Interface, req Request, opcode int) (requ | |||
| 457 | 456 | // them, and the descriptor list is attached to the request. | |
| 458 | 457 | params = append(params, name+" int") | |
| 459 | 458 | fdExprs = append(fdExprs, name) | |
| 460 | - | data.FDArgs = append(data.FDArgs, name) | |
| 461 | 459 | expr = "uintptr(" + name + ")" | |
| 462 | 460 | ||
| 463 | 461 | default: | |
| @@ -488,23 +486,16 @@ func (s *Scanner) processRequest(iface Interface, req Request, opcode int) (requ | |||
| 488 | 486 | } | |
| 489 | 487 | ||
| 490 | 488 | data.Params = strings.Join(params, ", ") | |
| 491 | - | data.ArgExprs = argExprs | |
| 492 | 489 | args := "" | |
| 493 | 490 | if len(argExprs) > 0 { | |
| 494 | 491 | args = ", " + strings.Join(argExprs, ", ") | |
| 495 | 492 | } | |
| 496 | - | // Destructors claim the proxy atomically before sending so a concurrent | |
| 497 | - | // second destroy cannot reach the wire. | |
| 498 | - | send := "SendRequest" | |
| 499 | - | if data.Destructor { | |
| 500 | - | send = "SendDestructor" | |
| 501 | - | } | |
| 502 | - | if len(fdExprs) > 0 { | |
| 503 | - | data.HasFDs = true | |
| 504 | - | data.SendCall = fmt.Sprintf("%sWithFDs(o, %d, []int{%s}%s)", send, opcode, strings.Join(fdExprs, ", "), args) | |
| 505 | - | } else { | |
| 506 | - | data.SendCall = fmt.Sprintf("%s(o, %d%s)", send, opcode, args) | |
| 507 | - | } | |
| 493 | + | // Context.Request owns the lifecycle: destructors claim the proxy | |
| 494 | + | // atomically, children are registered before the send and descriptors are | |
| 495 | + | // closed only after a successful send. | |
| 496 | + | data.ArgList = args | |
| 497 | + | data.FDList = strings.Join(fdExprs, ", ") | |
| 498 | + | data.HasFDs = len(fdExprs) > 0 | |
| 508 | 499 | if data.CreatesChild { | |
| 509 | 500 | data.Results = "(*" + data.ChildType + ", error)" | |
| 510 | 501 | data.ErrorReturn = "nil, err" | |
| @@ -191,15 +191,14 @@ type requestData struct { | |||||
| 191 | Params string | 191 | Params string | ||
| 192 | Results string | 192 | Results string | ||
| 193 | ArgPreparations []string | 193 | ArgPreparations []string | ||
| 194 | - | ArgExprs []string | |||
| 195 | CreatesChild bool | 194 | CreatesChild bool | ||
| 196 | ChildVar string | 195 | ChildVar string | ||
| 197 | ChildType string | 196 | ChildType string | ||
| 198 | ChildFactory string | 197 | ChildFactory string | ||
| 199 | ErrorReturn string | 198 | ErrorReturn string | ||
| 200 | - | FDArgs []string | |||
| 201 | HasFDs bool | 199 | HasFDs bool | ||
| 202 | - | SendCall string | 200 | + | FDList string |
| 201 | + | ArgList string | |||
| 203 | } | 202 | } | ||
| 204 | 203 | ||||
| 205 | // argSlot is one positional argument of a request, in declaration order. A | 204 | // argSlot is one positional argument of a request, in declaration order. A | ||
| @@ -457,7 +456,6 @@ func (s *Scanner) processRequest(iface Interface, req Request, opcode int) (requ | |||||
| 457 | // them, and the descriptor list is attached to the request. | 456 | // them, and the descriptor list is attached to the request. | ||
| 458 | params = append(params, name+" int") | 457 | params = append(params, name+" int") | ||
| 459 | fdExprs = append(fdExprs, name) | 458 | fdExprs = append(fdExprs, name) | ||
| 460 | - | data.FDArgs = append(data.FDArgs, name) | |||
| 461 | expr = "uintptr(" + name + ")" | 459 | expr = "uintptr(" + name + ")" | ||
| 462 | 460 | ||||
| 463 | default: | 461 | default: | ||
| @@ -488,23 +486,16 @@ func (s *Scanner) processRequest(iface Interface, req Request, opcode int) (requ | |||||
| 488 | } | 486 | } | ||
| 489 | 487 | ||||
| 490 | data.Params = strings.Join(params, ", ") | 488 | data.Params = strings.Join(params, ", ") | ||
| 491 | - | data.ArgExprs = argExprs | |||
| 492 | args := "" | 489 | args := "" | ||
| 493 | if len(argExprs) > 0 { | 490 | if len(argExprs) > 0 { | ||
| 494 | args = ", " + strings.Join(argExprs, ", ") | 491 | args = ", " + strings.Join(argExprs, ", ") | ||
| 495 | } | 492 | } | ||
| 496 | - | // Destructors claim the proxy atomically before sending so a concurrent | 493 | + | // Context.Request owns the lifecycle: destructors claim the proxy |
| 497 | - | // second destroy cannot reach the wire. | 494 | + | // atomically, children are registered before the send and descriptors are |
| 498 | - | send := "SendRequest" | 495 | + | // closed only after a successful send. |
| 499 | - | if data.Destructor { | 496 | + | data.ArgList = args |
| 500 | - | send = "SendDestructor" | 497 | + | data.FDList = strings.Join(fdExprs, ", ") |
| 501 | - | } | 498 | + | data.HasFDs = len(fdExprs) > 0 |
| 502 | - | if len(fdExprs) > 0 { | |||
| 503 | - | data.HasFDs = true | |||
| 504 | - | data.SendCall = fmt.Sprintf("%sWithFDs(o, %d, []int{%s}%s)", send, opcode, strings.Join(fdExprs, ", "), args) | |||
| 505 | - | } else { | |||
| 506 | - | data.SendCall = fmt.Sprintf("%s(o, %d%s)", send, opcode, args) | |||
| 507 | - | } | |||
| 508 | if data.CreatesChild { | 499 | if data.CreatesChild { | ||
| 509 | data.Results = "(*" + data.ChildType + ", error)" | 500 | data.Results = "(*" + data.ChildType + ", error)" | ||
| 510 | data.ErrorReturn = "nil, err" | 501 | data.ErrorReturn = "nil, err" | ||
M internal/scanner/template.go +8 -16
| @@ -2,8 +2,9 @@ package scanner | |||
| 2 | 2 | ||
| 3 | 3 | // protocolTemplate is the template for generating WLTurbo-backed Go bindings. | |
| 4 | 4 | // | |
| 5 | - | // Generated objects embed wl.BaseProxy, allocate and register child objects | |
| 6 | - | // through the wl.Context, send requests through that context, and dispatch | |
| 5 | + | // Generated objects embed wl.BaseProxy, send every request through | |
| 6 | + | // wl.Context.Request (which owns version checks, child registration and FD | |
| 7 | + | // cleanup), and dispatch | |
| 7 | 8 | // typed events to registered handlers. Nothing in the generated code opens a | |
| 8 | 9 | // socket or frames messages itself: that is the transport's job. | |
| 9 | 10 | const protocolTemplate = `// Code generated by wlturbo-scanner. DO NOT EDIT. | |
| @@ -50,10 +51,6 @@ func New{{$iface.GoName}}(ctx *wl.Context) *{{$iface.GoName}} { | |||
| 50 | 51 | // {{.Doc}} | |
| 51 | 52 | {{- end}} | |
| 52 | 53 | func (o *{{$iface.GoName}}) {{.GoName}}({{.Params}}) {{.Results}} { | |
| 53 | - | if err := o.Context().CheckProxy(o); err != nil { return {{.ErrorReturn}} } | |
| 54 | - | {{- if gt .Since 1}} | |
| 55 | - | if err := wl.CheckVersion(o.Version(), {{.Since}}, "{{$iface.Name}}.{{.Name}}"); err != nil { return {{.ErrorReturn}} } | |
| 56 | - | {{- end}} | |
| 57 | 54 | {{- range .ArgPreparations}} | |
| 58 | 55 | {{.}} | |
| 59 | 56 | {{- end}} | |
| @@ -64,19 +61,14 @@ if err := o.Context().CheckProxy(o); err != nil { return {{.ErrorReturn}} } | |||
| 64 | 61 | {{.ChildVar}} := &{{.ChildType}}{} | |
| 65 | 62 | {{.ChildVar}}.SetContext(o.Context()) | |
| 66 | 63 | {{- end}} | |
| 67 | - | {{.ChildVar}}.SetID(o.Context().AllocateID()) | |
| 68 | - | {{.ChildVar}}.SetVersion(o.Version()) | |
| 69 | - | o.Context().Register({{.ChildVar}}) | |
| 70 | - | {{- end}} | |
| 71 | - | if err := o.Context().{{.SendCall}}; err != nil { | |
| 72 | - | {{- if .CreatesChild}} | |
| 73 | - | o.Context().Unregister({{.ChildVar}}) | |
| 74 | 64 | {{- end}} | |
| 65 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: {{.Opcode}}, Name: "{{$iface.Name}}.{{.Name}}" | |
| 66 | + | {{- if gt .Since 1}}, Since: {{.Since}}{{end}} | |
| 67 | + | {{- if .Destructor}}, Destructor: true{{end}} | |
| 68 | + | {{- if .CreatesChild}}, Child: {{.ChildVar}}{{end}} | |
| 69 | + | {{- if .HasFDs}}, FDs: []int{ {{- .FDList -}} }{{end}}}{{.ArgList}}); err != nil { | |
| 75 | 70 | return {{.ErrorReturn}} | |
| 76 | 71 | } | |
| 77 | - | {{- range .FDArgs}} | |
| 78 | - | _ = wl.CloseSentFD({{.}}) | |
| 79 | - | {{- end}} | |
| 80 | 72 | {{- if .CreatesChild}} | |
| 81 | 73 | return {{.ChildVar}}, nil | |
| 82 | 74 | {{- else}} | |
| @@ -2,8 +2,9 @@ package scanner | |||||
| 2 | 2 | ||||
| 3 | // protocolTemplate is the template for generating WLTurbo-backed Go bindings. | 3 | // protocolTemplate is the template for generating WLTurbo-backed Go bindings. | ||
| 4 | // | 4 | // | ||
| 5 | - | // Generated objects embed wl.BaseProxy, allocate and register child objects | 5 | + | // Generated objects embed wl.BaseProxy, send every request through |
| 6 | - | // through the wl.Context, send requests through that context, and dispatch | 6 | + | // wl.Context.Request (which owns version checks, child registration and FD |
| 7 | + | // cleanup), and dispatch | |||
| 7 | // typed events to registered handlers. Nothing in the generated code opens a | 8 | // typed events to registered handlers. Nothing in the generated code opens a | ||
| 8 | // socket or frames messages itself: that is the transport's job. | 9 | // socket or frames messages itself: that is the transport's job. | ||
| 9 | const protocolTemplate = `// Code generated by wlturbo-scanner. DO NOT EDIT. | 10 | const protocolTemplate = `// Code generated by wlturbo-scanner. DO NOT EDIT. | ||
| @@ -50,10 +51,6 @@ func New{{$iface.GoName}}(ctx *wl.Context) *{{$iface.GoName}} { | |||||
| 50 | // {{.Doc}} | 51 | // {{.Doc}} | ||
| 51 | {{- end}} | 52 | {{- end}} | ||
| 52 | func (o *{{$iface.GoName}}) {{.GoName}}({{.Params}}) {{.Results}} { | 53 | func (o *{{$iface.GoName}}) {{.GoName}}({{.Params}}) {{.Results}} { | ||
| 53 | - | if err := o.Context().CheckProxy(o); err != nil { return {{.ErrorReturn}} } | |||
| 54 | - | {{- if gt .Since 1}} | |||
| 55 | - | if err := wl.CheckVersion(o.Version(), {{.Since}}, "{{$iface.Name}}.{{.Name}}"); err != nil { return {{.ErrorReturn}} } | |||
| 56 | - | {{- end}} | |||
| 57 | {{- range .ArgPreparations}} | 54 | {{- range .ArgPreparations}} | ||
| 58 | {{.}} | 55 | {{.}} | ||
| 59 | {{- end}} | 56 | {{- end}} | ||
| @@ -64,19 +61,14 @@ if err := o.Context().CheckProxy(o); err != nil { return {{.ErrorReturn}} } | |||||
| 64 | {{.ChildVar}} := &{{.ChildType}}{} | 61 | {{.ChildVar}} := &{{.ChildType}}{} | ||
| 65 | {{.ChildVar}}.SetContext(o.Context()) | 62 | {{.ChildVar}}.SetContext(o.Context()) | ||
| 66 | {{- end}} | 63 | {{- end}} | ||
| 67 | - | {{.ChildVar}}.SetID(o.Context().AllocateID()) | |||
| 68 | - | {{.ChildVar}}.SetVersion(o.Version()) | |||
| 69 | - | o.Context().Register({{.ChildVar}}) | |||
| 70 | - | {{- end}} | |||
| 71 | - | if err := o.Context().{{.SendCall}}; err != nil { | |||
| 72 | - | {{- if .CreatesChild}} | |||
| 73 | - | o.Context().Unregister({{.ChildVar}}) | |||
| 74 | {{- end}} | 64 | {{- end}} | ||
| 65 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: {{.Opcode}}, Name: "{{$iface.Name}}.{{.Name}}" | |||
| 66 | + | {{- if gt .Since 1}}, Since: {{.Since}}{{end}} | |||
| 67 | + | {{- if .Destructor}}, Destructor: true{{end}} | |||
| 68 | + | {{- if .CreatesChild}}, Child: {{.ChildVar}}{{end}} | |||
| 69 | + | {{- if .HasFDs}}, FDs: []int{ {{- .FDList -}} }{{end}}}{{.ArgList}}); err != nil { | |||
| 75 | return {{.ErrorReturn}} | 70 | return {{.ErrorReturn}} | ||
| 76 | } | 71 | } | ||
| 77 | - | {{- range .FDArgs}} | |||
| 78 | - | _ = wl.CloseSentFD({{.}}) | |||
| 79 | - | {{- end}} | |||
| 80 | {{- if .CreatesChild}} | 72 | {{- if .CreatesChild}} | ||
| 81 | return {{.ChildVar}}, nil | 73 | return {{.ChildVar}}, nil | ||
| 82 | {{- else}} | 74 | {{- else}} | ||
M protocol/core/wayland_generated.go +69 -384
| @@ -773,16 +773,9 @@ func NewCompositor(ctx *wl.Context) *Compositor { | |||
| 773 | 773 | ||
| 774 | 774 | // Ask the compositor to create a new surface. | |
| 775 | 775 | func (o *Compositor) CreateSurface() (*Surface, error) { | |
| 776 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 777 | - | return nil, err | |
| 778 | - | } | |
| 779 | 776 | child := &Surface{} | |
| 780 | 777 | child.SetContext(o.Context()) | |
| 781 | - | child.SetID(o.Context().AllocateID()) | |
| 782 | - | child.SetVersion(o.Version()) | |
| 783 | - | o.Context().Register(child) | |
| 784 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |
| 785 | - | o.Context().Unregister(child) | |
| 778 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_compositor.create_surface", Child: child}, child); err != nil { | |
| 786 | 779 | return nil, err | |
| 787 | 780 | } | |
| 788 | 781 | return child, nil | |
| @@ -790,16 +783,9 @@ func (o *Compositor) CreateSurface() (*Surface, error) { | |||
| 790 | 783 | ||
| 791 | 784 | // Ask the compositor to create a new region. | |
| 792 | 785 | func (o *Compositor) CreateRegion() (*Region, error) { | |
| 793 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 794 | - | return nil, err | |
| 795 | - | } | |
| 796 | 786 | child := &Region{} | |
| 797 | 787 | child.SetContext(o.Context()) | |
| 798 | - | child.SetID(o.Context().AllocateID()) | |
| 799 | - | child.SetVersion(o.Version()) | |
| 800 | - | o.Context().Register(child) | |
| 801 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |
| 802 | - | o.Context().Unregister(child) | |
| 788 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_compositor.create_region", Child: child}, child); err != nil { | |
| 803 | 789 | return nil, err | |
| 804 | 790 | } | |
| 805 | 791 | return child, nil | |
| @@ -807,13 +793,7 @@ func (o *Compositor) CreateRegion() (*Region, error) { | |||
| 807 | 793 | ||
| 808 | 794 | // This request destroys the wl_compositor. This has no effect on any other objects. | |
| 809 | 795 | func (o *Compositor) Release() error { | |
| 810 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 811 | - | return err | |
| 812 | - | } | |
| 813 | - | if err := wl.CheckVersion(o.Version(), 7, "wl_compositor.release"); err != nil { | |
| 814 | - | return err | |
| 815 | - | } | |
| 816 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |
| 796 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_compositor.release", Since: 7, Destructor: true}); err != nil { | |
| 817 | 797 | return err | |
| 818 | 798 | } | |
| 819 | 799 | return nil | |
| @@ -852,16 +832,9 @@ func NewShmPool(ctx *wl.Context) *ShmPool { | |||
| 852 | 832 | ||
| 853 | 833 | // Create a wl_buffer object from the pool. The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event. A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it. | |
| 854 | 834 | func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride int32, format uint32) (*Buffer, error) { | |
| 855 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 856 | - | return nil, err | |
| 857 | - | } | |
| 858 | 835 | child := &Buffer{} | |
| 859 | 836 | child.SetContext(o.Context()) | |
| 860 | - | child.SetID(o.Context().AllocateID()) | |
| 861 | - | child.SetVersion(o.Version()) | |
| 862 | - | o.Context().Register(child) | |
| 863 | - | if err := o.Context().SendRequest(o, 0, child, offset, width, height, stride, format); err != nil { | |
| 864 | - | o.Context().Unregister(child) | |
| 837 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm_pool.create_buffer", Child: child}, child, offset, width, height, stride, format); err != nil { | |
| 865 | 838 | return nil, err | |
| 866 | 839 | } | |
| 867 | 840 | return child, nil | |
| @@ -869,10 +842,7 @@ func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride i | |||
| 869 | 842 | ||
| 870 | 843 | // Destroy the shared memory pool. The mmapped memory will be released when all buffers that have been created from this pool are gone. | |
| 871 | 844 | func (o *ShmPool) Destroy() error { | |
| 872 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 873 | - | return err | |
| 874 | - | } | |
| 875 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 845 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm_pool.destroy", Destructor: true}); err != nil { | |
| 876 | 846 | return err | |
| 877 | 847 | } | |
| 878 | 848 | return nil | |
| @@ -880,10 +850,7 @@ func (o *ShmPool) Destroy() error { | |||
| 880 | 850 | ||
| 881 | 851 | // This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. This request only changes the amount of bytes that are mmapped by the server and does not touch the file corresponding to the file descriptor passed at creation time. It is the client's responsibility to ensure that the file is at least as big as the new pool size. | |
| 882 | 852 | func (o *ShmPool) Resize(size int32) error { | |
| 883 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 884 | - | return err | |
| 885 | - | } | |
| 886 | - | if err := o.Context().SendRequest(o, 2, size); err != nil { | |
| 853 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shm_pool.resize"}, size); err != nil { | |
| 887 | 854 | return err | |
| 888 | 855 | } | |
| 889 | 856 | return nil | |
| @@ -926,31 +893,17 @@ func NewShm(ctx *wl.Context) *Shm { | |||
| 926 | 893 | ||
| 927 | 894 | // Create a new wl_shm_pool object. The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool. | |
| 928 | 895 | func (o *Shm) CreatePool(fd int, size int32) (*ShmPool, error) { | |
| 929 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 930 | - | return nil, err | |
| 931 | - | } | |
| 932 | 896 | child := &ShmPool{} | |
| 933 | 897 | child.SetContext(o.Context()) | |
| 934 | - | child.SetID(o.Context().AllocateID()) | |
| 935 | - | child.SetVersion(o.Version()) | |
| 936 | - | o.Context().Register(child) | |
| 937 | - | if err := o.Context().SendRequestWithFDs(o, 0, []int{fd}, child, uintptr(fd), size); err != nil { | |
| 938 | - | o.Context().Unregister(child) | |
| 898 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm.create_pool", Child: child, FDs: []int{fd}}, child, uintptr(fd), size); err != nil { | |
| 939 | 899 | return nil, err | |
| 940 | 900 | } | |
| 941 | - | _ = wl.CloseSentFD(fd) | |
| 942 | 901 | return child, nil | |
| 943 | 902 | } | |
| 944 | 903 | ||
| 945 | 904 | // Using this request a client can tell the server that it is not going to use the shm object anymore. Objects created via this interface remain unaffected. | |
| 946 | 905 | func (o *Shm) Release() error { | |
| 947 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 948 | - | return err | |
| 949 | - | } | |
| 950 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_shm.release"); err != nil { | |
| 951 | - | return err | |
| 952 | - | } | |
| 953 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 906 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm.release", Since: 2, Destructor: true}); err != nil { | |
| 954 | 907 | return err | |
| 955 | 908 | } | |
| 956 | 909 | return nil | |
| @@ -1024,10 +977,7 @@ func NewBuffer(ctx *wl.Context) *Buffer { | |||
| 1024 | 977 | ||
| 1025 | 978 | // Destroy a buffer. If and how you need to release the backing storage is defined by the buffer factory interface. For possible side-effects to a surface, see wl_surface.attach. | |
| 1026 | 979 | func (o *Buffer) Destroy() error { | |
| 1027 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1028 | - | return err | |
| 1029 | - | } | |
| 1030 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 980 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_buffer.destroy", Destructor: true}); err != nil { | |
| 1031 | 981 | return err | |
| 1032 | 982 | } | |
| 1033 | 983 | return nil | |
| @@ -1102,10 +1052,7 @@ func NewDataOffer(ctx *wl.Context) *DataOffer { | |||
| 1102 | 1052 | ||
| 1103 | 1053 | // Indicate that the client can accept the given mime type, or NULL for not accepted. For objects of version 2 or older, this request is used by the client to give feedback whether the client can receive the given mime type, or NULL if none is accepted; the feedback does not determine whether the drag-and-drop operation succeeds or not. For objects of version 3 or newer, this request determines the final result of the drag-and-drop operation. If the end result is that no mime types were accepted, the drag-and-drop operation will be cancelled and the corresponding drag source will receive wl_data_source.cancelled. Clients may still use this event in conjunction with wl_data_source.action for feedback. | |
| 1104 | 1054 | func (o *DataOffer) Accept(serial uint32, mimeType string) error { | |
| 1105 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1106 | - | return err | |
| 1107 | - | } | |
| 1108 | - | if err := o.Context().SendRequest(o, 0, serial, mimeType); err != nil { | |
| 1055 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_offer.accept"}, serial, mimeType); err != nil { | |
| 1109 | 1056 | return err | |
| 1110 | 1057 | } | |
| 1111 | 1058 | return nil | |
| @@ -1113,22 +1060,15 @@ func (o *DataOffer) Accept(serial uint32, mimeType string) error { | |||
| 1113 | 1060 | ||
| 1114 | 1061 | // To transfer the offered data, the client issues this request and indicates the mime type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor. The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete. This request may happen multiple times for different mime types, both before and after wl_data_device.drop. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance. | |
| 1115 | 1062 | func (o *DataOffer) Receive(mimeType string, fd int) error { | |
| 1116 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1117 | - | return err | |
| 1118 | - | } | |
| 1119 | - | if err := o.Context().SendRequestWithFDs(o, 1, []int{fd}, mimeType, uintptr(fd)); err != nil { | |
| 1063 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_offer.receive", FDs: []int{fd}}, mimeType, uintptr(fd)); err != nil { | |
| 1120 | 1064 | return err | |
| 1121 | 1065 | } | |
| 1122 | - | _ = wl.CloseSentFD(fd) | |
| 1123 | 1066 | return nil | |
| 1124 | 1067 | } | |
| 1125 | 1068 | ||
| 1126 | 1069 | // Destroy the data offer. | |
| 1127 | 1070 | func (o *DataOffer) Destroy() error { | |
| 1128 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1129 | - | return err | |
| 1130 | - | } | |
| 1131 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |
| 1071 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_offer.destroy", Destructor: true}); err != nil { | |
| 1132 | 1072 | return err | |
| 1133 | 1073 | } | |
| 1134 | 1074 | return nil | |
| @@ -1136,13 +1076,7 @@ func (o *DataOffer) Destroy() error { | |||
| 1136 | 1076 | ||
| 1137 | 1077 | // Notifies the compositor that the drag destination successfully finished the drag-and-drop operation. Upon receiving this request, the compositor will emit wl_data_source.dnd_finished on the drag source client. It is a client error to perform other requests than wl_data_offer.destroy after this one. It is also an error to perform this request after a NULL mime type has been set in wl_data_offer.accept or no action was received through wl_data_offer.action. If wl_data_offer.finish request is received for a non drag and drop operation, the invalid_finish protocol error is raised. | |
| 1138 | 1078 | func (o *DataOffer) Finish() error { | |
| 1139 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1140 | - | return err | |
| 1141 | - | } | |
| 1142 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_offer.finish"); err != nil { | |
| 1143 | - | return err | |
| 1144 | - | } | |
| 1145 | - | if err := o.Context().SendRequest(o, 3); err != nil { | |
| 1079 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_data_offer.finish", Since: 3}); err != nil { | |
| 1146 | 1080 | return err | |
| 1147 | 1081 | } | |
| 1148 | 1082 | return nil | |
| @@ -1150,13 +1084,7 @@ func (o *DataOffer) Finish() error { | |||
| 1150 | 1084 | ||
| 1151 | 1085 | // Sets the actions that the destination side client supports for this operation. This request may trigger the emission of wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. This request can be called multiple times throughout the drag-and-drop operation, typically in response to wl_data_device.enter or wl_data_device.motion events. This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, the drag source will receive wl_data_source.cancelled. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, and the preferred_action argument must only contain one of those values set, otherwise it will result in a protocol error. While managing an "ask" action, the destination drag-and-drop client may perform further wl_data_offer.receive requests, and is expected to perform one last wl_data_offer.set_actions request with a preferred action other than "ask" (and optionally wl_data_offer.accept) before requesting wl_data_offer.finish, in order to convey the action selected by the user. If the preferred action is not in the wl_data_offer.source_actions mask, an error will be raised. If the "ask" action is dismissed (e.g. user cancellation), the client is expected to perform wl_data_offer.destroy right away. This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise. | |
| 1152 | 1086 | func (o *DataOffer) SetActions(dndActions uint32, preferredAction uint32) error { | |
| 1153 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1154 | - | return err | |
| 1155 | - | } | |
| 1156 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_offer.set_actions"); err != nil { | |
| 1157 | - | return err | |
| 1158 | - | } | |
| 1159 | - | if err := o.Context().SendRequest(o, 4, dndActions, preferredAction); err != nil { | |
| 1087 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_data_offer.set_actions", Since: 3}, dndActions, preferredAction); err != nil { | |
| 1160 | 1088 | return err | |
| 1161 | 1089 | } | |
| 1162 | 1090 | return nil | |
| @@ -1297,10 +1225,7 @@ func NewDataSource(ctx *wl.Context) *DataSource { | |||
| 1297 | 1225 | ||
| 1298 | 1226 | // This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types. | |
| 1299 | 1227 | func (o *DataSource) Offer(mimeType string) error { | |
| 1300 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1301 | - | return err | |
| 1302 | - | } | |
| 1303 | - | if err := o.Context().SendRequest(o, 0, mimeType); err != nil { | |
| 1228 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_source.offer"}, mimeType); err != nil { | |
| 1304 | 1229 | return err | |
| 1305 | 1230 | } | |
| 1306 | 1231 | return nil | |
| @@ -1308,10 +1233,7 @@ func (o *DataSource) Offer(mimeType string) error { | |||
| 1308 | 1233 | ||
| 1309 | 1234 | // Destroy the data source. | |
| 1310 | 1235 | func (o *DataSource) Destroy() error { | |
| 1311 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1312 | - | return err | |
| 1313 | - | } | |
| 1314 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 1236 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_source.destroy", Destructor: true}); err != nil { | |
| 1315 | 1237 | return err | |
| 1316 | 1238 | } | |
| 1317 | 1239 | return nil | |
| @@ -1319,13 +1241,7 @@ func (o *DataSource) Destroy() error { | |||
| 1319 | 1241 | ||
| 1320 | 1242 | // Sets the actions that the source side client supports for this operation. This request may trigger wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, otherwise it will result in a protocol error. This request must be made once only, and can only be made on sources used in drag-and-drop, so it must be performed before wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error. | |
| 1321 | 1243 | func (o *DataSource) SetActions(dndActions uint32) error { | |
| 1322 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1323 | - | return err | |
| 1324 | - | } | |
| 1325 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_source.set_actions"); err != nil { | |
| 1326 | - | return err | |
| 1327 | - | } | |
| 1328 | - | if err := o.Context().SendRequest(o, 2, dndActions); err != nil { | |
| 1244 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_source.set_actions", Since: 3}, dndActions); err != nil { | |
| 1329 | 1245 | return err | |
| 1330 | 1246 | } | |
| 1331 | 1247 | return nil | |
| @@ -1561,9 +1477,6 @@ func NewDataDevice(ctx *wl.Context) *DataDevice { | |||
| 1561 | 1477 | ||
| 1562 | 1478 | // This request asks the compositor to start a drag-and-drop operation on behalf of the client. The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled. The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial. The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. The input region is ignored for wl_surfaces with the role of a drag-and-drop icon. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | |
| 1563 | 1479 | func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surface, serial uint32) error { | |
| 1564 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1565 | - | return err | |
| 1566 | - | } | |
| 1567 | 1480 | var arg0 wl.Object | |
| 1568 | 1481 | if source != nil { | |
| 1569 | 1482 | arg0 = source | |
| @@ -1576,7 +1489,7 @@ func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surfac | |||
| 1576 | 1489 | if icon != nil { | |
| 1577 | 1490 | arg2 = icon | |
| 1578 | 1491 | } | |
| 1579 | - | if err := o.Context().SendRequest(o, 0, arg0, arg1, arg2, serial); err != nil { | |
| 1492 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device.start_drag"}, arg0, arg1, arg2, serial); err != nil { | |
| 1580 | 1493 | return err | |
| 1581 | 1494 | } | |
| 1582 | 1495 | return nil | |
| @@ -1584,14 +1497,11 @@ func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surfac | |||
| 1584 | 1497 | ||
| 1585 | 1498 | // This request asks the compositor to set the selection to the data from the source on behalf of the client. To unset the selection, set the source to NULL. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | |
| 1586 | 1499 | func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error { | |
| 1587 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1588 | - | return err | |
| 1589 | - | } | |
| 1590 | 1500 | var arg0 wl.Object | |
| 1591 | 1501 | if source != nil { | |
| 1592 | 1502 | arg0 = source | |
| 1593 | 1503 | } | |
| 1594 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | |
| 1504 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device.set_selection"}, arg0, serial); err != nil { | |
| 1595 | 1505 | return err | |
| 1596 | 1506 | } | |
| 1597 | 1507 | return nil | |
| @@ -1599,13 +1509,7 @@ func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error { | |||
| 1599 | 1509 | ||
| 1600 | 1510 | // This request destroys the data device. | |
| 1601 | 1511 | func (o *DataDevice) Release() error { | |
| 1602 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1603 | - | return err | |
| 1604 | - | } | |
| 1605 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_data_device.release"); err != nil { | |
| 1606 | - | return err | |
| 1607 | - | } | |
| 1608 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |
| 1512 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device.release", Since: 2, Destructor: true}); err != nil { | |
| 1609 | 1513 | return err | |
| 1610 | 1514 | } | |
| 1611 | 1515 | return nil | |
| @@ -1839,16 +1743,9 @@ func NewDataDeviceManager(ctx *wl.Context) *DataDeviceManager { | |||
| 1839 | 1743 | ||
| 1840 | 1744 | // Create a new data source. | |
| 1841 | 1745 | func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) { | |
| 1842 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1843 | - | return nil, err | |
| 1844 | - | } | |
| 1845 | 1746 | child := &DataSource{} | |
| 1846 | 1747 | child.SetContext(o.Context()) | |
| 1847 | - | child.SetID(o.Context().AllocateID()) | |
| 1848 | - | child.SetVersion(o.Version()) | |
| 1849 | - | o.Context().Register(child) | |
| 1850 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |
| 1851 | - | o.Context().Unregister(child) | |
| 1748 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device_manager.create_data_source", Child: child}, child); err != nil { | |
| 1852 | 1749 | return nil, err | |
| 1853 | 1750 | } | |
| 1854 | 1751 | return child, nil | |
| @@ -1856,20 +1753,13 @@ func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) { | |||
| 1856 | 1753 | ||
| 1857 | 1754 | // Create a new data device for a given seat. | |
| 1858 | 1755 | func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) { | |
| 1859 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1860 | - | return nil, err | |
| 1861 | - | } | |
| 1862 | 1756 | var arg1 wl.Object | |
| 1863 | 1757 | if seat != nil { | |
| 1864 | 1758 | arg1 = seat | |
| 1865 | 1759 | } | |
| 1866 | 1760 | child := &DataDevice{} | |
| 1867 | 1761 | child.SetContext(o.Context()) | |
| 1868 | - | child.SetID(o.Context().AllocateID()) | |
| 1869 | - | child.SetVersion(o.Version()) | |
| 1870 | - | o.Context().Register(child) | |
| 1871 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 1872 | - | o.Context().Unregister(child) | |
| 1762 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device_manager.get_data_device", Child: child}, child, arg1); err != nil { | |
| 1873 | 1763 | return nil, err | |
| 1874 | 1764 | } | |
| 1875 | 1765 | return child, nil | |
| @@ -1877,13 +1767,7 @@ func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) { | |||
| 1877 | 1767 | ||
| 1878 | 1768 | // This request destroys the wl_data_device_manager. This has no effect on any other objects. | |
| 1879 | 1769 | func (o *DataDeviceManager) Release() error { | |
| 1880 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1881 | - | return err | |
| 1882 | - | } | |
| 1883 | - | if err := wl.CheckVersion(o.Version(), 4, "wl_data_device_manager.release"); err != nil { | |
| 1884 | - | return err | |
| 1885 | - | } | |
| 1886 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |
| 1770 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device_manager.release", Since: 4, Destructor: true}); err != nil { | |
| 1887 | 1771 | return err | |
| 1888 | 1772 | } | |
| 1889 | 1773 | return nil | |
| @@ -1922,20 +1806,13 @@ func NewShell(ctx *wl.Context) *Shell { | |||
| 1922 | 1806 | ||
| 1923 | 1807 | // Create a shell surface for an existing surface. This gives the wl_surface the role of a shell surface. If the wl_surface already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface. | |
| 1924 | 1808 | func (o *Shell) GetShellSurface(surface *Surface) (*ShellSurface, error) { | |
| 1925 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1926 | - | return nil, err | |
| 1927 | - | } | |
| 1928 | 1809 | var arg1 wl.Object | |
| 1929 | 1810 | if surface != nil { | |
| 1930 | 1811 | arg1 = surface | |
| 1931 | 1812 | } | |
| 1932 | 1813 | child := &ShellSurface{} | |
| 1933 | 1814 | child.SetContext(o.Context()) | |
| 1934 | - | child.SetID(o.Context().AllocateID()) | |
| 1935 | - | child.SetVersion(o.Version()) | |
| 1936 | - | o.Context().Register(child) | |
| 1937 | - | if err := o.Context().SendRequest(o, 0, child, arg1); err != nil { | |
| 1938 | - | o.Context().Unregister(child) | |
| 1815 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell.get_shell_surface", Child: child}, child, arg1); err != nil { | |
| 1939 | 1816 | return nil, err | |
| 1940 | 1817 | } | |
| 1941 | 1818 | return child, nil | |
| @@ -1980,10 +1857,7 @@ func NewShellSurface(ctx *wl.Context) *ShellSurface { | |||
| 1980 | 1857 | ||
| 1981 | 1858 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. | |
| 1982 | 1859 | func (o *ShellSurface) Pong(serial uint32) error { | |
| 1983 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1984 | - | return err | |
| 1985 | - | } | |
| 1986 | - | if err := o.Context().SendRequest(o, 0, serial); err != nil { | |
| 1860 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell_surface.pong"}, serial); err != nil { | |
| 1987 | 1861 | return err | |
| 1988 | 1862 | } | |
| 1989 | 1863 | return nil | |
| @@ -1991,14 +1865,11 @@ func (o *ShellSurface) Pong(serial uint32) error { | |||
| 1991 | 1865 | ||
| 1992 | 1866 | // Start a pointer-driven move of the surface. This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). | |
| 1993 | 1867 | func (o *ShellSurface) Move(seat *Seat, serial uint32) error { | |
| 1994 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1995 | - | return err | |
| 1996 | - | } | |
| 1997 | 1868 | var arg0 wl.Object | |
| 1998 | 1869 | if seat != nil { | |
| 1999 | 1870 | arg0 = seat | |
| 2000 | 1871 | } | |
| 2001 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | |
| 1872 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shell_surface.move"}, arg0, serial); err != nil { | |
| 2002 | 1873 | return err | |
| 2003 | 1874 | } | |
| 2004 | 1875 | return nil | |
| @@ -2006,14 +1877,11 @@ func (o *ShellSurface) Move(seat *Seat, serial uint32) error { | |||
| 2006 | 1877 | ||
| 2007 | 1878 | // Start a pointer-driven resizing of the surface. This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). | |
| 2008 | 1879 | func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error { | |
| 2009 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2010 | - | return err | |
| 2011 | - | } | |
| 2012 | 1880 | var arg0 wl.Object | |
| 2013 | 1881 | if seat != nil { | |
| 2014 | 1882 | arg0 = seat | |
| 2015 | 1883 | } | |
| 2016 | - | if err := o.Context().SendRequest(o, 2, arg0, serial, edges); err != nil { | |
| 1884 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shell_surface.resize"}, arg0, serial, edges); err != nil { | |
| 2017 | 1885 | return err | |
| 2018 | 1886 | } | |
| 2019 | 1887 | return nil | |
| @@ -2021,10 +1889,7 @@ func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error { | |||
| 2021 | 1889 | ||
| 2022 | 1890 | // Map the surface as a toplevel surface. A toplevel surface is not fullscreen, maximized or transient. | |
| 2023 | 1891 | func (o *ShellSurface) SetToplevel() error { | |
| 2024 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2025 | - | return err | |
| 2026 | - | } | |
| 2027 | - | if err := o.Context().SendRequest(o, 3); err != nil { | |
| 1892 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_shell_surface.set_toplevel"}); err != nil { | |
| 2028 | 1893 | return err | |
| 2029 | 1894 | } | |
| 2030 | 1895 | return nil | |
| @@ -2032,14 +1897,11 @@ func (o *ShellSurface) SetToplevel() error { | |||
| 2032 | 1897 | ||
| 2033 | 1898 | // Map the surface relative to an existing surface. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour. | |
| 2034 | 1899 | func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uint32) error { | |
| 2035 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2036 | - | return err | |
| 2037 | - | } | |
| 2038 | 1900 | var arg0 wl.Object | |
| 2039 | 1901 | if parent != nil { | |
| 2040 | 1902 | arg0 = parent | |
| 2041 | 1903 | } | |
| 2042 | - | if err := o.Context().SendRequest(o, 4, arg0, x, y, flags); err != nil { | |
| 1904 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_shell_surface.set_transient"}, arg0, x, y, flags); err != nil { | |
| 2043 | 1905 | return err | |
| 2044 | 1906 | } | |
| 2045 | 1907 | return nil | |
| @@ -2047,14 +1909,11 @@ func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uin | |||
| 2047 | 1909 | ||
| 2048 | 1910 | // Map the surface as a fullscreen surface. If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The client may specify a method to resolve a size conflict between the output size and the surface size - this is provided through the method parameter. The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. A method of "scale" or "driver" implies a scaling operation of the surface, either via a direct scaling operation or a change of the output mode. This will override any kind of output scaling, so that mapping a surface with a buffer size equal to the mode can fill the screen independent of buffer_scale. A method of "fill" means we don't scale up the buffer, however any output scale is applied. This means that you may run into an edge case where the application maps a buffer with the same size of the output mode but buffer_scale 1 (thus making a surface larger than the output). In this case it is allowed to downscale the results to fit the screen. The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen. | |
| 2049 | 1911 | func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Output) error { | |
| 2050 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2051 | - | return err | |
| 2052 | - | } | |
| 2053 | 1912 | var arg2 wl.Object | |
| 2054 | 1913 | if output != nil { | |
| 2055 | 1914 | arg2 = output | |
| 2056 | 1915 | } | |
| 2057 | - | if err := o.Context().SendRequest(o, 5, method, framerate, arg2); err != nil { | |
| 1916 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_shell_surface.set_fullscreen"}, method, framerate, arg2); err != nil { | |
| 2058 | 1917 | return err | |
| 2059 | 1918 | } | |
| 2060 | 1919 | return nil | |
| @@ -2062,9 +1921,6 @@ func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Ou | |||
| 2062 | 1921 | ||
| 2063 | 1922 | // Map the surface as a popup. A popup surface is a transient surface with an added pointer grab. An existing implicit grab will be changed to owner-events mode, and the popup grab will continue after the implicit grab ends (i.e. releasing the mouse button does not cause the popup to be unmapped). The popup grab continues until the window is destroyed or a mouse button is pressed in any other client's window. A click in any of the client's surfaces is reported as normal, however, clicks in other clients' surfaces will be discarded and trigger the callback. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. | |
| 2064 | 1923 | func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x int32, y int32, flags uint32) error { | |
| 2065 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2066 | - | return err | |
| 2067 | - | } | |
| 2068 | 1924 | var arg0 wl.Object | |
| 2069 | 1925 | if seat != nil { | |
| 2070 | 1926 | arg0 = seat | |
| @@ -2073,7 +1929,7 @@ func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x in | |||
| 2073 | 1929 | if parent != nil { | |
| 2074 | 1930 | arg2 = parent | |
| 2075 | 1931 | } | |
| 2076 | - | if err := o.Context().SendRequest(o, 6, arg0, serial, arg2, x, y, flags); err != nil { | |
| 1932 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_shell_surface.set_popup"}, arg0, serial, arg2, x, y, flags); err != nil { | |
| 2077 | 1933 | return err | |
| 2078 | 1934 | } | |
| 2079 | 1935 | return nil | |
| @@ -2081,14 +1937,11 @@ func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x in | |||
| 2081 | 1937 | ||
| 2082 | 1938 | // Map the surface as a maximized surface. If an output parameter is given then the surface will be maximized on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The compositor will reply with a configure event telling the expected new surface size. The operation is completed on the next buffer attach to this surface. A maximized surface typically fills the entire output it is bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface. The details depend on the compositor implementation. | |
| 2083 | 1939 | func (o *ShellSurface) SetMaximized(output *Output) error { | |
| 2084 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2085 | - | return err | |
| 2086 | - | } | |
| 2087 | 1940 | var arg0 wl.Object | |
| 2088 | 1941 | if output != nil { | |
| 2089 | 1942 | arg0 = output | |
| 2090 | 1943 | } | |
| 2091 | - | if err := o.Context().SendRequest(o, 7, arg0); err != nil { | |
| 1944 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_shell_surface.set_maximized"}, arg0); err != nil { | |
| 2092 | 1945 | return err | |
| 2093 | 1946 | } | |
| 2094 | 1947 | return nil | |
| @@ -2096,10 +1949,7 @@ func (o *ShellSurface) SetMaximized(output *Output) error { | |||
| 2096 | 1949 | ||
| 2097 | 1950 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | |
| 2098 | 1951 | func (o *ShellSurface) SetTitle(title string) error { | |
| 2099 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2100 | - | return err | |
| 2101 | - | } | |
| 2102 | - | if err := o.Context().SendRequest(o, 8, title); err != nil { | |
| 1952 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_shell_surface.set_title"}, title); err != nil { | |
| 2103 | 1953 | return err | |
| 2104 | 1954 | } | |
| 2105 | 1955 | return nil | |
| @@ -2107,10 +1957,7 @@ func (o *ShellSurface) SetTitle(title string) error { | |||
| 2107 | 1957 | ||
| 2108 | 1958 | // Set a class for the surface. The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name (or the full path if it is a non-standard location) of the application's .desktop file as the class. | |
| 2109 | 1959 | func (o *ShellSurface) SetClass(class string) error { | |
| 2110 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2111 | - | return err | |
| 2112 | - | } | |
| 2113 | - | if err := o.Context().SendRequest(o, 9, class); err != nil { | |
| 1960 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_shell_surface.set_class"}, class); err != nil { | |
| 2114 | 1961 | return err | |
| 2115 | 1962 | } | |
| 2116 | 1963 | return nil | |
| @@ -2250,10 +2097,7 @@ func NewSurface(ctx *wl.Context) *Surface { | |||
| 2250 | 2097 | ||
| 2251 | 2098 | // Deletes the surface and invalidates its object ID. | |
| 2252 | 2099 | func (o *Surface) Destroy() error { | |
| 2253 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2254 | - | return err | |
| 2255 | - | } | |
| 2256 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 2100 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_surface.destroy", Destructor: true}); err != nil { | |
| 2257 | 2101 | return err | |
| 2258 | 2102 | } | |
| 2259 | 2103 | return nil | |
| @@ -2261,14 +2105,11 @@ func (o *Surface) Destroy() error { | |||
| 2261 | 2105 | ||
| 2262 | 2106 | // Set a buffer as the content of this surface. The new size of the surface is calculated based on the buffer size transformed by the inverse buffer_transform and the inverse buffer_scale. This means that at commit time the supplied buffer size must be an integer multiple of the buffer_scale. If that's not the case, an invalid_size error is sent. The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. Setting anything other than 0 as x and y arguments is discouraged, and should instead be replaced with using the separate wl_surface.offset request. When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an 'invalid_offset' error being raised. The x and y arguments are ignored and do not change the pending state. To achieve equivalent semantics, use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. wl_surface.commit makes the pending wl_buffer the new surface contents, and the size of the surface becomes the size calculated from the wl_buffer, as described above. After commit, there is no pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the pixels in the wl_buffer. The compositor may access the pixels at any time after the wl_surface.commit request. When the compositor will not access the pixels anymore, it will send the wl_buffer.release event. Only after receiving wl_buffer.release, the client may reuse the wl_buffer. A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor. If a pending wl_buffer has been committed to more than one wl_surface, the delivery of wl_buffer.release events becomes undefined. A well behaved client should not rely on wl_buffer.release events in this case. Instead, clients hitting this case should use wl_surface.get_release or use a protocol extension providing per-commit release notifications (if none of these options are available, a fallback can be implemented by creating multiple wl_buffer objects from the same backing storage). Destroying the wl_buffer after wl_buffer.release does not change the surface contents. Destroying the wl_buffer before wl_buffer.release is allowed as long as the underlying buffer storage isn't re-used (this can happen e.g. on client process termination). However, if the client destroys the wl_buffer before receiving the wl_buffer.release event and mutates the underlying buffer storage, the surface contents become undefined immediately. If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. If a pending wl_buffer has been destroyed, the result is not specified. Many compositors are known to remove the surface content on the following wl_surface.commit, but this behaviour is not universal. Clients seeking to maximise compatibility should not destroy pending buffers and should ensure that they explicitly remove content from surfaces, even after destroying buffers. | |
| 2263 | 2107 | func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error { | |
| 2264 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2265 | - | return err | |
| 2266 | - | } | |
| 2267 | 2108 | var arg0 wl.Object | |
| 2268 | 2109 | if buffer != nil { | |
| 2269 | 2110 | arg0 = buffer | |
| 2270 | 2111 | } | |
| 2271 | - | if err := o.Context().SendRequest(o, 1, arg0, x, y); err != nil { | |
| 2112 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_surface.attach"}, arg0, x, y); err != nil { | |
| 2272 | 2113 | return err | |
| 2273 | 2114 | } | |
| 2274 | 2115 | return nil | |
| @@ -2276,10 +2117,7 @@ func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error { | |||
| 2276 | 2117 | ||
| 2277 | 2118 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in surface-local coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. Note! New clients should not use this request. Instead damage can be posted with wl_surface.damage_buffer which uses buffer coordinates instead of surface coordinates. | |
| 2278 | 2119 | func (o *Surface) Damage(x int32, y int32, width int32, height int32) error { | |
| 2279 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2280 | - | return err | |
| 2281 | - | } | |
| 2282 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |
| 2120 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_surface.damage"}, x, y, width, height); err != nil { | |
| 2283 | 2121 | return err | |
| 2284 | 2122 | } | |
| 2285 | 2123 | return nil | |
| @@ -2287,16 +2125,9 @@ func (o *Surface) Damage(x int32, y int32, width int32, height int32) error { | |||
| 2287 | 2125 | ||
| 2288 | 2126 | // Request a notification when it is a good time to start drawing a new frame, by creating a frame callback. This is useful for throttling redrawing operations, and driving animations. When a client is animating on a wl_surface, it can use the 'frame' request to get notified when it is a good time to draw and commit the next frame of animation. If the client commits an update earlier than that, it is likely that some updates will not make it to the display, and the client is wasting resources by drawing too often. The frame request will take effect on the next wl_surface.commit. The notification will only be posted for one frame unless requested again. For a wl_surface, the notifications are posted in the order the frame requests were committed. The server must send the notifications so that a client will not send excessive updates, while still allowing the highest possible update rate for clients that wait for the reply before drawing again. The server should give some time for the client to draw and commit after sending the frame callback events to let it hit the next output refresh. A server should avoid signaling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. The callback_data passed in the callback is the current time, in milliseconds, with an undefined base. | |
| 2289 | 2127 | func (o *Surface) Frame() (*Callback, error) { | |
| 2290 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2291 | - | return nil, err | |
| 2292 | - | } | |
| 2293 | 2128 | child := &Callback{} | |
| 2294 | 2129 | child.SetContext(o.Context()) | |
| 2295 | - | child.SetID(o.Context().AllocateID()) | |
| 2296 | - | child.SetVersion(o.Version()) | |
| 2297 | - | o.Context().Register(child) | |
| 2298 | - | if err := o.Context().SendRequest(o, 3, child); err != nil { | |
| 2299 | - | o.Context().Unregister(child) | |
| 2130 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_surface.frame", Child: child}, child); err != nil { | |
| 2300 | 2131 | return nil, err | |
| 2301 | 2132 | } | |
| 2302 | 2133 | return child, nil | |
| @@ -2304,14 +2135,11 @@ func (o *Surface) Frame() (*Callback, error) { | |||
| 2304 | 2135 | ||
| 2305 | 2136 | // This request sets the region of the surface that contains opaque content. The opaque region is an optimization hint for the compositor that lets it optimize the redrawing of content behind opaque regions. Setting an opaque region is not required for correct behaviour, but marking transparent content as opaque will result in repaint artifacts. The opaque region is specified in surface-local coordinates. The compositor ignores the parts of the opaque region that fall outside of the surface. Opaque region is double-buffered state, see wl_surface.commit. wl_surface.set_opaque_region changes the pending opaque region. wl_surface.commit copies the pending region to the current region. Otherwise, the pending and current regions are never changed. The initial value for an opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. | |
| 2306 | 2137 | func (o *Surface) SetOpaqueRegion(region *Region) error { | |
| 2307 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2308 | - | return err | |
| 2309 | - | } | |
| 2310 | 2138 | var arg0 wl.Object | |
| 2311 | 2139 | if region != nil { | |
| 2312 | 2140 | arg0 = region | |
| 2313 | 2141 | } | |
| 2314 | - | if err := o.Context().SendRequest(o, 4, arg0); err != nil { | |
| 2142 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_surface.set_opaque_region"}, arg0); err != nil { | |
| 2315 | 2143 | return err | |
| 2316 | 2144 | } | |
| 2317 | 2145 | return nil | |
| @@ -2319,14 +2147,11 @@ func (o *Surface) SetOpaqueRegion(region *Region) error { | |||
| 2319 | 2147 | ||
| 2320 | 2148 | // This request sets the region of the surface that can receive pointer and touch events. Input events happening outside of this region will try the next surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. The input region is specified in surface-local coordinates. Input region is double-buffered state, see wl_surface.commit. wl_surface.set_input_region changes the pending input region. wl_surface.commit copies the pending region to the current region. Otherwise the pending and current regions are never changed, except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite. | |
| 2321 | 2149 | func (o *Surface) SetInputRegion(region *Region) error { | |
| 2322 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2323 | - | return err | |
| 2324 | - | } | |
| 2325 | 2150 | var arg0 wl.Object | |
| 2326 | 2151 | if region != nil { | |
| 2327 | 2152 | arg0 = region | |
| 2328 | 2153 | } | |
| 2329 | - | if err := o.Context().SendRequest(o, 5, arg0); err != nil { | |
| 2154 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_surface.set_input_region"}, arg0); err != nil { | |
| 2330 | 2155 | return err | |
| 2331 | 2156 | } | |
| 2332 | 2157 | return nil | |
| @@ -2334,10 +2159,7 @@ func (o *Surface) SetInputRegion(region *Region) error { | |||
| 2334 | 2159 | ||
| 2335 | 2160 | // Surface state (input, opaque, and damage regions, attached buffers, etc.) is double-buffered. Protocol requests modify the pending state, as opposed to the active state in use by the compositor. All requests that need a commit to become effective are documented to affect double-buffered state. Other interfaces may add further double-buffered surface state. A commit request atomically creates a Content Update (CU) from the pending state, even if the pending state has not been touched. The content update is placed at the end of a per-surface queue until it becomes active. After commit, the new pending state is as documented for each related request. A CU is either a Desync Content Update (DCU) or a Sync Content Update (SCU). If the surface is effectively synchronized at the commit request, it is a SCU, otherwise a DCU. When a surface transitions from effectively synchronized to effectively desynchronized, all SCUs in its queue which are not reachable by any DCU become DCUs and dependency edges from outside the queue to these CUs are removed. See wl_subsurface for the definition of 'effectively synchronized' and 'effectively desynchronized'. When a CU is placed in the queue, the CU has a dependency on the CU in front of it and to the SCU at end of the queue of every direct child surface if that SCU exists and does not have another dependent. This can form a directed acyclic graph of CUs with dependencies as edges. In addition to surface state, the CU can have constraints that must be satisfied before it can be applied. Other interfaces may add CU constraints. All DCUs which do not have a SCU in front of themselves in their queue, are candidates. If the graph that's reachable by a candidate does not have any unsatisfied constraints, the entire graph must be applied atomically. When a CU is applied, the wl_buffer is applied before all other state. This means that all coordinates in double-buffered state are relative to the newly attached wl_buffers, except for wl_surface.attach itself. If there is no newly attached wl_buffer, the coordinates are relative to the previous content update. | |
| 2336 | 2161 | func (o *Surface) Commit() error { | |
| 2337 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2338 | - | return err | |
| 2339 | - | } | |
| 2340 | - | if err := o.Context().SendRequest(o, 6); err != nil { | |
| 2162 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_surface.commit"}); err != nil { | |
| 2341 | 2163 | return err | |
| 2342 | 2164 | } | |
| 2343 | 2165 | return nil | |
| @@ -2345,13 +2167,7 @@ func (o *Surface) Commit() error { | |||
| 2345 | 2167 | ||
| 2346 | 2168 | // This request sets the transformation that the client has already applied to the content of the buffer. The accepted values for the transform parameter are the values for wl_output.transform. The compositor applies the inverse of this transformation whenever it uses the buffer contents. Buffer transform is double-buffered state, see wl_surface.commit. A newly created surface has its buffer transformation set to normal. wl_surface.set_buffer_transform changes the pending buffer transformation. wl_surface.commit copies the pending buffer transformation to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to render content according to the output transform, thus permitting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen surfaces are examples of such optimizations. Those optimizations are highly dependent on the compositor implementation, so the use of this request should be considered on a case-by-case basis. Note that if the transform value includes 90 or 270 degree rotation, the width of the buffer will become the surface height and the height of the buffer will become the surface width. If transform is not one of the values from the wl_output.transform enum the invalid_transform protocol error is raised. | |
| 2347 | 2169 | func (o *Surface) SetBufferTransform(transform int32) error { | |
| 2348 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2349 | - | return err | |
| 2350 | - | } | |
| 2351 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_surface.set_buffer_transform"); err != nil { | |
| 2352 | - | return err | |
| 2353 | - | } | |
| 2354 | - | if err := o.Context().SendRequest(o, 7, transform); err != nil { | |
| 2170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_surface.set_buffer_transform", Since: 2}, transform); err != nil { | |
| 2355 | 2171 | return err | |
| 2356 | 2172 | } | |
| 2357 | 2173 | return nil | |
| @@ -2359,13 +2175,7 @@ func (o *Surface) SetBufferTransform(transform int32) error { | |||
| 2359 | 2175 | ||
| 2360 | 2176 | // This request sets an optional scaling factor on how the compositor interprets the contents of the buffer attached to the window. Buffer scale is double-buffered state, see wl_surface.commit. A newly created surface has its buffer scale set to 1. wl_surface.set_buffer_scale changes the pending buffer scale. wl_surface.commit copies the pending buffer scale to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to supply higher resolution buffer data for use on high resolution outputs. It is intended that you pick the same buffer scale as the scale of the output that the surface is displayed on. This means the compositor can avoid scaling when rendering the surface on that output. Note that if the scale is larger than 1, then you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. If scale is not greater than 0 the invalid_scale protocol error is raised. | |
| 2361 | 2177 | func (o *Surface) SetBufferScale(scale int32) error { | |
| 2362 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2363 | - | return err | |
| 2364 | - | } | |
| 2365 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_surface.set_buffer_scale"); err != nil { | |
| 2366 | - | return err | |
| 2367 | - | } | |
| 2368 | - | if err := o.Context().SendRequest(o, 8, scale); err != nil { | |
| 2178 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_surface.set_buffer_scale", Since: 3}, scale); err != nil { | |
| 2369 | 2179 | return err | |
| 2370 | 2180 | } | |
| 2371 | 2181 | return nil | |
| @@ -2373,13 +2183,7 @@ func (o *Surface) SetBufferScale(scale int32) error { | |||
| 2373 | 2183 | ||
| 2374 | 2184 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in buffer coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage_buffer adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. This request differs from wl_surface.damage in only one way - it takes damage in buffer coordinates instead of surface-local coordinates. While this generally is more intuitive than surface coordinates, it is especially desirable when using wp_viewport or when a drawing library (like EGL) is unaware of buffer scale and buffer transform. Note: Because buffer transformation changes and damage requests may be interleaved in the protocol stream, it is impossible to determine the actual mapping between surface and buffer damage until wl_surface.commit time. Therefore, compositors wishing to take both kinds of damage into account will have to accumulate damage from the two requests separately and only transform from one to the other after receiving the wl_surface.commit. | |
| 2375 | 2185 | func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) error { | |
| 2376 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2377 | - | return err | |
| 2378 | - | } | |
| 2379 | - | if err := wl.CheckVersion(o.Version(), 4, "wl_surface.damage_buffer"); err != nil { | |
| 2380 | - | return err | |
| 2381 | - | } | |
| 2382 | - | if err := o.Context().SendRequest(o, 9, x, y, width, height); err != nil { | |
| 2186 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_surface.damage_buffer", Since: 4}, x, y, width, height); err != nil { | |
| 2383 | 2187 | return err | |
| 2384 | 2188 | } | |
| 2385 | 2189 | return nil | |
| @@ -2387,13 +2191,7 @@ func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) erro | |||
| 2387 | 2191 | ||
| 2388 | 2192 | // The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. The exact semantics of wl_surface.offset are role-specific. Refer to the documentation of specific roles for more information. Surface location offset is double-buffered state, see wl_surface.commit. This request is semantically equivalent to and the replaces the x and y arguments in the wl_surface.attach request in wl_surface versions prior to 5. See wl_surface.attach for details. | |
| 2389 | 2193 | func (o *Surface) Offset(x int32, y int32) error { | |
| 2390 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2391 | - | return err | |
| 2392 | - | } | |
| 2393 | - | if err := wl.CheckVersion(o.Version(), 5, "wl_surface.offset"); err != nil { | |
| 2394 | - | return err | |
| 2395 | - | } | |
| 2396 | - | if err := o.Context().SendRequest(o, 10, x, y); err != nil { | |
| 2194 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "wl_surface.offset", Since: 5}, x, y); err != nil { | |
| 2397 | 2195 | return err | |
| 2398 | 2196 | } | |
| 2399 | 2197 | return nil | |
| @@ -2401,19 +2199,9 @@ func (o *Surface) Offset(x int32, y int32) error { | |||
| 2401 | 2199 | ||
| 2402 | 2200 | // Create a callback for the release of the buffer attached by the client with wl_surface.attach. The compositor will release the buffer when it has finished its usage of the underlying storage for the relevant commit. Once the client receives this event, and assuming the associated buffer is not pending release from other wl_surface.commit requests, the client can safely re-use the buffer. Release callbacks are double-buffered state, and will be associated with the pending buffer at wl_surface.commit time. The callback_data passed in the wl_callback.done event is unused and is always zero. Sending this request without attaching a non-null buffer in the same content update is a protocol error. The compositor will send the no_buffer error in this case. | |
| 2403 | 2201 | func (o *Surface) GetRelease() (*Callback, error) { | |
| 2404 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2405 | - | return nil, err | |
| 2406 | - | } | |
| 2407 | - | if err := wl.CheckVersion(o.Version(), 7, "wl_surface.get_release"); err != nil { | |
| 2408 | - | return nil, err | |
| 2409 | - | } | |
| 2410 | 2202 | child := &Callback{} | |
| 2411 | 2203 | child.SetContext(o.Context()) | |
| 2412 | - | child.SetID(o.Context().AllocateID()) | |
| 2413 | - | child.SetVersion(o.Version()) | |
| 2414 | - | o.Context().Register(child) | |
| 2415 | - | if err := o.Context().SendRequest(o, 11, child); err != nil { | |
| 2416 | - | o.Context().Unregister(child) | |
| 2204 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 11, Name: "wl_surface.get_release", Since: 7, Child: child}, child); err != nil { | |
| 2417 | 2205 | return nil, err | |
| 2418 | 2206 | } | |
| 2419 | 2207 | return child, nil | |
| @@ -2581,16 +2369,9 @@ func NewSeat(ctx *wl.Context) *Seat { | |||
| 2581 | 2369 | ||
| 2582 | 2370 | // The ID provided will be initialized to the wl_pointer interface for this seat. This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has never had the pointer capability. The missing_capability error will be sent in this case. | |
| 2583 | 2371 | func (o *Seat) GetPointer() (*Pointer, error) { | |
| 2584 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2585 | - | return nil, err | |
| 2586 | - | } | |
| 2587 | 2372 | child := &Pointer{} | |
| 2588 | 2373 | child.SetContext(o.Context()) | |
| 2589 | - | child.SetID(o.Context().AllocateID()) | |
| 2590 | - | child.SetVersion(o.Version()) | |
| 2591 | - | o.Context().Register(child) | |
| 2592 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |
| 2593 | - | o.Context().Unregister(child) | |
| 2374 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_seat.get_pointer", Child: child}, child); err != nil { | |
| 2594 | 2375 | return nil, err | |
| 2595 | 2376 | } | |
| 2596 | 2377 | return child, nil | |
| @@ -2598,16 +2379,9 @@ func (o *Seat) GetPointer() (*Pointer, error) { | |||
| 2598 | 2379 | ||
| 2599 | 2380 | // The ID provided will be initialized to the wl_keyboard interface for this seat. This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has never had the keyboard capability. The missing_capability error will be sent in this case. | |
| 2600 | 2381 | func (o *Seat) GetKeyboard() (*Keyboard, error) { | |
| 2601 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2602 | - | return nil, err | |
| 2603 | - | } | |
| 2604 | 2382 | child := &Keyboard{} | |
| 2605 | 2383 | child.SetContext(o.Context()) | |
| 2606 | - | child.SetID(o.Context().AllocateID()) | |
| 2607 | - | child.SetVersion(o.Version()) | |
| 2608 | - | o.Context().Register(child) | |
| 2609 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |
| 2610 | - | o.Context().Unregister(child) | |
| 2384 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_seat.get_keyboard", Child: child}, child); err != nil { | |
| 2611 | 2385 | return nil, err | |
| 2612 | 2386 | } | |
| 2613 | 2387 | return child, nil | |
| @@ -2615,16 +2389,9 @@ func (o *Seat) GetKeyboard() (*Keyboard, error) { | |||
| 2615 | 2389 | ||
| 2616 | 2390 | // The ID provided will be initialized to the wl_touch interface for this seat. This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has never had the touch capability. The missing_capability error will be sent in this case. | |
| 2617 | 2391 | func (o *Seat) GetTouch() (*Touch, error) { | |
| 2618 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2619 | - | return nil, err | |
| 2620 | - | } | |
| 2621 | 2392 | child := &Touch{} | |
| 2622 | 2393 | child.SetContext(o.Context()) | |
| 2623 | - | child.SetID(o.Context().AllocateID()) | |
| 2624 | - | child.SetVersion(o.Version()) | |
| 2625 | - | o.Context().Register(child) | |
| 2626 | - | if err := o.Context().SendRequest(o, 2, child); err != nil { | |
| 2627 | - | o.Context().Unregister(child) | |
| 2394 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_seat.get_touch", Child: child}, child); err != nil { | |
| 2628 | 2395 | return nil, err | |
| 2629 | 2396 | } | |
| 2630 | 2397 | return child, nil | |
| @@ -2632,13 +2399,7 @@ func (o *Seat) GetTouch() (*Touch, error) { | |||
| 2632 | 2399 | ||
| 2633 | 2400 | // Using this request a client can tell the server that it is not going to use the seat object anymore. | |
| 2634 | 2401 | func (o *Seat) Release() error { | |
| 2635 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2636 | - | return err | |
| 2637 | - | } | |
| 2638 | - | if err := wl.CheckVersion(o.Version(), 5, "wl_seat.release"); err != nil { | |
| 2639 | - | return err | |
| 2640 | - | } | |
| 2641 | - | if err := o.Context().SendDestructor(o, 3); err != nil { | |
| 2402 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_seat.release", Since: 5, Destructor: true}); err != nil { | |
| 2642 | 2403 | return err | |
| 2643 | 2404 | } | |
| 2644 | 2405 | return nil | |
| @@ -2754,14 +2515,11 @@ func NewPointer(ctx *wl.Context) *Pointer { | |||
| 2754 | 2515 | ||
| 2755 | 2516 | // Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. If the surface already has another role, it raises a protocol error. The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the pointer image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On wl_surface.offset requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. The offset must be applied by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The input region is ignored for wl_surfaces with the role of a cursor. When the use as a cursor ends, the wl_surface is unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be ignored. | |
| 2756 | 2517 | func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hotspotY int32) error { | |
| 2757 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2758 | - | return err | |
| 2759 | - | } | |
| 2760 | 2518 | var arg1 wl.Object | |
| 2761 | 2519 | if surface != nil { | |
| 2762 | 2520 | arg1 = surface | |
| 2763 | 2521 | } | |
| 2764 | - | if err := o.Context().SendRequest(o, 0, serial, arg1, hotspotX, hotspotY); err != nil { | |
| 2522 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_pointer.set_cursor"}, serial, arg1, hotspotX, hotspotY); err != nil { | |
| 2765 | 2523 | return err | |
| 2766 | 2524 | } | |
| 2767 | 2525 | return nil | |
| @@ -2769,13 +2527,7 @@ func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hot | |||
| 2769 | 2527 | ||
| 2770 | 2528 | // Using this request a client can tell the server that it is not going to use the pointer object anymore. This request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request. | |
| 2771 | 2529 | func (o *Pointer) Release() error { | |
| 2772 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2773 | - | return err | |
| 2774 | - | } | |
| 2775 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_pointer.release"); err != nil { | |
| 2776 | - | return err | |
| 2777 | - | } | |
| 2778 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 2530 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_pointer.release", Since: 3, Destructor: true}); err != nil { | |
| 2779 | 2531 | return err | |
| 2780 | 2532 | } | |
| 2781 | 2533 | return nil | |
| @@ -3210,13 +2962,7 @@ func NewKeyboard(ctx *wl.Context) *Keyboard { | |||
| 3210 | 2962 | ||
| 3211 | 2963 | // release the keyboard object | |
| 3212 | 2964 | func (o *Keyboard) Release() error { | |
| 3213 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 3214 | - | return err | |
| 3215 | - | } | |
| 3216 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_keyboard.release"); err != nil { | |
| 3217 | - | return err | |
| 3218 | - | } | |
| 3219 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 2965 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_keyboard.release", Since: 3, Destructor: true}); err != nil { | |
| 3220 | 2966 | return err | |
| 3221 | 2967 | } | |
| 3222 | 2968 | return nil | |
| @@ -3468,13 +3214,7 @@ func NewTouch(ctx *wl.Context) *Touch { | |||
| 3468 | 3214 | ||
| 3469 | 3215 | // release the touch object | |
| 3470 | 3216 | func (o *Touch) Release() error { | |
| 3471 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 3472 | - | return err | |
| 3473 | - | } | |
| 3474 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_touch.release"); err != nil { | |
| 3475 | - | return err | |
| 3476 | - | } | |
| 3477 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3217 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_touch.release", Since: 3, Destructor: true}); err != nil { | |
| 3478 | 3218 | return err | |
| 3479 | 3219 | } | |
| 3480 | 3220 | return nil | |
| @@ -3750,13 +3490,7 @@ func NewOutput(ctx *wl.Context) *Output { | |||
| 3750 | 3490 | ||
| 3751 | 3491 | // Using this request a client can tell the server that it is not going to use the output object anymore. | |
| 3752 | 3492 | func (o *Output) Release() error { | |
| 3753 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 3754 | - | return err | |
| 3755 | - | } | |
| 3756 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_output.release"); err != nil { | |
| 3757 | - | return err | |
| 3758 | - | } | |
| 3759 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3493 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_output.release", Since: 3, Destructor: true}); err != nil { | |
| 3760 | 3494 | return err | |
| 3761 | 3495 | } | |
| 3762 | 3496 | return nil | |
| @@ -3990,10 +3724,7 @@ func NewRegion(ctx *wl.Context) *Region { | |||
| 3990 | 3724 | ||
| 3991 | 3725 | // Destroy the region. This will invalidate the object ID. | |
| 3992 | 3726 | func (o *Region) Destroy() error { | |
| 3993 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 3994 | - | return err | |
| 3995 | - | } | |
| 3996 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3727 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_region.destroy", Destructor: true}); err != nil { | |
| 3997 | 3728 | return err | |
| 3998 | 3729 | } | |
| 3999 | 3730 | return nil | |
| @@ -4001,10 +3732,7 @@ func (o *Region) Destroy() error { | |||
| 4001 | 3732 | ||
| 4002 | 3733 | // Add the specified rectangle to the region. | |
| 4003 | 3734 | func (o *Region) Add(x int32, y int32, width int32, height int32) error { | |
| 4004 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4005 | - | return err | |
| 4006 | - | } | |
| 4007 | - | if err := o.Context().SendRequest(o, 1, x, y, width, height); err != nil { | |
| 3735 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_region.add"}, x, y, width, height); err != nil { | |
| 4008 | 3736 | return err | |
| 4009 | 3737 | } | |
| 4010 | 3738 | return nil | |
| @@ -4012,10 +3740,7 @@ func (o *Region) Add(x int32, y int32, width int32, height int32) error { | |||
| 4012 | 3740 | ||
| 4013 | 3741 | // Subtract the specified rectangle from the region. | |
| 4014 | 3742 | func (o *Region) Subtract(x int32, y int32, width int32, height int32) error { | |
| 4015 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4016 | - | return err | |
| 4017 | - | } | |
| 4018 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |
| 3743 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_region.subtract"}, x, y, width, height); err != nil { | |
| 4019 | 3744 | return err | |
| 4020 | 3745 | } | |
| 4021 | 3746 | return nil | |
| @@ -4054,10 +3779,7 @@ func NewSubcompositor(ctx *wl.Context) *Subcompositor { | |||
| 4054 | 3779 | ||
| 4055 | 3780 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wl_subsurface objects included. | |
| 4056 | 3781 | func (o *Subcompositor) Destroy() error { | |
| 4057 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4058 | - | return err | |
| 4059 | - | } | |
| 4060 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3782 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subcompositor.destroy", Destructor: true}); err != nil { | |
| 4061 | 3783 | return err | |
| 4062 | 3784 | } | |
| 4063 | 3785 | return nil | |
| @@ -4065,9 +3787,6 @@ func (o *Subcompositor) Destroy() error { | |||
| 4065 | 3787 | ||
| 4066 | 3788 | // Create a sub-surface interface for the given surface, and associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it must not have an existing wl_subsurface object. Otherwise the bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. The parent surface must not be one of the child surface's descendants, and the parent must be different from the child surface, otherwise the bad_parent protocol error is raised. This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface. | |
| 4067 | 3789 | func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsurface, error) { | |
| 4068 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4069 | - | return nil, err | |
| 4070 | - | } | |
| 4071 | 3790 | var arg1 wl.Object | |
| 4072 | 3791 | if surface != nil { | |
| 4073 | 3792 | arg1 = surface | |
| @@ -4078,11 +3797,7 @@ func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsu | |||
| 4078 | 3797 | } | |
| 4079 | 3798 | child := &Subsurface{} | |
| 4080 | 3799 | child.SetContext(o.Context()) | |
| 4081 | - | child.SetID(o.Context().AllocateID()) | |
| 4082 | - | child.SetVersion(o.Version()) | |
| 4083 | - | o.Context().Register(child) | |
| 4084 | - | if err := o.Context().SendRequest(o, 1, child, arg1, arg2); err != nil { | |
| 4085 | - | o.Context().Unregister(child) | |
| 3800 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subcompositor.get_subsurface", Child: child}, child, arg1, arg2); err != nil { | |
| 4086 | 3801 | return nil, err | |
| 4087 | 3802 | } | |
| 4088 | 3803 | return child, nil | |
| @@ -4121,10 +3836,7 @@ func NewSubsurface(ctx *wl.Context) *Subsurface { | |||
| 4121 | 3836 | ||
| 4122 | 3837 | // The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted. The wl_surface is unmapped immediately. | |
| 4123 | 3838 | func (o *Subsurface) Destroy() error { | |
| 4124 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4125 | - | return err | |
| 4126 | - | } | |
| 4127 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3839 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subsurface.destroy", Destructor: true}); err != nil { | |
| 4128 | 3840 | return err | |
| 4129 | 3841 | } | |
| 4130 | 3842 | return nil | |
| @@ -4132,10 +3844,7 @@ func (o *Subsurface) Destroy() error { | |||
| 4132 | 3844 | ||
| 4133 | 3845 | // This sets the position of the sub-surface, relative to the parent surface. The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. The initial position is 0, 0. Position is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | |
| 4134 | 3846 | func (o *Subsurface) SetPosition(x int32, y int32) error { | |
| 4135 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4136 | - | return err | |
| 4137 | - | } | |
| 4138 | - | if err := o.Context().SendRequest(o, 1, x, y); err != nil { | |
| 3847 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subsurface.set_position"}, x, y); err != nil { | |
| 4139 | 3848 | return err | |
| 4140 | 3849 | } | |
| 4141 | 3850 | return nil | |
| @@ -4143,14 +3852,11 @@ func (o *Subsurface) SetPosition(x int32, y int32) error { | |||
| 4143 | 3852 | ||
| 4144 | 3853 | // This sub-surface is taken from the stack, and put back just above the reference surface, changing the z-order of the sub-surfaces. The reference surface must be one of the sibling surfaces, or the parent surface. Using any other surface, including this sub-surface, will cause a protocol error. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. Z-order is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | |
| 4145 | 3854 | func (o *Subsurface) PlaceAbove(sibling *Surface) error { | |
| 4146 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4147 | - | return err | |
| 4148 | - | } | |
| 4149 | 3855 | var arg0 wl.Object | |
| 4150 | 3856 | if sibling != nil { | |
| 4151 | 3857 | arg0 = sibling | |
| 4152 | 3858 | } | |
| 4153 | - | if err := o.Context().SendRequest(o, 2, arg0); err != nil { | |
| 3859 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_subsurface.place_above"}, arg0); err != nil { | |
| 4154 | 3860 | return err | |
| 4155 | 3861 | } | |
| 4156 | 3862 | return nil | |
| @@ -4158,14 +3864,11 @@ func (o *Subsurface) PlaceAbove(sibling *Surface) error { | |||
| 4158 | 3864 | ||
| 4159 | 3865 | // The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. | |
| 4160 | 3866 | func (o *Subsurface) PlaceBelow(sibling *Surface) error { | |
| 4161 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4162 | - | return err | |
| 4163 | - | } | |
| 4164 | 3867 | var arg0 wl.Object | |
| 4165 | 3868 | if sibling != nil { | |
| 4166 | 3869 | arg0 = sibling | |
| 4167 | 3870 | } | |
| 4168 | - | if err := o.Context().SendRequest(o, 3, arg0); err != nil { | |
| 3871 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_subsurface.place_below"}, arg0); err != nil { | |
| 4169 | 3872 | return err | |
| 4170 | 3873 | } | |
| 4171 | 3874 | return nil | |
| @@ -4173,10 +3876,7 @@ func (o *Subsurface) PlaceBelow(sibling *Surface) error { | |||
| 4173 | 3876 | ||
| 4174 | 3877 | // Change the commit behaviour of the sub-surface to synchronized mode. See wl_subsurface and wl_surface.commit for more information. | |
| 4175 | 3878 | func (o *Subsurface) SetSync() error { | |
| 4176 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4177 | - | return err | |
| 4178 | - | } | |
| 4179 | - | if err := o.Context().SendRequest(o, 4); err != nil { | |
| 3879 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_subsurface.set_sync"}); err != nil { | |
| 4180 | 3880 | return err | |
| 4181 | 3881 | } | |
| 4182 | 3882 | return nil | |
| @@ -4184,10 +3884,7 @@ func (o *Subsurface) SetSync() error { | |||
| 4184 | 3884 | ||
| 4185 | 3885 | // Change the commit behaviour of the sub-surface to desynchronized mode. See wl_subsurface and wl_surface.commit for more information. | |
| 4186 | 3886 | func (o *Subsurface) SetDesync() error { | |
| 4187 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4188 | - | return err | |
| 4189 | - | } | |
| 4190 | - | if err := o.Context().SendRequest(o, 5); err != nil { | |
| 3887 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_subsurface.set_desync"}); err != nil { | |
| 4191 | 3888 | return err | |
| 4192 | 3889 | } | |
| 4193 | 3890 | return nil | |
| @@ -4226,10 +3923,7 @@ func NewFixes(ctx *wl.Context) *Fixes { | |||
| 4226 | 3923 | ||
| 4227 | 3924 | // destroys this object | |
| 4228 | 3925 | func (o *Fixes) Destroy() error { | |
| 4229 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4230 | - | return err | |
| 4231 | - | } | |
| 4232 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 3926 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_fixes.destroy", Destructor: true}); err != nil { | |
| 4233 | 3927 | return err | |
| 4234 | 3928 | } | |
| 4235 | 3929 | return nil | |
| @@ -4237,14 +3931,11 @@ func (o *Fixes) Destroy() error { | |||
| 4237 | 3931 | ||
| 4238 | 3932 | // This request destroys a wl_registry object. The client should no longer use the wl_registry after making this request. The compositor will emit a wl_display.delete_id event with the object ID of the registry and will no longer emit any events on the registry. The client should re-use the object ID once it receives the wl_display.delete_id event. | |
| 4239 | 3933 | func (o *Fixes) DestroyRegistry(registry *wl.Registry) error { | |
| 4240 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4241 | - | return err | |
| 4242 | - | } | |
| 4243 | 3934 | var arg0 wl.Object | |
| 4244 | 3935 | if registry != nil { | |
| 4245 | 3936 | arg0 = registry | |
| 4246 | 3937 | } | |
| 4247 | - | if err := o.Context().SendRequest(o, 1, arg0); err != nil { | |
| 3938 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_fixes.destroy_registry"}, arg0); err != nil { | |
| 4248 | 3939 | return err | |
| 4249 | 3940 | } | |
| 4250 | 3941 | return nil | |
| @@ -4252,17 +3943,11 @@ func (o *Fixes) DestroyRegistry(registry *wl.Registry) error { | |||
| 4252 | 3943 | ||
| 4253 | 3944 | // Acknowledge the removal of the specified global. If no global with the specified name exists or the global is not removed, the wl_fixes.invalid_ack_remove protocol error will be posted. Due to the Wayland protocol being asynchronous, the wl_global objects cannot be destroyed immediately. For example, if a wl_global is removed and a client attempts to bind that global around same time, it can result in a protocol error due to an unknown global name in the bind request. In order to avoid crashing clients, the compositor should remove the wl_global once it is guaranteed that no more bind requests will come. The wl_fixes.ack_global_remove() request is used to signal to the compositor that the client will not bind the given global anymore. After all clients acknowledge the removal of the global, the compositor can safely destroy it. The client must call the wl_fixes.ack_global_remove() request in response to a wl_registry.global_remove() event even if it did not bind the corresponding global. | |
| 4254 | 3945 | func (o *Fixes) AckGlobalRemove(registry *wl.Registry, name uint32) error { | |
| 4255 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 4256 | - | return err | |
| 4257 | - | } | |
| 4258 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_fixes.ack_global_remove"); err != nil { | |
| 4259 | - | return err | |
| 4260 | - | } | |
| 4261 | 3946 | var arg0 wl.Object | |
| 4262 | 3947 | if registry != nil { | |
| 4263 | 3948 | arg0 = registry | |
| 4264 | 3949 | } | |
| 4265 | - | if err := o.Context().SendRequest(o, 2, arg0, name); err != nil { | |
| 3950 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_fixes.ack_global_remove", Since: 2}, arg0, name); err != nil { | |
| 4266 | 3951 | return err | |
| 4267 | 3952 | } | |
| 4268 | 3953 | return nil | |
| @@ -773,16 +773,9 @@ func NewCompositor(ctx *wl.Context) *Compositor { | |||||
| 773 | 773 | ||||
| 774 | // Ask the compositor to create a new surface. | 774 | // Ask the compositor to create a new surface. | ||
| 775 | func (o *Compositor) CreateSurface() (*Surface, error) { | 775 | func (o *Compositor) CreateSurface() (*Surface, error) { | ||
| 776 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 777 | - | return nil, err | |||
| 778 | - | } | |||
| 779 | child := &Surface{} | 776 | child := &Surface{} | ||
| 780 | child.SetContext(o.Context()) | 777 | child.SetContext(o.Context()) | ||
| 781 | - | child.SetID(o.Context().AllocateID()) | 778 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_compositor.create_surface", Child: child}, child); err != nil { |
| 782 | - | child.SetVersion(o.Version()) | |||
| 783 | - | o.Context().Register(child) | |||
| 784 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |||
| 785 | - | o.Context().Unregister(child) | |||
| 786 | return nil, err | 779 | return nil, err | ||
| 787 | } | 780 | } | ||
| 788 | return child, nil | 781 | return child, nil | ||
| @@ -790,16 +783,9 @@ func (o *Compositor) CreateSurface() (*Surface, error) { | |||||
| 790 | 783 | ||||
| 791 | // Ask the compositor to create a new region. | 784 | // Ask the compositor to create a new region. | ||
| 792 | func (o *Compositor) CreateRegion() (*Region, error) { | 785 | func (o *Compositor) CreateRegion() (*Region, error) { | ||
| 793 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 794 | - | return nil, err | |||
| 795 | - | } | |||
| 796 | child := &Region{} | 786 | child := &Region{} | ||
| 797 | child.SetContext(o.Context()) | 787 | child.SetContext(o.Context()) | ||
| 798 | - | child.SetID(o.Context().AllocateID()) | 788 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_compositor.create_region", Child: child}, child); err != nil { |
| 799 | - | child.SetVersion(o.Version()) | |||
| 800 | - | o.Context().Register(child) | |||
| 801 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |||
| 802 | - | o.Context().Unregister(child) | |||
| 803 | return nil, err | 789 | return nil, err | ||
| 804 | } | 790 | } | ||
| 805 | return child, nil | 791 | return child, nil | ||
| @@ -807,13 +793,7 @@ func (o *Compositor) CreateRegion() (*Region, error) { | |||||
| 807 | 793 | ||||
| 808 | // This request destroys the wl_compositor. This has no effect on any other objects. | 794 | // This request destroys the wl_compositor. This has no effect on any other objects. | ||
| 809 | func (o *Compositor) Release() error { | 795 | func (o *Compositor) Release() error { | ||
| 810 | - | if err := o.Context().CheckProxy(o); err != nil { | 796 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_compositor.release", Since: 7, Destructor: true}); err != nil { |
| 811 | - | return err | |||
| 812 | - | } | |||
| 813 | - | if err := wl.CheckVersion(o.Version(), 7, "wl_compositor.release"); err != nil { | |||
| 814 | - | return err | |||
| 815 | - | } | |||
| 816 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |||
| 817 | return err | 797 | return err | ||
| 818 | } | 798 | } | ||
| 819 | return nil | 799 | return nil | ||
| @@ -852,16 +832,9 @@ func NewShmPool(ctx *wl.Context) *ShmPool { | |||||
| 852 | 832 | ||||
| 853 | // Create a wl_buffer object from the pool. The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event. A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it. | 833 | // Create a wl_buffer object from the pool. The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event. A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it. | ||
| 854 | func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride int32, format uint32) (*Buffer, error) { | 834 | func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride int32, format uint32) (*Buffer, error) { | ||
| 855 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 856 | - | return nil, err | |||
| 857 | - | } | |||
| 858 | child := &Buffer{} | 835 | child := &Buffer{} | ||
| 859 | child.SetContext(o.Context()) | 836 | child.SetContext(o.Context()) | ||
| 860 | - | child.SetID(o.Context().AllocateID()) | 837 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm_pool.create_buffer", Child: child}, child, offset, width, height, stride, format); err != nil { |
| 861 | - | child.SetVersion(o.Version()) | |||
| 862 | - | o.Context().Register(child) | |||
| 863 | - | if err := o.Context().SendRequest(o, 0, child, offset, width, height, stride, format); err != nil { | |||
| 864 | - | o.Context().Unregister(child) | |||
| 865 | return nil, err | 838 | return nil, err | ||
| 866 | } | 839 | } | ||
| 867 | return child, nil | 840 | return child, nil | ||
| @@ -869,10 +842,7 @@ func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride i | |||||
| 869 | 842 | ||||
| 870 | // Destroy the shared memory pool. The mmapped memory will be released when all buffers that have been created from this pool are gone. | 843 | // Destroy the shared memory pool. The mmapped memory will be released when all buffers that have been created from this pool are gone. | ||
| 871 | func (o *ShmPool) Destroy() error { | 844 | func (o *ShmPool) Destroy() error { | ||
| 872 | - | if err := o.Context().CheckProxy(o); err != nil { | 845 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm_pool.destroy", Destructor: true}); err != nil { |
| 873 | - | return err | |||
| 874 | - | } | |||
| 875 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 876 | return err | 846 | return err | ||
| 877 | } | 847 | } | ||
| 878 | return nil | 848 | return nil | ||
| @@ -880,10 +850,7 @@ func (o *ShmPool) Destroy() error { | |||||
| 880 | 850 | ||||
| 881 | // This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. This request only changes the amount of bytes that are mmapped by the server and does not touch the file corresponding to the file descriptor passed at creation time. It is the client's responsibility to ensure that the file is at least as big as the new pool size. | 851 | // This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. This request only changes the amount of bytes that are mmapped by the server and does not touch the file corresponding to the file descriptor passed at creation time. It is the client's responsibility to ensure that the file is at least as big as the new pool size. | ||
| 882 | func (o *ShmPool) Resize(size int32) error { | 852 | func (o *ShmPool) Resize(size int32) error { | ||
| 883 | - | if err := o.Context().CheckProxy(o); err != nil { | 853 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shm_pool.resize"}, size); err != nil { |
| 884 | - | return err | |||
| 885 | - | } | |||
| 886 | - | if err := o.Context().SendRequest(o, 2, size); err != nil { | |||
| 887 | return err | 854 | return err | ||
| 888 | } | 855 | } | ||
| 889 | return nil | 856 | return nil | ||
| @@ -926,31 +893,17 @@ func NewShm(ctx *wl.Context) *Shm { | |||||
| 926 | 893 | ||||
| 927 | // Create a new wl_shm_pool object. The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool. | 894 | // Create a new wl_shm_pool object. The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool. | ||
| 928 | func (o *Shm) CreatePool(fd int, size int32) (*ShmPool, error) { | 895 | func (o *Shm) CreatePool(fd int, size int32) (*ShmPool, error) { | ||
| 929 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 930 | - | return nil, err | |||
| 931 | - | } | |||
| 932 | child := &ShmPool{} | 896 | child := &ShmPool{} | ||
| 933 | child.SetContext(o.Context()) | 897 | child.SetContext(o.Context()) | ||
| 934 | - | child.SetID(o.Context().AllocateID()) | 898 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm.create_pool", Child: child, FDs: []int{fd}}, child, uintptr(fd), size); err != nil { |
| 935 | - | child.SetVersion(o.Version()) | |||
| 936 | - | o.Context().Register(child) | |||
| 937 | - | if err := o.Context().SendRequestWithFDs(o, 0, []int{fd}, child, uintptr(fd), size); err != nil { | |||
| 938 | - | o.Context().Unregister(child) | |||
| 939 | return nil, err | 899 | return nil, err | ||
| 940 | } | 900 | } | ||
| 941 | - | _ = wl.CloseSentFD(fd) | |||
| 942 | return child, nil | 901 | return child, nil | ||
| 943 | } | 902 | } | ||
| 944 | 903 | ||||
| 945 | // Using this request a client can tell the server that it is not going to use the shm object anymore. Objects created via this interface remain unaffected. | 904 | // Using this request a client can tell the server that it is not going to use the shm object anymore. Objects created via this interface remain unaffected. | ||
| 946 | func (o *Shm) Release() error { | 905 | func (o *Shm) Release() error { | ||
| 947 | - | if err := o.Context().CheckProxy(o); err != nil { | 906 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm.release", Since: 2, Destructor: true}); err != nil { |
| 948 | - | return err | |||
| 949 | - | } | |||
| 950 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_shm.release"); err != nil { | |||
| 951 | - | return err | |||
| 952 | - | } | |||
| 953 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 954 | return err | 907 | return err | ||
| 955 | } | 908 | } | ||
| 956 | return nil | 909 | return nil | ||
| @@ -1024,10 +977,7 @@ func NewBuffer(ctx *wl.Context) *Buffer { | |||||
| 1024 | 977 | ||||
| 1025 | // Destroy a buffer. If and how you need to release the backing storage is defined by the buffer factory interface. For possible side-effects to a surface, see wl_surface.attach. | 978 | // Destroy a buffer. If and how you need to release the backing storage is defined by the buffer factory interface. For possible side-effects to a surface, see wl_surface.attach. | ||
| 1026 | func (o *Buffer) Destroy() error { | 979 | func (o *Buffer) Destroy() error { | ||
| 1027 | - | if err := o.Context().CheckProxy(o); err != nil { | 980 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_buffer.destroy", Destructor: true}); err != nil { |
| 1028 | - | return err | |||
| 1029 | - | } | |||
| 1030 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 1031 | return err | 981 | return err | ||
| 1032 | } | 982 | } | ||
| 1033 | return nil | 983 | return nil | ||
| @@ -1102,10 +1052,7 @@ func NewDataOffer(ctx *wl.Context) *DataOffer { | |||||
| 1102 | 1052 | ||||
| 1103 | // Indicate that the client can accept the given mime type, or NULL for not accepted. For objects of version 2 or older, this request is used by the client to give feedback whether the client can receive the given mime type, or NULL if none is accepted; the feedback does not determine whether the drag-and-drop operation succeeds or not. For objects of version 3 or newer, this request determines the final result of the drag-and-drop operation. If the end result is that no mime types were accepted, the drag-and-drop operation will be cancelled and the corresponding drag source will receive wl_data_source.cancelled. Clients may still use this event in conjunction with wl_data_source.action for feedback. | 1053 | // Indicate that the client can accept the given mime type, or NULL for not accepted. For objects of version 2 or older, this request is used by the client to give feedback whether the client can receive the given mime type, or NULL if none is accepted; the feedback does not determine whether the drag-and-drop operation succeeds or not. For objects of version 3 or newer, this request determines the final result of the drag-and-drop operation. If the end result is that no mime types were accepted, the drag-and-drop operation will be cancelled and the corresponding drag source will receive wl_data_source.cancelled. Clients may still use this event in conjunction with wl_data_source.action for feedback. | ||
| 1104 | func (o *DataOffer) Accept(serial uint32, mimeType string) error { | 1054 | func (o *DataOffer) Accept(serial uint32, mimeType string) error { | ||
| 1105 | - | if err := o.Context().CheckProxy(o); err != nil { | 1055 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_offer.accept"}, serial, mimeType); err != nil { |
| 1106 | - | return err | |||
| 1107 | - | } | |||
| 1108 | - | if err := o.Context().SendRequest(o, 0, serial, mimeType); err != nil { | |||
| 1109 | return err | 1056 | return err | ||
| 1110 | } | 1057 | } | ||
| 1111 | return nil | 1058 | return nil | ||
| @@ -1113,22 +1060,15 @@ func (o *DataOffer) Accept(serial uint32, mimeType string) error { | |||||
| 1113 | 1060 | ||||
| 1114 | // To transfer the offered data, the client issues this request and indicates the mime type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor. The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete. This request may happen multiple times for different mime types, both before and after wl_data_device.drop. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance. | 1061 | // To transfer the offered data, the client issues this request and indicates the mime type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor. The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete. This request may happen multiple times for different mime types, both before and after wl_data_device.drop. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance. | ||
| 1115 | func (o *DataOffer) Receive(mimeType string, fd int) error { | 1062 | func (o *DataOffer) Receive(mimeType string, fd int) error { | ||
| 1116 | - | if err := o.Context().CheckProxy(o); err != nil { | 1063 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_offer.receive", FDs: []int{fd}}, mimeType, uintptr(fd)); err != nil { |
| 1117 | - | return err | |||
| 1118 | - | } | |||
| 1119 | - | if err := o.Context().SendRequestWithFDs(o, 1, []int{fd}, mimeType, uintptr(fd)); err != nil { | |||
| 1120 | return err | 1064 | return err | ||
| 1121 | } | 1065 | } | ||
| 1122 | - | _ = wl.CloseSentFD(fd) | |||
| 1123 | return nil | 1066 | return nil | ||
| 1124 | } | 1067 | } | ||
| 1125 | 1068 | ||||
| 1126 | // Destroy the data offer. | 1069 | // Destroy the data offer. | ||
| 1127 | func (o *DataOffer) Destroy() error { | 1070 | func (o *DataOffer) Destroy() error { | ||
| 1128 | - | if err := o.Context().CheckProxy(o); err != nil { | 1071 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_offer.destroy", Destructor: true}); err != nil { |
| 1129 | - | return err | |||
| 1130 | - | } | |||
| 1131 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |||
| 1132 | return err | 1072 | return err | ||
| 1133 | } | 1073 | } | ||
| 1134 | return nil | 1074 | return nil | ||
| @@ -1136,13 +1076,7 @@ func (o *DataOffer) Destroy() error { | |||||
| 1136 | 1076 | ||||
| 1137 | // Notifies the compositor that the drag destination successfully finished the drag-and-drop operation. Upon receiving this request, the compositor will emit wl_data_source.dnd_finished on the drag source client. It is a client error to perform other requests than wl_data_offer.destroy after this one. It is also an error to perform this request after a NULL mime type has been set in wl_data_offer.accept or no action was received through wl_data_offer.action. If wl_data_offer.finish request is received for a non drag and drop operation, the invalid_finish protocol error is raised. | 1077 | // Notifies the compositor that the drag destination successfully finished the drag-and-drop operation. Upon receiving this request, the compositor will emit wl_data_source.dnd_finished on the drag source client. It is a client error to perform other requests than wl_data_offer.destroy after this one. It is also an error to perform this request after a NULL mime type has been set in wl_data_offer.accept or no action was received through wl_data_offer.action. If wl_data_offer.finish request is received for a non drag and drop operation, the invalid_finish protocol error is raised. | ||
| 1138 | func (o *DataOffer) Finish() error { | 1078 | func (o *DataOffer) Finish() error { | ||
| 1139 | - | if err := o.Context().CheckProxy(o); err != nil { | 1079 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_data_offer.finish", Since: 3}); err != nil { |
| 1140 | - | return err | |||
| 1141 | - | } | |||
| 1142 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_offer.finish"); err != nil { | |||
| 1143 | - | return err | |||
| 1144 | - | } | |||
| 1145 | - | if err := o.Context().SendRequest(o, 3); err != nil { | |||
| 1146 | return err | 1080 | return err | ||
| 1147 | } | 1081 | } | ||
| 1148 | return nil | 1082 | return nil | ||
| @@ -1150,13 +1084,7 @@ func (o *DataOffer) Finish() error { | |||||
| 1150 | 1084 | ||||
| 1151 | // Sets the actions that the destination side client supports for this operation. This request may trigger the emission of wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. This request can be called multiple times throughout the drag-and-drop operation, typically in response to wl_data_device.enter or wl_data_device.motion events. This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, the drag source will receive wl_data_source.cancelled. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, and the preferred_action argument must only contain one of those values set, otherwise it will result in a protocol error. While managing an "ask" action, the destination drag-and-drop client may perform further wl_data_offer.receive requests, and is expected to perform one last wl_data_offer.set_actions request with a preferred action other than "ask" (and optionally wl_data_offer.accept) before requesting wl_data_offer.finish, in order to convey the action selected by the user. If the preferred action is not in the wl_data_offer.source_actions mask, an error will be raised. If the "ask" action is dismissed (e.g. user cancellation), the client is expected to perform wl_data_offer.destroy right away. This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise. | 1085 | // Sets the actions that the destination side client supports for this operation. This request may trigger the emission of wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. This request can be called multiple times throughout the drag-and-drop operation, typically in response to wl_data_device.enter or wl_data_device.motion events. This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, the drag source will receive wl_data_source.cancelled. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, and the preferred_action argument must only contain one of those values set, otherwise it will result in a protocol error. While managing an "ask" action, the destination drag-and-drop client may perform further wl_data_offer.receive requests, and is expected to perform one last wl_data_offer.set_actions request with a preferred action other than "ask" (and optionally wl_data_offer.accept) before requesting wl_data_offer.finish, in order to convey the action selected by the user. If the preferred action is not in the wl_data_offer.source_actions mask, an error will be raised. If the "ask" action is dismissed (e.g. user cancellation), the client is expected to perform wl_data_offer.destroy right away. This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise. | ||
| 1152 | func (o *DataOffer) SetActions(dndActions uint32, preferredAction uint32) error { | 1086 | func (o *DataOffer) SetActions(dndActions uint32, preferredAction uint32) error { | ||
| 1153 | - | if err := o.Context().CheckProxy(o); err != nil { | 1087 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_data_offer.set_actions", Since: 3}, dndActions, preferredAction); err != nil { |
| 1154 | - | return err | |||
| 1155 | - | } | |||
| 1156 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_offer.set_actions"); err != nil { | |||
| 1157 | - | return err | |||
| 1158 | - | } | |||
| 1159 | - | if err := o.Context().SendRequest(o, 4, dndActions, preferredAction); err != nil { | |||
| 1160 | return err | 1088 | return err | ||
| 1161 | } | 1089 | } | ||
| 1162 | return nil | 1090 | return nil | ||
| @@ -1297,10 +1225,7 @@ func NewDataSource(ctx *wl.Context) *DataSource { | |||||
| 1297 | 1225 | ||||
| 1298 | // This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types. | 1226 | // This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types. | ||
| 1299 | func (o *DataSource) Offer(mimeType string) error { | 1227 | func (o *DataSource) Offer(mimeType string) error { | ||
| 1300 | - | if err := o.Context().CheckProxy(o); err != nil { | 1228 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_source.offer"}, mimeType); err != nil { |
| 1301 | - | return err | |||
| 1302 | - | } | |||
| 1303 | - | if err := o.Context().SendRequest(o, 0, mimeType); err != nil { | |||
| 1304 | return err | 1229 | return err | ||
| 1305 | } | 1230 | } | ||
| 1306 | return nil | 1231 | return nil | ||
| @@ -1308,10 +1233,7 @@ func (o *DataSource) Offer(mimeType string) error { | |||||
| 1308 | 1233 | ||||
| 1309 | // Destroy the data source. | 1234 | // Destroy the data source. | ||
| 1310 | func (o *DataSource) Destroy() error { | 1235 | func (o *DataSource) Destroy() error { | ||
| 1311 | - | if err := o.Context().CheckProxy(o); err != nil { | 1236 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_source.destroy", Destructor: true}); err != nil { |
| 1312 | - | return err | |||
| 1313 | - | } | |||
| 1314 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 1315 | return err | 1237 | return err | ||
| 1316 | } | 1238 | } | ||
| 1317 | return nil | 1239 | return nil | ||
| @@ -1319,13 +1241,7 @@ func (o *DataSource) Destroy() error { | |||||
| 1319 | 1241 | ||||
| 1320 | // Sets the actions that the source side client supports for this operation. This request may trigger wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, otherwise it will result in a protocol error. This request must be made once only, and can only be made on sources used in drag-and-drop, so it must be performed before wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error. | 1242 | // Sets the actions that the source side client supports for this operation. This request may trigger wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, otherwise it will result in a protocol error. This request must be made once only, and can only be made on sources used in drag-and-drop, so it must be performed before wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error. | ||
| 1321 | func (o *DataSource) SetActions(dndActions uint32) error { | 1243 | func (o *DataSource) SetActions(dndActions uint32) error { | ||
| 1322 | - | if err := o.Context().CheckProxy(o); err != nil { | 1244 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_source.set_actions", Since: 3}, dndActions); err != nil { |
| 1323 | - | return err | |||
| 1324 | - | } | |||
| 1325 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_data_source.set_actions"); err != nil { | |||
| 1326 | - | return err | |||
| 1327 | - | } | |||
| 1328 | - | if err := o.Context().SendRequest(o, 2, dndActions); err != nil { | |||
| 1329 | return err | 1245 | return err | ||
| 1330 | } | 1246 | } | ||
| 1331 | return nil | 1247 | return nil | ||
| @@ -1561,9 +1477,6 @@ func NewDataDevice(ctx *wl.Context) *DataDevice { | |||||
| 1561 | 1477 | ||||
| 1562 | // This request asks the compositor to start a drag-and-drop operation on behalf of the client. The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled. The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial. The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. The input region is ignored for wl_surfaces with the role of a drag-and-drop icon. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | 1478 | // This request asks the compositor to start a drag-and-drop operation on behalf of the client. The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled. The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial. The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. The input region is ignored for wl_surfaces with the role of a drag-and-drop icon. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | ||
| 1563 | func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surface, serial uint32) error { | 1479 | func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surface, serial uint32) error { | ||
| 1564 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1565 | - | return err | |||
| 1566 | - | } | |||
| 1567 | var arg0 wl.Object | 1480 | var arg0 wl.Object | ||
| 1568 | if source != nil { | 1481 | if source != nil { | ||
| 1569 | arg0 = source | 1482 | arg0 = source | ||
| @@ -1576,7 +1489,7 @@ func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surfac | |||||
| 1576 | if icon != nil { | 1489 | if icon != nil { | ||
| 1577 | arg2 = icon | 1490 | arg2 = icon | ||
| 1578 | } | 1491 | } | ||
| 1579 | - | if err := o.Context().SendRequest(o, 0, arg0, arg1, arg2, serial); err != nil { | 1492 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device.start_drag"}, arg0, arg1, arg2, serial); err != nil { |
| 1580 | return err | 1493 | return err | ||
| 1581 | } | 1494 | } | ||
| 1582 | return nil | 1495 | return nil | ||
| @@ -1584,14 +1497,11 @@ func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surfac | |||||
| 1584 | 1497 | ||||
| 1585 | // This request asks the compositor to set the selection to the data from the source on behalf of the client. To unset the selection, set the source to NULL. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | 1498 | // This request asks the compositor to set the selection to the data from the source on behalf of the client. To unset the selection, set the source to NULL. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error. | ||
| 1586 | func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error { | 1499 | func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error { | ||
| 1587 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1588 | - | return err | |||
| 1589 | - | } | |||
| 1590 | var arg0 wl.Object | 1500 | var arg0 wl.Object | ||
| 1591 | if source != nil { | 1501 | if source != nil { | ||
| 1592 | arg0 = source | 1502 | arg0 = source | ||
| 1593 | } | 1503 | } | ||
| 1594 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | 1504 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device.set_selection"}, arg0, serial); err != nil { |
| 1595 | return err | 1505 | return err | ||
| 1596 | } | 1506 | } | ||
| 1597 | return nil | 1507 | return nil | ||
| @@ -1599,13 +1509,7 @@ func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error { | |||||
| 1599 | 1509 | ||||
| 1600 | // This request destroys the data device. | 1510 | // This request destroys the data device. | ||
| 1601 | func (o *DataDevice) Release() error { | 1511 | func (o *DataDevice) Release() error { | ||
| 1602 | - | if err := o.Context().CheckProxy(o); err != nil { | 1512 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device.release", Since: 2, Destructor: true}); err != nil { |
| 1603 | - | return err | |||
| 1604 | - | } | |||
| 1605 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_data_device.release"); err != nil { | |||
| 1606 | - | return err | |||
| 1607 | - | } | |||
| 1608 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |||
| 1609 | return err | 1513 | return err | ||
| 1610 | } | 1514 | } | ||
| 1611 | return nil | 1515 | return nil | ||
| @@ -1839,16 +1743,9 @@ func NewDataDeviceManager(ctx *wl.Context) *DataDeviceManager { | |||||
| 1839 | 1743 | ||||
| 1840 | // Create a new data source. | 1744 | // Create a new data source. | ||
| 1841 | func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) { | 1745 | func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) { | ||
| 1842 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1843 | - | return nil, err | |||
| 1844 | - | } | |||
| 1845 | child := &DataSource{} | 1746 | child := &DataSource{} | ||
| 1846 | child.SetContext(o.Context()) | 1747 | child.SetContext(o.Context()) | ||
| 1847 | - | child.SetID(o.Context().AllocateID()) | 1748 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device_manager.create_data_source", Child: child}, child); err != nil { |
| 1848 | - | child.SetVersion(o.Version()) | |||
| 1849 | - | o.Context().Register(child) | |||
| 1850 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |||
| 1851 | - | o.Context().Unregister(child) | |||
| 1852 | return nil, err | 1749 | return nil, err | ||
| 1853 | } | 1750 | } | ||
| 1854 | return child, nil | 1751 | return child, nil | ||
| @@ -1856,20 +1753,13 @@ func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) { | |||||
| 1856 | 1753 | ||||
| 1857 | // Create a new data device for a given seat. | 1754 | // Create a new data device for a given seat. | ||
| 1858 | func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) { | 1755 | func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) { | ||
| 1859 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1860 | - | return nil, err | |||
| 1861 | - | } | |||
| 1862 | var arg1 wl.Object | 1756 | var arg1 wl.Object | ||
| 1863 | if seat != nil { | 1757 | if seat != nil { | ||
| 1864 | arg1 = seat | 1758 | arg1 = seat | ||
| 1865 | } | 1759 | } | ||
| 1866 | child := &DataDevice{} | 1760 | child := &DataDevice{} | ||
| 1867 | child.SetContext(o.Context()) | 1761 | child.SetContext(o.Context()) | ||
| 1868 | - | child.SetID(o.Context().AllocateID()) | 1762 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device_manager.get_data_device", Child: child}, child, arg1); err != nil { |
| 1869 | - | child.SetVersion(o.Version()) | |||
| 1870 | - | o.Context().Register(child) | |||
| 1871 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 1872 | - | o.Context().Unregister(child) | |||
| 1873 | return nil, err | 1763 | return nil, err | ||
| 1874 | } | 1764 | } | ||
| 1875 | return child, nil | 1765 | return child, nil | ||
| @@ -1877,13 +1767,7 @@ func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) { | |||||
| 1877 | 1767 | ||||
| 1878 | // This request destroys the wl_data_device_manager. This has no effect on any other objects. | 1768 | // This request destroys the wl_data_device_manager. This has no effect on any other objects. | ||
| 1879 | func (o *DataDeviceManager) Release() error { | 1769 | func (o *DataDeviceManager) Release() error { | ||
| 1880 | - | if err := o.Context().CheckProxy(o); err != nil { | 1770 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device_manager.release", Since: 4, Destructor: true}); err != nil { |
| 1881 | - | return err | |||
| 1882 | - | } | |||
| 1883 | - | if err := wl.CheckVersion(o.Version(), 4, "wl_data_device_manager.release"); err != nil { | |||
| 1884 | - | return err | |||
| 1885 | - | } | |||
| 1886 | - | if err := o.Context().SendDestructor(o, 2); err != nil { | |||
| 1887 | return err | 1771 | return err | ||
| 1888 | } | 1772 | } | ||
| 1889 | return nil | 1773 | return nil | ||
| @@ -1922,20 +1806,13 @@ func NewShell(ctx *wl.Context) *Shell { | |||||
| 1922 | 1806 | ||||
| 1923 | // Create a shell surface for an existing surface. This gives the wl_surface the role of a shell surface. If the wl_surface already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface. | 1807 | // Create a shell surface for an existing surface. This gives the wl_surface the role of a shell surface. If the wl_surface already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface. | ||
| 1924 | func (o *Shell) GetShellSurface(surface *Surface) (*ShellSurface, error) { | 1808 | func (o *Shell) GetShellSurface(surface *Surface) (*ShellSurface, error) { | ||
| 1925 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1926 | - | return nil, err | |||
| 1927 | - | } | |||
| 1928 | var arg1 wl.Object | 1809 | var arg1 wl.Object | ||
| 1929 | if surface != nil { | 1810 | if surface != nil { | ||
| 1930 | arg1 = surface | 1811 | arg1 = surface | ||
| 1931 | } | 1812 | } | ||
| 1932 | child := &ShellSurface{} | 1813 | child := &ShellSurface{} | ||
| 1933 | child.SetContext(o.Context()) | 1814 | child.SetContext(o.Context()) | ||
| 1934 | - | child.SetID(o.Context().AllocateID()) | 1815 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell.get_shell_surface", Child: child}, child, arg1); err != nil { |
| 1935 | - | child.SetVersion(o.Version()) | |||
| 1936 | - | o.Context().Register(child) | |||
| 1937 | - | if err := o.Context().SendRequest(o, 0, child, arg1); err != nil { | |||
| 1938 | - | o.Context().Unregister(child) | |||
| 1939 | return nil, err | 1816 | return nil, err | ||
| 1940 | } | 1817 | } | ||
| 1941 | return child, nil | 1818 | return child, nil | ||
| @@ -1980,10 +1857,7 @@ func NewShellSurface(ctx *wl.Context) *ShellSurface { | |||||
| 1980 | 1857 | ||||
| 1981 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. | 1858 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. | ||
| 1982 | func (o *ShellSurface) Pong(serial uint32) error { | 1859 | func (o *ShellSurface) Pong(serial uint32) error { | ||
| 1983 | - | if err := o.Context().CheckProxy(o); err != nil { | 1860 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell_surface.pong"}, serial); err != nil { |
| 1984 | - | return err | |||
| 1985 | - | } | |||
| 1986 | - | if err := o.Context().SendRequest(o, 0, serial); err != nil { | |||
| 1987 | return err | 1861 | return err | ||
| 1988 | } | 1862 | } | ||
| 1989 | return nil | 1863 | return nil | ||
| @@ -1991,14 +1865,11 @@ func (o *ShellSurface) Pong(serial uint32) error { | |||||
| 1991 | 1865 | ||||
| 1992 | // Start a pointer-driven move of the surface. This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). | 1866 | // Start a pointer-driven move of the surface. This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). | ||
| 1993 | func (o *ShellSurface) Move(seat *Seat, serial uint32) error { | 1867 | func (o *ShellSurface) Move(seat *Seat, serial uint32) error { | ||
| 1994 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1995 | - | return err | |||
| 1996 | - | } | |||
| 1997 | var arg0 wl.Object | 1868 | var arg0 wl.Object | ||
| 1998 | if seat != nil { | 1869 | if seat != nil { | ||
| 1999 | arg0 = seat | 1870 | arg0 = seat | ||
| 2000 | } | 1871 | } | ||
| 2001 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | 1872 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shell_surface.move"}, arg0, serial); err != nil { |
| 2002 | return err | 1873 | return err | ||
| 2003 | } | 1874 | } | ||
| 2004 | return nil | 1875 | return nil | ||
| @@ -2006,14 +1877,11 @@ func (o *ShellSurface) Move(seat *Seat, serial uint32) error { | |||||
| 2006 | 1877 | ||||
| 2007 | // Start a pointer-driven resizing of the surface. This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). | 1878 | // Start a pointer-driven resizing of the surface. This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). | ||
| 2008 | func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error { | 1879 | func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error { | ||
| 2009 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2010 | - | return err | |||
| 2011 | - | } | |||
| 2012 | var arg0 wl.Object | 1880 | var arg0 wl.Object | ||
| 2013 | if seat != nil { | 1881 | if seat != nil { | ||
| 2014 | arg0 = seat | 1882 | arg0 = seat | ||
| 2015 | } | 1883 | } | ||
| 2016 | - | if err := o.Context().SendRequest(o, 2, arg0, serial, edges); err != nil { | 1884 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shell_surface.resize"}, arg0, serial, edges); err != nil { |
| 2017 | return err | 1885 | return err | ||
| 2018 | } | 1886 | } | ||
| 2019 | return nil | 1887 | return nil | ||
| @@ -2021,10 +1889,7 @@ func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error { | |||||
| 2021 | 1889 | ||||
| 2022 | // Map the surface as a toplevel surface. A toplevel surface is not fullscreen, maximized or transient. | 1890 | // Map the surface as a toplevel surface. A toplevel surface is not fullscreen, maximized or transient. | ||
| 2023 | func (o *ShellSurface) SetToplevel() error { | 1891 | func (o *ShellSurface) SetToplevel() error { | ||
| 2024 | - | if err := o.Context().CheckProxy(o); err != nil { | 1892 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_shell_surface.set_toplevel"}); err != nil { |
| 2025 | - | return err | |||
| 2026 | - | } | |||
| 2027 | - | if err := o.Context().SendRequest(o, 3); err != nil { | |||
| 2028 | return err | 1893 | return err | ||
| 2029 | } | 1894 | } | ||
| 2030 | return nil | 1895 | return nil | ||
| @@ -2032,14 +1897,11 @@ func (o *ShellSurface) SetToplevel() error { | |||||
| 2032 | 1897 | ||||
| 2033 | // Map the surface relative to an existing surface. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour. | 1898 | // Map the surface relative to an existing surface. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour. | ||
| 2034 | func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uint32) error { | 1899 | func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uint32) error { | ||
| 2035 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2036 | - | return err | |||
| 2037 | - | } | |||
| 2038 | var arg0 wl.Object | 1900 | var arg0 wl.Object | ||
| 2039 | if parent != nil { | 1901 | if parent != nil { | ||
| 2040 | arg0 = parent | 1902 | arg0 = parent | ||
| 2041 | } | 1903 | } | ||
| 2042 | - | if err := o.Context().SendRequest(o, 4, arg0, x, y, flags); err != nil { | 1904 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_shell_surface.set_transient"}, arg0, x, y, flags); err != nil { |
| 2043 | return err | 1905 | return err | ||
| 2044 | } | 1906 | } | ||
| 2045 | return nil | 1907 | return nil | ||
| @@ -2047,14 +1909,11 @@ func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uin | |||||
| 2047 | 1909 | ||||
| 2048 | // Map the surface as a fullscreen surface. If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The client may specify a method to resolve a size conflict between the output size and the surface size - this is provided through the method parameter. The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. A method of "scale" or "driver" implies a scaling operation of the surface, either via a direct scaling operation or a change of the output mode. This will override any kind of output scaling, so that mapping a surface with a buffer size equal to the mode can fill the screen independent of buffer_scale. A method of "fill" means we don't scale up the buffer, however any output scale is applied. This means that you may run into an edge case where the application maps a buffer with the same size of the output mode but buffer_scale 1 (thus making a surface larger than the output). In this case it is allowed to downscale the results to fit the screen. The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen. | 1910 | // Map the surface as a fullscreen surface. If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The client may specify a method to resolve a size conflict between the output size and the surface size - this is provided through the method parameter. The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. A method of "scale" or "driver" implies a scaling operation of the surface, either via a direct scaling operation or a change of the output mode. This will override any kind of output scaling, so that mapping a surface with a buffer size equal to the mode can fill the screen independent of buffer_scale. A method of "fill" means we don't scale up the buffer, however any output scale is applied. This means that you may run into an edge case where the application maps a buffer with the same size of the output mode but buffer_scale 1 (thus making a surface larger than the output). In this case it is allowed to downscale the results to fit the screen. The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen. | ||
| 2049 | func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Output) error { | 1911 | func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Output) error { | ||
| 2050 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2051 | - | return err | |||
| 2052 | - | } | |||
| 2053 | var arg2 wl.Object | 1912 | var arg2 wl.Object | ||
| 2054 | if output != nil { | 1913 | if output != nil { | ||
| 2055 | arg2 = output | 1914 | arg2 = output | ||
| 2056 | } | 1915 | } | ||
| 2057 | - | if err := o.Context().SendRequest(o, 5, method, framerate, arg2); err != nil { | 1916 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_shell_surface.set_fullscreen"}, method, framerate, arg2); err != nil { |
| 2058 | return err | 1917 | return err | ||
| 2059 | } | 1918 | } | ||
| 2060 | return nil | 1919 | return nil | ||
| @@ -2062,9 +1921,6 @@ func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Ou | |||||
| 2062 | 1921 | ||||
| 2063 | // Map the surface as a popup. A popup surface is a transient surface with an added pointer grab. An existing implicit grab will be changed to owner-events mode, and the popup grab will continue after the implicit grab ends (i.e. releasing the mouse button does not cause the popup to be unmapped). The popup grab continues until the window is destroyed or a mouse button is pressed in any other client's window. A click in any of the client's surfaces is reported as normal, however, clicks in other clients' surfaces will be discarded and trigger the callback. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. | 1922 | // Map the surface as a popup. A popup surface is a transient surface with an added pointer grab. An existing implicit grab will be changed to owner-events mode, and the popup grab will continue after the implicit grab ends (i.e. releasing the mouse button does not cause the popup to be unmapped). The popup grab continues until the window is destroyed or a mouse button is pressed in any other client's window. A click in any of the client's surfaces is reported as normal, however, clicks in other clients' surfaces will be discarded and trigger the callback. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. | ||
| 2064 | func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x int32, y int32, flags uint32) error { | 1923 | func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x int32, y int32, flags uint32) error { | ||
| 2065 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2066 | - | return err | |||
| 2067 | - | } | |||
| 2068 | var arg0 wl.Object | 1924 | var arg0 wl.Object | ||
| 2069 | if seat != nil { | 1925 | if seat != nil { | ||
| 2070 | arg0 = seat | 1926 | arg0 = seat | ||
| @@ -2073,7 +1929,7 @@ func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x in | |||||
| 2073 | if parent != nil { | 1929 | if parent != nil { | ||
| 2074 | arg2 = parent | 1930 | arg2 = parent | ||
| 2075 | } | 1931 | } | ||
| 2076 | - | if err := o.Context().SendRequest(o, 6, arg0, serial, arg2, x, y, flags); err != nil { | 1932 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_shell_surface.set_popup"}, arg0, serial, arg2, x, y, flags); err != nil { |
| 2077 | return err | 1933 | return err | ||
| 2078 | } | 1934 | } | ||
| 2079 | return nil | 1935 | return nil | ||
| @@ -2081,14 +1937,11 @@ func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x in | |||||
| 2081 | 1937 | ||||
| 2082 | // Map the surface as a maximized surface. If an output parameter is given then the surface will be maximized on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The compositor will reply with a configure event telling the expected new surface size. The operation is completed on the next buffer attach to this surface. A maximized surface typically fills the entire output it is bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface. The details depend on the compositor implementation. | 1938 | // Map the surface as a maximized surface. If an output parameter is given then the surface will be maximized on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The compositor will reply with a configure event telling the expected new surface size. The operation is completed on the next buffer attach to this surface. A maximized surface typically fills the entire output it is bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface. The details depend on the compositor implementation. | ||
| 2083 | func (o *ShellSurface) SetMaximized(output *Output) error { | 1939 | func (o *ShellSurface) SetMaximized(output *Output) error { | ||
| 2084 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2085 | - | return err | |||
| 2086 | - | } | |||
| 2087 | var arg0 wl.Object | 1940 | var arg0 wl.Object | ||
| 2088 | if output != nil { | 1941 | if output != nil { | ||
| 2089 | arg0 = output | 1942 | arg0 = output | ||
| 2090 | } | 1943 | } | ||
| 2091 | - | if err := o.Context().SendRequest(o, 7, arg0); err != nil { | 1944 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_shell_surface.set_maximized"}, arg0); err != nil { |
| 2092 | return err | 1945 | return err | ||
| 2093 | } | 1946 | } | ||
| 2094 | return nil | 1947 | return nil | ||
| @@ -2096,10 +1949,7 @@ func (o *ShellSurface) SetMaximized(output *Output) error { | |||||
| 2096 | 1949 | ||||
| 2097 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | 1950 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | ||
| 2098 | func (o *ShellSurface) SetTitle(title string) error { | 1951 | func (o *ShellSurface) SetTitle(title string) error { | ||
| 2099 | - | if err := o.Context().CheckProxy(o); err != nil { | 1952 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_shell_surface.set_title"}, title); err != nil { |
| 2100 | - | return err | |||
| 2101 | - | } | |||
| 2102 | - | if err := o.Context().SendRequest(o, 8, title); err != nil { | |||
| 2103 | return err | 1953 | return err | ||
| 2104 | } | 1954 | } | ||
| 2105 | return nil | 1955 | return nil | ||
| @@ -2107,10 +1957,7 @@ func (o *ShellSurface) SetTitle(title string) error { | |||||
| 2107 | 1957 | ||||
| 2108 | // Set a class for the surface. The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name (or the full path if it is a non-standard location) of the application's .desktop file as the class. | 1958 | // Set a class for the surface. The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name (or the full path if it is a non-standard location) of the application's .desktop file as the class. | ||
| 2109 | func (o *ShellSurface) SetClass(class string) error { | 1959 | func (o *ShellSurface) SetClass(class string) error { | ||
| 2110 | - | if err := o.Context().CheckProxy(o); err != nil { | 1960 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_shell_surface.set_class"}, class); err != nil { |
| 2111 | - | return err | |||
| 2112 | - | } | |||
| 2113 | - | if err := o.Context().SendRequest(o, 9, class); err != nil { | |||
| 2114 | return err | 1961 | return err | ||
| 2115 | } | 1962 | } | ||
| 2116 | return nil | 1963 | return nil | ||
| @@ -2250,10 +2097,7 @@ func NewSurface(ctx *wl.Context) *Surface { | |||||
| 2250 | 2097 | ||||
| 2251 | // Deletes the surface and invalidates its object ID. | 2098 | // Deletes the surface and invalidates its object ID. | ||
| 2252 | func (o *Surface) Destroy() error { | 2099 | func (o *Surface) Destroy() error { | ||
| 2253 | - | if err := o.Context().CheckProxy(o); err != nil { | 2100 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_surface.destroy", Destructor: true}); err != nil { |
| 2254 | - | return err | |||
| 2255 | - | } | |||
| 2256 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 2257 | return err | 2101 | return err | ||
| 2258 | } | 2102 | } | ||
| 2259 | return nil | 2103 | return nil | ||
| @@ -2261,14 +2105,11 @@ func (o *Surface) Destroy() error { | |||||
| 2261 | 2105 | ||||
| 2262 | // Set a buffer as the content of this surface. The new size of the surface is calculated based on the buffer size transformed by the inverse buffer_transform and the inverse buffer_scale. This means that at commit time the supplied buffer size must be an integer multiple of the buffer_scale. If that's not the case, an invalid_size error is sent. The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. Setting anything other than 0 as x and y arguments is discouraged, and should instead be replaced with using the separate wl_surface.offset request. When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an 'invalid_offset' error being raised. The x and y arguments are ignored and do not change the pending state. To achieve equivalent semantics, use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. wl_surface.commit makes the pending wl_buffer the new surface contents, and the size of the surface becomes the size calculated from the wl_buffer, as described above. After commit, there is no pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the pixels in the wl_buffer. The compositor may access the pixels at any time after the wl_surface.commit request. When the compositor will not access the pixels anymore, it will send the wl_buffer.release event. Only after receiving wl_buffer.release, the client may reuse the wl_buffer. A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor. If a pending wl_buffer has been committed to more than one wl_surface, the delivery of wl_buffer.release events becomes undefined. A well behaved client should not rely on wl_buffer.release events in this case. Instead, clients hitting this case should use wl_surface.get_release or use a protocol extension providing per-commit release notifications (if none of these options are available, a fallback can be implemented by creating multiple wl_buffer objects from the same backing storage). Destroying the wl_buffer after wl_buffer.release does not change the surface contents. Destroying the wl_buffer before wl_buffer.release is allowed as long as the underlying buffer storage isn't re-used (this can happen e.g. on client process termination). However, if the client destroys the wl_buffer before receiving the wl_buffer.release event and mutates the underlying buffer storage, the surface contents become undefined immediately. If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. If a pending wl_buffer has been destroyed, the result is not specified. Many compositors are known to remove the surface content on the following wl_surface.commit, but this behaviour is not universal. Clients seeking to maximise compatibility should not destroy pending buffers and should ensure that they explicitly remove content from surfaces, even after destroying buffers. | 2106 | // Set a buffer as the content of this surface. The new size of the surface is calculated based on the buffer size transformed by the inverse buffer_transform and the inverse buffer_scale. This means that at commit time the supplied buffer size must be an integer multiple of the buffer_scale. If that's not the case, an invalid_size error is sent. The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. Setting anything other than 0 as x and y arguments is discouraged, and should instead be replaced with using the separate wl_surface.offset request. When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an 'invalid_offset' error being raised. The x and y arguments are ignored and do not change the pending state. To achieve equivalent semantics, use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. wl_surface.commit makes the pending wl_buffer the new surface contents, and the size of the surface becomes the size calculated from the wl_buffer, as described above. After commit, there is no pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the pixels in the wl_buffer. The compositor may access the pixels at any time after the wl_surface.commit request. When the compositor will not access the pixels anymore, it will send the wl_buffer.release event. Only after receiving wl_buffer.release, the client may reuse the wl_buffer. A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor. If a pending wl_buffer has been committed to more than one wl_surface, the delivery of wl_buffer.release events becomes undefined. A well behaved client should not rely on wl_buffer.release events in this case. Instead, clients hitting this case should use wl_surface.get_release or use a protocol extension providing per-commit release notifications (if none of these options are available, a fallback can be implemented by creating multiple wl_buffer objects from the same backing storage). Destroying the wl_buffer after wl_buffer.release does not change the surface contents. Destroying the wl_buffer before wl_buffer.release is allowed as long as the underlying buffer storage isn't re-used (this can happen e.g. on client process termination). However, if the client destroys the wl_buffer before receiving the wl_buffer.release event and mutates the underlying buffer storage, the surface contents become undefined immediately. If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. If a pending wl_buffer has been destroyed, the result is not specified. Many compositors are known to remove the surface content on the following wl_surface.commit, but this behaviour is not universal. Clients seeking to maximise compatibility should not destroy pending buffers and should ensure that they explicitly remove content from surfaces, even after destroying buffers. | ||
| 2263 | func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error { | 2107 | func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error { | ||
| 2264 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2265 | - | return err | |||
| 2266 | - | } | |||
| 2267 | var arg0 wl.Object | 2108 | var arg0 wl.Object | ||
| 2268 | if buffer != nil { | 2109 | if buffer != nil { | ||
| 2269 | arg0 = buffer | 2110 | arg0 = buffer | ||
| 2270 | } | 2111 | } | ||
| 2271 | - | if err := o.Context().SendRequest(o, 1, arg0, x, y); err != nil { | 2112 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_surface.attach"}, arg0, x, y); err != nil { |
| 2272 | return err | 2113 | return err | ||
| 2273 | } | 2114 | } | ||
| 2274 | return nil | 2115 | return nil | ||
| @@ -2276,10 +2117,7 @@ func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error { | |||||
| 2276 | 2117 | ||||
| 2277 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in surface-local coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. Note! New clients should not use this request. Instead damage can be posted with wl_surface.damage_buffer which uses buffer coordinates instead of surface coordinates. | 2118 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in surface-local coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. Note! New clients should not use this request. Instead damage can be posted with wl_surface.damage_buffer which uses buffer coordinates instead of surface coordinates. | ||
| 2278 | func (o *Surface) Damage(x int32, y int32, width int32, height int32) error { | 2119 | func (o *Surface) Damage(x int32, y int32, width int32, height int32) error { | ||
| 2279 | - | if err := o.Context().CheckProxy(o); err != nil { | 2120 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_surface.damage"}, x, y, width, height); err != nil { |
| 2280 | - | return err | |||
| 2281 | - | } | |||
| 2282 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |||
| 2283 | return err | 2121 | return err | ||
| 2284 | } | 2122 | } | ||
| 2285 | return nil | 2123 | return nil | ||
| @@ -2287,16 +2125,9 @@ func (o *Surface) Damage(x int32, y int32, width int32, height int32) error { | |||||
| 2287 | 2125 | ||||
| 2288 | // Request a notification when it is a good time to start drawing a new frame, by creating a frame callback. This is useful for throttling redrawing operations, and driving animations. When a client is animating on a wl_surface, it can use the 'frame' request to get notified when it is a good time to draw and commit the next frame of animation. If the client commits an update earlier than that, it is likely that some updates will not make it to the display, and the client is wasting resources by drawing too often. The frame request will take effect on the next wl_surface.commit. The notification will only be posted for one frame unless requested again. For a wl_surface, the notifications are posted in the order the frame requests were committed. The server must send the notifications so that a client will not send excessive updates, while still allowing the highest possible update rate for clients that wait for the reply before drawing again. The server should give some time for the client to draw and commit after sending the frame callback events to let it hit the next output refresh. A server should avoid signaling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. The callback_data passed in the callback is the current time, in milliseconds, with an undefined base. | 2126 | // Request a notification when it is a good time to start drawing a new frame, by creating a frame callback. This is useful for throttling redrawing operations, and driving animations. When a client is animating on a wl_surface, it can use the 'frame' request to get notified when it is a good time to draw and commit the next frame of animation. If the client commits an update earlier than that, it is likely that some updates will not make it to the display, and the client is wasting resources by drawing too often. The frame request will take effect on the next wl_surface.commit. The notification will only be posted for one frame unless requested again. For a wl_surface, the notifications are posted in the order the frame requests were committed. The server must send the notifications so that a client will not send excessive updates, while still allowing the highest possible update rate for clients that wait for the reply before drawing again. The server should give some time for the client to draw and commit after sending the frame callback events to let it hit the next output refresh. A server should avoid signaling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. The callback_data passed in the callback is the current time, in milliseconds, with an undefined base. | ||
| 2289 | func (o *Surface) Frame() (*Callback, error) { | 2127 | func (o *Surface) Frame() (*Callback, error) { | ||
| 2290 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2291 | - | return nil, err | |||
| 2292 | - | } | |||
| 2293 | child := &Callback{} | 2128 | child := &Callback{} | ||
| 2294 | child.SetContext(o.Context()) | 2129 | child.SetContext(o.Context()) | ||
| 2295 | - | child.SetID(o.Context().AllocateID()) | 2130 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_surface.frame", Child: child}, child); err != nil { |
| 2296 | - | child.SetVersion(o.Version()) | |||
| 2297 | - | o.Context().Register(child) | |||
| 2298 | - | if err := o.Context().SendRequest(o, 3, child); err != nil { | |||
| 2299 | - | o.Context().Unregister(child) | |||
| 2300 | return nil, err | 2131 | return nil, err | ||
| 2301 | } | 2132 | } | ||
| 2302 | return child, nil | 2133 | return child, nil | ||
| @@ -2304,14 +2135,11 @@ func (o *Surface) Frame() (*Callback, error) { | |||||
| 2304 | 2135 | ||||
| 2305 | // This request sets the region of the surface that contains opaque content. The opaque region is an optimization hint for the compositor that lets it optimize the redrawing of content behind opaque regions. Setting an opaque region is not required for correct behaviour, but marking transparent content as opaque will result in repaint artifacts. The opaque region is specified in surface-local coordinates. The compositor ignores the parts of the opaque region that fall outside of the surface. Opaque region is double-buffered state, see wl_surface.commit. wl_surface.set_opaque_region changes the pending opaque region. wl_surface.commit copies the pending region to the current region. Otherwise, the pending and current regions are never changed. The initial value for an opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. | 2136 | // This request sets the region of the surface that contains opaque content. The opaque region is an optimization hint for the compositor that lets it optimize the redrawing of content behind opaque regions. Setting an opaque region is not required for correct behaviour, but marking transparent content as opaque will result in repaint artifacts. The opaque region is specified in surface-local coordinates. The compositor ignores the parts of the opaque region that fall outside of the surface. Opaque region is double-buffered state, see wl_surface.commit. wl_surface.set_opaque_region changes the pending opaque region. wl_surface.commit copies the pending region to the current region. Otherwise, the pending and current regions are never changed. The initial value for an opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. | ||
| 2306 | func (o *Surface) SetOpaqueRegion(region *Region) error { | 2137 | func (o *Surface) SetOpaqueRegion(region *Region) error { | ||
| 2307 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2308 | - | return err | |||
| 2309 | - | } | |||
| 2310 | var arg0 wl.Object | 2138 | var arg0 wl.Object | ||
| 2311 | if region != nil { | 2139 | if region != nil { | ||
| 2312 | arg0 = region | 2140 | arg0 = region | ||
| 2313 | } | 2141 | } | ||
| 2314 | - | if err := o.Context().SendRequest(o, 4, arg0); err != nil { | 2142 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_surface.set_opaque_region"}, arg0); err != nil { |
| 2315 | return err | 2143 | return err | ||
| 2316 | } | 2144 | } | ||
| 2317 | return nil | 2145 | return nil | ||
| @@ -2319,14 +2147,11 @@ func (o *Surface) SetOpaqueRegion(region *Region) error { | |||||
| 2319 | 2147 | ||||
| 2320 | // This request sets the region of the surface that can receive pointer and touch events. Input events happening outside of this region will try the next surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. The input region is specified in surface-local coordinates. Input region is double-buffered state, see wl_surface.commit. wl_surface.set_input_region changes the pending input region. wl_surface.commit copies the pending region to the current region. Otherwise the pending and current regions are never changed, except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite. | 2148 | // This request sets the region of the surface that can receive pointer and touch events. Input events happening outside of this region will try the next surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. The input region is specified in surface-local coordinates. Input region is double-buffered state, see wl_surface.commit. wl_surface.set_input_region changes the pending input region. wl_surface.commit copies the pending region to the current region. Otherwise the pending and current regions are never changed, except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite. | ||
| 2321 | func (o *Surface) SetInputRegion(region *Region) error { | 2149 | func (o *Surface) SetInputRegion(region *Region) error { | ||
| 2322 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2323 | - | return err | |||
| 2324 | - | } | |||
| 2325 | var arg0 wl.Object | 2150 | var arg0 wl.Object | ||
| 2326 | if region != nil { | 2151 | if region != nil { | ||
| 2327 | arg0 = region | 2152 | arg0 = region | ||
| 2328 | } | 2153 | } | ||
| 2329 | - | if err := o.Context().SendRequest(o, 5, arg0); err != nil { | 2154 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_surface.set_input_region"}, arg0); err != nil { |
| 2330 | return err | 2155 | return err | ||
| 2331 | } | 2156 | } | ||
| 2332 | return nil | 2157 | return nil | ||
| @@ -2334,10 +2159,7 @@ func (o *Surface) SetInputRegion(region *Region) error { | |||||
| 2334 | 2159 | ||||
| 2335 | // Surface state (input, opaque, and damage regions, attached buffers, etc.) is double-buffered. Protocol requests modify the pending state, as opposed to the active state in use by the compositor. All requests that need a commit to become effective are documented to affect double-buffered state. Other interfaces may add further double-buffered surface state. A commit request atomically creates a Content Update (CU) from the pending state, even if the pending state has not been touched. The content update is placed at the end of a per-surface queue until it becomes active. After commit, the new pending state is as documented for each related request. A CU is either a Desync Content Update (DCU) or a Sync Content Update (SCU). If the surface is effectively synchronized at the commit request, it is a SCU, otherwise a DCU. When a surface transitions from effectively synchronized to effectively desynchronized, all SCUs in its queue which are not reachable by any DCU become DCUs and dependency edges from outside the queue to these CUs are removed. See wl_subsurface for the definition of 'effectively synchronized' and 'effectively desynchronized'. When a CU is placed in the queue, the CU has a dependency on the CU in front of it and to the SCU at end of the queue of every direct child surface if that SCU exists and does not have another dependent. This can form a directed acyclic graph of CUs with dependencies as edges. In addition to surface state, the CU can have constraints that must be satisfied before it can be applied. Other interfaces may add CU constraints. All DCUs which do not have a SCU in front of themselves in their queue, are candidates. If the graph that's reachable by a candidate does not have any unsatisfied constraints, the entire graph must be applied atomically. When a CU is applied, the wl_buffer is applied before all other state. This means that all coordinates in double-buffered state are relative to the newly attached wl_buffers, except for wl_surface.attach itself. If there is no newly attached wl_buffer, the coordinates are relative to the previous content update. | 2160 | // Surface state (input, opaque, and damage regions, attached buffers, etc.) is double-buffered. Protocol requests modify the pending state, as opposed to the active state in use by the compositor. All requests that need a commit to become effective are documented to affect double-buffered state. Other interfaces may add further double-buffered surface state. A commit request atomically creates a Content Update (CU) from the pending state, even if the pending state has not been touched. The content update is placed at the end of a per-surface queue until it becomes active. After commit, the new pending state is as documented for each related request. A CU is either a Desync Content Update (DCU) or a Sync Content Update (SCU). If the surface is effectively synchronized at the commit request, it is a SCU, otherwise a DCU. When a surface transitions from effectively synchronized to effectively desynchronized, all SCUs in its queue which are not reachable by any DCU become DCUs and dependency edges from outside the queue to these CUs are removed. See wl_subsurface for the definition of 'effectively synchronized' and 'effectively desynchronized'. When a CU is placed in the queue, the CU has a dependency on the CU in front of it and to the SCU at end of the queue of every direct child surface if that SCU exists and does not have another dependent. This can form a directed acyclic graph of CUs with dependencies as edges. In addition to surface state, the CU can have constraints that must be satisfied before it can be applied. Other interfaces may add CU constraints. All DCUs which do not have a SCU in front of themselves in their queue, are candidates. If the graph that's reachable by a candidate does not have any unsatisfied constraints, the entire graph must be applied atomically. When a CU is applied, the wl_buffer is applied before all other state. This means that all coordinates in double-buffered state are relative to the newly attached wl_buffers, except for wl_surface.attach itself. If there is no newly attached wl_buffer, the coordinates are relative to the previous content update. | ||
| 2336 | func (o *Surface) Commit() error { | 2161 | func (o *Surface) Commit() error { | ||
| 2337 | - | if err := o.Context().CheckProxy(o); err != nil { | 2162 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_surface.commit"}); err != nil { |
| 2338 | - | return err | |||
| 2339 | - | } | |||
| 2340 | - | if err := o.Context().SendRequest(o, 6); err != nil { | |||
| 2341 | return err | 2163 | return err | ||
| 2342 | } | 2164 | } | ||
| 2343 | return nil | 2165 | return nil | ||
| @@ -2345,13 +2167,7 @@ func (o *Surface) Commit() error { | |||||
| 2345 | 2167 | ||||
| 2346 | // This request sets the transformation that the client has already applied to the content of the buffer. The accepted values for the transform parameter are the values for wl_output.transform. The compositor applies the inverse of this transformation whenever it uses the buffer contents. Buffer transform is double-buffered state, see wl_surface.commit. A newly created surface has its buffer transformation set to normal. wl_surface.set_buffer_transform changes the pending buffer transformation. wl_surface.commit copies the pending buffer transformation to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to render content according to the output transform, thus permitting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen surfaces are examples of such optimizations. Those optimizations are highly dependent on the compositor implementation, so the use of this request should be considered on a case-by-case basis. Note that if the transform value includes 90 or 270 degree rotation, the width of the buffer will become the surface height and the height of the buffer will become the surface width. If transform is not one of the values from the wl_output.transform enum the invalid_transform protocol error is raised. | 2168 | // This request sets the transformation that the client has already applied to the content of the buffer. The accepted values for the transform parameter are the values for wl_output.transform. The compositor applies the inverse of this transformation whenever it uses the buffer contents. Buffer transform is double-buffered state, see wl_surface.commit. A newly created surface has its buffer transformation set to normal. wl_surface.set_buffer_transform changes the pending buffer transformation. wl_surface.commit copies the pending buffer transformation to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to render content according to the output transform, thus permitting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen surfaces are examples of such optimizations. Those optimizations are highly dependent on the compositor implementation, so the use of this request should be considered on a case-by-case basis. Note that if the transform value includes 90 or 270 degree rotation, the width of the buffer will become the surface height and the height of the buffer will become the surface width. If transform is not one of the values from the wl_output.transform enum the invalid_transform protocol error is raised. | ||
| 2347 | func (o *Surface) SetBufferTransform(transform int32) error { | 2169 | func (o *Surface) SetBufferTransform(transform int32) error { | ||
| 2348 | - | if err := o.Context().CheckProxy(o); err != nil { | 2170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_surface.set_buffer_transform", Since: 2}, transform); err != nil { |
| 2349 | - | return err | |||
| 2350 | - | } | |||
| 2351 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_surface.set_buffer_transform"); err != nil { | |||
| 2352 | - | return err | |||
| 2353 | - | } | |||
| 2354 | - | if err := o.Context().SendRequest(o, 7, transform); err != nil { | |||
| 2355 | return err | 2171 | return err | ||
| 2356 | } | 2172 | } | ||
| 2357 | return nil | 2173 | return nil | ||
| @@ -2359,13 +2175,7 @@ func (o *Surface) SetBufferTransform(transform int32) error { | |||||
| 2359 | 2175 | ||||
| 2360 | // This request sets an optional scaling factor on how the compositor interprets the contents of the buffer attached to the window. Buffer scale is double-buffered state, see wl_surface.commit. A newly created surface has its buffer scale set to 1. wl_surface.set_buffer_scale changes the pending buffer scale. wl_surface.commit copies the pending buffer scale to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to supply higher resolution buffer data for use on high resolution outputs. It is intended that you pick the same buffer scale as the scale of the output that the surface is displayed on. This means the compositor can avoid scaling when rendering the surface on that output. Note that if the scale is larger than 1, then you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. If scale is not greater than 0 the invalid_scale protocol error is raised. | 2176 | // This request sets an optional scaling factor on how the compositor interprets the contents of the buffer attached to the window. Buffer scale is double-buffered state, see wl_surface.commit. A newly created surface has its buffer scale set to 1. wl_surface.set_buffer_scale changes the pending buffer scale. wl_surface.commit copies the pending buffer scale to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to supply higher resolution buffer data for use on high resolution outputs. It is intended that you pick the same buffer scale as the scale of the output that the surface is displayed on. This means the compositor can avoid scaling when rendering the surface on that output. Note that if the scale is larger than 1, then you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. If scale is not greater than 0 the invalid_scale protocol error is raised. | ||
| 2361 | func (o *Surface) SetBufferScale(scale int32) error { | 2177 | func (o *Surface) SetBufferScale(scale int32) error { | ||
| 2362 | - | if err := o.Context().CheckProxy(o); err != nil { | 2178 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_surface.set_buffer_scale", Since: 3}, scale); err != nil { |
| 2363 | - | return err | |||
| 2364 | - | } | |||
| 2365 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_surface.set_buffer_scale"); err != nil { | |||
| 2366 | - | return err | |||
| 2367 | - | } | |||
| 2368 | - | if err := o.Context().SendRequest(o, 8, scale); err != nil { | |||
| 2369 | return err | 2179 | return err | ||
| 2370 | } | 2180 | } | ||
| 2371 | return nil | 2181 | return nil | ||
| @@ -2373,13 +2183,7 @@ func (o *Surface) SetBufferScale(scale int32) error { | |||||
| 2373 | 2183 | ||||
| 2374 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in buffer coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage_buffer adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. This request differs from wl_surface.damage in only one way - it takes damage in buffer coordinates instead of surface-local coordinates. While this generally is more intuitive than surface coordinates, it is especially desirable when using wp_viewport or when a drawing library (like EGL) is unaware of buffer scale and buffer transform. Note: Because buffer transformation changes and damage requests may be interleaved in the protocol stream, it is impossible to determine the actual mapping between surface and buffer damage until wl_surface.commit time. Therefore, compositors wishing to take both kinds of damage into account will have to accumulate damage from the two requests separately and only transform from one to the other after receiving the wl_surface.commit. | 2184 | // This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in buffer coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage_buffer adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. This request differs from wl_surface.damage in only one way - it takes damage in buffer coordinates instead of surface-local coordinates. While this generally is more intuitive than surface coordinates, it is especially desirable when using wp_viewport or when a drawing library (like EGL) is unaware of buffer scale and buffer transform. Note: Because buffer transformation changes and damage requests may be interleaved in the protocol stream, it is impossible to determine the actual mapping between surface and buffer damage until wl_surface.commit time. Therefore, compositors wishing to take both kinds of damage into account will have to accumulate damage from the two requests separately and only transform from one to the other after receiving the wl_surface.commit. | ||
| 2375 | func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) error { | 2185 | func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) error { | ||
| 2376 | - | if err := o.Context().CheckProxy(o); err != nil { | 2186 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_surface.damage_buffer", Since: 4}, x, y, width, height); err != nil { |
| 2377 | - | return err | |||
| 2378 | - | } | |||
| 2379 | - | if err := wl.CheckVersion(o.Version(), 4, "wl_surface.damage_buffer"); err != nil { | |||
| 2380 | - | return err | |||
| 2381 | - | } | |||
| 2382 | - | if err := o.Context().SendRequest(o, 9, x, y, width, height); err != nil { | |||
| 2383 | return err | 2187 | return err | ||
| 2384 | } | 2188 | } | ||
| 2385 | return nil | 2189 | return nil | ||
| @@ -2387,13 +2191,7 @@ func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) erro | |||||
| 2387 | 2191 | ||||
| 2388 | // The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. The exact semantics of wl_surface.offset are role-specific. Refer to the documentation of specific roles for more information. Surface location offset is double-buffered state, see wl_surface.commit. This request is semantically equivalent to and the replaces the x and y arguments in the wl_surface.attach request in wl_surface versions prior to 5. See wl_surface.attach for details. | 2192 | // The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. The exact semantics of wl_surface.offset are role-specific. Refer to the documentation of specific roles for more information. Surface location offset is double-buffered state, see wl_surface.commit. This request is semantically equivalent to and the replaces the x and y arguments in the wl_surface.attach request in wl_surface versions prior to 5. See wl_surface.attach for details. | ||
| 2389 | func (o *Surface) Offset(x int32, y int32) error { | 2193 | func (o *Surface) Offset(x int32, y int32) error { | ||
| 2390 | - | if err := o.Context().CheckProxy(o); err != nil { | 2194 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "wl_surface.offset", Since: 5}, x, y); err != nil { |
| 2391 | - | return err | |||
| 2392 | - | } | |||
| 2393 | - | if err := wl.CheckVersion(o.Version(), 5, "wl_surface.offset"); err != nil { | |||
| 2394 | - | return err | |||
| 2395 | - | } | |||
| 2396 | - | if err := o.Context().SendRequest(o, 10, x, y); err != nil { | |||
| 2397 | return err | 2195 | return err | ||
| 2398 | } | 2196 | } | ||
| 2399 | return nil | 2197 | return nil | ||
| @@ -2401,19 +2199,9 @@ func (o *Surface) Offset(x int32, y int32) error { | |||||
| 2401 | 2199 | ||||
| 2402 | // Create a callback for the release of the buffer attached by the client with wl_surface.attach. The compositor will release the buffer when it has finished its usage of the underlying storage for the relevant commit. Once the client receives this event, and assuming the associated buffer is not pending release from other wl_surface.commit requests, the client can safely re-use the buffer. Release callbacks are double-buffered state, and will be associated with the pending buffer at wl_surface.commit time. The callback_data passed in the wl_callback.done event is unused and is always zero. Sending this request without attaching a non-null buffer in the same content update is a protocol error. The compositor will send the no_buffer error in this case. | 2200 | // Create a callback for the release of the buffer attached by the client with wl_surface.attach. The compositor will release the buffer when it has finished its usage of the underlying storage for the relevant commit. Once the client receives this event, and assuming the associated buffer is not pending release from other wl_surface.commit requests, the client can safely re-use the buffer. Release callbacks are double-buffered state, and will be associated with the pending buffer at wl_surface.commit time. The callback_data passed in the wl_callback.done event is unused and is always zero. Sending this request without attaching a non-null buffer in the same content update is a protocol error. The compositor will send the no_buffer error in this case. | ||
| 2403 | func (o *Surface) GetRelease() (*Callback, error) { | 2201 | func (o *Surface) GetRelease() (*Callback, error) { | ||
| 2404 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2405 | - | return nil, err | |||
| 2406 | - | } | |||
| 2407 | - | if err := wl.CheckVersion(o.Version(), 7, "wl_surface.get_release"); err != nil { | |||
| 2408 | - | return nil, err | |||
| 2409 | - | } | |||
| 2410 | child := &Callback{} | 2202 | child := &Callback{} | ||
| 2411 | child.SetContext(o.Context()) | 2203 | child.SetContext(o.Context()) | ||
| 2412 | - | child.SetID(o.Context().AllocateID()) | 2204 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 11, Name: "wl_surface.get_release", Since: 7, Child: child}, child); err != nil { |
| 2413 | - | child.SetVersion(o.Version()) | |||
| 2414 | - | o.Context().Register(child) | |||
| 2415 | - | if err := o.Context().SendRequest(o, 11, child); err != nil { | |||
| 2416 | - | o.Context().Unregister(child) | |||
| 2417 | return nil, err | 2205 | return nil, err | ||
| 2418 | } | 2206 | } | ||
| 2419 | return child, nil | 2207 | return child, nil | ||
| @@ -2581,16 +2369,9 @@ func NewSeat(ctx *wl.Context) *Seat { | |||||
| 2581 | 2369 | ||||
| 2582 | // The ID provided will be initialized to the wl_pointer interface for this seat. This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has never had the pointer capability. The missing_capability error will be sent in this case. | 2370 | // The ID provided will be initialized to the wl_pointer interface for this seat. This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has never had the pointer capability. The missing_capability error will be sent in this case. | ||
| 2583 | func (o *Seat) GetPointer() (*Pointer, error) { | 2371 | func (o *Seat) GetPointer() (*Pointer, error) { | ||
| 2584 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2585 | - | return nil, err | |||
| 2586 | - | } | |||
| 2587 | child := &Pointer{} | 2372 | child := &Pointer{} | ||
| 2588 | child.SetContext(o.Context()) | 2373 | child.SetContext(o.Context()) | ||
| 2589 | - | child.SetID(o.Context().AllocateID()) | 2374 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_seat.get_pointer", Child: child}, child); err != nil { |
| 2590 | - | child.SetVersion(o.Version()) | |||
| 2591 | - | o.Context().Register(child) | |||
| 2592 | - | if err := o.Context().SendRequest(o, 0, child); err != nil { | |||
| 2593 | - | o.Context().Unregister(child) | |||
| 2594 | return nil, err | 2375 | return nil, err | ||
| 2595 | } | 2376 | } | ||
| 2596 | return child, nil | 2377 | return child, nil | ||
| @@ -2598,16 +2379,9 @@ func (o *Seat) GetPointer() (*Pointer, error) { | |||||
| 2598 | 2379 | ||||
| 2599 | // The ID provided will be initialized to the wl_keyboard interface for this seat. This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has never had the keyboard capability. The missing_capability error will be sent in this case. | 2380 | // The ID provided will be initialized to the wl_keyboard interface for this seat. This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has never had the keyboard capability. The missing_capability error will be sent in this case. | ||
| 2600 | func (o *Seat) GetKeyboard() (*Keyboard, error) { | 2381 | func (o *Seat) GetKeyboard() (*Keyboard, error) { | ||
| 2601 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2602 | - | return nil, err | |||
| 2603 | - | } | |||
| 2604 | child := &Keyboard{} | 2382 | child := &Keyboard{} | ||
| 2605 | child.SetContext(o.Context()) | 2383 | child.SetContext(o.Context()) | ||
| 2606 | - | child.SetID(o.Context().AllocateID()) | 2384 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_seat.get_keyboard", Child: child}, child); err != nil { |
| 2607 | - | child.SetVersion(o.Version()) | |||
| 2608 | - | o.Context().Register(child) | |||
| 2609 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |||
| 2610 | - | o.Context().Unregister(child) | |||
| 2611 | return nil, err | 2385 | return nil, err | ||
| 2612 | } | 2386 | } | ||
| 2613 | return child, nil | 2387 | return child, nil | ||
| @@ -2615,16 +2389,9 @@ func (o *Seat) GetKeyboard() (*Keyboard, error) { | |||||
| 2615 | 2389 | ||||
| 2616 | // The ID provided will be initialized to the wl_touch interface for this seat. This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has never had the touch capability. The missing_capability error will be sent in this case. | 2390 | // The ID provided will be initialized to the wl_touch interface for this seat. This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has never had the touch capability. The missing_capability error will be sent in this case. | ||
| 2617 | func (o *Seat) GetTouch() (*Touch, error) { | 2391 | func (o *Seat) GetTouch() (*Touch, error) { | ||
| 2618 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2619 | - | return nil, err | |||
| 2620 | - | } | |||
| 2621 | child := &Touch{} | 2392 | child := &Touch{} | ||
| 2622 | child.SetContext(o.Context()) | 2393 | child.SetContext(o.Context()) | ||
| 2623 | - | child.SetID(o.Context().AllocateID()) | 2394 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_seat.get_touch", Child: child}, child); err != nil { |
| 2624 | - | child.SetVersion(o.Version()) | |||
| 2625 | - | o.Context().Register(child) | |||
| 2626 | - | if err := o.Context().SendRequest(o, 2, child); err != nil { | |||
| 2627 | - | o.Context().Unregister(child) | |||
| 2628 | return nil, err | 2395 | return nil, err | ||
| 2629 | } | 2396 | } | ||
| 2630 | return child, nil | 2397 | return child, nil | ||
| @@ -2632,13 +2399,7 @@ func (o *Seat) GetTouch() (*Touch, error) { | |||||
| 2632 | 2399 | ||||
| 2633 | // Using this request a client can tell the server that it is not going to use the seat object anymore. | 2400 | // Using this request a client can tell the server that it is not going to use the seat object anymore. | ||
| 2634 | func (o *Seat) Release() error { | 2401 | func (o *Seat) Release() error { | ||
| 2635 | - | if err := o.Context().CheckProxy(o); err != nil { | 2402 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_seat.release", Since: 5, Destructor: true}); err != nil { |
| 2636 | - | return err | |||
| 2637 | - | } | |||
| 2638 | - | if err := wl.CheckVersion(o.Version(), 5, "wl_seat.release"); err != nil { | |||
| 2639 | - | return err | |||
| 2640 | - | } | |||
| 2641 | - | if err := o.Context().SendDestructor(o, 3); err != nil { | |||
| 2642 | return err | 2403 | return err | ||
| 2643 | } | 2404 | } | ||
| 2644 | return nil | 2405 | return nil | ||
| @@ -2754,14 +2515,11 @@ func NewPointer(ctx *wl.Context) *Pointer { | |||||
| 2754 | 2515 | ||||
| 2755 | // Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. If the surface already has another role, it raises a protocol error. The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the pointer image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On wl_surface.offset requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. The offset must be applied by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The input region is ignored for wl_surfaces with the role of a cursor. When the use as a cursor ends, the wl_surface is unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be ignored. | 2516 | // Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. If the surface already has another role, it raises a protocol error. The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the pointer image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On wl_surface.offset requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. The offset must be applied by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The input region is ignored for wl_surfaces with the role of a cursor. When the use as a cursor ends, the wl_surface is unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be ignored. | ||
| 2756 | func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hotspotY int32) error { | 2517 | func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hotspotY int32) error { | ||
| 2757 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 2758 | - | return err | |||
| 2759 | - | } | |||
| 2760 | var arg1 wl.Object | 2518 | var arg1 wl.Object | ||
| 2761 | if surface != nil { | 2519 | if surface != nil { | ||
| 2762 | arg1 = surface | 2520 | arg1 = surface | ||
| 2763 | } | 2521 | } | ||
| 2764 | - | if err := o.Context().SendRequest(o, 0, serial, arg1, hotspotX, hotspotY); err != nil { | 2522 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_pointer.set_cursor"}, serial, arg1, hotspotX, hotspotY); err != nil { |
| 2765 | return err | 2523 | return err | ||
| 2766 | } | 2524 | } | ||
| 2767 | return nil | 2525 | return nil | ||
| @@ -2769,13 +2527,7 @@ func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hot | |||||
| 2769 | 2527 | ||||
| 2770 | // Using this request a client can tell the server that it is not going to use the pointer object anymore. This request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request. | 2528 | // Using this request a client can tell the server that it is not going to use the pointer object anymore. This request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request. | ||
| 2771 | func (o *Pointer) Release() error { | 2529 | func (o *Pointer) Release() error { | ||
| 2772 | - | if err := o.Context().CheckProxy(o); err != nil { | 2530 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_pointer.release", Since: 3, Destructor: true}); err != nil { |
| 2773 | - | return err | |||
| 2774 | - | } | |||
| 2775 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_pointer.release"); err != nil { | |||
| 2776 | - | return err | |||
| 2777 | - | } | |||
| 2778 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 2779 | return err | 2531 | return err | ||
| 2780 | } | 2532 | } | ||
| 2781 | return nil | 2533 | return nil | ||
| @@ -3210,13 +2962,7 @@ func NewKeyboard(ctx *wl.Context) *Keyboard { | |||||
| 3210 | 2962 | ||||
| 3211 | // release the keyboard object | 2963 | // release the keyboard object | ||
| 3212 | func (o *Keyboard) Release() error { | 2964 | func (o *Keyboard) Release() error { | ||
| 3213 | - | if err := o.Context().CheckProxy(o); err != nil { | 2965 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_keyboard.release", Since: 3, Destructor: true}); err != nil { |
| 3214 | - | return err | |||
| 3215 | - | } | |||
| 3216 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_keyboard.release"); err != nil { | |||
| 3217 | - | return err | |||
| 3218 | - | } | |||
| 3219 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 3220 | return err | 2966 | return err | ||
| 3221 | } | 2967 | } | ||
| 3222 | return nil | 2968 | return nil | ||
| @@ -3468,13 +3214,7 @@ func NewTouch(ctx *wl.Context) *Touch { | |||||
| 3468 | 3214 | ||||
| 3469 | // release the touch object | 3215 | // release the touch object | ||
| 3470 | func (o *Touch) Release() error { | 3216 | func (o *Touch) Release() error { | ||
| 3471 | - | if err := o.Context().CheckProxy(o); err != nil { | 3217 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_touch.release", Since: 3, Destructor: true}); err != nil { |
| 3472 | - | return err | |||
| 3473 | - | } | |||
| 3474 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_touch.release"); err != nil { | |||
| 3475 | - | return err | |||
| 3476 | - | } | |||
| 3477 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 3478 | return err | 3218 | return err | ||
| 3479 | } | 3219 | } | ||
| 3480 | return nil | 3220 | return nil | ||
| @@ -3750,13 +3490,7 @@ func NewOutput(ctx *wl.Context) *Output { | |||||
| 3750 | 3490 | ||||
| 3751 | // Using this request a client can tell the server that it is not going to use the output object anymore. | 3491 | // Using this request a client can tell the server that it is not going to use the output object anymore. | ||
| 3752 | func (o *Output) Release() error { | 3492 | func (o *Output) Release() error { | ||
| 3753 | - | if err := o.Context().CheckProxy(o); err != nil { | 3493 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_output.release", Since: 3, Destructor: true}); err != nil { |
| 3754 | - | return err | |||
| 3755 | - | } | |||
| 3756 | - | if err := wl.CheckVersion(o.Version(), 3, "wl_output.release"); err != nil { | |||
| 3757 | - | return err | |||
| 3758 | - | } | |||
| 3759 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 3760 | return err | 3494 | return err | ||
| 3761 | } | 3495 | } | ||
| 3762 | return nil | 3496 | return nil | ||
| @@ -3990,10 +3724,7 @@ func NewRegion(ctx *wl.Context) *Region { | |||||
| 3990 | 3724 | ||||
| 3991 | // Destroy the region. This will invalidate the object ID. | 3725 | // Destroy the region. This will invalidate the object ID. | ||
| 3992 | func (o *Region) Destroy() error { | 3726 | func (o *Region) Destroy() error { | ||
| 3993 | - | if err := o.Context().CheckProxy(o); err != nil { | 3727 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_region.destroy", Destructor: true}); err != nil { |
| 3994 | - | return err | |||
| 3995 | - | } | |||
| 3996 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 3997 | return err | 3728 | return err | ||
| 3998 | } | 3729 | } | ||
| 3999 | return nil | 3730 | return nil | ||
| @@ -4001,10 +3732,7 @@ func (o *Region) Destroy() error { | |||||
| 4001 | 3732 | ||||
| 4002 | // Add the specified rectangle to the region. | 3733 | // Add the specified rectangle to the region. | ||
| 4003 | func (o *Region) Add(x int32, y int32, width int32, height int32) error { | 3734 | func (o *Region) Add(x int32, y int32, width int32, height int32) error { | ||
| 4004 | - | if err := o.Context().CheckProxy(o); err != nil { | 3735 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_region.add"}, x, y, width, height); err != nil { |
| 4005 | - | return err | |||
| 4006 | - | } | |||
| 4007 | - | if err := o.Context().SendRequest(o, 1, x, y, width, height); err != nil { | |||
| 4008 | return err | 3736 | return err | ||
| 4009 | } | 3737 | } | ||
| 4010 | return nil | 3738 | return nil | ||
| @@ -4012,10 +3740,7 @@ func (o *Region) Add(x int32, y int32, width int32, height int32) error { | |||||
| 4012 | 3740 | ||||
| 4013 | // Subtract the specified rectangle from the region. | 3741 | // Subtract the specified rectangle from the region. | ||
| 4014 | func (o *Region) Subtract(x int32, y int32, width int32, height int32) error { | 3742 | func (o *Region) Subtract(x int32, y int32, width int32, height int32) error { | ||
| 4015 | - | if err := o.Context().CheckProxy(o); err != nil { | 3743 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_region.subtract"}, x, y, width, height); err != nil { |
| 4016 | - | return err | |||
| 4017 | - | } | |||
| 4018 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |||
| 4019 | return err | 3744 | return err | ||
| 4020 | } | 3745 | } | ||
| 4021 | return nil | 3746 | return nil | ||
| @@ -4054,10 +3779,7 @@ func NewSubcompositor(ctx *wl.Context) *Subcompositor { | |||||
| 4054 | 3779 | ||||
| 4055 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wl_subsurface objects included. | 3780 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wl_subsurface objects included. | ||
| 4056 | func (o *Subcompositor) Destroy() error { | 3781 | func (o *Subcompositor) Destroy() error { | ||
| 4057 | - | if err := o.Context().CheckProxy(o); err != nil { | 3782 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subcompositor.destroy", Destructor: true}); err != nil { |
| 4058 | - | return err | |||
| 4059 | - | } | |||
| 4060 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 4061 | return err | 3783 | return err | ||
| 4062 | } | 3784 | } | ||
| 4063 | return nil | 3785 | return nil | ||
| @@ -4065,9 +3787,6 @@ func (o *Subcompositor) Destroy() error { | |||||
| 4065 | 3787 | ||||
| 4066 | // Create a sub-surface interface for the given surface, and associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it must not have an existing wl_subsurface object. Otherwise the bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. The parent surface must not be one of the child surface's descendants, and the parent must be different from the child surface, otherwise the bad_parent protocol error is raised. This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface. | 3788 | // Create a sub-surface interface for the given surface, and associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it must not have an existing wl_subsurface object. Otherwise the bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. The parent surface must not be one of the child surface's descendants, and the parent must be different from the child surface, otherwise the bad_parent protocol error is raised. This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface. | ||
| 4067 | func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsurface, error) { | 3789 | func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsurface, error) { | ||
| 4068 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 4069 | - | return nil, err | |||
| 4070 | - | } | |||
| 4071 | var arg1 wl.Object | 3790 | var arg1 wl.Object | ||
| 4072 | if surface != nil { | 3791 | if surface != nil { | ||
| 4073 | arg1 = surface | 3792 | arg1 = surface | ||
| @@ -4078,11 +3797,7 @@ func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsu | |||||
| 4078 | } | 3797 | } | ||
| 4079 | child := &Subsurface{} | 3798 | child := &Subsurface{} | ||
| 4080 | child.SetContext(o.Context()) | 3799 | child.SetContext(o.Context()) | ||
| 4081 | - | child.SetID(o.Context().AllocateID()) | 3800 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subcompositor.get_subsurface", Child: child}, child, arg1, arg2); err != nil { |
| 4082 | - | child.SetVersion(o.Version()) | |||
| 4083 | - | o.Context().Register(child) | |||
| 4084 | - | if err := o.Context().SendRequest(o, 1, child, arg1, arg2); err != nil { | |||
| 4085 | - | o.Context().Unregister(child) | |||
| 4086 | return nil, err | 3801 | return nil, err | ||
| 4087 | } | 3802 | } | ||
| 4088 | return child, nil | 3803 | return child, nil | ||
| @@ -4121,10 +3836,7 @@ func NewSubsurface(ctx *wl.Context) *Subsurface { | |||||
| 4121 | 3836 | ||||
| 4122 | // The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted. The wl_surface is unmapped immediately. | 3837 | // The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted. The wl_surface is unmapped immediately. | ||
| 4123 | func (o *Subsurface) Destroy() error { | 3838 | func (o *Subsurface) Destroy() error { | ||
| 4124 | - | if err := o.Context().CheckProxy(o); err != nil { | 3839 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subsurface.destroy", Destructor: true}); err != nil { |
| 4125 | - | return err | |||
| 4126 | - | } | |||
| 4127 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 4128 | return err | 3840 | return err | ||
| 4129 | } | 3841 | } | ||
| 4130 | return nil | 3842 | return nil | ||
| @@ -4132,10 +3844,7 @@ func (o *Subsurface) Destroy() error { | |||||
| 4132 | 3844 | ||||
| 4133 | // This sets the position of the sub-surface, relative to the parent surface. The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. The initial position is 0, 0. Position is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | 3845 | // This sets the position of the sub-surface, relative to the parent surface. The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. The initial position is 0, 0. Position is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | ||
| 4134 | func (o *Subsurface) SetPosition(x int32, y int32) error { | 3846 | func (o *Subsurface) SetPosition(x int32, y int32) error { | ||
| 4135 | - | if err := o.Context().CheckProxy(o); err != nil { | 3847 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subsurface.set_position"}, x, y); err != nil { |
| 4136 | - | return err | |||
| 4137 | - | } | |||
| 4138 | - | if err := o.Context().SendRequest(o, 1, x, y); err != nil { | |||
| 4139 | return err | 3848 | return err | ||
| 4140 | } | 3849 | } | ||
| 4141 | return nil | 3850 | return nil | ||
| @@ -4143,14 +3852,11 @@ func (o *Subsurface) SetPosition(x int32, y int32) error { | |||||
| 4143 | 3852 | ||||
| 4144 | // This sub-surface is taken from the stack, and put back just above the reference surface, changing the z-order of the sub-surfaces. The reference surface must be one of the sibling surfaces, or the parent surface. Using any other surface, including this sub-surface, will cause a protocol error. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. Z-order is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | 3853 | // This sub-surface is taken from the stack, and put back just above the reference surface, changing the z-order of the sub-surfaces. The reference surface must be one of the sibling surfaces, or the parent surface. Using any other surface, including this sub-surface, will cause a protocol error. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. Z-order is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information. | ||
| 4145 | func (o *Subsurface) PlaceAbove(sibling *Surface) error { | 3854 | func (o *Subsurface) PlaceAbove(sibling *Surface) error { | ||
| 4146 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 4147 | - | return err | |||
| 4148 | - | } | |||
| 4149 | var arg0 wl.Object | 3855 | var arg0 wl.Object | ||
| 4150 | if sibling != nil { | 3856 | if sibling != nil { | ||
| 4151 | arg0 = sibling | 3857 | arg0 = sibling | ||
| 4152 | } | 3858 | } | ||
| 4153 | - | if err := o.Context().SendRequest(o, 2, arg0); err != nil { | 3859 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_subsurface.place_above"}, arg0); err != nil { |
| 4154 | return err | 3860 | return err | ||
| 4155 | } | 3861 | } | ||
| 4156 | return nil | 3862 | return nil | ||
| @@ -4158,14 +3864,11 @@ func (o *Subsurface) PlaceAbove(sibling *Surface) error { | |||||
| 4158 | 3864 | ||||
| 4159 | // The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. | 3865 | // The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. | ||
| 4160 | func (o *Subsurface) PlaceBelow(sibling *Surface) error { | 3866 | func (o *Subsurface) PlaceBelow(sibling *Surface) error { | ||
| 4161 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 4162 | - | return err | |||
| 4163 | - | } | |||
| 4164 | var arg0 wl.Object | 3867 | var arg0 wl.Object | ||
| 4165 | if sibling != nil { | 3868 | if sibling != nil { | ||
| 4166 | arg0 = sibling | 3869 | arg0 = sibling | ||
| 4167 | } | 3870 | } | ||
| 4168 | - | if err := o.Context().SendRequest(o, 3, arg0); err != nil { | 3871 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_subsurface.place_below"}, arg0); err != nil { |
| 4169 | return err | 3872 | return err | ||
| 4170 | } | 3873 | } | ||
| 4171 | return nil | 3874 | return nil | ||
| @@ -4173,10 +3876,7 @@ func (o *Subsurface) PlaceBelow(sibling *Surface) error { | |||||
| 4173 | 3876 | ||||
| 4174 | // Change the commit behaviour of the sub-surface to synchronized mode. See wl_subsurface and wl_surface.commit for more information. | 3877 | // Change the commit behaviour of the sub-surface to synchronized mode. See wl_subsurface and wl_surface.commit for more information. | ||
| 4175 | func (o *Subsurface) SetSync() error { | 3878 | func (o *Subsurface) SetSync() error { | ||
| 4176 | - | if err := o.Context().CheckProxy(o); err != nil { | 3879 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_subsurface.set_sync"}); err != nil { |
| 4177 | - | return err | |||
| 4178 | - | } | |||
| 4179 | - | if err := o.Context().SendRequest(o, 4); err != nil { | |||
| 4180 | return err | 3880 | return err | ||
| 4181 | } | 3881 | } | ||
| 4182 | return nil | 3882 | return nil | ||
| @@ -4184,10 +3884,7 @@ func (o *Subsurface) SetSync() error { | |||||
| 4184 | 3884 | ||||
| 4185 | // Change the commit behaviour of the sub-surface to desynchronized mode. See wl_subsurface and wl_surface.commit for more information. | 3885 | // Change the commit behaviour of the sub-surface to desynchronized mode. See wl_subsurface and wl_surface.commit for more information. | ||
| 4186 | func (o *Subsurface) SetDesync() error { | 3886 | func (o *Subsurface) SetDesync() error { | ||
| 4187 | - | if err := o.Context().CheckProxy(o); err != nil { | 3887 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_subsurface.set_desync"}); err != nil { |
| 4188 | - | return err | |||
| 4189 | - | } | |||
| 4190 | - | if err := o.Context().SendRequest(o, 5); err != nil { | |||
| 4191 | return err | 3888 | return err | ||
| 4192 | } | 3889 | } | ||
| 4193 | return nil | 3890 | return nil | ||
| @@ -4226,10 +3923,7 @@ func NewFixes(ctx *wl.Context) *Fixes { | |||||
| 4226 | 3923 | ||||
| 4227 | // destroys this object | 3924 | // destroys this object | ||
| 4228 | func (o *Fixes) Destroy() error { | 3925 | func (o *Fixes) Destroy() error { | ||
| 4229 | - | if err := o.Context().CheckProxy(o); err != nil { | 3926 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_fixes.destroy", Destructor: true}); err != nil { |
| 4230 | - | return err | |||
| 4231 | - | } | |||
| 4232 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 4233 | return err | 3927 | return err | ||
| 4234 | } | 3928 | } | ||
| 4235 | return nil | 3929 | return nil | ||
| @@ -4237,14 +3931,11 @@ func (o *Fixes) Destroy() error { | |||||
| 4237 | 3931 | ||||
| 4238 | // This request destroys a wl_registry object. The client should no longer use the wl_registry after making this request. The compositor will emit a wl_display.delete_id event with the object ID of the registry and will no longer emit any events on the registry. The client should re-use the object ID once it receives the wl_display.delete_id event. | 3932 | // This request destroys a wl_registry object. The client should no longer use the wl_registry after making this request. The compositor will emit a wl_display.delete_id event with the object ID of the registry and will no longer emit any events on the registry. The client should re-use the object ID once it receives the wl_display.delete_id event. | ||
| 4239 | func (o *Fixes) DestroyRegistry(registry *wl.Registry) error { | 3933 | func (o *Fixes) DestroyRegistry(registry *wl.Registry) error { | ||
| 4240 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 4241 | - | return err | |||
| 4242 | - | } | |||
| 4243 | var arg0 wl.Object | 3934 | var arg0 wl.Object | ||
| 4244 | if registry != nil { | 3935 | if registry != nil { | ||
| 4245 | arg0 = registry | 3936 | arg0 = registry | ||
| 4246 | } | 3937 | } | ||
| 4247 | - | if err := o.Context().SendRequest(o, 1, arg0); err != nil { | 3938 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_fixes.destroy_registry"}, arg0); err != nil { |
| 4248 | return err | 3939 | return err | ||
| 4249 | } | 3940 | } | ||
| 4250 | return nil | 3941 | return nil | ||
| @@ -4252,17 +3943,11 @@ func (o *Fixes) DestroyRegistry(registry *wl.Registry) error { | |||||
| 4252 | 3943 | ||||
| 4253 | // Acknowledge the removal of the specified global. If no global with the specified name exists or the global is not removed, the wl_fixes.invalid_ack_remove protocol error will be posted. Due to the Wayland protocol being asynchronous, the wl_global objects cannot be destroyed immediately. For example, if a wl_global is removed and a client attempts to bind that global around same time, it can result in a protocol error due to an unknown global name in the bind request. In order to avoid crashing clients, the compositor should remove the wl_global once it is guaranteed that no more bind requests will come. The wl_fixes.ack_global_remove() request is used to signal to the compositor that the client will not bind the given global anymore. After all clients acknowledge the removal of the global, the compositor can safely destroy it. The client must call the wl_fixes.ack_global_remove() request in response to a wl_registry.global_remove() event even if it did not bind the corresponding global. | 3944 | // Acknowledge the removal of the specified global. If no global with the specified name exists or the global is not removed, the wl_fixes.invalid_ack_remove protocol error will be posted. Due to the Wayland protocol being asynchronous, the wl_global objects cannot be destroyed immediately. For example, if a wl_global is removed and a client attempts to bind that global around same time, it can result in a protocol error due to an unknown global name in the bind request. In order to avoid crashing clients, the compositor should remove the wl_global once it is guaranteed that no more bind requests will come. The wl_fixes.ack_global_remove() request is used to signal to the compositor that the client will not bind the given global anymore. After all clients acknowledge the removal of the global, the compositor can safely destroy it. The client must call the wl_fixes.ack_global_remove() request in response to a wl_registry.global_remove() event even if it did not bind the corresponding global. | ||
| 4254 | func (o *Fixes) AckGlobalRemove(registry *wl.Registry, name uint32) error { | 3945 | func (o *Fixes) AckGlobalRemove(registry *wl.Registry, name uint32) error { | ||
| 4255 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 4256 | - | return err | |||
| 4257 | - | } | |||
| 4258 | - | if err := wl.CheckVersion(o.Version(), 2, "wl_fixes.ack_global_remove"); err != nil { | |||
| 4259 | - | return err | |||
| 4260 | - | } | |||
| 4261 | var arg0 wl.Object | 3946 | var arg0 wl.Object | ||
| 4262 | if registry != nil { | 3947 | if registry != nil { | ||
| 4263 | arg0 = registry | 3948 | arg0 = registry | ||
| 4264 | } | 3949 | } | ||
| 4265 | - | if err := o.Context().SendRequest(o, 2, arg0, name); err != nil { | 3950 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_fixes.ack_global_remove", Since: 2}, arg0, name); err != nil { |
| 4266 | return err | 3951 | return err | ||
| 4267 | } | 3952 | } | ||
| 4268 | return nil | 3953 | return nil | ||
M protocol/cursorshape/cursor-shape-v1_generated.go +5 -28
| @@ -139,10 +139,7 @@ func NewWpCursorShapeManager(ctx *wl.Context) *WpCursorShapeManager { | |||
| 139 | 139 | ||
| 140 | 140 | // Destroy the cursor shape manager. | |
| 141 | 141 | func (o *WpCursorShapeManager) Destroy() error { | |
| 142 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 143 | - | return err | |
| 144 | - | } | |
| 145 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 142 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_manager_v1.destroy", Destructor: true}); err != nil { | |
| 146 | 143 | return err | |
| 147 | 144 | } | |
| 148 | 145 | return nil | |
| @@ -150,20 +147,13 @@ func (o *WpCursorShapeManager) Destroy() error { | |||
| 150 | 147 | ||
| 151 | 148 | // Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. When the pointer capability is removed from the wl_seat, the wp_cursor_shape_device_v1 object becomes inert. | |
| 152 | 149 | func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*WpCursorShapeDevice, error) { | |
| 153 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 154 | - | return nil, err | |
| 155 | - | } | |
| 156 | 150 | var arg1 wl.Object | |
| 157 | 151 | if pointer != nil { | |
| 158 | 152 | arg1 = pointer | |
| 159 | 153 | } | |
| 160 | 154 | child := &WpCursorShapeDevice{} | |
| 161 | 155 | child.SetContext(o.Context()) | |
| 162 | - | child.SetID(o.Context().AllocateID()) | |
| 163 | - | child.SetVersion(o.Version()) | |
| 164 | - | o.Context().Register(child) | |
| 165 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 166 | - | o.Context().Unregister(child) | |
| 156 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_manager_v1.get_pointer", Child: child}, child, arg1); err != nil { | |
| 167 | 157 | return nil, err | |
| 168 | 158 | } | |
| 169 | 159 | return child, nil | |
| @@ -171,20 +161,13 @@ func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*W | |||
| 171 | 161 | ||
| 172 | 162 | // Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 object becomes inert. | |
| 173 | 163 | func (o *WpCursorShapeManager) GetTabletTool(tabletTool *cross_zwp_tablet_tool_v2.TabletTool) (*WpCursorShapeDevice, error) { | |
| 174 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 175 | - | return nil, err | |
| 176 | - | } | |
| 177 | 164 | var arg1 wl.Object | |
| 178 | 165 | if tabletTool != nil { | |
| 179 | 166 | arg1 = tabletTool | |
| 180 | 167 | } | |
| 181 | 168 | child := &WpCursorShapeDevice{} | |
| 182 | 169 | child.SetContext(o.Context()) | |
| 183 | - | child.SetID(o.Context().AllocateID()) | |
| 184 | - | child.SetVersion(o.Version()) | |
| 185 | - | o.Context().Register(child) | |
| 186 | - | if err := o.Context().SendRequest(o, 2, child, arg1); err != nil { | |
| 187 | - | o.Context().Unregister(child) | |
| 170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_cursor_shape_manager_v1.get_tablet_tool_v2", Child: child}, child, arg1); err != nil { | |
| 188 | 171 | return nil, err | |
| 189 | 172 | } | |
| 190 | 173 | return child, nil | |
| @@ -223,10 +206,7 @@ func NewWpCursorShapeDevice(ctx *wl.Context) *WpCursorShapeDevice { | |||
| 223 | 206 | ||
| 224 | 207 | // Destroy the cursor shape device. The device cursor shape remains unchanged. | |
| 225 | 208 | func (o *WpCursorShapeDevice) Destroy() error { | |
| 226 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 227 | - | return err | |
| 228 | - | } | |
| 229 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 209 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_device_v1.destroy", Destructor: true}); err != nil { | |
| 230 | 210 | return err | |
| 231 | 211 | } | |
| 232 | 212 | return nil | |
| @@ -234,10 +214,7 @@ func (o *WpCursorShapeDevice) Destroy() error { | |||
| 234 | 214 | ||
| 235 | 215 | // Sets the device cursor to the specified shape. The compositor will change the cursor image based on the specified shape. The cursor actually changes only if the input device focus is one of the requesting client's surfaces. If any, the previous cursor image (surface or shape) is replaced. The "shape" argument must be a valid enum entry, otherwise the invalid_shape protocol error is raised. This is similar to the wl_pointer.set_cursor and zwp_tablet_tool_v2.set_cursor requests, but this request accepts a shape instead of contents in the form of a surface. Clients can mix set_cursor and set_shape requests. The serial parameter must match the latest wl_pointer.enter or zwp_tablet_tool_v2.proximity_in serial number sent to the client. Otherwise the request will be ignored. | |
| 236 | 216 | func (o *WpCursorShapeDevice) SetShape(serial uint32, shape uint32) error { | |
| 237 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 238 | - | return err | |
| 239 | - | } | |
| 240 | - | if err := o.Context().SendRequest(o, 1, serial, shape); err != nil { | |
| 217 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_device_v1.set_shape"}, serial, shape); err != nil { | |
| 241 | 218 | return err | |
| 242 | 219 | } | |
| 243 | 220 | return nil | |
| @@ -139,10 +139,7 @@ func NewWpCursorShapeManager(ctx *wl.Context) *WpCursorShapeManager { | |||||
| 139 | 139 | ||||
| 140 | // Destroy the cursor shape manager. | 140 | // Destroy the cursor shape manager. | ||
| 141 | func (o *WpCursorShapeManager) Destroy() error { | 141 | func (o *WpCursorShapeManager) Destroy() error { | ||
| 142 | - | if err := o.Context().CheckProxy(o); err != nil { | 142 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_manager_v1.destroy", Destructor: true}); err != nil { |
| 143 | - | return err | |||
| 144 | - | } | |||
| 145 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 146 | return err | 143 | return err | ||
| 147 | } | 144 | } | ||
| 148 | return nil | 145 | return nil | ||
| @@ -150,20 +147,13 @@ func (o *WpCursorShapeManager) Destroy() error { | |||||
| 150 | 147 | ||||
| 151 | // Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. When the pointer capability is removed from the wl_seat, the wp_cursor_shape_device_v1 object becomes inert. | 148 | // Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. When the pointer capability is removed from the wl_seat, the wp_cursor_shape_device_v1 object becomes inert. | ||
| 152 | func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*WpCursorShapeDevice, error) { | 149 | func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*WpCursorShapeDevice, error) { | ||
| 153 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 154 | - | return nil, err | |||
| 155 | - | } | |||
| 156 | var arg1 wl.Object | 150 | var arg1 wl.Object | ||
| 157 | if pointer != nil { | 151 | if pointer != nil { | ||
| 158 | arg1 = pointer | 152 | arg1 = pointer | ||
| 159 | } | 153 | } | ||
| 160 | child := &WpCursorShapeDevice{} | 154 | child := &WpCursorShapeDevice{} | ||
| 161 | child.SetContext(o.Context()) | 155 | child.SetContext(o.Context()) | ||
| 162 | - | child.SetID(o.Context().AllocateID()) | 156 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_manager_v1.get_pointer", Child: child}, child, arg1); err != nil { |
| 163 | - | child.SetVersion(o.Version()) | |||
| 164 | - | o.Context().Register(child) | |||
| 165 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 166 | - | o.Context().Unregister(child) | |||
| 167 | return nil, err | 157 | return nil, err | ||
| 168 | } | 158 | } | ||
| 169 | return child, nil | 159 | return child, nil | ||
| @@ -171,20 +161,13 @@ func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*W | |||||
| 171 | 161 | ||||
| 172 | // Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 object becomes inert. | 162 | // Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 object becomes inert. | ||
| 173 | func (o *WpCursorShapeManager) GetTabletTool(tabletTool *cross_zwp_tablet_tool_v2.TabletTool) (*WpCursorShapeDevice, error) { | 163 | func (o *WpCursorShapeManager) GetTabletTool(tabletTool *cross_zwp_tablet_tool_v2.TabletTool) (*WpCursorShapeDevice, error) { | ||
| 174 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 175 | - | return nil, err | |||
| 176 | - | } | |||
| 177 | var arg1 wl.Object | 164 | var arg1 wl.Object | ||
| 178 | if tabletTool != nil { | 165 | if tabletTool != nil { | ||
| 179 | arg1 = tabletTool | 166 | arg1 = tabletTool | ||
| 180 | } | 167 | } | ||
| 181 | child := &WpCursorShapeDevice{} | 168 | child := &WpCursorShapeDevice{} | ||
| 182 | child.SetContext(o.Context()) | 169 | child.SetContext(o.Context()) | ||
| 183 | - | child.SetID(o.Context().AllocateID()) | 170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_cursor_shape_manager_v1.get_tablet_tool_v2", Child: child}, child, arg1); err != nil { |
| 184 | - | child.SetVersion(o.Version()) | |||
| 185 | - | o.Context().Register(child) | |||
| 186 | - | if err := o.Context().SendRequest(o, 2, child, arg1); err != nil { | |||
| 187 | - | o.Context().Unregister(child) | |||
| 188 | return nil, err | 171 | return nil, err | ||
| 189 | } | 172 | } | ||
| 190 | return child, nil | 173 | return child, nil | ||
| @@ -223,10 +206,7 @@ func NewWpCursorShapeDevice(ctx *wl.Context) *WpCursorShapeDevice { | |||||
| 223 | 206 | ||||
| 224 | // Destroy the cursor shape device. The device cursor shape remains unchanged. | 207 | // Destroy the cursor shape device. The device cursor shape remains unchanged. | ||
| 225 | func (o *WpCursorShapeDevice) Destroy() error { | 208 | func (o *WpCursorShapeDevice) Destroy() error { | ||
| 226 | - | if err := o.Context().CheckProxy(o); err != nil { | 209 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_device_v1.destroy", Destructor: true}); err != nil { |
| 227 | - | return err | |||
| 228 | - | } | |||
| 229 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 230 | return err | 210 | return err | ||
| 231 | } | 211 | } | ||
| 232 | return nil | 212 | return nil | ||
| @@ -234,10 +214,7 @@ func (o *WpCursorShapeDevice) Destroy() error { | |||||
| 234 | 214 | ||||
| 235 | // Sets the device cursor to the specified shape. The compositor will change the cursor image based on the specified shape. The cursor actually changes only if the input device focus is one of the requesting client's surfaces. If any, the previous cursor image (surface or shape) is replaced. The "shape" argument must be a valid enum entry, otherwise the invalid_shape protocol error is raised. This is similar to the wl_pointer.set_cursor and zwp_tablet_tool_v2.set_cursor requests, but this request accepts a shape instead of contents in the form of a surface. Clients can mix set_cursor and set_shape requests. The serial parameter must match the latest wl_pointer.enter or zwp_tablet_tool_v2.proximity_in serial number sent to the client. Otherwise the request will be ignored. | 215 | // Sets the device cursor to the specified shape. The compositor will change the cursor image based on the specified shape. The cursor actually changes only if the input device focus is one of the requesting client's surfaces. If any, the previous cursor image (surface or shape) is replaced. The "shape" argument must be a valid enum entry, otherwise the invalid_shape protocol error is raised. This is similar to the wl_pointer.set_cursor and zwp_tablet_tool_v2.set_cursor requests, but this request accepts a shape instead of contents in the form of a surface. Clients can mix set_cursor and set_shape requests. The serial parameter must match the latest wl_pointer.enter or zwp_tablet_tool_v2.proximity_in serial number sent to the client. Otherwise the request will be ignored. | ||
| 236 | func (o *WpCursorShapeDevice) SetShape(serial uint32, shape uint32) error { | 216 | func (o *WpCursorShapeDevice) SetShape(serial uint32, shape uint32) error { | ||
| 237 | - | if err := o.Context().CheckProxy(o); err != nil { | 217 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_device_v1.set_shape"}, serial, shape); err != nil { |
| 238 | - | return err | |||
| 239 | - | } | |||
| 240 | - | if err := o.Context().SendRequest(o, 1, serial, shape); err != nil { | |||
| 241 | return err | 218 | return err | ||
| 242 | } | 219 | } | ||
| 243 | return nil | 220 | return nil | ||
M protocol/drmsyncobj/linux-drm-syncobj-v1_generated.go +7 -37
| @@ -51,10 +51,7 @@ func NewWpLinuxDrmSyncobjManager(ctx *wl.Context) *WpLinuxDrmSyncobjManager { | |||
| 51 | 51 | ||
| 52 | 52 | // Destroy this explicit synchronization factory object. Other objects shall not be affected by this request. | |
| 53 | 53 | func (o *WpLinuxDrmSyncobjManager) Destroy() error { | |
| 54 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 55 | - | return err | |
| 56 | - | } | |
| 57 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 54 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_manager_v1.destroy", Destructor: true}); err != nil { | |
| 58 | 55 | return err | |
| 59 | 56 | } | |
| 60 | 57 | return nil | |
| @@ -62,20 +59,13 @@ func (o *WpLinuxDrmSyncobjManager) Destroy() error { | |||
| 62 | 59 | ||
| 63 | 60 | // Instantiate an interface extension for the given wl_surface to provide explicit synchronization. If the given wl_surface already has an explicit synchronization object associated, the surface_exists protocol error is raised. Graphics APIs, like EGL or Vulkan, that manage the buffer queue and commits of a wl_surface themselves, are likely to be using this extension internally. If a client is using such an API for a wl_surface, it should not directly use this extension on that surface, to avoid raising a surface_exists protocol error. | |
| 64 | 61 | func (o *WpLinuxDrmSyncobjManager) GetSurface(surface *cross_wl_surface.Surface) (*WpLinuxDrmSyncobjSurface, error) { | |
| 65 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 66 | - | return nil, err | |
| 67 | - | } | |
| 68 | 62 | var arg1 wl.Object | |
| 69 | 63 | if surface != nil { | |
| 70 | 64 | arg1 = surface | |
| 71 | 65 | } | |
| 72 | 66 | child := &WpLinuxDrmSyncobjSurface{} | |
| 73 | 67 | child.SetContext(o.Context()) | |
| 74 | - | child.SetID(o.Context().AllocateID()) | |
| 75 | - | child.SetVersion(o.Version()) | |
| 76 | - | o.Context().Register(child) | |
| 77 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 78 | - | o.Context().Unregister(child) | |
| 68 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_linux_drm_syncobj_manager_v1.get_surface", Child: child}, child, arg1); err != nil { | |
| 79 | 69 | return nil, err | |
| 80 | 70 | } | |
| 81 | 71 | return child, nil | |
| @@ -83,19 +73,11 @@ func (o *WpLinuxDrmSyncobjManager) GetSurface(surface *cross_wl_surface.Surface) | |||
| 83 | 73 | ||
| 84 | 74 | // Import a DRM synchronization object timeline. If the FD cannot be imported, the invalid_timeline error is raised. | |
| 85 | 75 | func (o *WpLinuxDrmSyncobjManager) ImportTimeline(fd int) (*WpLinuxDrmSyncobjTimeline, error) { | |
| 86 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 87 | - | return nil, err | |
| 88 | - | } | |
| 89 | 76 | child := &WpLinuxDrmSyncobjTimeline{} | |
| 90 | 77 | child.SetContext(o.Context()) | |
| 91 | - | child.SetID(o.Context().AllocateID()) | |
| 92 | - | child.SetVersion(o.Version()) | |
| 93 | - | o.Context().Register(child) | |
| 94 | - | if err := o.Context().SendRequestWithFDs(o, 2, []int{fd}, child, uintptr(fd)); err != nil { | |
| 95 | - | o.Context().Unregister(child) | |
| 78 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_linux_drm_syncobj_manager_v1.import_timeline", Child: child, FDs: []int{fd}}, child, uintptr(fd)); err != nil { | |
| 96 | 79 | return nil, err | |
| 97 | 80 | } | |
| 98 | - | _ = wl.CloseSentFD(fd) | |
| 99 | 81 | return child, nil | |
| 100 | 82 | } | |
| 101 | 83 | ||
| @@ -132,10 +114,7 @@ func NewWpLinuxDrmSyncobjTimeline(ctx *wl.Context) *WpLinuxDrmSyncobjTimeline { | |||
| 132 | 114 | ||
| 133 | 115 | // Destroy the synchronization object timeline. Other objects are not affected by this request, in particular timeline points set by set_acquire_point and set_release_point are not unset. | |
| 134 | 116 | func (o *WpLinuxDrmSyncobjTimeline) Destroy() error { | |
| 135 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 136 | - | return err | |
| 137 | - | } | |
| 138 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 117 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_timeline_v1.destroy", Destructor: true}); err != nil { | |
| 139 | 118 | return err | |
| 140 | 119 | } | |
| 141 | 120 | return nil | |
| @@ -174,10 +153,7 @@ func NewWpLinuxDrmSyncobjSurface(ctx *wl.Context) *WpLinuxDrmSyncobjSurface { | |||
| 174 | 153 | ||
| 175 | 154 | // Destroy this surface synchronization object. Any timeline point set by this object with set_acquire_point or set_release_point since the last commit may be discarded by the compositor. Any timeline point set by this object before the last commit will not be affected. | |
| 176 | 155 | func (o *WpLinuxDrmSyncobjSurface) Destroy() error { | |
| 177 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 178 | - | return err | |
| 179 | - | } | |
| 180 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 156 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_surface_v1.destroy", Destructor: true}); err != nil { | |
| 181 | 157 | return err | |
| 182 | 158 | } | |
| 183 | 159 | return nil | |
| @@ -185,14 +161,11 @@ func (o *WpLinuxDrmSyncobjSurface) Destroy() error { | |||
| 185 | 161 | ||
| 186 | 162 | // Set the timeline point that must be signalled before the compositor may sample from the buffer attached with wl_surface.attach. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The acquire point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If an acquire point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending acquire timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending acquire timeline point set, the no_acquire_point protocol error is raised. | |
| 187 | 163 | func (o *WpLinuxDrmSyncobjSurface) SetAcquirePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | |
| 188 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 189 | - | return err | |
| 190 | - | } | |
| 191 | 164 | var arg0 wl.Object | |
| 192 | 165 | if timeline != nil { | |
| 193 | 166 | arg0 = timeline | |
| 194 | 167 | } | |
| 195 | - | if err := o.Context().SendRequest(o, 1, arg0, pointHi, pointLo); err != nil { | |
| 168 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_linux_drm_syncobj_surface_v1.set_acquire_point"}, arg0, pointHi, pointLo); err != nil { | |
| 196 | 169 | return err | |
| 197 | 170 | } | |
| 198 | 171 | return nil | |
| @@ -200,14 +173,11 @@ func (o *WpLinuxDrmSyncobjSurface) SetAcquirePoint(timeline *WpLinuxDrmSyncobjTi | |||
| 200 | 173 | ||
| 201 | 174 | // Set the timeline point that must be signalled by the compositor when it has finished its usage of the buffer attached with wl_surface.attach for the relevant commit. Once the timeline point is signaled, and assuming the associated buffer is not pending release from other wl_surface.commit requests, no additional explicit or implicit synchronization with the compositor is required to safely re-use the buffer. Note that clients cannot rely on the release point being always signaled after the acquire point: compositors may release buffers without ever reading from them. In addition, the compositor may use different presentation paths for different commits, which may have different release behavior. As a result, the compositor may signal the release points in a different order than the client committed them. Because signaling a timeline point also signals every previous point, it is generally not safe to use the same timeline object for the release points of multiple buffers. The out-of-order signaling described above may lead to a release point being signaled before the compositor has finished reading. To avoid this, it is strongly recommended that each buffer should use a separate timeline for its release points. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The release point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If a release point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending release timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending release timeline point set, the no_release_point protocol error is raised. | |
| 202 | 175 | func (o *WpLinuxDrmSyncobjSurface) SetReleasePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | |
| 203 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 204 | - | return err | |
| 205 | - | } | |
| 206 | 176 | var arg0 wl.Object | |
| 207 | 177 | if timeline != nil { | |
| 208 | 178 | arg0 = timeline | |
| 209 | 179 | } | |
| 210 | - | if err := o.Context().SendRequest(o, 2, arg0, pointHi, pointLo); err != nil { | |
| 180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_linux_drm_syncobj_surface_v1.set_release_point"}, arg0, pointHi, pointLo); err != nil { | |
| 211 | 181 | return err | |
| 212 | 182 | } | |
| 213 | 183 | return nil | |
| @@ -51,10 +51,7 @@ func NewWpLinuxDrmSyncobjManager(ctx *wl.Context) *WpLinuxDrmSyncobjManager { | |||||
| 51 | 51 | ||||
| 52 | // Destroy this explicit synchronization factory object. Other objects shall not be affected by this request. | 52 | // Destroy this explicit synchronization factory object. Other objects shall not be affected by this request. | ||
| 53 | func (o *WpLinuxDrmSyncobjManager) Destroy() error { | 53 | func (o *WpLinuxDrmSyncobjManager) Destroy() error { | ||
| 54 | - | if err := o.Context().CheckProxy(o); err != nil { | 54 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_manager_v1.destroy", Destructor: true}); err != nil { |
| 55 | - | return err | |||
| 56 | - | } | |||
| 57 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 58 | return err | 55 | return err | ||
| 59 | } | 56 | } | ||
| 60 | return nil | 57 | return nil | ||
| @@ -62,20 +59,13 @@ func (o *WpLinuxDrmSyncobjManager) Destroy() error { | |||||
| 62 | 59 | ||||
| 63 | // Instantiate an interface extension for the given wl_surface to provide explicit synchronization. If the given wl_surface already has an explicit synchronization object associated, the surface_exists protocol error is raised. Graphics APIs, like EGL or Vulkan, that manage the buffer queue and commits of a wl_surface themselves, are likely to be using this extension internally. If a client is using such an API for a wl_surface, it should not directly use this extension on that surface, to avoid raising a surface_exists protocol error. | 60 | // Instantiate an interface extension for the given wl_surface to provide explicit synchronization. If the given wl_surface already has an explicit synchronization object associated, the surface_exists protocol error is raised. Graphics APIs, like EGL or Vulkan, that manage the buffer queue and commits of a wl_surface themselves, are likely to be using this extension internally. If a client is using such an API for a wl_surface, it should not directly use this extension on that surface, to avoid raising a surface_exists protocol error. | ||
| 64 | func (o *WpLinuxDrmSyncobjManager) GetSurface(surface *cross_wl_surface.Surface) (*WpLinuxDrmSyncobjSurface, error) { | 61 | func (o *WpLinuxDrmSyncobjManager) GetSurface(surface *cross_wl_surface.Surface) (*WpLinuxDrmSyncobjSurface, error) { | ||
| 65 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 66 | - | return nil, err | |||
| 67 | - | } | |||
| 68 | var arg1 wl.Object | 62 | var arg1 wl.Object | ||
| 69 | if surface != nil { | 63 | if surface != nil { | ||
| 70 | arg1 = surface | 64 | arg1 = surface | ||
| 71 | } | 65 | } | ||
| 72 | child := &WpLinuxDrmSyncobjSurface{} | 66 | child := &WpLinuxDrmSyncobjSurface{} | ||
| 73 | child.SetContext(o.Context()) | 67 | child.SetContext(o.Context()) | ||
| 74 | - | child.SetID(o.Context().AllocateID()) | 68 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_linux_drm_syncobj_manager_v1.get_surface", Child: child}, child, arg1); err != nil { |
| 75 | - | child.SetVersion(o.Version()) | |||
| 76 | - | o.Context().Register(child) | |||
| 77 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 78 | - | o.Context().Unregister(child) | |||
| 79 | return nil, err | 69 | return nil, err | ||
| 80 | } | 70 | } | ||
| 81 | return child, nil | 71 | return child, nil | ||
| @@ -83,19 +73,11 @@ func (o *WpLinuxDrmSyncobjManager) GetSurface(surface *cross_wl_surface.Surface) | |||||
| 83 | 73 | ||||
| 84 | // Import a DRM synchronization object timeline. If the FD cannot be imported, the invalid_timeline error is raised. | 74 | // Import a DRM synchronization object timeline. If the FD cannot be imported, the invalid_timeline error is raised. | ||
| 85 | func (o *WpLinuxDrmSyncobjManager) ImportTimeline(fd int) (*WpLinuxDrmSyncobjTimeline, error) { | 75 | func (o *WpLinuxDrmSyncobjManager) ImportTimeline(fd int) (*WpLinuxDrmSyncobjTimeline, error) { | ||
| 86 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 87 | - | return nil, err | |||
| 88 | - | } | |||
| 89 | child := &WpLinuxDrmSyncobjTimeline{} | 76 | child := &WpLinuxDrmSyncobjTimeline{} | ||
| 90 | child.SetContext(o.Context()) | 77 | child.SetContext(o.Context()) | ||
| 91 | - | child.SetID(o.Context().AllocateID()) | 78 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_linux_drm_syncobj_manager_v1.import_timeline", Child: child, FDs: []int{fd}}, child, uintptr(fd)); err != nil { |
| 92 | - | child.SetVersion(o.Version()) | |||
| 93 | - | o.Context().Register(child) | |||
| 94 | - | if err := o.Context().SendRequestWithFDs(o, 2, []int{fd}, child, uintptr(fd)); err != nil { | |||
| 95 | - | o.Context().Unregister(child) | |||
| 96 | return nil, err | 79 | return nil, err | ||
| 97 | } | 80 | } | ||
| 98 | - | _ = wl.CloseSentFD(fd) | |||
| 99 | return child, nil | 81 | return child, nil | ||
| 100 | } | 82 | } | ||
| 101 | 83 | ||||
| @@ -132,10 +114,7 @@ func NewWpLinuxDrmSyncobjTimeline(ctx *wl.Context) *WpLinuxDrmSyncobjTimeline { | |||||
| 132 | 114 | ||||
| 133 | // Destroy the synchronization object timeline. Other objects are not affected by this request, in particular timeline points set by set_acquire_point and set_release_point are not unset. | 115 | // Destroy the synchronization object timeline. Other objects are not affected by this request, in particular timeline points set by set_acquire_point and set_release_point are not unset. | ||
| 134 | func (o *WpLinuxDrmSyncobjTimeline) Destroy() error { | 116 | func (o *WpLinuxDrmSyncobjTimeline) Destroy() error { | ||
| 135 | - | if err := o.Context().CheckProxy(o); err != nil { | 117 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_timeline_v1.destroy", Destructor: true}); err != nil { |
| 136 | - | return err | |||
| 137 | - | } | |||
| 138 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 139 | return err | 118 | return err | ||
| 140 | } | 119 | } | ||
| 141 | return nil | 120 | return nil | ||
| @@ -174,10 +153,7 @@ func NewWpLinuxDrmSyncobjSurface(ctx *wl.Context) *WpLinuxDrmSyncobjSurface { | |||||
| 174 | 153 | ||||
| 175 | // Destroy this surface synchronization object. Any timeline point set by this object with set_acquire_point or set_release_point since the last commit may be discarded by the compositor. Any timeline point set by this object before the last commit will not be affected. | 154 | // Destroy this surface synchronization object. Any timeline point set by this object with set_acquire_point or set_release_point since the last commit may be discarded by the compositor. Any timeline point set by this object before the last commit will not be affected. | ||
| 176 | func (o *WpLinuxDrmSyncobjSurface) Destroy() error { | 155 | func (o *WpLinuxDrmSyncobjSurface) Destroy() error { | ||
| 177 | - | if err := o.Context().CheckProxy(o); err != nil { | 156 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_linux_drm_syncobj_surface_v1.destroy", Destructor: true}); err != nil { |
| 178 | - | return err | |||
| 179 | - | } | |||
| 180 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 181 | return err | 157 | return err | ||
| 182 | } | 158 | } | ||
| 183 | return nil | 159 | return nil | ||
| @@ -185,14 +161,11 @@ func (o *WpLinuxDrmSyncobjSurface) Destroy() error { | |||||
| 185 | 161 | ||||
| 186 | // Set the timeline point that must be signalled before the compositor may sample from the buffer attached with wl_surface.attach. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The acquire point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If an acquire point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending acquire timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending acquire timeline point set, the no_acquire_point protocol error is raised. | 162 | // Set the timeline point that must be signalled before the compositor may sample from the buffer attached with wl_surface.attach. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The acquire point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If an acquire point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending acquire timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending acquire timeline point set, the no_acquire_point protocol error is raised. | ||
| 187 | func (o *WpLinuxDrmSyncobjSurface) SetAcquirePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | 163 | func (o *WpLinuxDrmSyncobjSurface) SetAcquirePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | ||
| 188 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 189 | - | return err | |||
| 190 | - | } | |||
| 191 | var arg0 wl.Object | 164 | var arg0 wl.Object | ||
| 192 | if timeline != nil { | 165 | if timeline != nil { | ||
| 193 | arg0 = timeline | 166 | arg0 = timeline | ||
| 194 | } | 167 | } | ||
| 195 | - | if err := o.Context().SendRequest(o, 1, arg0, pointHi, pointLo); err != nil { | 168 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_linux_drm_syncobj_surface_v1.set_acquire_point"}, arg0, pointHi, pointLo); err != nil { |
| 196 | return err | 169 | return err | ||
| 197 | } | 170 | } | ||
| 198 | return nil | 171 | return nil | ||
| @@ -200,14 +173,11 @@ func (o *WpLinuxDrmSyncobjSurface) SetAcquirePoint(timeline *WpLinuxDrmSyncobjTi | |||||
| 200 | 173 | ||||
| 201 | // Set the timeline point that must be signalled by the compositor when it has finished its usage of the buffer attached with wl_surface.attach for the relevant commit. Once the timeline point is signaled, and assuming the associated buffer is not pending release from other wl_surface.commit requests, no additional explicit or implicit synchronization with the compositor is required to safely re-use the buffer. Note that clients cannot rely on the release point being always signaled after the acquire point: compositors may release buffers without ever reading from them. In addition, the compositor may use different presentation paths for different commits, which may have different release behavior. As a result, the compositor may signal the release points in a different order than the client committed them. Because signaling a timeline point also signals every previous point, it is generally not safe to use the same timeline object for the release points of multiple buffers. The out-of-order signaling described above may lead to a release point being signaled before the compositor has finished reading. To avoid this, it is strongly recommended that each buffer should use a separate timeline for its release points. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The release point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If a release point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending release timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending release timeline point set, the no_release_point protocol error is raised. | 174 | // Set the timeline point that must be signalled by the compositor when it has finished its usage of the buffer attached with wl_surface.attach for the relevant commit. Once the timeline point is signaled, and assuming the associated buffer is not pending release from other wl_surface.commit requests, no additional explicit or implicit synchronization with the compositor is required to safely re-use the buffer. Note that clients cannot rely on the release point being always signaled after the acquire point: compositors may release buffers without ever reading from them. In addition, the compositor may use different presentation paths for different commits, which may have different release behavior. As a result, the compositor may signal the release points in a different order than the client committed them. Because signaling a timeline point also signals every previous point, it is generally not safe to use the same timeline object for the release points of multiple buffers. The out-of-order signaling described above may lead to a release point being signaled before the compositor has finished reading. To avoid this, it is strongly recommended that each buffer should use a separate timeline for its release points. The 64-bit unsigned value combined from point_hi and point_lo is the point value. The release point is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If a release point has already been attached during the same commit cycle, the new point replaces the old one. If the associated wl_surface was destroyed, a no_surface error is raised. If at surface commit time there is a pending release timeline point set but no pending buffer attached, a no_buffer error is raised. If at surface commit time there is a pending buffer attached but no pending release timeline point set, the no_release_point protocol error is raised. | ||
| 202 | func (o *WpLinuxDrmSyncobjSurface) SetReleasePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | 175 | func (o *WpLinuxDrmSyncobjSurface) SetReleasePoint(timeline *WpLinuxDrmSyncobjTimeline, pointHi uint32, pointLo uint32) error { | ||
| 203 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 204 | - | return err | |||
| 205 | - | } | |||
| 206 | var arg0 wl.Object | 176 | var arg0 wl.Object | ||
| 207 | if timeline != nil { | 177 | if timeline != nil { | ||
| 208 | arg0 = timeline | 178 | arg0 = timeline | ||
| 209 | } | 179 | } | ||
| 210 | - | if err := o.Context().SendRequest(o, 2, arg0, pointHi, pointLo); err != nil { | 180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_linux_drm_syncobj_surface_v1.set_release_point"}, arg0, pointHi, pointLo); err != nil { |
| 211 | return err | 181 | return err | ||
| 212 | } | 182 | } | ||
| 213 | return nil | 183 | return nil | ||
M protocol/fractionalscale/fractional-scale-v1_generated.go +3 -16
| @@ -32,10 +32,7 @@ func NewWpFractionalScaleManager(ctx *wl.Context) *WpFractionalScaleManager { | |||
| 32 | 32 | ||
| 33 | 33 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_fractional_scale_v1 objects included. | |
| 34 | 34 | func (o *WpFractionalScaleManager) Destroy() error { | |
| 35 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 36 | - | return err | |
| 37 | - | } | |
| 38 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 35 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_manager_v1.destroy", Destructor: true}); err != nil { | |
| 39 | 36 | return err | |
| 40 | 37 | } | |
| 41 | 38 | return nil | |
| @@ -43,20 +40,13 @@ func (o *WpFractionalScaleManager) Destroy() error { | |||
| 43 | 40 | ||
| 44 | 41 | // Create an add-on object for the the wl_surface to let the compositor request fractional scales. If the given wl_surface already has a wp_fractional_scale_v1 object associated, the fractional_scale_exists protocol error is raised. | |
| 45 | 42 | func (o *WpFractionalScaleManager) GetFractionalScale(surface *cross_wl_surface.Surface) (*WpFractionalScale, error) { | |
| 46 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 47 | - | return nil, err | |
| 48 | - | } | |
| 49 | 43 | var arg1 wl.Object | |
| 50 | 44 | if surface != nil { | |
| 51 | 45 | arg1 = surface | |
| 52 | 46 | } | |
| 53 | 47 | child := &WpFractionalScale{} | |
| 54 | 48 | child.SetContext(o.Context()) | |
| 55 | - | child.SetID(o.Context().AllocateID()) | |
| 56 | - | child.SetVersion(o.Version()) | |
| 57 | - | o.Context().Register(child) | |
| 58 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 59 | - | o.Context().Unregister(child) | |
| 49 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_fractional_scale_manager_v1.get_fractional_scale", Child: child}, child, arg1); err != nil { | |
| 60 | 50 | return nil, err | |
| 61 | 51 | } | |
| 62 | 52 | return child, nil | |
| @@ -99,10 +89,7 @@ func NewWpFractionalScale(ctx *wl.Context) *WpFractionalScale { | |||
| 99 | 89 | ||
| 100 | 90 | // Destroy the fractional scale object. When this object is destroyed, preferred_scale events will no longer be sent. | |
| 101 | 91 | func (o *WpFractionalScale) Destroy() error { | |
| 102 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 103 | - | return err | |
| 104 | - | } | |
| 105 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 92 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_v1.destroy", Destructor: true}); err != nil { | |
| 106 | 93 | return err | |
| 107 | 94 | } | |
| 108 | 95 | return nil | |
| @@ -32,10 +32,7 @@ func NewWpFractionalScaleManager(ctx *wl.Context) *WpFractionalScaleManager { | |||||
| 32 | 32 | ||||
| 33 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_fractional_scale_v1 objects included. | 33 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_fractional_scale_v1 objects included. | ||
| 34 | func (o *WpFractionalScaleManager) Destroy() error { | 34 | func (o *WpFractionalScaleManager) Destroy() error { | ||
| 35 | - | if err := o.Context().CheckProxy(o); err != nil { | 35 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_manager_v1.destroy", Destructor: true}); err != nil { |
| 36 | - | return err | |||
| 37 | - | } | |||
| 38 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 39 | return err | 36 | return err | ||
| 40 | } | 37 | } | ||
| 41 | return nil | 38 | return nil | ||
| @@ -43,20 +40,13 @@ func (o *WpFractionalScaleManager) Destroy() error { | |||||
| 43 | 40 | ||||
| 44 | // Create an add-on object for the the wl_surface to let the compositor request fractional scales. If the given wl_surface already has a wp_fractional_scale_v1 object associated, the fractional_scale_exists protocol error is raised. | 41 | // Create an add-on object for the the wl_surface to let the compositor request fractional scales. If the given wl_surface already has a wp_fractional_scale_v1 object associated, the fractional_scale_exists protocol error is raised. | ||
| 45 | func (o *WpFractionalScaleManager) GetFractionalScale(surface *cross_wl_surface.Surface) (*WpFractionalScale, error) { | 42 | func (o *WpFractionalScaleManager) GetFractionalScale(surface *cross_wl_surface.Surface) (*WpFractionalScale, error) { | ||
| 46 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 47 | - | return nil, err | |||
| 48 | - | } | |||
| 49 | var arg1 wl.Object | 43 | var arg1 wl.Object | ||
| 50 | if surface != nil { | 44 | if surface != nil { | ||
| 51 | arg1 = surface | 45 | arg1 = surface | ||
| 52 | } | 46 | } | ||
| 53 | child := &WpFractionalScale{} | 47 | child := &WpFractionalScale{} | ||
| 54 | child.SetContext(o.Context()) | 48 | child.SetContext(o.Context()) | ||
| 55 | - | child.SetID(o.Context().AllocateID()) | 49 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_fractional_scale_manager_v1.get_fractional_scale", Child: child}, child, arg1); err != nil { |
| 56 | - | child.SetVersion(o.Version()) | |||
| 57 | - | o.Context().Register(child) | |||
| 58 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 59 | - | o.Context().Unregister(child) | |||
| 60 | return nil, err | 50 | return nil, err | ||
| 61 | } | 51 | } | ||
| 62 | return child, nil | 52 | return child, nil | ||
| @@ -99,10 +89,7 @@ func NewWpFractionalScale(ctx *wl.Context) *WpFractionalScale { | |||||
| 99 | 89 | ||||
| 100 | // Destroy the fractional scale object. When this object is destroyed, preferred_scale events will no longer be sent. | 90 | // Destroy the fractional scale object. When this object is destroyed, preferred_scale events will no longer be sent. | ||
| 101 | func (o *WpFractionalScale) Destroy() error { | 91 | func (o *WpFractionalScale) Destroy() error { | ||
| 102 | - | if err := o.Context().CheckProxy(o); err != nil { | 92 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_v1.destroy", Destructor: true}); err != nil { |
| 103 | - | return err | |||
| 104 | - | } | |||
| 105 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 106 | return err | 93 | return err | ||
| 107 | } | 94 | } | ||
| 108 | return nil | 95 | return nil | ||
M protocol/linuxdmabuf/linux-dmabuf-v1_generated.go +10 -69
| @@ -77,10 +77,7 @@ func NewLinuxDmabuf(ctx *wl.Context) *LinuxDmabuf { | |||
| 77 | 77 | ||
| 78 | 78 | // Objects created through this interface, especially wl_buffers, will remain valid. | |
| 79 | 79 | func (o *LinuxDmabuf) Destroy() error { | |
| 80 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 81 | - | return err | |
| 82 | - | } | |
| 83 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 80 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_v1.destroy", Destructor: true}); err != nil { | |
| 84 | 81 | return err | |
| 85 | 82 | } | |
| 86 | 83 | return nil | |
| @@ -88,16 +85,9 @@ func (o *LinuxDmabuf) Destroy() error { | |||
| 88 | 85 | ||
| 89 | 86 | // This temporary object is used to collect multiple dmabuf handles into a single batch to create a wl_buffer. It can only be used once and should be destroyed after a 'created' or 'failed' event has been received. | |
| 90 | 87 | func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) { | |
| 91 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 92 | - | return nil, err | |
| 93 | - | } | |
| 94 | 88 | child := &LinuxBufferParams{} | |
| 95 | 89 | child.SetContext(o.Context()) | |
| 96 | - | child.SetID(o.Context().AllocateID()) | |
| 97 | - | child.SetVersion(o.Version()) | |
| 98 | - | o.Context().Register(child) | |
| 99 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |
| 100 | - | o.Context().Unregister(child) | |
| 90 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_dmabuf_v1.create_params", Child: child}, child); err != nil { | |
| 101 | 91 | return nil, err | |
| 102 | 92 | } | |
| 103 | 93 | return child, nil | |
| @@ -105,19 +95,9 @@ func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) { | |||
| 105 | 95 | ||
| 106 | 96 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object not bound to a particular surface. This object will deliver feedback about dmabuf parameters to use if the client doesn't support per-surface feedback (see get_surface_feedback). | |
| 107 | 97 | func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) { | |
| 108 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 109 | - | return nil, err | |
| 110 | - | } | |
| 111 | - | if err := wl.CheckVersion(o.Version(), 4, "zwp_linux_dmabuf_v1.get_default_feedback"); err != nil { | |
| 112 | - | return nil, err | |
| 113 | - | } | |
| 114 | 98 | child := &LinuxDmabufFeedback{} | |
| 115 | 99 | child.SetContext(o.Context()) | |
| 116 | - | child.SetID(o.Context().AllocateID()) | |
| 117 | - | child.SetVersion(o.Version()) | |
| 118 | - | o.Context().Register(child) | |
| 119 | - | if err := o.Context().SendRequest(o, 2, child); err != nil { | |
| 120 | - | o.Context().Unregister(child) | |
| 100 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_dmabuf_v1.get_default_feedback", Since: 4, Child: child}, child); err != nil { | |
| 121 | 101 | return nil, err | |
| 122 | 102 | } | |
| 123 | 103 | return child, nil | |
| @@ -125,23 +105,13 @@ func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) { | |||
| 125 | 105 | ||
| 126 | 106 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object for the specified wl_surface. This object will deliver feedback about dmabuf parameters to use for buffers attached to this surface. If the surface is destroyed before the zwp_linux_dmabuf_feedback_v1 object, the feedback object becomes inert. | |
| 127 | 107 | func (o *LinuxDmabuf) GetSurfaceFeedback(surface *cross_wl_surface.Surface) (*LinuxDmabufFeedback, error) { | |
| 128 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 129 | - | return nil, err | |
| 130 | - | } | |
| 131 | - | if err := wl.CheckVersion(o.Version(), 4, "zwp_linux_dmabuf_v1.get_surface_feedback"); err != nil { | |
| 132 | - | return nil, err | |
| 133 | - | } | |
| 134 | 108 | var arg1 wl.Object | |
| 135 | 109 | if surface != nil { | |
| 136 | 110 | arg1 = surface | |
| 137 | 111 | } | |
| 138 | 112 | child := &LinuxDmabufFeedback{} | |
| 139 | 113 | child.SetContext(o.Context()) | |
| 140 | - | child.SetID(o.Context().AllocateID()) | |
| 141 | - | child.SetVersion(o.Version()) | |
| 142 | - | o.Context().Register(child) | |
| 143 | - | if err := o.Context().SendRequest(o, 3, child, arg1); err != nil { | |
| 144 | - | o.Context().Unregister(child) | |
| 114 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_dmabuf_v1.get_surface_feedback", Since: 4, Child: child}, child, arg1); err != nil { | |
| 145 | 115 | return nil, err | |
| 146 | 116 | } | |
| 147 | 117 | return child, nil | |
| @@ -249,10 +219,7 @@ func NewLinuxBufferParams(ctx *wl.Context) *LinuxBufferParams { | |||
| 249 | 219 | ||
| 250 | 220 | // Cleans up the temporary data sent to the server for dmabuf-based wl_buffer creation. | |
| 251 | 221 | func (o *LinuxBufferParams) Destroy() error { | |
| 252 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 253 | - | return err | |
| 254 | - | } | |
| 255 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 222 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_buffer_params_v1.destroy", Destructor: true}); err != nil { | |
| 256 | 223 | return err | |
| 257 | 224 | } | |
| 258 | 225 | return nil | |
| @@ -260,22 +227,15 @@ func (o *LinuxBufferParams) Destroy() error { | |||
| 260 | 227 | ||
| 261 | 228 | // This request adds one dmabuf to the set in this zwp_linux_buffer_params_v1. The 64-bit unsigned value combined from modifier_hi and modifier_lo is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the fb modifier, which is defined in drm_mode.h of Linux UAPI. This is an opaque token. Drivers use this token to express tiling, compression, etc. driver-specific modifications to the base format defined by the DRM fourcc code. Starting from version 4, the invalid_format protocol error is sent if the format + modifier pair was not advertised as supported. Starting from version 5, the invalid_format protocol error is sent if all planes don't use the same modifier. This request raises the PLANE_IDX error if plane_idx is too large. The error PLANE_SET is raised if attempting to set a plane that was already set. | |
| 262 | 229 | func (o *LinuxBufferParams) Add(fd int, planeIdx uint32, offset uint32, stride uint32, modifierHi uint32, modifierLo uint32) error { | |
| 263 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 230 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_buffer_params_v1.add", FDs: []int{fd}}, uintptr(fd), planeIdx, offset, stride, modifierHi, modifierLo); err != nil { | |
| 264 | 231 | return err | |
| 265 | 232 | } | |
| 266 | - | if err := o.Context().SendRequestWithFDs(o, 1, []int{fd}, uintptr(fd), planeIdx, offset, stride, modifierHi, modifierLo); err != nil { | |
| 267 | - | return err | |
| 268 | - | } | |
| 269 | - | _ = wl.CloseSentFD(fd) | |
| 270 | 233 | return nil | |
| 271 | 234 | } | |
| 272 | 235 | ||
| 273 | 236 | // This asks for creation of a wl_buffer from the added dmabuf buffers. The wl_buffer is not created immediately but returned via the 'created' event if the dmabuf sharing succeeds. The sharing may fail at runtime for reasons a client cannot predict, in which case the 'failed' event is triggered. The 'format' argument is a DRM_FORMAT code, as defined by the libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the authoritative source on how the format codes should work. The 'flags' is a bitfield of the flags defined in enum "flags". 'y_invert' means that the image needs to be y-flipped. Flag 'interlaced' means that the frame in the buffer is not progressive as usual, but interlaced. An interlaced buffer as supported here must always contain both top and bottom fields. The top field always begins on the first pixel row. The temporal ordering between the two fields is top field first, unless 'bottom_first' is specified. It is undefined whether 'bottom_first' is ignored if 'interlaced' is not set. This protocol does not convey any information about field rate, duration, or timing, other than the relative ordering between the two fields in one buffer. A compositor may have to estimate the intended field rate from the incoming buffer rate. It is undefined whether the time of receiving wl_surface.commit with a new buffer attached, applying the wl_surface state, wl_surface.frame callback trigger, presentation, or any other point in the compositor cycle is used to measure the frame or field times. There is no support for detecting missed or late frames/fields/buffers either, and there is no support whatsoever for cooperating with interlaced compositor output. The composited image quality resulting from the use of interlaced buffers is explicitly undefined. A compositor may use elaborate hardware features or software to deinterlace and create progressive output frames from a sequence of interlaced input buffers, or it may produce substandard image quality. However, compositors that cannot guarantee reasonable image quality in all cases are recommended to just reject all interlaced buffers. Any argument errors, including non-positive width or height, mismatch between the number of planes and the format, bad format, bad offset or stride, may be indicated by fatal protocol errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS. Dmabuf import errors in the server that are not obvious client bugs are returned via the 'failed' event as non-fatal. This allows attempting dmabuf sharing and falling back in the client if it fails. This request can be sent only once in the object's lifetime, after which the only legal request is destroy. This object should be destroyed after issuing a 'create' request. Attempting to use this object after issuing 'create' raises the ALREADY_USED protocol error. It is not mandatory to issue 'create'. If a client wants to cancel the buffer creation, it can just destroy this object. | |
| 274 | 237 | func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, flags uint32) error { | |
| 275 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 276 | - | return err | |
| 277 | - | } | |
| 278 | - | if err := o.Context().SendRequest(o, 2, width, height, format, flags); err != nil { | |
| 238 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_buffer_params_v1.create"}, width, height, format, flags); err != nil { | |
| 279 | 239 | return err | |
| 280 | 240 | } | |
| 281 | 241 | return nil | |
| @@ -283,18 +243,8 @@ func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, fla | |||
| 283 | 243 | ||
| 284 | 244 | // This asks for immediate creation of a wl_buffer by importing the added dmabufs. In case of import success, no event is sent from the server, and the wl_buffer is ready to be used by the client. Upon import failure, either of the following may happen, as seen fit by the implementation: - the client is terminated with one of the following fatal protocol errors: - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, in case of argument errors such as mismatch between the number of planes and the format, bad format, non-positive width or height, or bad offset or stride. - INVALID_WL_BUFFER, in case the cause for failure is unknown or platform specific. - the server creates an invalid wl_buffer, marks it as failed and sends a 'failed' event to the client. The result of using this invalid wl_buffer as an argument in any request by the client is defined by the compositor implementation. This takes the same arguments as a 'create' request, and obeys the same restrictions. | |
| 285 | 245 | func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32, flags uint32) (*cross_wl_buffer.Buffer, error) { | |
| 286 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 287 | - | return nil, err | |
| 288 | - | } | |
| 289 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_linux_buffer_params_v1.create_immed"); err != nil { | |
| 290 | - | return nil, err | |
| 291 | - | } | |
| 292 | 246 | child := cross_wl_buffer.NewBuffer(o.Context()) | |
| 293 | - | child.SetID(o.Context().AllocateID()) | |
| 294 | - | child.SetVersion(o.Version()) | |
| 295 | - | o.Context().Register(child) | |
| 296 | - | if err := o.Context().SendRequest(o, 3, child, width, height, format, flags); err != nil { | |
| 297 | - | o.Context().Unregister(child) | |
| 247 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_buffer_params_v1.create_immed", Since: 2, Child: child}, child, width, height, format, flags); err != nil { | |
| 298 | 248 | return nil, err | |
| 299 | 249 | } | |
| 300 | 250 | return child, nil | |
| @@ -302,13 +252,7 @@ func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32 | |||
| 302 | 252 | ||
| 303 | 253 | // Set the device the compositor should import the dmabufs to for sampling in the next create or create_immed request. To avoid race conditions when the compositor removes a device from the tranches, it is not a protocol error if the device hasn't been advertised by the compositor in a tranche with the sampling flag, but the import is likely to fail in that case. If the client doesn't know a suitable target device, it shouldn't set one, and the compositor should attempt import on all devices it supports. If the array is too small to contain a dev_t or larger than required, the invalid_dev_t_size error will be emitted. | |
| 304 | 254 | func (o *LinuxBufferParams) SetSamplingDevice(device []byte) error { | |
| 305 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 306 | - | return err | |
| 307 | - | } | |
| 308 | - | if err := wl.CheckVersion(o.Version(), 6, "zwp_linux_buffer_params_v1.set_sampling_device"); err != nil { | |
| 309 | - | return err | |
| 310 | - | } | |
| 311 | - | if err := o.Context().SendRequest(o, 4, device); err != nil { | |
| 255 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_linux_buffer_params_v1.set_sampling_device", Since: 6}, device); err != nil { | |
| 312 | 256 | return err | |
| 313 | 257 | } | |
| 314 | 258 | return nil | |
| @@ -422,10 +366,7 @@ func NewLinuxDmabufFeedback(ctx *wl.Context) *LinuxDmabufFeedback { | |||
| 422 | 366 | ||
| 423 | 367 | // Using this request a client can tell the server that it is not going to use the zwp_linux_dmabuf_feedback_v1 object anymore. | |
| 424 | 368 | func (o *LinuxDmabufFeedback) Destroy() error { | |
| 425 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 426 | - | return err | |
| 427 | - | } | |
| 428 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 369 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_feedback_v1.destroy", Destructor: true}); err != nil { | |
| 429 | 370 | return err | |
| 430 | 371 | } | |
| 431 | 372 | return nil | |
| @@ -77,10 +77,7 @@ func NewLinuxDmabuf(ctx *wl.Context) *LinuxDmabuf { | |||||
| 77 | 77 | ||||
| 78 | // Objects created through this interface, especially wl_buffers, will remain valid. | 78 | // Objects created through this interface, especially wl_buffers, will remain valid. | ||
| 79 | func (o *LinuxDmabuf) Destroy() error { | 79 | func (o *LinuxDmabuf) Destroy() error { | ||
| 80 | - | if err := o.Context().CheckProxy(o); err != nil { | 80 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_v1.destroy", Destructor: true}); err != nil { |
| 81 | - | return err | |||
| 82 | - | } | |||
| 83 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 84 | return err | 81 | return err | ||
| 85 | } | 82 | } | ||
| 86 | return nil | 83 | return nil | ||
| @@ -88,16 +85,9 @@ func (o *LinuxDmabuf) Destroy() error { | |||||
| 88 | 85 | ||||
| 89 | // This temporary object is used to collect multiple dmabuf handles into a single batch to create a wl_buffer. It can only be used once and should be destroyed after a 'created' or 'failed' event has been received. | 86 | // This temporary object is used to collect multiple dmabuf handles into a single batch to create a wl_buffer. It can only be used once and should be destroyed after a 'created' or 'failed' event has been received. | ||
| 90 | func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) { | 87 | func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) { | ||
| 91 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 92 | - | return nil, err | |||
| 93 | - | } | |||
| 94 | child := &LinuxBufferParams{} | 88 | child := &LinuxBufferParams{} | ||
| 95 | child.SetContext(o.Context()) | 89 | child.SetContext(o.Context()) | ||
| 96 | - | child.SetID(o.Context().AllocateID()) | 90 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_dmabuf_v1.create_params", Child: child}, child); err != nil { |
| 97 | - | child.SetVersion(o.Version()) | |||
| 98 | - | o.Context().Register(child) | |||
| 99 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |||
| 100 | - | o.Context().Unregister(child) | |||
| 101 | return nil, err | 91 | return nil, err | ||
| 102 | } | 92 | } | ||
| 103 | return child, nil | 93 | return child, nil | ||
| @@ -105,19 +95,9 @@ func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) { | |||||
| 105 | 95 | ||||
| 106 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object not bound to a particular surface. This object will deliver feedback about dmabuf parameters to use if the client doesn't support per-surface feedback (see get_surface_feedback). | 96 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object not bound to a particular surface. This object will deliver feedback about dmabuf parameters to use if the client doesn't support per-surface feedback (see get_surface_feedback). | ||
| 107 | func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) { | 97 | func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) { | ||
| 108 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 109 | - | return nil, err | |||
| 110 | - | } | |||
| 111 | - | if err := wl.CheckVersion(o.Version(), 4, "zwp_linux_dmabuf_v1.get_default_feedback"); err != nil { | |||
| 112 | - | return nil, err | |||
| 113 | - | } | |||
| 114 | child := &LinuxDmabufFeedback{} | 98 | child := &LinuxDmabufFeedback{} | ||
| 115 | child.SetContext(o.Context()) | 99 | child.SetContext(o.Context()) | ||
| 116 | - | child.SetID(o.Context().AllocateID()) | 100 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_dmabuf_v1.get_default_feedback", Since: 4, Child: child}, child); err != nil { |
| 117 | - | child.SetVersion(o.Version()) | |||
| 118 | - | o.Context().Register(child) | |||
| 119 | - | if err := o.Context().SendRequest(o, 2, child); err != nil { | |||
| 120 | - | o.Context().Unregister(child) | |||
| 121 | return nil, err | 101 | return nil, err | ||
| 122 | } | 102 | } | ||
| 123 | return child, nil | 103 | return child, nil | ||
| @@ -125,23 +105,13 @@ func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) { | |||||
| 125 | 105 | ||||
| 126 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object for the specified wl_surface. This object will deliver feedback about dmabuf parameters to use for buffers attached to this surface. If the surface is destroyed before the zwp_linux_dmabuf_feedback_v1 object, the feedback object becomes inert. | 106 | // This request creates a new zwp_linux_dmabuf_feedback_v1 object for the specified wl_surface. This object will deliver feedback about dmabuf parameters to use for buffers attached to this surface. If the surface is destroyed before the zwp_linux_dmabuf_feedback_v1 object, the feedback object becomes inert. | ||
| 127 | func (o *LinuxDmabuf) GetSurfaceFeedback(surface *cross_wl_surface.Surface) (*LinuxDmabufFeedback, error) { | 107 | func (o *LinuxDmabuf) GetSurfaceFeedback(surface *cross_wl_surface.Surface) (*LinuxDmabufFeedback, error) { | ||
| 128 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 129 | - | return nil, err | |||
| 130 | - | } | |||
| 131 | - | if err := wl.CheckVersion(o.Version(), 4, "zwp_linux_dmabuf_v1.get_surface_feedback"); err != nil { | |||
| 132 | - | return nil, err | |||
| 133 | - | } | |||
| 134 | var arg1 wl.Object | 108 | var arg1 wl.Object | ||
| 135 | if surface != nil { | 109 | if surface != nil { | ||
| 136 | arg1 = surface | 110 | arg1 = surface | ||
| 137 | } | 111 | } | ||
| 138 | child := &LinuxDmabufFeedback{} | 112 | child := &LinuxDmabufFeedback{} | ||
| 139 | child.SetContext(o.Context()) | 113 | child.SetContext(o.Context()) | ||
| 140 | - | child.SetID(o.Context().AllocateID()) | 114 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_dmabuf_v1.get_surface_feedback", Since: 4, Child: child}, child, arg1); err != nil { |
| 141 | - | child.SetVersion(o.Version()) | |||
| 142 | - | o.Context().Register(child) | |||
| 143 | - | if err := o.Context().SendRequest(o, 3, child, arg1); err != nil { | |||
| 144 | - | o.Context().Unregister(child) | |||
| 145 | return nil, err | 115 | return nil, err | ||
| 146 | } | 116 | } | ||
| 147 | return child, nil | 117 | return child, nil | ||
| @@ -249,10 +219,7 @@ func NewLinuxBufferParams(ctx *wl.Context) *LinuxBufferParams { | |||||
| 249 | 219 | ||||
| 250 | // Cleans up the temporary data sent to the server for dmabuf-based wl_buffer creation. | 220 | // Cleans up the temporary data sent to the server for dmabuf-based wl_buffer creation. | ||
| 251 | func (o *LinuxBufferParams) Destroy() error { | 221 | func (o *LinuxBufferParams) Destroy() error { | ||
| 252 | - | if err := o.Context().CheckProxy(o); err != nil { | 222 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_buffer_params_v1.destroy", Destructor: true}); err != nil { |
| 253 | - | return err | |||
| 254 | - | } | |||
| 255 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 256 | return err | 223 | return err | ||
| 257 | } | 224 | } | ||
| 258 | return nil | 225 | return nil | ||
| @@ -260,22 +227,15 @@ func (o *LinuxBufferParams) Destroy() error { | |||||
| 260 | 227 | ||||
| 261 | // This request adds one dmabuf to the set in this zwp_linux_buffer_params_v1. The 64-bit unsigned value combined from modifier_hi and modifier_lo is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the fb modifier, which is defined in drm_mode.h of Linux UAPI. This is an opaque token. Drivers use this token to express tiling, compression, etc. driver-specific modifications to the base format defined by the DRM fourcc code. Starting from version 4, the invalid_format protocol error is sent if the format + modifier pair was not advertised as supported. Starting from version 5, the invalid_format protocol error is sent if all planes don't use the same modifier. This request raises the PLANE_IDX error if plane_idx is too large. The error PLANE_SET is raised if attempting to set a plane that was already set. | 228 | // This request adds one dmabuf to the set in this zwp_linux_buffer_params_v1. The 64-bit unsigned value combined from modifier_hi and modifier_lo is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the fb modifier, which is defined in drm_mode.h of Linux UAPI. This is an opaque token. Drivers use this token to express tiling, compression, etc. driver-specific modifications to the base format defined by the DRM fourcc code. Starting from version 4, the invalid_format protocol error is sent if the format + modifier pair was not advertised as supported. Starting from version 5, the invalid_format protocol error is sent if all planes don't use the same modifier. This request raises the PLANE_IDX error if plane_idx is too large. The error PLANE_SET is raised if attempting to set a plane that was already set. | ||
| 262 | func (o *LinuxBufferParams) Add(fd int, planeIdx uint32, offset uint32, stride uint32, modifierHi uint32, modifierLo uint32) error { | 229 | func (o *LinuxBufferParams) Add(fd int, planeIdx uint32, offset uint32, stride uint32, modifierHi uint32, modifierLo uint32) error { | ||
| 263 | - | if err := o.Context().CheckProxy(o); err != nil { | 230 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_buffer_params_v1.add", FDs: []int{fd}}, uintptr(fd), planeIdx, offset, stride, modifierHi, modifierLo); err != nil { |
| 264 | return err | 231 | return err | ||
| 265 | } | 232 | } | ||
| 266 | - | if err := o.Context().SendRequestWithFDs(o, 1, []int{fd}, uintptr(fd), planeIdx, offset, stride, modifierHi, modifierLo); err != nil { | |||
| 267 | - | return err | |||
| 268 | - | } | |||
| 269 | - | _ = wl.CloseSentFD(fd) | |||
| 270 | return nil | 233 | return nil | ||
| 271 | } | 234 | } | ||
| 272 | 235 | ||||
| 273 | // This asks for creation of a wl_buffer from the added dmabuf buffers. The wl_buffer is not created immediately but returned via the 'created' event if the dmabuf sharing succeeds. The sharing may fail at runtime for reasons a client cannot predict, in which case the 'failed' event is triggered. The 'format' argument is a DRM_FORMAT code, as defined by the libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the authoritative source on how the format codes should work. The 'flags' is a bitfield of the flags defined in enum "flags". 'y_invert' means that the image needs to be y-flipped. Flag 'interlaced' means that the frame in the buffer is not progressive as usual, but interlaced. An interlaced buffer as supported here must always contain both top and bottom fields. The top field always begins on the first pixel row. The temporal ordering between the two fields is top field first, unless 'bottom_first' is specified. It is undefined whether 'bottom_first' is ignored if 'interlaced' is not set. This protocol does not convey any information about field rate, duration, or timing, other than the relative ordering between the two fields in one buffer. A compositor may have to estimate the intended field rate from the incoming buffer rate. It is undefined whether the time of receiving wl_surface.commit with a new buffer attached, applying the wl_surface state, wl_surface.frame callback trigger, presentation, or any other point in the compositor cycle is used to measure the frame or field times. There is no support for detecting missed or late frames/fields/buffers either, and there is no support whatsoever for cooperating with interlaced compositor output. The composited image quality resulting from the use of interlaced buffers is explicitly undefined. A compositor may use elaborate hardware features or software to deinterlace and create progressive output frames from a sequence of interlaced input buffers, or it may produce substandard image quality. However, compositors that cannot guarantee reasonable image quality in all cases are recommended to just reject all interlaced buffers. Any argument errors, including non-positive width or height, mismatch between the number of planes and the format, bad format, bad offset or stride, may be indicated by fatal protocol errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS. Dmabuf import errors in the server that are not obvious client bugs are returned via the 'failed' event as non-fatal. This allows attempting dmabuf sharing and falling back in the client if it fails. This request can be sent only once in the object's lifetime, after which the only legal request is destroy. This object should be destroyed after issuing a 'create' request. Attempting to use this object after issuing 'create' raises the ALREADY_USED protocol error. It is not mandatory to issue 'create'. If a client wants to cancel the buffer creation, it can just destroy this object. | 236 | // This asks for creation of a wl_buffer from the added dmabuf buffers. The wl_buffer is not created immediately but returned via the 'created' event if the dmabuf sharing succeeds. The sharing may fail at runtime for reasons a client cannot predict, in which case the 'failed' event is triggered. The 'format' argument is a DRM_FORMAT code, as defined by the libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the authoritative source on how the format codes should work. The 'flags' is a bitfield of the flags defined in enum "flags". 'y_invert' means that the image needs to be y-flipped. Flag 'interlaced' means that the frame in the buffer is not progressive as usual, but interlaced. An interlaced buffer as supported here must always contain both top and bottom fields. The top field always begins on the first pixel row. The temporal ordering between the two fields is top field first, unless 'bottom_first' is specified. It is undefined whether 'bottom_first' is ignored if 'interlaced' is not set. This protocol does not convey any information about field rate, duration, or timing, other than the relative ordering between the two fields in one buffer. A compositor may have to estimate the intended field rate from the incoming buffer rate. It is undefined whether the time of receiving wl_surface.commit with a new buffer attached, applying the wl_surface state, wl_surface.frame callback trigger, presentation, or any other point in the compositor cycle is used to measure the frame or field times. There is no support for detecting missed or late frames/fields/buffers either, and there is no support whatsoever for cooperating with interlaced compositor output. The composited image quality resulting from the use of interlaced buffers is explicitly undefined. A compositor may use elaborate hardware features or software to deinterlace and create progressive output frames from a sequence of interlaced input buffers, or it may produce substandard image quality. However, compositors that cannot guarantee reasonable image quality in all cases are recommended to just reject all interlaced buffers. Any argument errors, including non-positive width or height, mismatch between the number of planes and the format, bad format, bad offset or stride, may be indicated by fatal protocol errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS. Dmabuf import errors in the server that are not obvious client bugs are returned via the 'failed' event as non-fatal. This allows attempting dmabuf sharing and falling back in the client if it fails. This request can be sent only once in the object's lifetime, after which the only legal request is destroy. This object should be destroyed after issuing a 'create' request. Attempting to use this object after issuing 'create' raises the ALREADY_USED protocol error. It is not mandatory to issue 'create'. If a client wants to cancel the buffer creation, it can just destroy this object. | ||
| 274 | func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, flags uint32) error { | 237 | func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, flags uint32) error { | ||
| 275 | - | if err := o.Context().CheckProxy(o); err != nil { | 238 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_buffer_params_v1.create"}, width, height, format, flags); err != nil { |
| 276 | - | return err | |||
| 277 | - | } | |||
| 278 | - | if err := o.Context().SendRequest(o, 2, width, height, format, flags); err != nil { | |||
| 279 | return err | 239 | return err | ||
| 280 | } | 240 | } | ||
| 281 | return nil | 241 | return nil | ||
| @@ -283,18 +243,8 @@ func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, fla | |||||
| 283 | 243 | ||||
| 284 | // This asks for immediate creation of a wl_buffer by importing the added dmabufs. In case of import success, no event is sent from the server, and the wl_buffer is ready to be used by the client. Upon import failure, either of the following may happen, as seen fit by the implementation: - the client is terminated with one of the following fatal protocol errors: - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, in case of argument errors such as mismatch between the number of planes and the format, bad format, non-positive width or height, or bad offset or stride. - INVALID_WL_BUFFER, in case the cause for failure is unknown or platform specific. - the server creates an invalid wl_buffer, marks it as failed and sends a 'failed' event to the client. The result of using this invalid wl_buffer as an argument in any request by the client is defined by the compositor implementation. This takes the same arguments as a 'create' request, and obeys the same restrictions. | 244 | // This asks for immediate creation of a wl_buffer by importing the added dmabufs. In case of import success, no event is sent from the server, and the wl_buffer is ready to be used by the client. Upon import failure, either of the following may happen, as seen fit by the implementation: - the client is terminated with one of the following fatal protocol errors: - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, in case of argument errors such as mismatch between the number of planes and the format, bad format, non-positive width or height, or bad offset or stride. - INVALID_WL_BUFFER, in case the cause for failure is unknown or platform specific. - the server creates an invalid wl_buffer, marks it as failed and sends a 'failed' event to the client. The result of using this invalid wl_buffer as an argument in any request by the client is defined by the compositor implementation. This takes the same arguments as a 'create' request, and obeys the same restrictions. | ||
| 285 | func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32, flags uint32) (*cross_wl_buffer.Buffer, error) { | 245 | func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32, flags uint32) (*cross_wl_buffer.Buffer, error) { | ||
| 286 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 287 | - | return nil, err | |||
| 288 | - | } | |||
| 289 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_linux_buffer_params_v1.create_immed"); err != nil { | |||
| 290 | - | return nil, err | |||
| 291 | - | } | |||
| 292 | child := cross_wl_buffer.NewBuffer(o.Context()) | 246 | child := cross_wl_buffer.NewBuffer(o.Context()) | ||
| 293 | - | child.SetID(o.Context().AllocateID()) | 247 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_buffer_params_v1.create_immed", Since: 2, Child: child}, child, width, height, format, flags); err != nil { |
| 294 | - | child.SetVersion(o.Version()) | |||
| 295 | - | o.Context().Register(child) | |||
| 296 | - | if err := o.Context().SendRequest(o, 3, child, width, height, format, flags); err != nil { | |||
| 297 | - | o.Context().Unregister(child) | |||
| 298 | return nil, err | 248 | return nil, err | ||
| 299 | } | 249 | } | ||
| 300 | return child, nil | 250 | return child, nil | ||
| @@ -302,13 +252,7 @@ func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32 | |||||
| 302 | 252 | ||||
| 303 | // Set the device the compositor should import the dmabufs to for sampling in the next create or create_immed request. To avoid race conditions when the compositor removes a device from the tranches, it is not a protocol error if the device hasn't been advertised by the compositor in a tranche with the sampling flag, but the import is likely to fail in that case. If the client doesn't know a suitable target device, it shouldn't set one, and the compositor should attempt import on all devices it supports. If the array is too small to contain a dev_t or larger than required, the invalid_dev_t_size error will be emitted. | 253 | // Set the device the compositor should import the dmabufs to for sampling in the next create or create_immed request. To avoid race conditions when the compositor removes a device from the tranches, it is not a protocol error if the device hasn't been advertised by the compositor in a tranche with the sampling flag, but the import is likely to fail in that case. If the client doesn't know a suitable target device, it shouldn't set one, and the compositor should attempt import on all devices it supports. If the array is too small to contain a dev_t or larger than required, the invalid_dev_t_size error will be emitted. | ||
| 304 | func (o *LinuxBufferParams) SetSamplingDevice(device []byte) error { | 254 | func (o *LinuxBufferParams) SetSamplingDevice(device []byte) error { | ||
| 305 | - | if err := o.Context().CheckProxy(o); err != nil { | 255 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_linux_buffer_params_v1.set_sampling_device", Since: 6}, device); err != nil { |
| 306 | - | return err | |||
| 307 | - | } | |||
| 308 | - | if err := wl.CheckVersion(o.Version(), 6, "zwp_linux_buffer_params_v1.set_sampling_device"); err != nil { | |||
| 309 | - | return err | |||
| 310 | - | } | |||
| 311 | - | if err := o.Context().SendRequest(o, 4, device); err != nil { | |||
| 312 | return err | 256 | return err | ||
| 313 | } | 257 | } | ||
| 314 | return nil | 258 | return nil | ||
| @@ -422,10 +366,7 @@ func NewLinuxDmabufFeedback(ctx *wl.Context) *LinuxDmabufFeedback { | |||||
| 422 | 366 | ||||
| 423 | // Using this request a client can tell the server that it is not going to use the zwp_linux_dmabuf_feedback_v1 object anymore. | 367 | // Using this request a client can tell the server that it is not going to use the zwp_linux_dmabuf_feedback_v1 object anymore. | ||
| 424 | func (o *LinuxDmabufFeedback) Destroy() error { | 368 | func (o *LinuxDmabufFeedback) Destroy() error { | ||
| 425 | - | if err := o.Context().CheckProxy(o); err != nil { | 369 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_feedback_v1.destroy", Destructor: true}); err != nil { |
| 426 | - | return err | |||
| 427 | - | } | |||
| 428 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 429 | return err | 370 | return err | ||
| 430 | } | 371 | } | ||
| 431 | return nil | 372 | return nil | ||
M protocol/tablet/tablet-v2_generated.go +15 -64
| @@ -108,20 +108,13 @@ func NewTabletManager(ctx *wl.Context) *TabletManager { | |||
| 108 | 108 | ||
| 109 | 109 | // Get the zwp_tablet_seat_v2 object for the given seat. This object provides access to all graphics tablets in this seat. | |
| 110 | 110 | func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, error) { | |
| 111 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 112 | - | return nil, err | |
| 113 | - | } | |
| 114 | 111 | var arg1 wl.Object | |
| 115 | 112 | if seat != nil { | |
| 116 | 113 | arg1 = seat | |
| 117 | 114 | } | |
| 118 | 115 | child := &TabletSeat{} | |
| 119 | 116 | child.SetContext(o.Context()) | |
| 120 | - | child.SetID(o.Context().AllocateID()) | |
| 121 | - | child.SetVersion(o.Version()) | |
| 122 | - | o.Context().Register(child) | |
| 123 | - | if err := o.Context().SendRequest(o, 0, child, arg1); err != nil { | |
| 124 | - | o.Context().Unregister(child) | |
| 117 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_manager_v2.get_tablet_seat", Child: child}, child, arg1); err != nil { | |
| 125 | 118 | return nil, err | |
| 126 | 119 | } | |
| 127 | 120 | return child, nil | |
| @@ -129,10 +122,7 @@ func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, er | |||
| 129 | 122 | ||
| 130 | 123 | // Destroy the zwp_tablet_manager_v2 object. Objects created from this object are unaffected and should be destroyed separately. | |
| 131 | 124 | func (o *TabletManager) Destroy() error { | |
| 132 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 133 | - | return err | |
| 134 | - | } | |
| 135 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 125 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_manager_v2.destroy", Destructor: true}); err != nil { | |
| 136 | 126 | return err | |
| 137 | 127 | } | |
| 138 | 128 | return nil | |
| @@ -177,10 +167,7 @@ func NewTabletSeat(ctx *wl.Context) *TabletSeat { | |||
| 177 | 167 | ||
| 178 | 168 | // Destroy the zwp_tablet_seat_v2 object. Objects created from this object are unaffected and should be destroyed separately. | |
| 179 | 169 | func (o *TabletSeat) Destroy() error { | |
| 180 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 181 | - | return err | |
| 182 | - | } | |
| 183 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_seat_v2.destroy", Destructor: true}); err != nil { | |
| 184 | 171 | return err | |
| 185 | 172 | } | |
| 186 | 173 | return nil | |
| @@ -349,14 +336,11 @@ func NewTabletTool(ctx *wl.Context) *TabletTool { | |||
| 349 | 336 | ||
| 350 | 337 | // Sets the surface of the cursor used for this tool on the given tablet. This request only takes effect if the tool is in proximity of one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the cursor image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The current and pending input regions of the wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. This request gives the surface the role of a zwp_tablet_tool_v2 cursor. A surface may only ever be used as the cursor surface for one zwp_tablet_tool_v2. If the surface already has another role or has previously been used as cursor surface for a different tool, a protocol error is raised. | |
| 351 | 338 | func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, hotspotX int32, hotspotY int32) error { | |
| 352 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 353 | - | return err | |
| 354 | - | } | |
| 355 | 339 | var arg1 wl.Object | |
| 356 | 340 | if surface != nil { | |
| 357 | 341 | arg1 = surface | |
| 358 | 342 | } | |
| 359 | - | if err := o.Context().SendRequest(o, 0, serial, arg1, hotspotX, hotspotY); err != nil { | |
| 343 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_tool_v2.set_cursor"}, serial, arg1, hotspotX, hotspotY); err != nil { | |
| 360 | 344 | return err | |
| 361 | 345 | } | |
| 362 | 346 | return nil | |
| @@ -364,10 +348,7 @@ func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, | |||
| 364 | 348 | ||
| 365 | 349 | // This destroys the client's resource for this tool object. | |
| 366 | 350 | func (o *TabletTool) Destroy() error { | |
| 367 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 368 | - | return err | |
| 369 | - | } | |
| 370 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 351 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_tool_v2.destroy", Destructor: true}); err != nil { | |
| 371 | 352 | return err | |
| 372 | 353 | } | |
| 373 | 354 | return nil | |
| @@ -1009,10 +990,7 @@ func NewTablet(ctx *wl.Context) *Tablet { | |||
| 1009 | 990 | ||
| 1010 | 991 | // This destroys the client's resource for this tablet object. | |
| 1011 | 992 | func (o *Tablet) Destroy() error { | |
| 1012 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1013 | - | return err | |
| 1014 | - | } | |
| 1015 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 993 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_v2.destroy", Destructor: true}); err != nil { | |
| 1016 | 994 | return err | |
| 1017 | 995 | } | |
| 1018 | 996 | return nil | |
| @@ -1243,10 +1221,7 @@ func NewTabletPadRing(ctx *wl.Context) *TabletPadRing { | |||
| 1243 | 1221 | ||
| 1244 | 1222 | // Request that the compositor use the provided feedback string associated with this ring. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the ring is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the ring; compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this ring. Requests providing other serials than the most recent one will be ignored. | |
| 1245 | 1223 | func (o *TabletPadRing) SetFeedback(description string, serial uint32) error { | |
| 1246 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1247 | - | return err | |
| 1248 | - | } | |
| 1249 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |
| 1224 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_ring_v2.set_feedback"}, description, serial); err != nil { | |
| 1250 | 1225 | return err | |
| 1251 | 1226 | } | |
| 1252 | 1227 | return nil | |
| @@ -1254,10 +1229,7 @@ func (o *TabletPadRing) SetFeedback(description string, serial uint32) error { | |||
| 1254 | 1229 | ||
| 1255 | 1230 | // This destroys the client's resource for this ring object. | |
| 1256 | 1231 | func (o *TabletPadRing) Destroy() error { | |
| 1257 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1258 | - | return err | |
| 1259 | - | } | |
| 1260 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 1232 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_ring_v2.destroy", Destructor: true}); err != nil { | |
| 1261 | 1233 | return err | |
| 1262 | 1234 | } | |
| 1263 | 1235 | return nil | |
| @@ -1426,10 +1398,7 @@ func NewTabletPadStrip(ctx *wl.Context) *TabletPadStrip { | |||
| 1426 | 1398 | ||
| 1427 | 1399 | // Requests the compositor to use the provided feedback string associated with this strip. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the strip is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the strip, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this strip. Requests providing other serials than the most recent one will be ignored. | |
| 1428 | 1400 | func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error { | |
| 1429 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1430 | - | return err | |
| 1431 | - | } | |
| 1432 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |
| 1401 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_strip_v2.set_feedback"}, description, serial); err != nil { | |
| 1433 | 1402 | return err | |
| 1434 | 1403 | } | |
| 1435 | 1404 | return nil | |
| @@ -1437,10 +1406,7 @@ func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error { | |||
| 1437 | 1406 | ||
| 1438 | 1407 | // This destroys the client's resource for this strip object. | |
| 1439 | 1408 | func (o *TabletPadStrip) Destroy() error { | |
| 1440 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1441 | - | return err | |
| 1442 | - | } | |
| 1443 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 1409 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_strip_v2.destroy", Destructor: true}); err != nil { | |
| 1444 | 1410 | return err | |
| 1445 | 1411 | } | |
| 1446 | 1412 | return nil | |
| @@ -1612,10 +1578,7 @@ func NewTabletPadGroup(ctx *wl.Context) *TabletPadGroup { | |||
| 1612 | 1578 | ||
| 1613 | 1579 | // Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object are unaffected and should be destroyed separately. | |
| 1614 | 1580 | func (o *TabletPadGroup) Destroy() error { | |
| 1615 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1616 | - | return err | |
| 1617 | - | } | |
| 1618 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 1581 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_group_v2.destroy", Destructor: true}); err != nil { | |
| 1619 | 1582 | return err | |
| 1620 | 1583 | } | |
| 1621 | 1584 | return nil | |
| @@ -1898,10 +1861,7 @@ func NewTabletPad(ctx *wl.Context) *TabletPad { | |||
| 1898 | 1861 | ||
| 1899 | 1862 | // Requests the compositor to use the provided feedback string associated with this button. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever a button is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with each button, and compositors may use this information to offer visual feedback on the button layout (e.g. on-screen displays). Button indices start at 0. Setting the feedback string on a button that is reserved by the compositor (i.e. not belonging to any zwp_tablet_pad_group_v2) does not generate an error but the compositor is free to ignore the request. The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this button. Requests providing other serials than the most recent one will be ignored. | |
| 1900 | 1863 | func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32) error { | |
| 1901 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1902 | - | return err | |
| 1903 | - | } | |
| 1904 | - | if err := o.Context().SendRequest(o, 0, button, description, serial); err != nil { | |
| 1864 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_v2.set_feedback"}, button, description, serial); err != nil { | |
| 1905 | 1865 | return err | |
| 1906 | 1866 | } | |
| 1907 | 1867 | return nil | |
| @@ -1909,10 +1869,7 @@ func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32 | |||
| 1909 | 1869 | ||
| 1910 | 1870 | // Destroy the zwp_tablet_pad_v2 object. Objects created from this object are unaffected and should be destroyed separately. | |
| 1911 | 1871 | func (o *TabletPad) Destroy() error { | |
| 1912 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1913 | - | return err | |
| 1914 | - | } | |
| 1915 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 1872 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_v2.destroy", Destructor: true}); err != nil { | |
| 1916 | 1873 | return err | |
| 1917 | 1874 | } | |
| 1918 | 1875 | return nil | |
| @@ -2212,10 +2169,7 @@ func NewTabletPadDial(ctx *wl.Context) *TabletPadDial { | |||
| 2212 | 2169 | ||
| 2213 | 2170 | // Requests the compositor to use the provided feedback string associated with this dial. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the dial is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the dial, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this dial. Requests providing other serials than the most recent one will be ignored. | |
| 2214 | 2171 | func (o *TabletPadDial) SetFeedback(description string, serial uint32) error { | |
| 2215 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2216 | - | return err | |
| 2217 | - | } | |
| 2218 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |
| 2172 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_dial_v2.set_feedback"}, description, serial); err != nil { | |
| 2219 | 2173 | return err | |
| 2220 | 2174 | } | |
| 2221 | 2175 | return nil | |
| @@ -2223,10 +2177,7 @@ func (o *TabletPadDial) SetFeedback(description string, serial uint32) error { | |||
| 2223 | 2177 | ||
| 2224 | 2178 | // This destroys the client's resource for this dial object. | |
| 2225 | 2179 | func (o *TabletPadDial) Destroy() error { | |
| 2226 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 2227 | - | return err | |
| 2228 | - | } | |
| 2229 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |
| 2180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_dial_v2.destroy", Destructor: true}); err != nil { | |
| 2230 | 2181 | return err | |
| 2231 | 2182 | } | |
| 2232 | 2183 | return nil | |
| @@ -108,20 +108,13 @@ func NewTabletManager(ctx *wl.Context) *TabletManager { | |||||
| 108 | 108 | ||||
| 109 | // Get the zwp_tablet_seat_v2 object for the given seat. This object provides access to all graphics tablets in this seat. | 109 | // Get the zwp_tablet_seat_v2 object for the given seat. This object provides access to all graphics tablets in this seat. | ||
| 110 | func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, error) { | 110 | func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, error) { | ||
| 111 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 112 | - | return nil, err | |||
| 113 | - | } | |||
| 114 | var arg1 wl.Object | 111 | var arg1 wl.Object | ||
| 115 | if seat != nil { | 112 | if seat != nil { | ||
| 116 | arg1 = seat | 113 | arg1 = seat | ||
| 117 | } | 114 | } | ||
| 118 | child := &TabletSeat{} | 115 | child := &TabletSeat{} | ||
| 119 | child.SetContext(o.Context()) | 116 | child.SetContext(o.Context()) | ||
| 120 | - | child.SetID(o.Context().AllocateID()) | 117 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_manager_v2.get_tablet_seat", Child: child}, child, arg1); err != nil { |
| 121 | - | child.SetVersion(o.Version()) | |||
| 122 | - | o.Context().Register(child) | |||
| 123 | - | if err := o.Context().SendRequest(o, 0, child, arg1); err != nil { | |||
| 124 | - | o.Context().Unregister(child) | |||
| 125 | return nil, err | 118 | return nil, err | ||
| 126 | } | 119 | } | ||
| 127 | return child, nil | 120 | return child, nil | ||
| @@ -129,10 +122,7 @@ func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, er | |||||
| 129 | 122 | ||||
| 130 | // Destroy the zwp_tablet_manager_v2 object. Objects created from this object are unaffected and should be destroyed separately. | 123 | // Destroy the zwp_tablet_manager_v2 object. Objects created from this object are unaffected and should be destroyed separately. | ||
| 131 | func (o *TabletManager) Destroy() error { | 124 | func (o *TabletManager) Destroy() error { | ||
| 132 | - | if err := o.Context().CheckProxy(o); err != nil { | 125 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_manager_v2.destroy", Destructor: true}); err != nil { |
| 133 | - | return err | |||
| 134 | - | } | |||
| 135 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 136 | return err | 126 | return err | ||
| 137 | } | 127 | } | ||
| 138 | return nil | 128 | return nil | ||
| @@ -177,10 +167,7 @@ func NewTabletSeat(ctx *wl.Context) *TabletSeat { | |||||
| 177 | 167 | ||||
| 178 | // Destroy the zwp_tablet_seat_v2 object. Objects created from this object are unaffected and should be destroyed separately. | 168 | // Destroy the zwp_tablet_seat_v2 object. Objects created from this object are unaffected and should be destroyed separately. | ||
| 179 | func (o *TabletSeat) Destroy() error { | 169 | func (o *TabletSeat) Destroy() error { | ||
| 180 | - | if err := o.Context().CheckProxy(o); err != nil { | 170 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_seat_v2.destroy", Destructor: true}); err != nil { |
| 181 | - | return err | |||
| 182 | - | } | |||
| 183 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 184 | return err | 171 | return err | ||
| 185 | } | 172 | } | ||
| 186 | return nil | 173 | return nil | ||
| @@ -349,14 +336,11 @@ func NewTabletTool(ctx *wl.Context) *TabletTool { | |||||
| 349 | 336 | ||||
| 350 | // Sets the surface of the cursor used for this tool on the given tablet. This request only takes effect if the tool is in proximity of one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the cursor image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The current and pending input regions of the wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. This request gives the surface the role of a zwp_tablet_tool_v2 cursor. A surface may only ever be used as the cursor surface for one zwp_tablet_tool_v2. If the surface already has another role or has previously been used as cursor surface for a different tool, a protocol error is raised. | 337 | // Sets the surface of the cursor used for this tool on the given tablet. This request only takes effect if the tool is in proximity of one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the cursor image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The current and pending input regions of the wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. This request gives the surface the role of a zwp_tablet_tool_v2 cursor. A surface may only ever be used as the cursor surface for one zwp_tablet_tool_v2. If the surface already has another role or has previously been used as cursor surface for a different tool, a protocol error is raised. | ||
| 351 | func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, hotspotX int32, hotspotY int32) error { | 338 | func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, hotspotX int32, hotspotY int32) error { | ||
| 352 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 353 | - | return err | |||
| 354 | - | } | |||
| 355 | var arg1 wl.Object | 339 | var arg1 wl.Object | ||
| 356 | if surface != nil { | 340 | if surface != nil { | ||
| 357 | arg1 = surface | 341 | arg1 = surface | ||
| 358 | } | 342 | } | ||
| 359 | - | if err := o.Context().SendRequest(o, 0, serial, arg1, hotspotX, hotspotY); err != nil { | 343 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_tool_v2.set_cursor"}, serial, arg1, hotspotX, hotspotY); err != nil { |
| 360 | return err | 344 | return err | ||
| 361 | } | 345 | } | ||
| 362 | return nil | 346 | return nil | ||
| @@ -364,10 +348,7 @@ func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, | |||||
| 364 | 348 | ||||
| 365 | // This destroys the client's resource for this tool object. | 349 | // This destroys the client's resource for this tool object. | ||
| 366 | func (o *TabletTool) Destroy() error { | 350 | func (o *TabletTool) Destroy() error { | ||
| 367 | - | if err := o.Context().CheckProxy(o); err != nil { | 351 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_tool_v2.destroy", Destructor: true}); err != nil { |
| 368 | - | return err | |||
| 369 | - | } | |||
| 370 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 371 | return err | 352 | return err | ||
| 372 | } | 353 | } | ||
| 373 | return nil | 354 | return nil | ||
| @@ -1009,10 +990,7 @@ func NewTablet(ctx *wl.Context) *Tablet { | |||||
| 1009 | 990 | ||||
| 1010 | // This destroys the client's resource for this tablet object. | 991 | // This destroys the client's resource for this tablet object. | ||
| 1011 | func (o *Tablet) Destroy() error { | 992 | func (o *Tablet) Destroy() error { | ||
| 1012 | - | if err := o.Context().CheckProxy(o); err != nil { | 993 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_v2.destroy", Destructor: true}); err != nil { |
| 1013 | - | return err | |||
| 1014 | - | } | |||
| 1015 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 1016 | return err | 994 | return err | ||
| 1017 | } | 995 | } | ||
| 1018 | return nil | 996 | return nil | ||
| @@ -1243,10 +1221,7 @@ func NewTabletPadRing(ctx *wl.Context) *TabletPadRing { | |||||
| 1243 | 1221 | ||||
| 1244 | // Request that the compositor use the provided feedback string associated with this ring. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the ring is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the ring; compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this ring. Requests providing other serials than the most recent one will be ignored. | 1222 | // Request that the compositor use the provided feedback string associated with this ring. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the ring is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the ring; compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this ring. Requests providing other serials than the most recent one will be ignored. | ||
| 1245 | func (o *TabletPadRing) SetFeedback(description string, serial uint32) error { | 1223 | func (o *TabletPadRing) SetFeedback(description string, serial uint32) error { | ||
| 1246 | - | if err := o.Context().CheckProxy(o); err != nil { | 1224 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_ring_v2.set_feedback"}, description, serial); err != nil { |
| 1247 | - | return err | |||
| 1248 | - | } | |||
| 1249 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |||
| 1250 | return err | 1225 | return err | ||
| 1251 | } | 1226 | } | ||
| 1252 | return nil | 1227 | return nil | ||
| @@ -1254,10 +1229,7 @@ func (o *TabletPadRing) SetFeedback(description string, serial uint32) error { | |||||
| 1254 | 1229 | ||||
| 1255 | // This destroys the client's resource for this ring object. | 1230 | // This destroys the client's resource for this ring object. | ||
| 1256 | func (o *TabletPadRing) Destroy() error { | 1231 | func (o *TabletPadRing) Destroy() error { | ||
| 1257 | - | if err := o.Context().CheckProxy(o); err != nil { | 1232 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_ring_v2.destroy", Destructor: true}); err != nil { |
| 1258 | - | return err | |||
| 1259 | - | } | |||
| 1260 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 1261 | return err | 1233 | return err | ||
| 1262 | } | 1234 | } | ||
| 1263 | return nil | 1235 | return nil | ||
| @@ -1426,10 +1398,7 @@ func NewTabletPadStrip(ctx *wl.Context) *TabletPadStrip { | |||||
| 1426 | 1398 | ||||
| 1427 | // Requests the compositor to use the provided feedback string associated with this strip. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the strip is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the strip, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this strip. Requests providing other serials than the most recent one will be ignored. | 1399 | // Requests the compositor to use the provided feedback string associated with this strip. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the strip is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the strip, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this strip. Requests providing other serials than the most recent one will be ignored. | ||
| 1428 | func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error { | 1400 | func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error { | ||
| 1429 | - | if err := o.Context().CheckProxy(o); err != nil { | 1401 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_strip_v2.set_feedback"}, description, serial); err != nil { |
| 1430 | - | return err | |||
| 1431 | - | } | |||
| 1432 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |||
| 1433 | return err | 1402 | return err | ||
| 1434 | } | 1403 | } | ||
| 1435 | return nil | 1404 | return nil | ||
| @@ -1437,10 +1406,7 @@ func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error { | |||||
| 1437 | 1406 | ||||
| 1438 | // This destroys the client's resource for this strip object. | 1407 | // This destroys the client's resource for this strip object. | ||
| 1439 | func (o *TabletPadStrip) Destroy() error { | 1408 | func (o *TabletPadStrip) Destroy() error { | ||
| 1440 | - | if err := o.Context().CheckProxy(o); err != nil { | 1409 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_strip_v2.destroy", Destructor: true}); err != nil { |
| 1441 | - | return err | |||
| 1442 | - | } | |||
| 1443 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 1444 | return err | 1410 | return err | ||
| 1445 | } | 1411 | } | ||
| 1446 | return nil | 1412 | return nil | ||
| @@ -1612,10 +1578,7 @@ func NewTabletPadGroup(ctx *wl.Context) *TabletPadGroup { | |||||
| 1612 | 1578 | ||||
| 1613 | // Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object are unaffected and should be destroyed separately. | 1579 | // Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object are unaffected and should be destroyed separately. | ||
| 1614 | func (o *TabletPadGroup) Destroy() error { | 1580 | func (o *TabletPadGroup) Destroy() error { | ||
| 1615 | - | if err := o.Context().CheckProxy(o); err != nil { | 1581 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_group_v2.destroy", Destructor: true}); err != nil { |
| 1616 | - | return err | |||
| 1617 | - | } | |||
| 1618 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 1619 | return err | 1582 | return err | ||
| 1620 | } | 1583 | } | ||
| 1621 | return nil | 1584 | return nil | ||
| @@ -1898,10 +1861,7 @@ func NewTabletPad(ctx *wl.Context) *TabletPad { | |||||
| 1898 | 1861 | ||||
| 1899 | // Requests the compositor to use the provided feedback string associated with this button. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever a button is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with each button, and compositors may use this information to offer visual feedback on the button layout (e.g. on-screen displays). Button indices start at 0. Setting the feedback string on a button that is reserved by the compositor (i.e. not belonging to any zwp_tablet_pad_group_v2) does not generate an error but the compositor is free to ignore the request. The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this button. Requests providing other serials than the most recent one will be ignored. | 1862 | // Requests the compositor to use the provided feedback string associated with this button. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever a button is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with each button, and compositors may use this information to offer visual feedback on the button layout (e.g. on-screen displays). Button indices start at 0. Setting the feedback string on a button that is reserved by the compositor (i.e. not belonging to any zwp_tablet_pad_group_v2) does not generate an error but the compositor is free to ignore the request. The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this button. Requests providing other serials than the most recent one will be ignored. | ||
| 1900 | func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32) error { | 1863 | func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32) error { | ||
| 1901 | - | if err := o.Context().CheckProxy(o); err != nil { | 1864 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_v2.set_feedback"}, button, description, serial); err != nil { |
| 1902 | - | return err | |||
| 1903 | - | } | |||
| 1904 | - | if err := o.Context().SendRequest(o, 0, button, description, serial); err != nil { | |||
| 1905 | return err | 1865 | return err | ||
| 1906 | } | 1866 | } | ||
| 1907 | return nil | 1867 | return nil | ||
| @@ -1909,10 +1869,7 @@ func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32 | |||||
| 1909 | 1869 | ||||
| 1910 | // Destroy the zwp_tablet_pad_v2 object. Objects created from this object are unaffected and should be destroyed separately. | 1870 | // Destroy the zwp_tablet_pad_v2 object. Objects created from this object are unaffected and should be destroyed separately. | ||
| 1911 | func (o *TabletPad) Destroy() error { | 1871 | func (o *TabletPad) Destroy() error { | ||
| 1912 | - | if err := o.Context().CheckProxy(o); err != nil { | 1872 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_v2.destroy", Destructor: true}); err != nil { |
| 1913 | - | return err | |||
| 1914 | - | } | |||
| 1915 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 1916 | return err | 1873 | return err | ||
| 1917 | } | 1874 | } | ||
| 1918 | return nil | 1875 | return nil | ||
| @@ -2212,10 +2169,7 @@ func NewTabletPadDial(ctx *wl.Context) *TabletPadDial { | |||||
| 2212 | 2169 | ||||
| 2213 | // Requests the compositor to use the provided feedback string associated with this dial. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the dial is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the dial, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this dial. Requests providing other serials than the most recent one will be ignored. | 2170 | // Requests the compositor to use the provided feedback string associated with this dial. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the dial is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the dial, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this dial. Requests providing other serials than the most recent one will be ignored. | ||
| 2214 | func (o *TabletPadDial) SetFeedback(description string, serial uint32) error { | 2171 | func (o *TabletPadDial) SetFeedback(description string, serial uint32) error { | ||
| 2215 | - | if err := o.Context().CheckProxy(o); err != nil { | 2172 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_dial_v2.set_feedback"}, description, serial); err != nil { |
| 2216 | - | return err | |||
| 2217 | - | } | |||
| 2218 | - | if err := o.Context().SendRequest(o, 0, description, serial); err != nil { | |||
| 2219 | return err | 2173 | return err | ||
| 2220 | } | 2174 | } | ||
| 2221 | return nil | 2175 | return nil | ||
| @@ -2223,10 +2177,7 @@ func (o *TabletPadDial) SetFeedback(description string, serial uint32) error { | |||||
| 2223 | 2177 | ||||
| 2224 | // This destroys the client's resource for this dial object. | 2178 | // This destroys the client's resource for this dial object. | ||
| 2225 | func (o *TabletPadDial) Destroy() error { | 2179 | func (o *TabletPadDial) Destroy() error { | ||
| 2226 | - | if err := o.Context().CheckProxy(o); err != nil { | 2180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_dial_v2.destroy", Destructor: true}); err != nil { |
| 2227 | - | return err | |||
| 2228 | - | } | |||
| 2229 | - | if err := o.Context().SendDestructor(o, 1); err != nil { | |||
| 2230 | return err | 2181 | return err | ||
| 2231 | } | 2182 | } | ||
| 2232 | return nil | 2183 | return nil | ||
M protocol/textinput/text-input-unstable-v3_generated.go +13 -65
| @@ -161,10 +161,7 @@ func NewTextInputV3(ctx *wl.Context) *TextInputV3 { | |||
| 161 | 161 | ||
| 162 | 162 | // Destroy the wp_text_input object. Also disables all surfaces enabled through this wp_text_input object. | |
| 163 | 163 | func (o *TextInputV3) Destroy() error { | |
| 164 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 165 | - | return err | |
| 166 | - | } | |
| 167 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 164 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_v3.destroy", Destructor: true}); err != nil { | |
| 168 | 165 | return err | |
| 169 | 166 | } | |
| 170 | 167 | return nil | |
| @@ -172,10 +169,7 @@ func (o *TextInputV3) Destroy() error { | |||
| 172 | 169 | ||
| 173 | 170 | // Requests text input on the surface previously obtained from the enter event. This request must be issued every time the focused text input changes to a new one, including within the current surface. Use zwp_text_input_v3.disable when there is no longer any input focus on the current surface. Clients must not enable more than one text input on the single seat and should disable the current text input before enabling the new one. Requests to enable a text input when another text input is enabled on the same seat must be ignored by compositor. This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with preedit_string, commit_string, and delete_surrounding_text events. The set_surrounding_text, set_content_type and set_cursor_rectangle requests must follow if the text input supports the necessary functionality. State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a zwp_text_input_v3.commit request. | |
| 174 | 171 | func (o *TextInputV3) Enable() error { | |
| 175 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 176 | - | return err | |
| 177 | - | } | |
| 178 | - | if err := o.Context().SendRequest(o, 1); err != nil { | |
| 172 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_v3.enable"}); err != nil { | |
| 179 | 173 | return err | |
| 180 | 174 | } | |
| 181 | 175 | return nil | |
| @@ -183,10 +177,7 @@ func (o *TextInputV3) Enable() error { | |||
| 183 | 177 | ||
| 184 | 178 | // Explicitly disable text input on the current surface (typically when there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request. | |
| 185 | 179 | func (o *TextInputV3) Disable() error { | |
| 186 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 187 | - | return err | |
| 188 | - | } | |
| 189 | - | if err := o.Context().SendRequest(o, 2); err != nil { | |
| 180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_text_input_v3.disable"}); err != nil { | |
| 190 | 181 | return err | |
| 191 | 182 | } | |
| 192 | 183 | return nil | |
| @@ -194,10 +185,7 @@ func (o *TextInputV3) Disable() error { | |||
| 194 | 185 | ||
| 195 | 186 | // Sets the surrounding plain text around the input, excluding the preedit text. The client should notify the compositor of any changes in any of the values carried with this request, including changes caused by handling incoming text-input events as well as changes caused by other mechanisms like keyboard typing. If the client is unaware of the text around the cursor, it should not issue this request, to signify lack of support to the compositor. Text is UTF-8 encoded, and should include the cursor position, the complete selection and additional characters before and after them. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes. Cursor is the byte offset of the cursor within text buffer. Anchor is the byte offset of the selection anchor within text buffer. If there is no selected text, anchor is the same as cursor. If any preedit text is present, it is replaced with a cursor for the purpose of this event. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text input does not support sending surrounding text. If the empty values get applied, subsequent attempts to change them may have no effect. | |
| 196 | 187 | func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32) error { | |
| 197 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 198 | - | return err | |
| 199 | - | } | |
| 200 | - | if err := o.Context().SendRequest(o, 3, text, cursor, anchor); err != nil { | |
| 188 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_text_input_v3.set_surrounding_text"}, text, cursor, anchor); err != nil { | |
| 201 | 189 | return err | |
| 202 | 190 | } | |
| 203 | 191 | return nil | |
| @@ -205,10 +193,7 @@ func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32 | |||
| 205 | 193 | ||
| 206 | 194 | // Tells the compositor why the text surrounding the cursor changed. Whenever the client detects an external change in text, cursor, or anchor posision, it must issue this request to the compositor. This request is intended to give the input method a chance to update the preedit text in an appropriate way, e.g. by removing it when the user starts typing with a keyboard. cause describes the source of the change. The value set with this request is double-buffered. It must be applied and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method. | |
| 207 | 195 | func (o *TextInputV3) SetTextChangeCause(cause uint32) error { | |
| 208 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 209 | - | return err | |
| 210 | - | } | |
| 211 | - | if err := o.Context().SendRequest(o, 4, cause); err != nil { | |
| 196 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_text_input_v3.set_text_change_cause"}, cause); err != nil { | |
| 212 | 197 | return err | |
| 213 | 198 | } | |
| 214 | 199 | return nil | |
| @@ -216,10 +201,7 @@ func (o *TextInputV3) SetTextChangeCause(cause uint32) error { | |||
| 216 | 201 | ||
| 217 | 202 | // Sets the content purpose and content hint. While the purpose is the basic purpose of an input field, the hint flags allow to modify some of the behavior. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. The initial value for hint is none, and the initial value for purpose is normal. | |
| 218 | 203 | func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error { | |
| 219 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 220 | - | return err | |
| 221 | - | } | |
| 222 | - | if err := o.Context().SendRequest(o, 5, hint, purpose); err != nil { | |
| 204 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "zwp_text_input_v3.set_content_type"}, hint, purpose); err != nil { | |
| 223 | 205 | return err | |
| 224 | 206 | } | |
| 225 | 207 | return nil | |
| @@ -227,10 +209,7 @@ func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error { | |||
| 227 | 209 | ||
| 228 | 210 | // Marks an area around the cursor as a x, y, width, height rectangle in surface local coordinates. Allows the compositor to put a window with word suggestions near the cursor, without obstructing the text being input. If the client is unaware of the position of edited text, it should not issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means the text input does not support describing the cursor area. If the empty values get applied, subsequent attempts to change them may have no effect. As of version 2, the zwp_text_input_v3.commit request does not apply values sent with this request. Instead, it stores them in a separate "committed" area. The committed values, if still valid, get applied on the next wl_surface.commit request on the surface with text-input focus. Both committed and applied values get invalidated on: - the next committed enable or disable request, or - a change of the focused surface of the text-input (leave or enter events). This double stage application allows the compositor to position the input method popup in the same frame as the contents of the text on the surface are updated. | |
| 229 | 211 | func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height int32) error { | |
| 230 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 231 | - | return err | |
| 232 | - | } | |
| 233 | - | if err := o.Context().SendRequest(o, 6, x, y, width, height); err != nil { | |
| 212 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "zwp_text_input_v3.set_cursor_rectangle"}, x, y, width, height); err != nil { | |
| 234 | 213 | return err | |
| 235 | 214 | } | |
| 236 | 215 | return nil | |
| @@ -238,10 +217,7 @@ func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height i | |||
| 238 | 217 | ||
| 239 | 218 | // Atomically applies state changes recently sent to the compositor. The commit request establishes and updates the state of the client, and must be issued after any changes to apply them. Text input state (enabled status, content purpose, content hint, surrounding text and change cause, cursor rectangle) is conceptually double-buffered within the context of a text input, i.e. between a committed enable request and the following committed enable or disable request. Protocol requests modify the pending state, as opposed to the current state in use by the input method. A commit request atomically applies all pending state, replacing the current state. After commit, the new pending state is as documented for each related request. Requests are applied in the order of arrival. Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from each zwp_text_input_v3 object and use the count as the serial in done events. | |
| 240 | 219 | func (o *TextInputV3) Commit() error { | |
| 241 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 242 | - | return err | |
| 243 | - | } | |
| 244 | - | if err := o.Context().SendRequest(o, 7); err != nil { | |
| 220 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "zwp_text_input_v3.commit"}); err != nil { | |
| 245 | 221 | return err | |
| 246 | 222 | } | |
| 247 | 223 | return nil | |
| @@ -249,13 +225,7 @@ func (o *TextInputV3) Commit() error { | |||
| 249 | 225 | ||
| 250 | 226 | // Set the actions available for this text input. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. If the available_actions array contains the none action, or contains the same action multiple times, the compositor must raise the invalid_action protocol error. Initially, no actions are available. | |
| 251 | 227 | func (o *TextInputV3) SetAvailableActions(availableActions []byte) error { | |
| 252 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 253 | - | return err | |
| 254 | - | } | |
| 255 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.set_available_actions"); err != nil { | |
| 256 | - | return err | |
| 257 | - | } | |
| 258 | - | if err := o.Context().SendRequest(o, 8, availableActions); err != nil { | |
| 228 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "zwp_text_input_v3.set_available_actions", Since: 2}, availableActions); err != nil { | |
| 259 | 229 | return err | |
| 260 | 230 | } | |
| 261 | 231 | return nil | |
| @@ -263,13 +233,7 @@ func (o *TextInputV3) SetAvailableActions(availableActions []byte) error { | |||
| 263 | 233 | ||
| 264 | 234 | // Requests an input panel to be shown (e.g. a on-screen keyboard). This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | |
| 265 | 235 | func (o *TextInputV3) ShowInputPanel() error { | |
| 266 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 267 | - | return err | |
| 268 | - | } | |
| 269 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.show_input_panel"); err != nil { | |
| 270 | - | return err | |
| 271 | - | } | |
| 272 | - | if err := o.Context().SendRequest(o, 9); err != nil { | |
| 236 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "zwp_text_input_v3.show_input_panel", Since: 2}); err != nil { | |
| 273 | 237 | return err | |
| 274 | 238 | } | |
| 275 | 239 | return nil | |
| @@ -277,13 +241,7 @@ func (o *TextInputV3) ShowInputPanel() error { | |||
| 277 | 241 | ||
| 278 | 242 | // Requests an input panel to be hidden. This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | |
| 279 | 243 | func (o *TextInputV3) HideInputPanel() error { | |
| 280 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 281 | - | return err | |
| 282 | - | } | |
| 283 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.hide_input_panel"); err != nil { | |
| 284 | - | return err | |
| 285 | - | } | |
| 286 | - | if err := o.Context().SendRequest(o, 10); err != nil { | |
| 244 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "zwp_text_input_v3.hide_input_panel", Since: 2}); err != nil { | |
| 287 | 245 | return err | |
| 288 | 246 | } | |
| 289 | 247 | return nil | |
| @@ -607,10 +565,7 @@ func NewTextInputManagerV3(ctx *wl.Context) *TextInputManagerV3 { | |||
| 607 | 565 | ||
| 608 | 566 | // Destroy the wp_text_input_manager object. | |
| 609 | 567 | func (o *TextInputManagerV3) Destroy() error { | |
| 610 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 611 | - | return err | |
| 612 | - | } | |
| 613 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 568 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_manager_v3.destroy", Destructor: true}); err != nil { | |
| 614 | 569 | return err | |
| 615 | 570 | } | |
| 616 | 571 | return nil | |
| @@ -618,20 +573,13 @@ func (o *TextInputManagerV3) Destroy() error { | |||
| 618 | 573 | ||
| 619 | 574 | // Creates a new text-input object for a given seat. | |
| 620 | 575 | func (o *TextInputManagerV3) GetTextInput(seat *cross_wl_seat.Seat) (*TextInputV3, error) { | |
| 621 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 622 | - | return nil, err | |
| 623 | - | } | |
| 624 | 576 | var arg1 wl.Object | |
| 625 | 577 | if seat != nil { | |
| 626 | 578 | arg1 = seat | |
| 627 | 579 | } | |
| 628 | 580 | child := &TextInputV3{} | |
| 629 | 581 | child.SetContext(o.Context()) | |
| 630 | - | child.SetID(o.Context().AllocateID()) | |
| 631 | - | child.SetVersion(o.Version()) | |
| 632 | - | o.Context().Register(child) | |
| 633 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 634 | - | o.Context().Unregister(child) | |
| 582 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_manager_v3.get_text_input", Child: child}, child, arg1); err != nil { | |
| 635 | 583 | return nil, err | |
| 636 | 584 | } | |
| 637 | 585 | return child, nil | |
| @@ -161,10 +161,7 @@ func NewTextInputV3(ctx *wl.Context) *TextInputV3 { | |||||
| 161 | 161 | ||||
| 162 | // Destroy the wp_text_input object. Also disables all surfaces enabled through this wp_text_input object. | 162 | // Destroy the wp_text_input object. Also disables all surfaces enabled through this wp_text_input object. | ||
| 163 | func (o *TextInputV3) Destroy() error { | 163 | func (o *TextInputV3) Destroy() error { | ||
| 164 | - | if err := o.Context().CheckProxy(o); err != nil { | 164 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_v3.destroy", Destructor: true}); err != nil { |
| 165 | - | return err | |||
| 166 | - | } | |||
| 167 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 168 | return err | 165 | return err | ||
| 169 | } | 166 | } | ||
| 170 | return nil | 167 | return nil | ||
| @@ -172,10 +169,7 @@ func (o *TextInputV3) Destroy() error { | |||||
| 172 | 169 | ||||
| 173 | // Requests text input on the surface previously obtained from the enter event. This request must be issued every time the focused text input changes to a new one, including within the current surface. Use zwp_text_input_v3.disable when there is no longer any input focus on the current surface. Clients must not enable more than one text input on the single seat and should disable the current text input before enabling the new one. Requests to enable a text input when another text input is enabled on the same seat must be ignored by compositor. This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with preedit_string, commit_string, and delete_surrounding_text events. The set_surrounding_text, set_content_type and set_cursor_rectangle requests must follow if the text input supports the necessary functionality. State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a zwp_text_input_v3.commit request. | 170 | // Requests text input on the surface previously obtained from the enter event. This request must be issued every time the focused text input changes to a new one, including within the current surface. Use zwp_text_input_v3.disable when there is no longer any input focus on the current surface. Clients must not enable more than one text input on the single seat and should disable the current text input before enabling the new one. Requests to enable a text input when another text input is enabled on the same seat must be ignored by compositor. This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with preedit_string, commit_string, and delete_surrounding_text events. The set_surrounding_text, set_content_type and set_cursor_rectangle requests must follow if the text input supports the necessary functionality. State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a zwp_text_input_v3.commit request. | ||
| 174 | func (o *TextInputV3) Enable() error { | 171 | func (o *TextInputV3) Enable() error { | ||
| 175 | - | if err := o.Context().CheckProxy(o); err != nil { | 172 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_v3.enable"}); err != nil { |
| 176 | - | return err | |||
| 177 | - | } | |||
| 178 | - | if err := o.Context().SendRequest(o, 1); err != nil { | |||
| 179 | return err | 173 | return err | ||
| 180 | } | 174 | } | ||
| 181 | return nil | 175 | return nil | ||
| @@ -183,10 +177,7 @@ func (o *TextInputV3) Enable() error { | |||||
| 183 | 177 | ||||
| 184 | // Explicitly disable text input on the current surface (typically when there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request. | 178 | // Explicitly disable text input on the current surface (typically when there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request. | ||
| 185 | func (o *TextInputV3) Disable() error { | 179 | func (o *TextInputV3) Disable() error { | ||
| 186 | - | if err := o.Context().CheckProxy(o); err != nil { | 180 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_text_input_v3.disable"}); err != nil { |
| 187 | - | return err | |||
| 188 | - | } | |||
| 189 | - | if err := o.Context().SendRequest(o, 2); err != nil { | |||
| 190 | return err | 181 | return err | ||
| 191 | } | 182 | } | ||
| 192 | return nil | 183 | return nil | ||
| @@ -194,10 +185,7 @@ func (o *TextInputV3) Disable() error { | |||||
| 194 | 185 | ||||
| 195 | // Sets the surrounding plain text around the input, excluding the preedit text. The client should notify the compositor of any changes in any of the values carried with this request, including changes caused by handling incoming text-input events as well as changes caused by other mechanisms like keyboard typing. If the client is unaware of the text around the cursor, it should not issue this request, to signify lack of support to the compositor. Text is UTF-8 encoded, and should include the cursor position, the complete selection and additional characters before and after them. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes. Cursor is the byte offset of the cursor within text buffer. Anchor is the byte offset of the selection anchor within text buffer. If there is no selected text, anchor is the same as cursor. If any preedit text is present, it is replaced with a cursor for the purpose of this event. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text input does not support sending surrounding text. If the empty values get applied, subsequent attempts to change them may have no effect. | 186 | // Sets the surrounding plain text around the input, excluding the preedit text. The client should notify the compositor of any changes in any of the values carried with this request, including changes caused by handling incoming text-input events as well as changes caused by other mechanisms like keyboard typing. If the client is unaware of the text around the cursor, it should not issue this request, to signify lack of support to the compositor. Text is UTF-8 encoded, and should include the cursor position, the complete selection and additional characters before and after them. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes. Cursor is the byte offset of the cursor within text buffer. Anchor is the byte offset of the selection anchor within text buffer. If there is no selected text, anchor is the same as cursor. If any preedit text is present, it is replaced with a cursor for the purpose of this event. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text input does not support sending surrounding text. If the empty values get applied, subsequent attempts to change them may have no effect. | ||
| 196 | func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32) error { | 187 | func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32) error { | ||
| 197 | - | if err := o.Context().CheckProxy(o); err != nil { | 188 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_text_input_v3.set_surrounding_text"}, text, cursor, anchor); err != nil { |
| 198 | - | return err | |||
| 199 | - | } | |||
| 200 | - | if err := o.Context().SendRequest(o, 3, text, cursor, anchor); err != nil { | |||
| 201 | return err | 189 | return err | ||
| 202 | } | 190 | } | ||
| 203 | return nil | 191 | return nil | ||
| @@ -205,10 +193,7 @@ func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32 | |||||
| 205 | 193 | ||||
| 206 | // Tells the compositor why the text surrounding the cursor changed. Whenever the client detects an external change in text, cursor, or anchor posision, it must issue this request to the compositor. This request is intended to give the input method a chance to update the preedit text in an appropriate way, e.g. by removing it when the user starts typing with a keyboard. cause describes the source of the change. The value set with this request is double-buffered. It must be applied and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method. | 194 | // Tells the compositor why the text surrounding the cursor changed. Whenever the client detects an external change in text, cursor, or anchor posision, it must issue this request to the compositor. This request is intended to give the input method a chance to update the preedit text in an appropriate way, e.g. by removing it when the user starts typing with a keyboard. cause describes the source of the change. The value set with this request is double-buffered. It must be applied and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method. | ||
| 207 | func (o *TextInputV3) SetTextChangeCause(cause uint32) error { | 195 | func (o *TextInputV3) SetTextChangeCause(cause uint32) error { | ||
| 208 | - | if err := o.Context().CheckProxy(o); err != nil { | 196 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_text_input_v3.set_text_change_cause"}, cause); err != nil { |
| 209 | - | return err | |||
| 210 | - | } | |||
| 211 | - | if err := o.Context().SendRequest(o, 4, cause); err != nil { | |||
| 212 | return err | 197 | return err | ||
| 213 | } | 198 | } | ||
| 214 | return nil | 199 | return nil | ||
| @@ -216,10 +201,7 @@ func (o *TextInputV3) SetTextChangeCause(cause uint32) error { | |||||
| 216 | 201 | ||||
| 217 | // Sets the content purpose and content hint. While the purpose is the basic purpose of an input field, the hint flags allow to modify some of the behavior. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. The initial value for hint is none, and the initial value for purpose is normal. | 202 | // Sets the content purpose and content hint. While the purpose is the basic purpose of an input field, the hint flags allow to modify some of the behavior. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. The initial value for hint is none, and the initial value for purpose is normal. | ||
| 218 | func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error { | 203 | func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error { | ||
| 219 | - | if err := o.Context().CheckProxy(o); err != nil { | 204 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "zwp_text_input_v3.set_content_type"}, hint, purpose); err != nil { |
| 220 | - | return err | |||
| 221 | - | } | |||
| 222 | - | if err := o.Context().SendRequest(o, 5, hint, purpose); err != nil { | |||
| 223 | return err | 205 | return err | ||
| 224 | } | 206 | } | ||
| 225 | return nil | 207 | return nil | ||
| @@ -227,10 +209,7 @@ func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error { | |||||
| 227 | 209 | ||||
| 228 | // Marks an area around the cursor as a x, y, width, height rectangle in surface local coordinates. Allows the compositor to put a window with word suggestions near the cursor, without obstructing the text being input. If the client is unaware of the position of edited text, it should not issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means the text input does not support describing the cursor area. If the empty values get applied, subsequent attempts to change them may have no effect. As of version 2, the zwp_text_input_v3.commit request does not apply values sent with this request. Instead, it stores them in a separate "committed" area. The committed values, if still valid, get applied on the next wl_surface.commit request on the surface with text-input focus. Both committed and applied values get invalidated on: - the next committed enable or disable request, or - a change of the focused surface of the text-input (leave or enter events). This double stage application allows the compositor to position the input method popup in the same frame as the contents of the text on the surface are updated. | 210 | // Marks an area around the cursor as a x, y, width, height rectangle in surface local coordinates. Allows the compositor to put a window with word suggestions near the cursor, without obstructing the text being input. If the client is unaware of the position of edited text, it should not issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means the text input does not support describing the cursor area. If the empty values get applied, subsequent attempts to change them may have no effect. As of version 2, the zwp_text_input_v3.commit request does not apply values sent with this request. Instead, it stores them in a separate "committed" area. The committed values, if still valid, get applied on the next wl_surface.commit request on the surface with text-input focus. Both committed and applied values get invalidated on: - the next committed enable or disable request, or - a change of the focused surface of the text-input (leave or enter events). This double stage application allows the compositor to position the input method popup in the same frame as the contents of the text on the surface are updated. | ||
| 229 | func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height int32) error { | 211 | func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height int32) error { | ||
| 230 | - | if err := o.Context().CheckProxy(o); err != nil { | 212 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "zwp_text_input_v3.set_cursor_rectangle"}, x, y, width, height); err != nil { |
| 231 | - | return err | |||
| 232 | - | } | |||
| 233 | - | if err := o.Context().SendRequest(o, 6, x, y, width, height); err != nil { | |||
| 234 | return err | 213 | return err | ||
| 235 | } | 214 | } | ||
| 236 | return nil | 215 | return nil | ||
| @@ -238,10 +217,7 @@ func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height i | |||||
| 238 | 217 | ||||
| 239 | // Atomically applies state changes recently sent to the compositor. The commit request establishes and updates the state of the client, and must be issued after any changes to apply them. Text input state (enabled status, content purpose, content hint, surrounding text and change cause, cursor rectangle) is conceptually double-buffered within the context of a text input, i.e. between a committed enable request and the following committed enable or disable request. Protocol requests modify the pending state, as opposed to the current state in use by the input method. A commit request atomically applies all pending state, replacing the current state. After commit, the new pending state is as documented for each related request. Requests are applied in the order of arrival. Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from each zwp_text_input_v3 object and use the count as the serial in done events. | 218 | // Atomically applies state changes recently sent to the compositor. The commit request establishes and updates the state of the client, and must be issued after any changes to apply them. Text input state (enabled status, content purpose, content hint, surrounding text and change cause, cursor rectangle) is conceptually double-buffered within the context of a text input, i.e. between a committed enable request and the following committed enable or disable request. Protocol requests modify the pending state, as opposed to the current state in use by the input method. A commit request atomically applies all pending state, replacing the current state. After commit, the new pending state is as documented for each related request. Requests are applied in the order of arrival. Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from each zwp_text_input_v3 object and use the count as the serial in done events. | ||
| 240 | func (o *TextInputV3) Commit() error { | 219 | func (o *TextInputV3) Commit() error { | ||
| 241 | - | if err := o.Context().CheckProxy(o); err != nil { | 220 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "zwp_text_input_v3.commit"}); err != nil { |
| 242 | - | return err | |||
| 243 | - | } | |||
| 244 | - | if err := o.Context().SendRequest(o, 7); err != nil { | |||
| 245 | return err | 221 | return err | ||
| 246 | } | 222 | } | ||
| 247 | return nil | 223 | return nil | ||
| @@ -249,13 +225,7 @@ func (o *TextInputV3) Commit() error { | |||||
| 249 | 225 | ||||
| 250 | // Set the actions available for this text input. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. If the available_actions array contains the none action, or contains the same action multiple times, the compositor must raise the invalid_action protocol error. Initially, no actions are available. | 226 | // Set the actions available for this text input. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. If the available_actions array contains the none action, or contains the same action multiple times, the compositor must raise the invalid_action protocol error. Initially, no actions are available. | ||
| 251 | func (o *TextInputV3) SetAvailableActions(availableActions []byte) error { | 227 | func (o *TextInputV3) SetAvailableActions(availableActions []byte) error { | ||
| 252 | - | if err := o.Context().CheckProxy(o); err != nil { | 228 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "zwp_text_input_v3.set_available_actions", Since: 2}, availableActions); err != nil { |
| 253 | - | return err | |||
| 254 | - | } | |||
| 255 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.set_available_actions"); err != nil { | |||
| 256 | - | return err | |||
| 257 | - | } | |||
| 258 | - | if err := o.Context().SendRequest(o, 8, availableActions); err != nil { | |||
| 259 | return err | 229 | return err | ||
| 260 | } | 230 | } | ||
| 261 | return nil | 231 | return nil | ||
| @@ -263,13 +233,7 @@ func (o *TextInputV3) SetAvailableActions(availableActions []byte) error { | |||||
| 263 | 233 | ||||
| 264 | // Requests an input panel to be shown (e.g. a on-screen keyboard). This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | 234 | // Requests an input panel to be shown (e.g. a on-screen keyboard). This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | ||
| 265 | func (o *TextInputV3) ShowInputPanel() error { | 235 | func (o *TextInputV3) ShowInputPanel() error { | ||
| 266 | - | if err := o.Context().CheckProxy(o); err != nil { | 236 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "zwp_text_input_v3.show_input_panel", Since: 2}); err != nil { |
| 267 | - | return err | |||
| 268 | - | } | |||
| 269 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.show_input_panel"); err != nil { | |||
| 270 | - | return err | |||
| 271 | - | } | |||
| 272 | - | if err := o.Context().SendRequest(o, 9); err != nil { | |||
| 273 | return err | 237 | return err | ||
| 274 | } | 238 | } | ||
| 275 | return nil | 239 | return nil | ||
| @@ -277,13 +241,7 @@ func (o *TextInputV3) ShowInputPanel() error { | |||||
| 277 | 241 | ||||
| 278 | // Requests an input panel to be hidden. This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | 242 | // Requests an input panel to be hidden. This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored. | ||
| 279 | func (o *TextInputV3) HideInputPanel() error { | 243 | func (o *TextInputV3) HideInputPanel() error { | ||
| 280 | - | if err := o.Context().CheckProxy(o); err != nil { | 244 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "zwp_text_input_v3.hide_input_panel", Since: 2}); err != nil { |
| 281 | - | return err | |||
| 282 | - | } | |||
| 283 | - | if err := wl.CheckVersion(o.Version(), 2, "zwp_text_input_v3.hide_input_panel"); err != nil { | |||
| 284 | - | return err | |||
| 285 | - | } | |||
| 286 | - | if err := o.Context().SendRequest(o, 10); err != nil { | |||
| 287 | return err | 245 | return err | ||
| 288 | } | 246 | } | ||
| 289 | return nil | 247 | return nil | ||
| @@ -607,10 +565,7 @@ func NewTextInputManagerV3(ctx *wl.Context) *TextInputManagerV3 { | |||||
| 607 | 565 | ||||
| 608 | // Destroy the wp_text_input_manager object. | 566 | // Destroy the wp_text_input_manager object. | ||
| 609 | func (o *TextInputManagerV3) Destroy() error { | 567 | func (o *TextInputManagerV3) Destroy() error { | ||
| 610 | - | if err := o.Context().CheckProxy(o); err != nil { | 568 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_manager_v3.destroy", Destructor: true}); err != nil { |
| 611 | - | return err | |||
| 612 | - | } | |||
| 613 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 614 | return err | 569 | return err | ||
| 615 | } | 570 | } | ||
| 616 | return nil | 571 | return nil | ||
| @@ -618,20 +573,13 @@ func (o *TextInputManagerV3) Destroy() error { | |||||
| 618 | 573 | ||||
| 619 | // Creates a new text-input object for a given seat. | 574 | // Creates a new text-input object for a given seat. | ||
| 620 | func (o *TextInputManagerV3) GetTextInput(seat *cross_wl_seat.Seat) (*TextInputV3, error) { | 575 | func (o *TextInputManagerV3) GetTextInput(seat *cross_wl_seat.Seat) (*TextInputV3, error) { | ||
| 621 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 622 | - | return nil, err | |||
| 623 | - | } | |||
| 624 | var arg1 wl.Object | 576 | var arg1 wl.Object | ||
| 625 | if seat != nil { | 577 | if seat != nil { | ||
| 626 | arg1 = seat | 578 | arg1 = seat | ||
| 627 | } | 579 | } | ||
| 628 | child := &TextInputV3{} | 580 | child := &TextInputV3{} | ||
| 629 | child.SetContext(o.Context()) | 581 | child.SetContext(o.Context()) | ||
| 630 | - | child.SetID(o.Context().AllocateID()) | 582 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_manager_v3.get_text_input", Child: child}, child, arg1); err != nil { |
| 631 | - | child.SetVersion(o.Version()) | |||
| 632 | - | o.Context().Register(child) | |||
| 633 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 634 | - | o.Context().Unregister(child) | |||
| 635 | return nil, err | 583 | return nil, err | ||
| 636 | } | 584 | } | ||
| 637 | return child, nil | 585 | return child, nil | ||
M protocol/viewporter/viewporter_generated.go +5 -24
| @@ -42,10 +42,7 @@ func NewWpViewporter(ctx *wl.Context) *WpViewporter { | |||
| 42 | 42 | ||
| 43 | 43 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_viewport objects included. | |
| 44 | 44 | func (o *WpViewporter) Destroy() error { | |
| 45 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 46 | - | return err | |
| 47 | - | } | |
| 48 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 45 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewporter.destroy", Destructor: true}); err != nil { | |
| 49 | 46 | return err | |
| 50 | 47 | } | |
| 51 | 48 | return nil | |
| @@ -53,20 +50,13 @@ func (o *WpViewporter) Destroy() error { | |||
| 53 | 50 | ||
| 54 | 51 | // Instantiate an interface extension for the given wl_surface to crop and scale its content. If the given wl_surface already has a wp_viewport object associated, the viewport_exists protocol error is raised. | |
| 55 | 52 | func (o *WpViewporter) GetViewport(surface *cross_wl_surface.Surface) (*WpViewport, error) { | |
| 56 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 57 | - | return nil, err | |
| 58 | - | } | |
| 59 | 53 | var arg1 wl.Object | |
| 60 | 54 | if surface != nil { | |
| 61 | 55 | arg1 = surface | |
| 62 | 56 | } | |
| 63 | 57 | child := &WpViewport{} | |
| 64 | 58 | child.SetContext(o.Context()) | |
| 65 | - | child.SetID(o.Context().AllocateID()) | |
| 66 | - | child.SetVersion(o.Version()) | |
| 67 | - | o.Context().Register(child) | |
| 68 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |
| 69 | - | o.Context().Unregister(child) | |
| 59 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewporter.get_viewport", Child: child}, child, arg1); err != nil { | |
| 70 | 60 | return nil, err | |
| 71 | 61 | } | |
| 72 | 62 | return child, nil | |
| @@ -105,10 +95,7 @@ func NewWpViewport(ctx *wl.Context) *WpViewport { | |||
| 105 | 95 | ||
| 106 | 96 | // The associated wl_surface's crop and scale state is removed. The change is applied on the next wl_surface.commit. | |
| 107 | 97 | func (o *WpViewport) Destroy() error { | |
| 108 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 109 | - | return err | |
| 110 | - | } | |
| 111 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 98 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewport.destroy", Destructor: true}); err != nil { | |
| 112 | 99 | return err | |
| 113 | 100 | } | |
| 114 | 101 | return nil | |
| @@ -116,10 +103,7 @@ func (o *WpViewport) Destroy() error { | |||
| 116 | 103 | ||
| 117 | 104 | // Set the source rectangle of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If all of x, y, width and height are -1.0, the source rectangle is unset instead. Any other set of values where width or height are zero or negative, or x or y are negative, raise the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | |
| 118 | 105 | func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl.Fixed) error { | |
| 119 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 120 | - | return err | |
| 121 | - | } | |
| 122 | - | if err := o.Context().SendRequest(o, 1, x, y, width, height); err != nil { | |
| 106 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewport.set_source"}, x, y, width, height); err != nil { | |
| 123 | 107 | return err | |
| 124 | 108 | } | |
| 125 | 109 | return nil | |
| @@ -127,10 +111,7 @@ func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl | |||
| 127 | 111 | ||
| 128 | 112 | // Set the destination size of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If width is -1 and height is -1, the destination size is unset instead. Any other pair of values for width and height that contains zero or negative values raises the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | |
| 129 | 113 | func (o *WpViewport) SetDestination(width int32, height int32) error { | |
| 130 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 131 | - | return err | |
| 132 | - | } | |
| 133 | - | if err := o.Context().SendRequest(o, 2, width, height); err != nil { | |
| 114 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_viewport.set_destination"}, width, height); err != nil { | |
| 134 | 115 | return err | |
| 135 | 116 | } | |
| 136 | 117 | return nil | |
| @@ -42,10 +42,7 @@ func NewWpViewporter(ctx *wl.Context) *WpViewporter { | |||||
| 42 | 42 | ||||
| 43 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_viewport objects included. | 43 | // Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_viewport objects included. | ||
| 44 | func (o *WpViewporter) Destroy() error { | 44 | func (o *WpViewporter) Destroy() error { | ||
| 45 | - | if err := o.Context().CheckProxy(o); err != nil { | 45 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewporter.destroy", Destructor: true}); err != nil { |
| 46 | - | return err | |||
| 47 | - | } | |||
| 48 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 49 | return err | 46 | return err | ||
| 50 | } | 47 | } | ||
| 51 | return nil | 48 | return nil | ||
| @@ -53,20 +50,13 @@ func (o *WpViewporter) Destroy() error { | |||||
| 53 | 50 | ||||
| 54 | // Instantiate an interface extension for the given wl_surface to crop and scale its content. If the given wl_surface already has a wp_viewport object associated, the viewport_exists protocol error is raised. | 51 | // Instantiate an interface extension for the given wl_surface to crop and scale its content. If the given wl_surface already has a wp_viewport object associated, the viewport_exists protocol error is raised. | ||
| 55 | func (o *WpViewporter) GetViewport(surface *cross_wl_surface.Surface) (*WpViewport, error) { | 52 | func (o *WpViewporter) GetViewport(surface *cross_wl_surface.Surface) (*WpViewport, error) { | ||
| 56 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 57 | - | return nil, err | |||
| 58 | - | } | |||
| 59 | var arg1 wl.Object | 53 | var arg1 wl.Object | ||
| 60 | if surface != nil { | 54 | if surface != nil { | ||
| 61 | arg1 = surface | 55 | arg1 = surface | ||
| 62 | } | 56 | } | ||
| 63 | child := &WpViewport{} | 57 | child := &WpViewport{} | ||
| 64 | child.SetContext(o.Context()) | 58 | child.SetContext(o.Context()) | ||
| 65 | - | child.SetID(o.Context().AllocateID()) | 59 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewporter.get_viewport", Child: child}, child, arg1); err != nil { |
| 66 | - | child.SetVersion(o.Version()) | |||
| 67 | - | o.Context().Register(child) | |||
| 68 | - | if err := o.Context().SendRequest(o, 1, child, arg1); err != nil { | |||
| 69 | - | o.Context().Unregister(child) | |||
| 70 | return nil, err | 60 | return nil, err | ||
| 71 | } | 61 | } | ||
| 72 | return child, nil | 62 | return child, nil | ||
| @@ -105,10 +95,7 @@ func NewWpViewport(ctx *wl.Context) *WpViewport { | |||||
| 105 | 95 | ||||
| 106 | // The associated wl_surface's crop and scale state is removed. The change is applied on the next wl_surface.commit. | 96 | // The associated wl_surface's crop and scale state is removed. The change is applied on the next wl_surface.commit. | ||
| 107 | func (o *WpViewport) Destroy() error { | 97 | func (o *WpViewport) Destroy() error { | ||
| 108 | - | if err := o.Context().CheckProxy(o); err != nil { | 98 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewport.destroy", Destructor: true}); err != nil { |
| 109 | - | return err | |||
| 110 | - | } | |||
| 111 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 112 | return err | 99 | return err | ||
| 113 | } | 100 | } | ||
| 114 | return nil | 101 | return nil | ||
| @@ -116,10 +103,7 @@ func (o *WpViewport) Destroy() error { | |||||
| 116 | 103 | ||||
| 117 | // Set the source rectangle of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If all of x, y, width and height are -1.0, the source rectangle is unset instead. Any other set of values where width or height are zero or negative, or x or y are negative, raise the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | 104 | // Set the source rectangle of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If all of x, y, width and height are -1.0, the source rectangle is unset instead. Any other set of values where width or height are zero or negative, or x or y are negative, raise the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | ||
| 118 | func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl.Fixed) error { | 105 | func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl.Fixed) error { | ||
| 119 | - | if err := o.Context().CheckProxy(o); err != nil { | 106 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewport.set_source"}, x, y, width, height); err != nil { |
| 120 | - | return err | |||
| 121 | - | } | |||
| 122 | - | if err := o.Context().SendRequest(o, 1, x, y, width, height); err != nil { | |||
| 123 | return err | 107 | return err | ||
| 124 | } | 108 | } | ||
| 125 | return nil | 109 | return nil | ||
| @@ -127,10 +111,7 @@ func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl | |||||
| 127 | 111 | ||||
| 128 | // Set the destination size of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If width is -1 and height is -1, the destination size is unset instead. Any other pair of values for width and height that contains zero or negative values raises the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | 112 | // Set the destination size of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size. If width is -1 and height is -1, the destination size is unset instead. Any other pair of values for width and height that contains zero or negative values raises the bad_value protocol error. The crop and scale state is double-buffered, see wl_surface.commit. | ||
| 129 | func (o *WpViewport) SetDestination(width int32, height int32) error { | 113 | func (o *WpViewport) SetDestination(width int32, height int32) error { | ||
| 130 | - | if err := o.Context().CheckProxy(o); err != nil { | 114 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_viewport.set_destination"}, width, height); err != nil { |
| 131 | - | return err | |||
| 132 | - | } | |||
| 133 | - | if err := o.Context().SendRequest(o, 2, width, height); err != nil { | |||
| 134 | return err | 115 | return err | ||
| 135 | } | 116 | } | ||
| 136 | return nil | 117 | return nil | ||
M protocol/xdgshell/xdg-shell_generated.go +36 -172
| @@ -242,10 +242,7 @@ func NewXdgWmBase(ctx *wl.Context) *XdgWmBase { | |||
| 242 | 242 | ||
| 243 | 243 | // Destroy this xdg_wm_base object. Destroying a bound xdg_wm_base object while there are surfaces still alive created by this xdg_wm_base object instance is illegal and will result in a defunct_surfaces error. | |
| 244 | 244 | func (o *XdgWmBase) Destroy() error { | |
| 245 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 246 | - | return err | |
| 247 | - | } | |
| 248 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 245 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_wm_base.destroy", Destructor: true}); err != nil { | |
| 249 | 246 | return err | |
| 250 | 247 | } | |
| 251 | 248 | return nil | |
| @@ -253,16 +250,9 @@ func (o *XdgWmBase) Destroy() error { | |||
| 253 | 250 | ||
| 254 | 251 | // Create a positioner object. A positioner object is used to position surfaces relative to some parent surface. See the interface description and xdg_surface.get_popup for details. | |
| 255 | 252 | func (o *XdgWmBase) CreatePositioner() (*XdgPositioner, error) { | |
| 256 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 257 | - | return nil, err | |
| 258 | - | } | |
| 259 | 253 | child := &XdgPositioner{} | |
| 260 | 254 | child.SetContext(o.Context()) | |
| 261 | - | child.SetID(o.Context().AllocateID()) | |
| 262 | - | child.SetVersion(o.Version()) | |
| 263 | - | o.Context().Register(child) | |
| 264 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |
| 265 | - | o.Context().Unregister(child) | |
| 255 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_wm_base.create_positioner", Child: child}, child); err != nil { | |
| 266 | 256 | return nil, err | |
| 267 | 257 | } | |
| 268 | 258 | return child, nil | |
| @@ -270,20 +260,13 @@ func (o *XdgWmBase) CreatePositioner() (*XdgPositioner, error) { | |||
| 270 | 260 | ||
| 271 | 261 | // This creates an xdg_surface for the given surface. An xdg_surface is used as basis to define a role to a given surface, such as xdg_toplevel or xdg_popup. It also manages functionality shared between xdg_surface based surface roles. While xdg_surface itself is not a role, the corresponding surface may only be assigned a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is illegal to create an xdg_surface for a wl_surface which already has anassigned role and this will result in a role error. See the documentation of xdg_surface for more details about what an xdg_surface is and how it is used. | |
| 272 | 262 | func (o *XdgWmBase) GetXdgSurface(surface *cross_wl_surface.Surface) (*XdgSurface, error) { | |
| 273 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 274 | - | return nil, err | |
| 275 | - | } | |
| 276 | 263 | var arg1 wl.Object | |
| 277 | 264 | if surface != nil { | |
| 278 | 265 | arg1 = surface | |
| 279 | 266 | } | |
| 280 | 267 | child := &XdgSurface{} | |
| 281 | 268 | child.SetContext(o.Context()) | |
| 282 | - | child.SetID(o.Context().AllocateID()) | |
| 283 | - | child.SetVersion(o.Version()) | |
| 284 | - | o.Context().Register(child) | |
| 285 | - | if err := o.Context().SendRequest(o, 2, child, arg1); err != nil { | |
| 286 | - | o.Context().Unregister(child) | |
| 269 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_wm_base.get_xdg_surface", Child: child}, child, arg1); err != nil { | |
| 287 | 270 | return nil, err | |
| 288 | 271 | } | |
| 289 | 272 | return child, nil | |
| @@ -291,10 +274,7 @@ func (o *XdgWmBase) GetXdgSurface(surface *cross_wl_surface.Surface) (*XdgSurfac | |||
| 291 | 274 | ||
| 292 | 275 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. See xdg_wm_base.ping and xdg_wm_base.error.unresponsive. | |
| 293 | 276 | func (o *XdgWmBase) Pong(serial uint32) error { | |
| 294 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 295 | - | return err | |
| 296 | - | } | |
| 297 | - | if err := o.Context().SendRequest(o, 3, serial); err != nil { | |
| 277 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_wm_base.pong"}, serial); err != nil { | |
| 298 | 278 | return err | |
| 299 | 279 | } | |
| 300 | 280 | return nil | |
| @@ -364,10 +344,7 @@ func NewXdgPositioner(ctx *wl.Context) *XdgPositioner { | |||
| 364 | 344 | ||
| 365 | 345 | // Notify the compositor that the xdg_positioner will no longer be used. | |
| 366 | 346 | func (o *XdgPositioner) Destroy() error { | |
| 367 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 368 | - | return err | |
| 369 | - | } | |
| 370 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 347 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_positioner.destroy", Destructor: true}); err != nil { | |
| 371 | 348 | return err | |
| 372 | 349 | } | |
| 373 | 350 | return nil | |
| @@ -375,10 +352,7 @@ func (o *XdgPositioner) Destroy() error { | |||
| 375 | 352 | ||
| 376 | 353 | // Set the size of the surface that is to be positioned with the positioner object. The size is in surface-local coordinates and corresponds to the window geometry. See xdg_surface.set_window_geometry. If a zero or negative size is set the invalid_input error is raised. | |
| 377 | 354 | func (o *XdgPositioner) SetSize(width int32, height int32) error { | |
| 378 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 379 | - | return err | |
| 380 | - | } | |
| 381 | - | if err := o.Context().SendRequest(o, 1, width, height); err != nil { | |
| 355 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_positioner.set_size"}, width, height); err != nil { | |
| 382 | 356 | return err | |
| 383 | 357 | } | |
| 384 | 358 | return nil | |
| @@ -386,10 +360,7 @@ func (o *XdgPositioner) SetSize(width int32, height int32) error { | |||
| 386 | 360 | ||
| 387 | 361 | // Specify the anchor rectangle within the parent surface that the child surface will be placed relative to. The rectangle is relative to the window geometry as defined by xdg_surface.set_window_geometry of the parent surface. When the xdg_positioner object is used to position a child surface, the anchor rectangle may not extend outside the window geometry of the positioned child's parent surface. If a negative size is set the invalid_input error is raised. | |
| 388 | 362 | func (o *XdgPositioner) SetAnchorRect(x int32, y int32, width int32, height int32) error { | |
| 389 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 390 | - | return err | |
| 391 | - | } | |
| 392 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |
| 363 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_positioner.set_anchor_rect"}, x, y, width, height); err != nil { | |
| 393 | 364 | return err | |
| 394 | 365 | } | |
| 395 | 366 | return nil | |
| @@ -397,10 +368,7 @@ func (o *XdgPositioner) SetAnchorRect(x int32, y int32, width int32, height int3 | |||
| 397 | 368 | ||
| 398 | 369 | // Defines the anchor point for the anchor rectangle. The specified anchor is used to derive an anchor point that the child surface will be positioned relative to. If a corner anchor is set (e.g. 'top_left' or 'bottom_right'), the anchor point will be at the specified corner; otherwise, the derived anchor point will be centered on the specified edge, or in the center of the anchor rectangle if no edge is specified. | |
| 399 | 370 | func (o *XdgPositioner) SetAnchor(anchor uint32) error { | |
| 400 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 401 | - | return err | |
| 402 | - | } | |
| 403 | - | if err := o.Context().SendRequest(o, 3, anchor); err != nil { | |
| 371 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_positioner.set_anchor"}, anchor); err != nil { | |
| 404 | 372 | return err | |
| 405 | 373 | } | |
| 406 | 374 | return nil | |
| @@ -408,10 +376,7 @@ func (o *XdgPositioner) SetAnchor(anchor uint32) error { | |||
| 408 | 376 | ||
| 409 | 377 | // Defines in what direction a surface should be positioned, relative to the anchor point of the parent surface. If a corner gravity is specified (e.g. 'bottom_right' or 'top_left'), then the child surface will be placed towards the specified gravity; otherwise, the child surface will be centered over the anchor point on any axis that had no gravity specified. If the gravity is not in the ‘gravity’ enum, an invalid_input error is raised. | |
| 410 | 378 | func (o *XdgPositioner) SetGravity(gravity uint32) error { | |
| 411 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 412 | - | return err | |
| 413 | - | } | |
| 414 | - | if err := o.Context().SendRequest(o, 4, gravity); err != nil { | |
| 379 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_positioner.set_gravity"}, gravity); err != nil { | |
| 415 | 380 | return err | |
| 416 | 381 | } | |
| 417 | 382 | return nil | |
| @@ -419,10 +384,7 @@ func (o *XdgPositioner) SetGravity(gravity uint32) error { | |||
| 419 | 384 | ||
| 420 | 385 | // Specify how the window should be positioned if the originally intended position caused the surface to be constrained, meaning at least partially outside positioning boundaries set by the compositor. The adjustment is set by constructing a bitmask describing the adjustment to be made when the surface is constrained on that axis. If no bit for one axis is set, the compositor will assume that the child surface should not change its position on that axis when constrained. If more than one bit for one axis is set, the order of how adjustments are applied is specified in the corresponding adjustment descriptions. The default adjustment is none. | |
| 421 | 386 | func (o *XdgPositioner) SetConstraintAdjustment(constraintAdjustment uint32) error { | |
| 422 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 423 | - | return err | |
| 424 | - | } | |
| 425 | - | if err := o.Context().SendRequest(o, 5, constraintAdjustment); err != nil { | |
| 387 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "xdg_positioner.set_constraint_adjustment"}, constraintAdjustment); err != nil { | |
| 426 | 388 | return err | |
| 427 | 389 | } | |
| 428 | 390 | return nil | |
| @@ -430,10 +392,7 @@ func (o *XdgPositioner) SetConstraintAdjustment(constraintAdjustment uint32) err | |||
| 430 | 392 | ||
| 431 | 393 | // Specify the surface position offset relative to the position of the anchor on the anchor rectangle and the anchor on the surface. For example if the anchor of the anchor rectangle is at (x, y), the surface has the gravity bottom|right, and the offset is (ox, oy), the calculated surface position will be (x + ox, y + oy). The offset position of the surface is the one used for constraint testing. See set_constraint_adjustment. An example use case is placing a popup menu on top of a user interface element, while aligning the user interface element of the parent surface with some user interface element placed somewhere in the popup surface. | |
| 432 | 394 | func (o *XdgPositioner) SetOffset(x int32, y int32) error { | |
| 433 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 434 | - | return err | |
| 435 | - | } | |
| 436 | - | if err := o.Context().SendRequest(o, 6, x, y); err != nil { | |
| 395 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "xdg_positioner.set_offset"}, x, y); err != nil { | |
| 437 | 396 | return err | |
| 438 | 397 | } | |
| 439 | 398 | return nil | |
| @@ -441,13 +400,7 @@ func (o *XdgPositioner) SetOffset(x int32, y int32) error { | |||
| 441 | 400 | ||
| 442 | 401 | // When set reactive, the surface is reconstrained if the conditions used for constraining changed, e.g. the parent window moved. If the conditions changed and the popup was reconstrained, an xdg_popup.configure event is sent with updated geometry, followed by an xdg_surface.configure event. | |
| 443 | 402 | func (o *XdgPositioner) SetReactive() error { | |
| 444 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 445 | - | return err | |
| 446 | - | } | |
| 447 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_reactive"); err != nil { | |
| 448 | - | return err | |
| 449 | - | } | |
| 450 | - | if err := o.Context().SendRequest(o, 7); err != nil { | |
| 403 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "xdg_positioner.set_reactive", Since: 3}); err != nil { | |
| 451 | 404 | return err | |
| 452 | 405 | } | |
| 453 | 406 | return nil | |
| @@ -455,13 +408,7 @@ func (o *XdgPositioner) SetReactive() error { | |||
| 455 | 408 | ||
| 456 | 409 | // Set the parent window geometry the compositor should use when positioning the popup. The compositor may use this information to determine the future state the popup should be constrained using. If this doesn't match the dimension of the parent the popup is eventually positioned against, the behavior is undefined. The arguments are given in the surface-local coordinate space. | |
| 457 | 410 | func (o *XdgPositioner) SetParentSize(parentWidth int32, parentHeight int32) error { | |
| 458 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 459 | - | return err | |
| 460 | - | } | |
| 461 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_parent_size"); err != nil { | |
| 462 | - | return err | |
| 463 | - | } | |
| 464 | - | if err := o.Context().SendRequest(o, 8, parentWidth, parentHeight); err != nil { | |
| 411 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "xdg_positioner.set_parent_size", Since: 3}, parentWidth, parentHeight); err != nil { | |
| 465 | 412 | return err | |
| 466 | 413 | } | |
| 467 | 414 | return nil | |
| @@ -469,13 +416,7 @@ func (o *XdgPositioner) SetParentSize(parentWidth int32, parentHeight int32) err | |||
| 469 | 416 | ||
| 470 | 417 | // Set the serial of an xdg_surface.configure event this positioner will be used in response to. The compositor may use this information together with set_parent_size to determine what future state the popup should be constrained using. | |
| 471 | 418 | func (o *XdgPositioner) SetParentConfigure(serial uint32) error { | |
| 472 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 473 | - | return err | |
| 474 | - | } | |
| 475 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_parent_configure"); err != nil { | |
| 476 | - | return err | |
| 477 | - | } | |
| 478 | - | if err := o.Context().SendRequest(o, 9, serial); err != nil { | |
| 419 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "xdg_positioner.set_parent_configure", Since: 3}, serial); err != nil { | |
| 479 | 420 | return err | |
| 480 | 421 | } | |
| 481 | 422 | return nil | |
| @@ -518,10 +459,7 @@ func NewXdgSurface(ctx *wl.Context) *XdgSurface { | |||
| 518 | 459 | ||
| 519 | 460 | // Destroy the xdg_surface object. An xdg_surface must only be destroyed after its role object has been destroyed, otherwise a defunct_role_object error is raised. | |
| 520 | 461 | func (o *XdgSurface) Destroy() error { | |
| 521 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 522 | - | return err | |
| 523 | - | } | |
| 524 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 462 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_surface.destroy", Destructor: true}); err != nil { | |
| 525 | 463 | return err | |
| 526 | 464 | } | |
| 527 | 465 | return nil | |
| @@ -529,16 +467,9 @@ func (o *XdgSurface) Destroy() error { | |||
| 529 | 467 | ||
| 530 | 468 | // This creates an xdg_toplevel object for the given xdg_surface and gives the associated wl_surface the xdg_toplevel role. See the documentation of xdg_toplevel for more details about what an xdg_toplevel is and how it is used. | |
| 531 | 469 | func (o *XdgSurface) GetToplevel() (*XdgToplevel, error) { | |
| 532 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 533 | - | return nil, err | |
| 534 | - | } | |
| 535 | 470 | child := &XdgToplevel{} | |
| 536 | 471 | child.SetContext(o.Context()) | |
| 537 | - | child.SetID(o.Context().AllocateID()) | |
| 538 | - | child.SetVersion(o.Version()) | |
| 539 | - | o.Context().Register(child) | |
| 540 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |
| 541 | - | o.Context().Unregister(child) | |
| 472 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_surface.get_toplevel", Child: child}, child); err != nil { | |
| 542 | 473 | return nil, err | |
| 543 | 474 | } | |
| 544 | 475 | return child, nil | |
| @@ -546,9 +477,6 @@ func (o *XdgSurface) GetToplevel() (*XdgToplevel, error) { | |||
| 546 | 477 | ||
| 547 | 478 | // This creates an xdg_popup object for the given xdg_surface and gives the associated wl_surface the xdg_popup role. If null is passed as a parent, a parent surface must be specified using some other protocol, before committing the initial state. See the documentation of xdg_popup for more details about what an xdg_popup is and how it is used. | |
| 548 | 479 | func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*XdgPopup, error) { | |
| 549 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 550 | - | return nil, err | |
| 551 | - | } | |
| 552 | 480 | var arg1 wl.Object | |
| 553 | 481 | if parent != nil { | |
| 554 | 482 | arg1 = parent | |
| @@ -559,11 +487,7 @@ func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*X | |||
| 559 | 487 | } | |
| 560 | 488 | child := &XdgPopup{} | |
| 561 | 489 | child.SetContext(o.Context()) | |
| 562 | - | child.SetID(o.Context().AllocateID()) | |
| 563 | - | child.SetVersion(o.Version()) | |
| 564 | - | o.Context().Register(child) | |
| 565 | - | if err := o.Context().SendRequest(o, 2, child, arg1, arg2); err != nil { | |
| 566 | - | o.Context().Unregister(child) | |
| 490 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_surface.get_popup", Child: child}, child, arg1, arg2); err != nil { | |
| 567 | 491 | return nil, err | |
| 568 | 492 | } | |
| 569 | 493 | return child, nil | |
| @@ -571,10 +495,7 @@ func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*X | |||
| 571 | 495 | ||
| 572 | 496 | // The window geometry of a surface is its "visible bounds" from the user's perspective. Client-side decorations often have invisible portions like drop-shadows which should be ignored for the purposes of aligning, placing and constraining windows. Note that in some situations, compositors may clip rendering to the window geometry, so the client should avoid putting functional elements outside of it. The window geometry is double-buffered state, see wl_surface.commit. When maintaining a position, the compositor should treat the (x, y) coordinate of the window geometry as the top left corner of the window. A client changing the (x, y) window geometry coordinate should in general not alter the position of the window. Once the window geometry of the surface is set, it is not possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached. If never set, the value is the full bounds of the surface, including any subsurfaces. This updates dynamically on every commit. This unset is meant for extremely simple clients. The arguments are given in the surface-local coordinate space of the wl_surface associated with this xdg_surface, and may extend outside of the wl_surface itself to mark parts of the subsurface tree as part of the window geometry. When applied, the effective window geometry will be the set window geometry clamped to the bounding rectangle of the combined geometry of the surface of the xdg_surface and the associated subsurfaces. The effective geometry will not be recalculated unless a new call to set_window_geometry is done and the new pending surface state is subsequently applied. The width and height of the effective window geometry must be greater than zero. Setting an invalid size will raise an invalid_size error. | |
| 573 | 497 | func (o *XdgSurface) SetWindowGeometry(x int32, y int32, width int32, height int32) error { | |
| 574 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 575 | - | return err | |
| 576 | - | } | |
| 577 | - | if err := o.Context().SendRequest(o, 3, x, y, width, height); err != nil { | |
| 498 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_surface.set_window_geometry"}, x, y, width, height); err != nil { | |
| 578 | 499 | return err | |
| 579 | 500 | } | |
| 580 | 501 | return nil | |
| @@ -582,10 +503,7 @@ func (o *XdgSurface) SetWindowGeometry(x int32, y int32, width int32, height int | |||
| 582 | 503 | ||
| 583 | 504 | // When a configure event is received, if a client commits the surface in response to the configure event, then the client must make an ack_configure request sometime before the commit request, passing along the serial of the configure event. For instance, for toplevel surfaces the compositor might use this information to move a surface to the top left only when the client has drawn itself for the maximized or fullscreen state. If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. Acking a configure event that was never sent raises an invalid_serial error. A client is not required to commit immediately after sending an ack_configure request - it may even ack_configure several times before its next surface commit. A client may send multiple ack_configure requests before committing, but only the last request sent before a commit indicates which configure event the client really is responding to. Sending an ack_configure request consumes the serial number sent with the request, as well as serial numbers sent by all configure events sent on this xdg_surface prior to the configure event referenced by the committed serial. It is an error to issue multiple ack_configure requests referencing a serial from the same configure event, or to issue an ack_configure request referencing a serial from a configure event issued before the event identified by the last ack_configure request for the same xdg_surface. Doing so will raise an invalid_serial error. | |
| 584 | 505 | func (o *XdgSurface) AckConfigure(serial uint32) error { | |
| 585 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 586 | - | return err | |
| 587 | - | } | |
| 588 | - | if err := o.Context().SendRequest(o, 4, serial); err != nil { | |
| 506 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_surface.ack_configure"}, serial); err != nil { | |
| 589 | 507 | return err | |
| 590 | 508 | } | |
| 591 | 509 | return nil | |
| @@ -662,10 +580,7 @@ func NewXdgToplevel(ctx *wl.Context) *XdgToplevel { | |||
| 662 | 580 | ||
| 663 | 581 | // This request destroys the role surface and unmaps the surface; see "Unmapping" behavior in interface section for details. | |
| 664 | 582 | func (o *XdgToplevel) Destroy() error { | |
| 665 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 666 | - | return err | |
| 667 | - | } | |
| 668 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 583 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_toplevel.destroy", Destructor: true}); err != nil { | |
| 669 | 584 | return err | |
| 670 | 585 | } | |
| 671 | 586 | return nil | |
| @@ -673,14 +588,11 @@ func (o *XdgToplevel) Destroy() error { | |||
| 673 | 588 | ||
| 674 | 589 | // Set the "parent" of this surface. This surface should be stacked above the parent surface and all other ancestor surfaces. Parent surfaces should be set on dialogs, toolboxes, or other "auxiliary" surfaces, so that the parent is raised when the dialog is raised. Setting a null parent for a child surface unsets its parent. Setting a null parent for a surface which currently has no parent is a no-op. Only mapped surfaces can have child surfaces. Setting a parent which is not mapped is equivalent to setting a null parent. If a surface becomes unmapped, its children's parent is set to the parent of the now-unmapped surface. If the now-unmapped surface has no parent, its children's parent is unset. If the now-unmapped surface becomes mapped again, its parent-child relationship is not restored. The parent toplevel must not be one of the child toplevel's descendants, and the parent must be different from the child toplevel, otherwise the invalid_parent protocol error is raised. | |
| 675 | 590 | func (o *XdgToplevel) SetParent(parent *XdgToplevel) error { | |
| 676 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 677 | - | return err | |
| 678 | - | } | |
| 679 | 591 | var arg0 wl.Object | |
| 680 | 592 | if parent != nil { | |
| 681 | 593 | arg0 = parent | |
| 682 | 594 | } | |
| 683 | - | if err := o.Context().SendRequest(o, 1, arg0); err != nil { | |
| 595 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_toplevel.set_parent"}, arg0); err != nil { | |
| 684 | 596 | return err | |
| 685 | 597 | } | |
| 686 | 598 | return nil | |
| @@ -688,10 +600,7 @@ func (o *XdgToplevel) SetParent(parent *XdgToplevel) error { | |||
| 688 | 600 | ||
| 689 | 601 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | |
| 690 | 602 | func (o *XdgToplevel) SetTitle(title string) error { | |
| 691 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 692 | - | return err | |
| 693 | - | } | |
| 694 | - | if err := o.Context().SendRequest(o, 2, title); err != nil { | |
| 603 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_toplevel.set_title"}, title); err != nil { | |
| 695 | 604 | return err | |
| 696 | 605 | } | |
| 697 | 606 | return nil | |
| @@ -699,10 +608,7 @@ func (o *XdgToplevel) SetTitle(title string) error { | |||
| 699 | 608 | ||
| 700 | 609 | // Set an application identifier for the surface. The app ID identifies the general class of applications to which the surface belongs. The compositor can use this to group multiple surfaces together, or to determine how to launch a new application. For D-Bus activatable applications, the app ID is used as the D-Bus service name. The compositor shell will try to group application surfaces together by their app ID. As a best practice, it is suggested to select app ID's that match the basename of the application's .desktop file. For example, "org.freedesktop.FooViewer" where the .desktop file is "org.freedesktop.FooViewer.desktop". Like other properties, a set_app_id request can be sent after the xdg_toplevel has been mapped to update the property. See the desktop-entry specification [0] for more details on application identifiers and how they relate to well-known D-Bus names and .desktop files. [0] https://standards.freedesktop.org/desktop-entry-spec/ | |
| 701 | 610 | func (o *XdgToplevel) SetAppId(appId string) error { | |
| 702 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 703 | - | return err | |
| 704 | - | } | |
| 705 | - | if err := o.Context().SendRequest(o, 3, appId); err != nil { | |
| 611 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_toplevel.set_app_id"}, appId); err != nil { | |
| 706 | 612 | return err | |
| 707 | 613 | } | |
| 708 | 614 | return nil | |
| @@ -710,14 +616,11 @@ func (o *XdgToplevel) SetAppId(appId string) error { | |||
| 710 | 616 | ||
| 711 | 617 | // Clients implementing client-side decorations might want to show a context menu when right-clicking on the decorations, giving the user a menu that they can use to maximize or minimize the window. This request asks the compositor to pop up such a window menu at the given position, relative to the local surface coordinates of the parent surface. There are no guarantees as to what menu items the window menu contains, or even if a window menu will be drawn at all. This request must be used in response to some sort of user action like a button press, key press, or touch down event. | |
| 712 | 618 | func (o *XdgToplevel) ShowWindowMenu(seat *cross_wl_seat.Seat, serial uint32, x int32, y int32) error { | |
| 713 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 714 | - | return err | |
| 715 | - | } | |
| 716 | 619 | var arg0 wl.Object | |
| 717 | 620 | if seat != nil { | |
| 718 | 621 | arg0 = seat | |
| 719 | 622 | } | |
| 720 | - | if err := o.Context().SendRequest(o, 4, arg0, serial, x, y); err != nil { | |
| 623 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_toplevel.show_window_menu"}, arg0, serial, x, y); err != nil { | |
| 721 | 624 | return err | |
| 722 | 625 | } | |
| 723 | 626 | return nil | |
| @@ -725,14 +628,11 @@ func (o *XdgToplevel) ShowWindowMenu(seat *cross_wl_seat.Seat, serial uint32, x | |||
| 725 | 628 | ||
| 726 | 629 | // Start an interactive, user-driven move of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive move (touch, pointer, etc). The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized), or if the passed serial is no longer valid. If triggered, the surface will lose the focus of the device (wl_pointer, wl_touch, etc) used for the move. It is up to the compositor to visually indicate that the move is taking place, such as updating a pointer cursor, during the move. There is no guarantee that the device focus will return when the move is completed. | |
| 727 | 630 | func (o *XdgToplevel) Move(seat *cross_wl_seat.Seat, serial uint32) error { | |
| 728 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 729 | - | return err | |
| 730 | - | } | |
| 731 | 631 | var arg0 wl.Object | |
| 732 | 632 | if seat != nil { | |
| 733 | 633 | arg0 = seat | |
| 734 | 634 | } | |
| 735 | - | if err := o.Context().SendRequest(o, 5, arg0, serial); err != nil { | |
| 635 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "xdg_toplevel.move"}, arg0, serial); err != nil { | |
| 736 | 636 | return err | |
| 737 | 637 | } | |
| 738 | 638 | return nil | |
| @@ -740,14 +640,11 @@ func (o *XdgToplevel) Move(seat *cross_wl_seat.Seat, serial uint32) error { | |||
| 740 | 640 | ||
| 741 | 641 | // Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive resize (touch, pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). If triggered, the client will receive configure events with the "resize" state enum value and the expected sizes. See the "resize" enum value for more details about what is required. The client must also acknowledge configure events using "ack_configure". After the resize is completed, the client will receive another "configure" event without the resize state. If triggered, the surface also will lose the focus of the device (wl_pointer, wl_touch, etc) used for the resize. It is up to the compositor to visually indicate that the resize is taking place, such as updating a pointer cursor, during the resize. There is no guarantee that the device focus will return when the resize is completed. The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum. Values not matching a variant of the enum will cause the invalid_resize_edge protocol error. The compositor may use this information to update the surface position for example when dragging the top left corner. The compositor may also use this information to adapt its behavior, e.g. choose an appropriate cursor image. | |
| 742 | 642 | func (o *XdgToplevel) Resize(seat *cross_wl_seat.Seat, serial uint32, edges uint32) error { | |
| 743 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 744 | - | return err | |
| 745 | - | } | |
| 746 | 643 | var arg0 wl.Object | |
| 747 | 644 | if seat != nil { | |
| 748 | 645 | arg0 = seat | |
| 749 | 646 | } | |
| 750 | - | if err := o.Context().SendRequest(o, 6, arg0, serial, edges); err != nil { | |
| 647 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "xdg_toplevel.resize"}, arg0, serial, edges); err != nil { | |
| 751 | 648 | return err | |
| 752 | 649 | } | |
| 753 | 650 | return nil | |
| @@ -755,10 +652,7 @@ func (o *XdgToplevel) Resize(seat *cross_wl_seat.Seat, serial uint32, edges uint | |||
| 755 | 652 | ||
| 756 | 653 | // Set a maximum size for the window. The client can specify a maximum size so that the compositor does not try to configure the window beyond this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the maximum size. The compositor may decide to ignore the values set by the client and request a larger size. If never set, or a value of zero in the request, means that the client has no expected maximum size in the given dimension. As a result, a client wishing to reset the maximum size to an unspecified state can use zero for width and height in the request. Requesting a maximum size to be smaller than the minimum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width or height will result in an invalid_size error. | |
| 757 | 654 | func (o *XdgToplevel) SetMaxSize(width int32, height int32) error { | |
| 758 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 759 | - | return err | |
| 760 | - | } | |
| 761 | - | if err := o.Context().SendRequest(o, 7, width, height); err != nil { | |
| 655 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "xdg_toplevel.set_max_size"}, width, height); err != nil { | |
| 762 | 656 | return err | |
| 763 | 657 | } | |
| 764 | 658 | return nil | |
| @@ -766,10 +660,7 @@ func (o *XdgToplevel) SetMaxSize(width int32, height int32) error { | |||
| 766 | 660 | ||
| 767 | 661 | // Set a minimum size for the window. The client can specify a minimum size so that the compositor does not try to configure the window below this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the minimum size. The compositor may decide to ignore the values set by the client and request a smaller size. If never set, or a value of zero in the request, means that the client has no expected minimum size in the given dimension. As a result, a client wishing to reset the minimum size to an unspecified state can use zero for width and height in the request. Requesting a minimum size to be larger than the maximum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width and height will result in an invalid_size error. | |
| 768 | 662 | func (o *XdgToplevel) SetMinSize(width int32, height int32) error { | |
| 769 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 770 | - | return err | |
| 771 | - | } | |
| 772 | - | if err := o.Context().SendRequest(o, 8, width, height); err != nil { | |
| 663 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "xdg_toplevel.set_min_size"}, width, height); err != nil { | |
| 773 | 664 | return err | |
| 774 | 665 | } | |
| 775 | 666 | return nil | |
| @@ -777,10 +668,7 @@ func (o *XdgToplevel) SetMinSize(width int32, height int32) error { | |||
| 777 | 668 | ||
| 778 | 669 | // Maximize the surface. After requesting that the surface should be maximized, the compositor will respond by emitting a configure event. Whether this configure actually sets the window maximized is subject to compositor policies. The client must then update its content, drawing in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to decide how and where to maximize the surface, for example which output and what region of the screen should be used. If the surface was already maximized, the compositor will still emit a configure event with the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | |
| 779 | 670 | func (o *XdgToplevel) SetMaximized() error { | |
| 780 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 781 | - | return err | |
| 782 | - | } | |
| 783 | - | if err := o.Context().SendRequest(o, 9); err != nil { | |
| 671 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "xdg_toplevel.set_maximized"}); err != nil { | |
| 784 | 672 | return err | |
| 785 | 673 | } | |
| 786 | 674 | return nil | |
| @@ -788,10 +676,7 @@ func (o *XdgToplevel) SetMaximized() error { | |||
| 788 | 676 | ||
| 789 | 677 | // Unmaximize the surface. After requesting that the surface should be unmaximized, the compositor will respond by emitting a configure event. Whether this actually un-maximizes the window is subject to compositor policies. If available and applicable, the compositor will include the window geometry dimensions the window had prior to being maximized in the configure event. The client must then update its content, drawing it in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if applicable. If the surface was already not maximized, the compositor will still emit a configure event without the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | |
| 790 | 678 | func (o *XdgToplevel) UnsetMaximized() error { | |
| 791 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 792 | - | return err | |
| 793 | - | } | |
| 794 | - | if err := o.Context().SendRequest(o, 10); err != nil { | |
| 679 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "xdg_toplevel.unset_maximized"}); err != nil { | |
| 795 | 680 | return err | |
| 796 | 681 | } | |
| 797 | 682 | return nil | |
| @@ -799,14 +684,11 @@ func (o *XdgToplevel) UnsetMaximized() error { | |||
| 799 | 684 | ||
| 800 | 685 | // Make the surface fullscreen. After requesting that the surface should be fullscreened, the compositor will respond by emitting a configure event. Whether the client is actually put into a fullscreen state is subject to compositor policies. The client must also acknowledge the configure when committing the new content (see ack_configure). The output passed by the request indicates the client's preference as to which display it should be set fullscreen on. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface. If the surface doesn't cover the whole output, the compositor will position the surface in the center of the output and compensate with border fill covering the rest of the output. The content of the border fill is undefined, but should be assumed to be in some way that attempts to blend into the surrounding area (e.g. solid black). If the fullscreened surface is not opaque, the compositor must make sure that other screen content not part of the same surface tree (made up of subsurfaces, popups or similarly coupled surfaces) are not visible below the fullscreened surface. | |
| 801 | 686 | func (o *XdgToplevel) SetFullscreen(output *cross_wl_output.Output) error { | |
| 802 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 803 | - | return err | |
| 804 | - | } | |
| 805 | 687 | var arg0 wl.Object | |
| 806 | 688 | if output != nil { | |
| 807 | 689 | arg0 = output | |
| 808 | 690 | } | |
| 809 | - | if err := o.Context().SendRequest(o, 11, arg0); err != nil { | |
| 691 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 11, Name: "xdg_toplevel.set_fullscreen"}, arg0); err != nil { | |
| 810 | 692 | return err | |
| 811 | 693 | } | |
| 812 | 694 | return nil | |
| @@ -814,10 +696,7 @@ func (o *XdgToplevel) SetFullscreen(output *cross_wl_output.Output) error { | |||
| 814 | 696 | ||
| 815 | 697 | // Make the surface no longer fullscreen. After requesting that the surface should be unfullscreened, the compositor will respond by emitting a configure event. Whether this actually removes the fullscreen state of the client is subject to compositor policies. Making a surface unfullscreen sets states for the surface based on the following: * the state(s) it may have had before becoming fullscreen * any state(s) decided by the compositor * any state(s) requested by the client while the surface was fullscreen The compositor may include the previous window geometry dimensions in the configure event, if applicable. The client must also acknowledge the configure when committing the new content (see ack_configure). | |
| 816 | 698 | func (o *XdgToplevel) UnsetFullscreen() error { | |
| 817 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 818 | - | return err | |
| 819 | - | } | |
| 820 | - | if err := o.Context().SendRequest(o, 12); err != nil { | |
| 699 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 12, Name: "xdg_toplevel.unset_fullscreen"}); err != nil { | |
| 821 | 700 | return err | |
| 822 | 701 | } | |
| 823 | 702 | return nil | |
| @@ -825,10 +704,7 @@ func (o *XdgToplevel) UnsetFullscreen() error { | |||
| 825 | 704 | ||
| 826 | 705 | // Request that the compositor minimize your surface. There is no way to know if the surface is currently minimized, nor is there any way to unset minimization on this surface. If you are looking to throttle redrawing when minimized, please instead use the wl_surface.frame event for this, as this will also work with live previews on windows in Alt-Tab, Expose or similar compositor features. | |
| 827 | 706 | func (o *XdgToplevel) SetMinimized() error { | |
| 828 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 829 | - | return err | |
| 830 | - | } | |
| 831 | - | if err := o.Context().SendRequest(o, 13); err != nil { | |
| 707 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 13, Name: "xdg_toplevel.set_minimized"}); err != nil { | |
| 832 | 708 | return err | |
| 833 | 709 | } | |
| 834 | 710 | return nil | |
| @@ -999,10 +875,7 @@ func NewXdgPopup(ctx *wl.Context) *XdgPopup { | |||
| 999 | 875 | ||
| 1000 | 876 | // This destroys the popup. Explicitly destroying the xdg_popup object will also dismiss the popup, and unmap the surface. If this xdg_popup is not the "topmost" popup, the xdg_wm_base.not_the_topmost_popup protocol error will be sent. | |
| 1001 | 877 | func (o *XdgPopup) Destroy() error { | |
| 1002 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1003 | - | return err | |
| 1004 | - | } | |
| 1005 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |
| 878 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_popup.destroy", Destructor: true}); err != nil { | |
| 1006 | 879 | return err | |
| 1007 | 880 | } | |
| 1008 | 881 | return nil | |
| @@ -1010,14 +883,11 @@ func (o *XdgPopup) Destroy() error { | |||
| 1010 | 883 | ||
| 1011 | 884 | // This request makes the created popup take an explicit grab. An explicit grab will be dismissed when the user dismisses the popup, or when the client destroys the xdg_popup. This can be done by the user clicking outside the surface, using the keyboard, or even locking the screen through closing the lid or a timeout. If the compositor denies the grab, the popup will be immediately dismissed. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The serial number of the event should be passed as 'serial'. The parent of a grabbing popup must either be an xdg_toplevel surface or another xdg_popup with an explicit grab. If the parent is another xdg_popup it means that the popups are nested, with this popup now being the topmost popup. Nested popups must be destroyed in the reverse order they were created in, e.g. the only popup you are allowed to destroy at all times is the topmost one. When compositors choose to dismiss a popup, they may dismiss every nested grabbing popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client. If the topmost grabbing popup is destroyed, the grab will be returned to the parent of the popup, if that parent previously had an explicit grab. If the parent is a grabbing popup which has already been dismissed, this popup will be immediately dismissed. If the parent is a popup that did not take an explicit grab, an error will be raised. During a popup grab, the client owning the grab will receive pointer and touch events for all their surfaces as normal (similar to an "owner-events" grab in X11 parlance), while the top most grabbing popup will always have keyboard focus. | |
| 1012 | 885 | func (o *XdgPopup) Grab(seat *cross_wl_seat.Seat, serial uint32) error { | |
| 1013 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1014 | - | return err | |
| 1015 | - | } | |
| 1016 | 886 | var arg0 wl.Object | |
| 1017 | 887 | if seat != nil { | |
| 1018 | 888 | arg0 = seat | |
| 1019 | 889 | } | |
| 1020 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | |
| 890 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_popup.grab"}, arg0, serial); err != nil { | |
| 1021 | 891 | return err | |
| 1022 | 892 | } | |
| 1023 | 893 | return nil | |
| @@ -1025,17 +895,11 @@ func (o *XdgPopup) Grab(seat *cross_wl_seat.Seat, serial uint32) error { | |||
| 1025 | 895 | ||
| 1026 | 896 | // Reposition an already-mapped popup. The popup will be placed given the details in the passed xdg_positioner object, and a xdg_popup.repositioned followed by xdg_popup.configure and xdg_surface.configure will be emitted in response. Any parameters set by the previous positioner will be discarded. The passed token will be sent in the corresponding xdg_popup.repositioned event. The new popup position will not take effect until the corresponding configure event is acknowledged by the client. See xdg_popup.repositioned for details. The token itself is opaque, and has no other special meaning. If multiple reposition requests are sent, the compositor may skip all but the last one. If the popup is repositioned in response to a configure event for its parent, the client should send an xdg_positioner.set_parent_configure and possibly an xdg_positioner.set_parent_size request to allow the compositor to properly constrain the popup. If the popup is repositioned together with a parent that is being resized, but not in response to a configure event, the client should send an xdg_positioner.set_parent_size request. | |
| 1027 | 897 | func (o *XdgPopup) Reposition(positioner *XdgPositioner, token uint32) error { | |
| 1028 | - | if err := o.Context().CheckProxy(o); err != nil { | |
| 1029 | - | return err | |
| 1030 | - | } | |
| 1031 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_popup.reposition"); err != nil { | |
| 1032 | - | return err | |
| 1033 | - | } | |
| 1034 | 898 | var arg0 wl.Object | |
| 1035 | 899 | if positioner != nil { | |
| 1036 | 900 | arg0 = positioner | |
| 1037 | 901 | } | |
| 1038 | - | if err := o.Context().SendRequest(o, 2, arg0, token); err != nil { | |
| 902 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_popup.reposition", Since: 3}, arg0, token); err != nil { | |
| 1039 | 903 | return err | |
| 1040 | 904 | } | |
| 1041 | 905 | return nil | |
| @@ -242,10 +242,7 @@ func NewXdgWmBase(ctx *wl.Context) *XdgWmBase { | |||||
| 242 | 242 | ||||
| 243 | // Destroy this xdg_wm_base object. Destroying a bound xdg_wm_base object while there are surfaces still alive created by this xdg_wm_base object instance is illegal and will result in a defunct_surfaces error. | 243 | // Destroy this xdg_wm_base object. Destroying a bound xdg_wm_base object while there are surfaces still alive created by this xdg_wm_base object instance is illegal and will result in a defunct_surfaces error. | ||
| 244 | func (o *XdgWmBase) Destroy() error { | 244 | func (o *XdgWmBase) Destroy() error { | ||
| 245 | - | if err := o.Context().CheckProxy(o); err != nil { | 245 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_wm_base.destroy", Destructor: true}); err != nil { |
| 246 | - | return err | |||
| 247 | - | } | |||
| 248 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 249 | return err | 246 | return err | ||
| 250 | } | 247 | } | ||
| 251 | return nil | 248 | return nil | ||
| @@ -253,16 +250,9 @@ func (o *XdgWmBase) Destroy() error { | |||||
| 253 | 250 | ||||
| 254 | // Create a positioner object. A positioner object is used to position surfaces relative to some parent surface. See the interface description and xdg_surface.get_popup for details. | 251 | // Create a positioner object. A positioner object is used to position surfaces relative to some parent surface. See the interface description and xdg_surface.get_popup for details. | ||
| 255 | func (o *XdgWmBase) CreatePositioner() (*XdgPositioner, error) { | 252 | func (o *XdgWmBase) CreatePositioner() (*XdgPositioner, error) { | ||
| 256 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 257 | - | return nil, err | |||
| 258 | - | } | |||
| 259 | child := &XdgPositioner{} | 253 | child := &XdgPositioner{} | ||
| 260 | child.SetContext(o.Context()) | 254 | child.SetContext(o.Context()) | ||
| 261 | - | child.SetID(o.Context().AllocateID()) | 255 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_wm_base.create_positioner", Child: child}, child); err != nil { |
| 262 | - | child.SetVersion(o.Version()) | |||
| 263 | - | o.Context().Register(child) | |||
| 264 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |||
| 265 | - | o.Context().Unregister(child) | |||
| 266 | return nil, err | 256 | return nil, err | ||
| 267 | } | 257 | } | ||
| 268 | return child, nil | 258 | return child, nil | ||
| @@ -270,20 +260,13 @@ func (o *XdgWmBase) CreatePositioner() (*XdgPositioner, error) { | |||||
| 270 | 260 | ||||
| 271 | // This creates an xdg_surface for the given surface. An xdg_surface is used as basis to define a role to a given surface, such as xdg_toplevel or xdg_popup. It also manages functionality shared between xdg_surface based surface roles. While xdg_surface itself is not a role, the corresponding surface may only be assigned a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is illegal to create an xdg_surface for a wl_surface which already has anassigned role and this will result in a role error. See the documentation of xdg_surface for more details about what an xdg_surface is and how it is used. | 261 | // This creates an xdg_surface for the given surface. An xdg_surface is used as basis to define a role to a given surface, such as xdg_toplevel or xdg_popup. It also manages functionality shared between xdg_surface based surface roles. While xdg_surface itself is not a role, the corresponding surface may only be assigned a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is illegal to create an xdg_surface for a wl_surface which already has anassigned role and this will result in a role error. See the documentation of xdg_surface for more details about what an xdg_surface is and how it is used. | ||
| 272 | func (o *XdgWmBase) GetXdgSurface(surface *cross_wl_surface.Surface) (*XdgSurface, error) { | 262 | func (o *XdgWmBase) GetXdgSurface(surface *cross_wl_surface.Surface) (*XdgSurface, error) { | ||
| 273 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 274 | - | return nil, err | |||
| 275 | - | } | |||
| 276 | var arg1 wl.Object | 263 | var arg1 wl.Object | ||
| 277 | if surface != nil { | 264 | if surface != nil { | ||
| 278 | arg1 = surface | 265 | arg1 = surface | ||
| 279 | } | 266 | } | ||
| 280 | child := &XdgSurface{} | 267 | child := &XdgSurface{} | ||
| 281 | child.SetContext(o.Context()) | 268 | child.SetContext(o.Context()) | ||
| 282 | - | child.SetID(o.Context().AllocateID()) | 269 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_wm_base.get_xdg_surface", Child: child}, child, arg1); err != nil { |
| 283 | - | child.SetVersion(o.Version()) | |||
| 284 | - | o.Context().Register(child) | |||
| 285 | - | if err := o.Context().SendRequest(o, 2, child, arg1); err != nil { | |||
| 286 | - | o.Context().Unregister(child) | |||
| 287 | return nil, err | 270 | return nil, err | ||
| 288 | } | 271 | } | ||
| 289 | return child, nil | 272 | return child, nil | ||
| @@ -291,10 +274,7 @@ func (o *XdgWmBase) GetXdgSurface(surface *cross_wl_surface.Surface) (*XdgSurfac | |||||
| 291 | 274 | ||||
| 292 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. See xdg_wm_base.ping and xdg_wm_base.error.unresponsive. | 275 | // A client must respond to a ping event with a pong request or the client may be deemed unresponsive. See xdg_wm_base.ping and xdg_wm_base.error.unresponsive. | ||
| 293 | func (o *XdgWmBase) Pong(serial uint32) error { | 276 | func (o *XdgWmBase) Pong(serial uint32) error { | ||
| 294 | - | if err := o.Context().CheckProxy(o); err != nil { | 277 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_wm_base.pong"}, serial); err != nil { |
| 295 | - | return err | |||
| 296 | - | } | |||
| 297 | - | if err := o.Context().SendRequest(o, 3, serial); err != nil { | |||
| 298 | return err | 278 | return err | ||
| 299 | } | 279 | } | ||
| 300 | return nil | 280 | return nil | ||
| @@ -364,10 +344,7 @@ func NewXdgPositioner(ctx *wl.Context) *XdgPositioner { | |||||
| 364 | 344 | ||||
| 365 | // Notify the compositor that the xdg_positioner will no longer be used. | 345 | // Notify the compositor that the xdg_positioner will no longer be used. | ||
| 366 | func (o *XdgPositioner) Destroy() error { | 346 | func (o *XdgPositioner) Destroy() error { | ||
| 367 | - | if err := o.Context().CheckProxy(o); err != nil { | 347 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_positioner.destroy", Destructor: true}); err != nil { |
| 368 | - | return err | |||
| 369 | - | } | |||
| 370 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 371 | return err | 348 | return err | ||
| 372 | } | 349 | } | ||
| 373 | return nil | 350 | return nil | ||
| @@ -375,10 +352,7 @@ func (o *XdgPositioner) Destroy() error { | |||||
| 375 | 352 | ||||
| 376 | // Set the size of the surface that is to be positioned with the positioner object. The size is in surface-local coordinates and corresponds to the window geometry. See xdg_surface.set_window_geometry. If a zero or negative size is set the invalid_input error is raised. | 353 | // Set the size of the surface that is to be positioned with the positioner object. The size is in surface-local coordinates and corresponds to the window geometry. See xdg_surface.set_window_geometry. If a zero or negative size is set the invalid_input error is raised. | ||
| 377 | func (o *XdgPositioner) SetSize(width int32, height int32) error { | 354 | func (o *XdgPositioner) SetSize(width int32, height int32) error { | ||
| 378 | - | if err := o.Context().CheckProxy(o); err != nil { | 355 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_positioner.set_size"}, width, height); err != nil { |
| 379 | - | return err | |||
| 380 | - | } | |||
| 381 | - | if err := o.Context().SendRequest(o, 1, width, height); err != nil { | |||
| 382 | return err | 356 | return err | ||
| 383 | } | 357 | } | ||
| 384 | return nil | 358 | return nil | ||
| @@ -386,10 +360,7 @@ func (o *XdgPositioner) SetSize(width int32, height int32) error { | |||||
| 386 | 360 | ||||
| 387 | // Specify the anchor rectangle within the parent surface that the child surface will be placed relative to. The rectangle is relative to the window geometry as defined by xdg_surface.set_window_geometry of the parent surface. When the xdg_positioner object is used to position a child surface, the anchor rectangle may not extend outside the window geometry of the positioned child's parent surface. If a negative size is set the invalid_input error is raised. | 361 | // Specify the anchor rectangle within the parent surface that the child surface will be placed relative to. The rectangle is relative to the window geometry as defined by xdg_surface.set_window_geometry of the parent surface. When the xdg_positioner object is used to position a child surface, the anchor rectangle may not extend outside the window geometry of the positioned child's parent surface. If a negative size is set the invalid_input error is raised. | ||
| 388 | func (o *XdgPositioner) SetAnchorRect(x int32, y int32, width int32, height int32) error { | 362 | func (o *XdgPositioner) SetAnchorRect(x int32, y int32, width int32, height int32) error { | ||
| 389 | - | if err := o.Context().CheckProxy(o); err != nil { | 363 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_positioner.set_anchor_rect"}, x, y, width, height); err != nil { |
| 390 | - | return err | |||
| 391 | - | } | |||
| 392 | - | if err := o.Context().SendRequest(o, 2, x, y, width, height); err != nil { | |||
| 393 | return err | 364 | return err | ||
| 394 | } | 365 | } | ||
| 395 | return nil | 366 | return nil | ||
| @@ -397,10 +368,7 @@ func (o *XdgPositioner) SetAnchorRect(x int32, y int32, width int32, height int3 | |||||
| 397 | 368 | ||||
| 398 | // Defines the anchor point for the anchor rectangle. The specified anchor is used to derive an anchor point that the child surface will be positioned relative to. If a corner anchor is set (e.g. 'top_left' or 'bottom_right'), the anchor point will be at the specified corner; otherwise, the derived anchor point will be centered on the specified edge, or in the center of the anchor rectangle if no edge is specified. | 369 | // Defines the anchor point for the anchor rectangle. The specified anchor is used to derive an anchor point that the child surface will be positioned relative to. If a corner anchor is set (e.g. 'top_left' or 'bottom_right'), the anchor point will be at the specified corner; otherwise, the derived anchor point will be centered on the specified edge, or in the center of the anchor rectangle if no edge is specified. | ||
| 399 | func (o *XdgPositioner) SetAnchor(anchor uint32) error { | 370 | func (o *XdgPositioner) SetAnchor(anchor uint32) error { | ||
| 400 | - | if err := o.Context().CheckProxy(o); err != nil { | 371 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_positioner.set_anchor"}, anchor); err != nil { |
| 401 | - | return err | |||
| 402 | - | } | |||
| 403 | - | if err := o.Context().SendRequest(o, 3, anchor); err != nil { | |||
| 404 | return err | 372 | return err | ||
| 405 | } | 373 | } | ||
| 406 | return nil | 374 | return nil | ||
| @@ -408,10 +376,7 @@ func (o *XdgPositioner) SetAnchor(anchor uint32) error { | |||||
| 408 | 376 | ||||
| 409 | // Defines in what direction a surface should be positioned, relative to the anchor point of the parent surface. If a corner gravity is specified (e.g. 'bottom_right' or 'top_left'), then the child surface will be placed towards the specified gravity; otherwise, the child surface will be centered over the anchor point on any axis that had no gravity specified. If the gravity is not in the ‘gravity’ enum, an invalid_input error is raised. | 377 | // Defines in what direction a surface should be positioned, relative to the anchor point of the parent surface. If a corner gravity is specified (e.g. 'bottom_right' or 'top_left'), then the child surface will be placed towards the specified gravity; otherwise, the child surface will be centered over the anchor point on any axis that had no gravity specified. If the gravity is not in the ‘gravity’ enum, an invalid_input error is raised. | ||
| 410 | func (o *XdgPositioner) SetGravity(gravity uint32) error { | 378 | func (o *XdgPositioner) SetGravity(gravity uint32) error { | ||
| 411 | - | if err := o.Context().CheckProxy(o); err != nil { | 379 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_positioner.set_gravity"}, gravity); err != nil { |
| 412 | - | return err | |||
| 413 | - | } | |||
| 414 | - | if err := o.Context().SendRequest(o, 4, gravity); err != nil { | |||
| 415 | return err | 380 | return err | ||
| 416 | } | 381 | } | ||
| 417 | return nil | 382 | return nil | ||
| @@ -419,10 +384,7 @@ func (o *XdgPositioner) SetGravity(gravity uint32) error { | |||||
| 419 | 384 | ||||
| 420 | // Specify how the window should be positioned if the originally intended position caused the surface to be constrained, meaning at least partially outside positioning boundaries set by the compositor. The adjustment is set by constructing a bitmask describing the adjustment to be made when the surface is constrained on that axis. If no bit for one axis is set, the compositor will assume that the child surface should not change its position on that axis when constrained. If more than one bit for one axis is set, the order of how adjustments are applied is specified in the corresponding adjustment descriptions. The default adjustment is none. | 385 | // Specify how the window should be positioned if the originally intended position caused the surface to be constrained, meaning at least partially outside positioning boundaries set by the compositor. The adjustment is set by constructing a bitmask describing the adjustment to be made when the surface is constrained on that axis. If no bit for one axis is set, the compositor will assume that the child surface should not change its position on that axis when constrained. If more than one bit for one axis is set, the order of how adjustments are applied is specified in the corresponding adjustment descriptions. The default adjustment is none. | ||
| 421 | func (o *XdgPositioner) SetConstraintAdjustment(constraintAdjustment uint32) error { | 386 | func (o *XdgPositioner) SetConstraintAdjustment(constraintAdjustment uint32) error { | ||
| 422 | - | if err := o.Context().CheckProxy(o); err != nil { | 387 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "xdg_positioner.set_constraint_adjustment"}, constraintAdjustment); err != nil { |
| 423 | - | return err | |||
| 424 | - | } | |||
| 425 | - | if err := o.Context().SendRequest(o, 5, constraintAdjustment); err != nil { | |||
| 426 | return err | 388 | return err | ||
| 427 | } | 389 | } | ||
| 428 | return nil | 390 | return nil | ||
| @@ -430,10 +392,7 @@ func (o *XdgPositioner) SetConstraintAdjustment(constraintAdjustment uint32) err | |||||
| 430 | 392 | ||||
| 431 | // Specify the surface position offset relative to the position of the anchor on the anchor rectangle and the anchor on the surface. For example if the anchor of the anchor rectangle is at (x, y), the surface has the gravity bottom|right, and the offset is (ox, oy), the calculated surface position will be (x + ox, y + oy). The offset position of the surface is the one used for constraint testing. See set_constraint_adjustment. An example use case is placing a popup menu on top of a user interface element, while aligning the user interface element of the parent surface with some user interface element placed somewhere in the popup surface. | 393 | // Specify the surface position offset relative to the position of the anchor on the anchor rectangle and the anchor on the surface. For example if the anchor of the anchor rectangle is at (x, y), the surface has the gravity bottom|right, and the offset is (ox, oy), the calculated surface position will be (x + ox, y + oy). The offset position of the surface is the one used for constraint testing. See set_constraint_adjustment. An example use case is placing a popup menu on top of a user interface element, while aligning the user interface element of the parent surface with some user interface element placed somewhere in the popup surface. | ||
| 432 | func (o *XdgPositioner) SetOffset(x int32, y int32) error { | 394 | func (o *XdgPositioner) SetOffset(x int32, y int32) error { | ||
| 433 | - | if err := o.Context().CheckProxy(o); err != nil { | 395 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "xdg_positioner.set_offset"}, x, y); err != nil { |
| 434 | - | return err | |||
| 435 | - | } | |||
| 436 | - | if err := o.Context().SendRequest(o, 6, x, y); err != nil { | |||
| 437 | return err | 396 | return err | ||
| 438 | } | 397 | } | ||
| 439 | return nil | 398 | return nil | ||
| @@ -441,13 +400,7 @@ func (o *XdgPositioner) SetOffset(x int32, y int32) error { | |||||
| 441 | 400 | ||||
| 442 | // When set reactive, the surface is reconstrained if the conditions used for constraining changed, e.g. the parent window moved. If the conditions changed and the popup was reconstrained, an xdg_popup.configure event is sent with updated geometry, followed by an xdg_surface.configure event. | 401 | // When set reactive, the surface is reconstrained if the conditions used for constraining changed, e.g. the parent window moved. If the conditions changed and the popup was reconstrained, an xdg_popup.configure event is sent with updated geometry, followed by an xdg_surface.configure event. | ||
| 443 | func (o *XdgPositioner) SetReactive() error { | 402 | func (o *XdgPositioner) SetReactive() error { | ||
| 444 | - | if err := o.Context().CheckProxy(o); err != nil { | 403 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "xdg_positioner.set_reactive", Since: 3}); err != nil { |
| 445 | - | return err | |||
| 446 | - | } | |||
| 447 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_reactive"); err != nil { | |||
| 448 | - | return err | |||
| 449 | - | } | |||
| 450 | - | if err := o.Context().SendRequest(o, 7); err != nil { | |||
| 451 | return err | 404 | return err | ||
| 452 | } | 405 | } | ||
| 453 | return nil | 406 | return nil | ||
| @@ -455,13 +408,7 @@ func (o *XdgPositioner) SetReactive() error { | |||||
| 455 | 408 | ||||
| 456 | // Set the parent window geometry the compositor should use when positioning the popup. The compositor may use this information to determine the future state the popup should be constrained using. If this doesn't match the dimension of the parent the popup is eventually positioned against, the behavior is undefined. The arguments are given in the surface-local coordinate space. | 409 | // Set the parent window geometry the compositor should use when positioning the popup. The compositor may use this information to determine the future state the popup should be constrained using. If this doesn't match the dimension of the parent the popup is eventually positioned against, the behavior is undefined. The arguments are given in the surface-local coordinate space. | ||
| 457 | func (o *XdgPositioner) SetParentSize(parentWidth int32, parentHeight int32) error { | 410 | func (o *XdgPositioner) SetParentSize(parentWidth int32, parentHeight int32) error { | ||
| 458 | - | if err := o.Context().CheckProxy(o); err != nil { | 411 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "xdg_positioner.set_parent_size", Since: 3}, parentWidth, parentHeight); err != nil { |
| 459 | - | return err | |||
| 460 | - | } | |||
| 461 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_parent_size"); err != nil { | |||
| 462 | - | return err | |||
| 463 | - | } | |||
| 464 | - | if err := o.Context().SendRequest(o, 8, parentWidth, parentHeight); err != nil { | |||
| 465 | return err | 412 | return err | ||
| 466 | } | 413 | } | ||
| 467 | return nil | 414 | return nil | ||
| @@ -469,13 +416,7 @@ func (o *XdgPositioner) SetParentSize(parentWidth int32, parentHeight int32) err | |||||
| 469 | 416 | ||||
| 470 | // Set the serial of an xdg_surface.configure event this positioner will be used in response to. The compositor may use this information together with set_parent_size to determine what future state the popup should be constrained using. | 417 | // Set the serial of an xdg_surface.configure event this positioner will be used in response to. The compositor may use this information together with set_parent_size to determine what future state the popup should be constrained using. | ||
| 471 | func (o *XdgPositioner) SetParentConfigure(serial uint32) error { | 418 | func (o *XdgPositioner) SetParentConfigure(serial uint32) error { | ||
| 472 | - | if err := o.Context().CheckProxy(o); err != nil { | 419 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "xdg_positioner.set_parent_configure", Since: 3}, serial); err != nil { |
| 473 | - | return err | |||
| 474 | - | } | |||
| 475 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_positioner.set_parent_configure"); err != nil { | |||
| 476 | - | return err | |||
| 477 | - | } | |||
| 478 | - | if err := o.Context().SendRequest(o, 9, serial); err != nil { | |||
| 479 | return err | 420 | return err | ||
| 480 | } | 421 | } | ||
| 481 | return nil | 422 | return nil | ||
| @@ -518,10 +459,7 @@ func NewXdgSurface(ctx *wl.Context) *XdgSurface { | |||||
| 518 | 459 | ||||
| 519 | // Destroy the xdg_surface object. An xdg_surface must only be destroyed after its role object has been destroyed, otherwise a defunct_role_object error is raised. | 460 | // Destroy the xdg_surface object. An xdg_surface must only be destroyed after its role object has been destroyed, otherwise a defunct_role_object error is raised. | ||
| 520 | func (o *XdgSurface) Destroy() error { | 461 | func (o *XdgSurface) Destroy() error { | ||
| 521 | - | if err := o.Context().CheckProxy(o); err != nil { | 462 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_surface.destroy", Destructor: true}); err != nil { |
| 522 | - | return err | |||
| 523 | - | } | |||
| 524 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 525 | return err | 463 | return err | ||
| 526 | } | 464 | } | ||
| 527 | return nil | 465 | return nil | ||
| @@ -529,16 +467,9 @@ func (o *XdgSurface) Destroy() error { | |||||
| 529 | 467 | ||||
| 530 | // This creates an xdg_toplevel object for the given xdg_surface and gives the associated wl_surface the xdg_toplevel role. See the documentation of xdg_toplevel for more details about what an xdg_toplevel is and how it is used. | 468 | // This creates an xdg_toplevel object for the given xdg_surface and gives the associated wl_surface the xdg_toplevel role. See the documentation of xdg_toplevel for more details about what an xdg_toplevel is and how it is used. | ||
| 531 | func (o *XdgSurface) GetToplevel() (*XdgToplevel, error) { | 469 | func (o *XdgSurface) GetToplevel() (*XdgToplevel, error) { | ||
| 532 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 533 | - | return nil, err | |||
| 534 | - | } | |||
| 535 | child := &XdgToplevel{} | 470 | child := &XdgToplevel{} | ||
| 536 | child.SetContext(o.Context()) | 471 | child.SetContext(o.Context()) | ||
| 537 | - | child.SetID(o.Context().AllocateID()) | 472 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_surface.get_toplevel", Child: child}, child); err != nil { |
| 538 | - | child.SetVersion(o.Version()) | |||
| 539 | - | o.Context().Register(child) | |||
| 540 | - | if err := o.Context().SendRequest(o, 1, child); err != nil { | |||
| 541 | - | o.Context().Unregister(child) | |||
| 542 | return nil, err | 473 | return nil, err | ||
| 543 | } | 474 | } | ||
| 544 | return child, nil | 475 | return child, nil | ||
| @@ -546,9 +477,6 @@ func (o *XdgSurface) GetToplevel() (*XdgToplevel, error) { | |||||
| 546 | 477 | ||||
| 547 | // This creates an xdg_popup object for the given xdg_surface and gives the associated wl_surface the xdg_popup role. If null is passed as a parent, a parent surface must be specified using some other protocol, before committing the initial state. See the documentation of xdg_popup for more details about what an xdg_popup is and how it is used. | 478 | // This creates an xdg_popup object for the given xdg_surface and gives the associated wl_surface the xdg_popup role. If null is passed as a parent, a parent surface must be specified using some other protocol, before committing the initial state. See the documentation of xdg_popup for more details about what an xdg_popup is and how it is used. | ||
| 548 | func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*XdgPopup, error) { | 479 | func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*XdgPopup, error) { | ||
| 549 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 550 | - | return nil, err | |||
| 551 | - | } | |||
| 552 | var arg1 wl.Object | 480 | var arg1 wl.Object | ||
| 553 | if parent != nil { | 481 | if parent != nil { | ||
| 554 | arg1 = parent | 482 | arg1 = parent | ||
| @@ -559,11 +487,7 @@ func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*X | |||||
| 559 | } | 487 | } | ||
| 560 | child := &XdgPopup{} | 488 | child := &XdgPopup{} | ||
| 561 | child.SetContext(o.Context()) | 489 | child.SetContext(o.Context()) | ||
| 562 | - | child.SetID(o.Context().AllocateID()) | 490 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_surface.get_popup", Child: child}, child, arg1, arg2); err != nil { |
| 563 | - | child.SetVersion(o.Version()) | |||
| 564 | - | o.Context().Register(child) | |||
| 565 | - | if err := o.Context().SendRequest(o, 2, child, arg1, arg2); err != nil { | |||
| 566 | - | o.Context().Unregister(child) | |||
| 567 | return nil, err | 491 | return nil, err | ||
| 568 | } | 492 | } | ||
| 569 | return child, nil | 493 | return child, nil | ||
| @@ -571,10 +495,7 @@ func (o *XdgSurface) GetPopup(parent *XdgSurface, positioner *XdgPositioner) (*X | |||||
| 571 | 495 | ||||
| 572 | // The window geometry of a surface is its "visible bounds" from the user's perspective. Client-side decorations often have invisible portions like drop-shadows which should be ignored for the purposes of aligning, placing and constraining windows. Note that in some situations, compositors may clip rendering to the window geometry, so the client should avoid putting functional elements outside of it. The window geometry is double-buffered state, see wl_surface.commit. When maintaining a position, the compositor should treat the (x, y) coordinate of the window geometry as the top left corner of the window. A client changing the (x, y) window geometry coordinate should in general not alter the position of the window. Once the window geometry of the surface is set, it is not possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached. If never set, the value is the full bounds of the surface, including any subsurfaces. This updates dynamically on every commit. This unset is meant for extremely simple clients. The arguments are given in the surface-local coordinate space of the wl_surface associated with this xdg_surface, and may extend outside of the wl_surface itself to mark parts of the subsurface tree as part of the window geometry. When applied, the effective window geometry will be the set window geometry clamped to the bounding rectangle of the combined geometry of the surface of the xdg_surface and the associated subsurfaces. The effective geometry will not be recalculated unless a new call to set_window_geometry is done and the new pending surface state is subsequently applied. The width and height of the effective window geometry must be greater than zero. Setting an invalid size will raise an invalid_size error. | 496 | // The window geometry of a surface is its "visible bounds" from the user's perspective. Client-side decorations often have invisible portions like drop-shadows which should be ignored for the purposes of aligning, placing and constraining windows. Note that in some situations, compositors may clip rendering to the window geometry, so the client should avoid putting functional elements outside of it. The window geometry is double-buffered state, see wl_surface.commit. When maintaining a position, the compositor should treat the (x, y) coordinate of the window geometry as the top left corner of the window. A client changing the (x, y) window geometry coordinate should in general not alter the position of the window. Once the window geometry of the surface is set, it is not possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached. If never set, the value is the full bounds of the surface, including any subsurfaces. This updates dynamically on every commit. This unset is meant for extremely simple clients. The arguments are given in the surface-local coordinate space of the wl_surface associated with this xdg_surface, and may extend outside of the wl_surface itself to mark parts of the subsurface tree as part of the window geometry. When applied, the effective window geometry will be the set window geometry clamped to the bounding rectangle of the combined geometry of the surface of the xdg_surface and the associated subsurfaces. The effective geometry will not be recalculated unless a new call to set_window_geometry is done and the new pending surface state is subsequently applied. The width and height of the effective window geometry must be greater than zero. Setting an invalid size will raise an invalid_size error. | ||
| 573 | func (o *XdgSurface) SetWindowGeometry(x int32, y int32, width int32, height int32) error { | 497 | func (o *XdgSurface) SetWindowGeometry(x int32, y int32, width int32, height int32) error { | ||
| 574 | - | if err := o.Context().CheckProxy(o); err != nil { | 498 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_surface.set_window_geometry"}, x, y, width, height); err != nil { |
| 575 | - | return err | |||
| 576 | - | } | |||
| 577 | - | if err := o.Context().SendRequest(o, 3, x, y, width, height); err != nil { | |||
| 578 | return err | 499 | return err | ||
| 579 | } | 500 | } | ||
| 580 | return nil | 501 | return nil | ||
| @@ -582,10 +503,7 @@ func (o *XdgSurface) SetWindowGeometry(x int32, y int32, width int32, height int | |||||
| 582 | 503 | ||||
| 583 | // When a configure event is received, if a client commits the surface in response to the configure event, then the client must make an ack_configure request sometime before the commit request, passing along the serial of the configure event. For instance, for toplevel surfaces the compositor might use this information to move a surface to the top left only when the client has drawn itself for the maximized or fullscreen state. If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. Acking a configure event that was never sent raises an invalid_serial error. A client is not required to commit immediately after sending an ack_configure request - it may even ack_configure several times before its next surface commit. A client may send multiple ack_configure requests before committing, but only the last request sent before a commit indicates which configure event the client really is responding to. Sending an ack_configure request consumes the serial number sent with the request, as well as serial numbers sent by all configure events sent on this xdg_surface prior to the configure event referenced by the committed serial. It is an error to issue multiple ack_configure requests referencing a serial from the same configure event, or to issue an ack_configure request referencing a serial from a configure event issued before the event identified by the last ack_configure request for the same xdg_surface. Doing so will raise an invalid_serial error. | 504 | // When a configure event is received, if a client commits the surface in response to the configure event, then the client must make an ack_configure request sometime before the commit request, passing along the serial of the configure event. For instance, for toplevel surfaces the compositor might use this information to move a surface to the top left only when the client has drawn itself for the maximized or fullscreen state. If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. Acking a configure event that was never sent raises an invalid_serial error. A client is not required to commit immediately after sending an ack_configure request - it may even ack_configure several times before its next surface commit. A client may send multiple ack_configure requests before committing, but only the last request sent before a commit indicates which configure event the client really is responding to. Sending an ack_configure request consumes the serial number sent with the request, as well as serial numbers sent by all configure events sent on this xdg_surface prior to the configure event referenced by the committed serial. It is an error to issue multiple ack_configure requests referencing a serial from the same configure event, or to issue an ack_configure request referencing a serial from a configure event issued before the event identified by the last ack_configure request for the same xdg_surface. Doing so will raise an invalid_serial error. | ||
| 584 | func (o *XdgSurface) AckConfigure(serial uint32) error { | 505 | func (o *XdgSurface) AckConfigure(serial uint32) error { | ||
| 585 | - | if err := o.Context().CheckProxy(o); err != nil { | 506 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_surface.ack_configure"}, serial); err != nil { |
| 586 | - | return err | |||
| 587 | - | } | |||
| 588 | - | if err := o.Context().SendRequest(o, 4, serial); err != nil { | |||
| 589 | return err | 507 | return err | ||
| 590 | } | 508 | } | ||
| 591 | return nil | 509 | return nil | ||
| @@ -662,10 +580,7 @@ func NewXdgToplevel(ctx *wl.Context) *XdgToplevel { | |||||
| 662 | 580 | ||||
| 663 | // This request destroys the role surface and unmaps the surface; see "Unmapping" behavior in interface section for details. | 581 | // This request destroys the role surface and unmaps the surface; see "Unmapping" behavior in interface section for details. | ||
| 664 | func (o *XdgToplevel) Destroy() error { | 582 | func (o *XdgToplevel) Destroy() error { | ||
| 665 | - | if err := o.Context().CheckProxy(o); err != nil { | 583 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_toplevel.destroy", Destructor: true}); err != nil { |
| 666 | - | return err | |||
| 667 | - | } | |||
| 668 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 669 | return err | 584 | return err | ||
| 670 | } | 585 | } | ||
| 671 | return nil | 586 | return nil | ||
| @@ -673,14 +588,11 @@ func (o *XdgToplevel) Destroy() error { | |||||
| 673 | 588 | ||||
| 674 | // Set the "parent" of this surface. This surface should be stacked above the parent surface and all other ancestor surfaces. Parent surfaces should be set on dialogs, toolboxes, or other "auxiliary" surfaces, so that the parent is raised when the dialog is raised. Setting a null parent for a child surface unsets its parent. Setting a null parent for a surface which currently has no parent is a no-op. Only mapped surfaces can have child surfaces. Setting a parent which is not mapped is equivalent to setting a null parent. If a surface becomes unmapped, its children's parent is set to the parent of the now-unmapped surface. If the now-unmapped surface has no parent, its children's parent is unset. If the now-unmapped surface becomes mapped again, its parent-child relationship is not restored. The parent toplevel must not be one of the child toplevel's descendants, and the parent must be different from the child toplevel, otherwise the invalid_parent protocol error is raised. | 589 | // Set the "parent" of this surface. This surface should be stacked above the parent surface and all other ancestor surfaces. Parent surfaces should be set on dialogs, toolboxes, or other "auxiliary" surfaces, so that the parent is raised when the dialog is raised. Setting a null parent for a child surface unsets its parent. Setting a null parent for a surface which currently has no parent is a no-op. Only mapped surfaces can have child surfaces. Setting a parent which is not mapped is equivalent to setting a null parent. If a surface becomes unmapped, its children's parent is set to the parent of the now-unmapped surface. If the now-unmapped surface has no parent, its children's parent is unset. If the now-unmapped surface becomes mapped again, its parent-child relationship is not restored. The parent toplevel must not be one of the child toplevel's descendants, and the parent must be different from the child toplevel, otherwise the invalid_parent protocol error is raised. | ||
| 675 | func (o *XdgToplevel) SetParent(parent *XdgToplevel) error { | 590 | func (o *XdgToplevel) SetParent(parent *XdgToplevel) error { | ||
| 676 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 677 | - | return err | |||
| 678 | - | } | |||
| 679 | var arg0 wl.Object | 591 | var arg0 wl.Object | ||
| 680 | if parent != nil { | 592 | if parent != nil { | ||
| 681 | arg0 = parent | 593 | arg0 = parent | ||
| 682 | } | 594 | } | ||
| 683 | - | if err := o.Context().SendRequest(o, 1, arg0); err != nil { | 595 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_toplevel.set_parent"}, arg0); err != nil { |
| 684 | return err | 596 | return err | ||
| 685 | } | 597 | } | ||
| 686 | return nil | 598 | return nil | ||
| @@ -688,10 +600,7 @@ func (o *XdgToplevel) SetParent(parent *XdgToplevel) error { | |||||
| 688 | 600 | ||||
| 689 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | 601 | // Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8. | ||
| 690 | func (o *XdgToplevel) SetTitle(title string) error { | 602 | func (o *XdgToplevel) SetTitle(title string) error { | ||
| 691 | - | if err := o.Context().CheckProxy(o); err != nil { | 603 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_toplevel.set_title"}, title); err != nil { |
| 692 | - | return err | |||
| 693 | - | } | |||
| 694 | - | if err := o.Context().SendRequest(o, 2, title); err != nil { | |||
| 695 | return err | 604 | return err | ||
| 696 | } | 605 | } | ||
| 697 | return nil | 606 | return nil | ||
| @@ -699,10 +608,7 @@ func (o *XdgToplevel) SetTitle(title string) error { | |||||
| 699 | 608 | ||||
| 700 | // Set an application identifier for the surface. The app ID identifies the general class of applications to which the surface belongs. The compositor can use this to group multiple surfaces together, or to determine how to launch a new application. For D-Bus activatable applications, the app ID is used as the D-Bus service name. The compositor shell will try to group application surfaces together by their app ID. As a best practice, it is suggested to select app ID's that match the basename of the application's .desktop file. For example, "org.freedesktop.FooViewer" where the .desktop file is "org.freedesktop.FooViewer.desktop". Like other properties, a set_app_id request can be sent after the xdg_toplevel has been mapped to update the property. See the desktop-entry specification [0] for more details on application identifiers and how they relate to well-known D-Bus names and .desktop files. [0] https://standards.freedesktop.org/desktop-entry-spec/ | 609 | // Set an application identifier for the surface. The app ID identifies the general class of applications to which the surface belongs. The compositor can use this to group multiple surfaces together, or to determine how to launch a new application. For D-Bus activatable applications, the app ID is used as the D-Bus service name. The compositor shell will try to group application surfaces together by their app ID. As a best practice, it is suggested to select app ID's that match the basename of the application's .desktop file. For example, "org.freedesktop.FooViewer" where the .desktop file is "org.freedesktop.FooViewer.desktop". Like other properties, a set_app_id request can be sent after the xdg_toplevel has been mapped to update the property. See the desktop-entry specification [0] for more details on application identifiers and how they relate to well-known D-Bus names and .desktop files. [0] https://standards.freedesktop.org/desktop-entry-spec/ | ||
| 701 | func (o *XdgToplevel) SetAppId(appId string) error { | 610 | func (o *XdgToplevel) SetAppId(appId string) error { | ||
| 702 | - | if err := o.Context().CheckProxy(o); err != nil { | 611 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "xdg_toplevel.set_app_id"}, appId); err != nil { |
| 703 | - | return err | |||
| 704 | - | } | |||
| 705 | - | if err := o.Context().SendRequest(o, 3, appId); err != nil { | |||
| 706 | return err | 612 | return err | ||
| 707 | } | 613 | } | ||
| 708 | return nil | 614 | return nil | ||
| @@ -710,14 +616,11 @@ func (o *XdgToplevel) SetAppId(appId string) error { | |||||
| 710 | 616 | ||||
| 711 | // Clients implementing client-side decorations might want to show a context menu when right-clicking on the decorations, giving the user a menu that they can use to maximize or minimize the window. This request asks the compositor to pop up such a window menu at the given position, relative to the local surface coordinates of the parent surface. There are no guarantees as to what menu items the window menu contains, or even if a window menu will be drawn at all. This request must be used in response to some sort of user action like a button press, key press, or touch down event. | 617 | // Clients implementing client-side decorations might want to show a context menu when right-clicking on the decorations, giving the user a menu that they can use to maximize or minimize the window. This request asks the compositor to pop up such a window menu at the given position, relative to the local surface coordinates of the parent surface. There are no guarantees as to what menu items the window menu contains, or even if a window menu will be drawn at all. This request must be used in response to some sort of user action like a button press, key press, or touch down event. | ||
| 712 | func (o *XdgToplevel) ShowWindowMenu(seat *cross_wl_seat.Seat, serial uint32, x int32, y int32) error { | 618 | func (o *XdgToplevel) ShowWindowMenu(seat *cross_wl_seat.Seat, serial uint32, x int32, y int32) error { | ||
| 713 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 714 | - | return err | |||
| 715 | - | } | |||
| 716 | var arg0 wl.Object | 619 | var arg0 wl.Object | ||
| 717 | if seat != nil { | 620 | if seat != nil { | ||
| 718 | arg0 = seat | 621 | arg0 = seat | ||
| 719 | } | 622 | } | ||
| 720 | - | if err := o.Context().SendRequest(o, 4, arg0, serial, x, y); err != nil { | 623 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "xdg_toplevel.show_window_menu"}, arg0, serial, x, y); err != nil { |
| 721 | return err | 624 | return err | ||
| 722 | } | 625 | } | ||
| 723 | return nil | 626 | return nil | ||
| @@ -725,14 +628,11 @@ func (o *XdgToplevel) ShowWindowMenu(seat *cross_wl_seat.Seat, serial uint32, x | |||||
| 725 | 628 | ||||
| 726 | // Start an interactive, user-driven move of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive move (touch, pointer, etc). The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized), or if the passed serial is no longer valid. If triggered, the surface will lose the focus of the device (wl_pointer, wl_touch, etc) used for the move. It is up to the compositor to visually indicate that the move is taking place, such as updating a pointer cursor, during the move. There is no guarantee that the device focus will return when the move is completed. | 629 | // Start an interactive, user-driven move of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive move (touch, pointer, etc). The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized), or if the passed serial is no longer valid. If triggered, the surface will lose the focus of the device (wl_pointer, wl_touch, etc) used for the move. It is up to the compositor to visually indicate that the move is taking place, such as updating a pointer cursor, during the move. There is no guarantee that the device focus will return when the move is completed. | ||
| 727 | func (o *XdgToplevel) Move(seat *cross_wl_seat.Seat, serial uint32) error { | 630 | func (o *XdgToplevel) Move(seat *cross_wl_seat.Seat, serial uint32) error { | ||
| 728 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 729 | - | return err | |||
| 730 | - | } | |||
| 731 | var arg0 wl.Object | 631 | var arg0 wl.Object | ||
| 732 | if seat != nil { | 632 | if seat != nil { | ||
| 733 | arg0 = seat | 633 | arg0 = seat | ||
| 734 | } | 634 | } | ||
| 735 | - | if err := o.Context().SendRequest(o, 5, arg0, serial); err != nil { | 635 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "xdg_toplevel.move"}, arg0, serial); err != nil { |
| 736 | return err | 636 | return err | ||
| 737 | } | 637 | } | ||
| 738 | return nil | 638 | return nil | ||
| @@ -740,14 +640,11 @@ func (o *XdgToplevel) Move(seat *cross_wl_seat.Seat, serial uint32) error { | |||||
| 740 | 640 | ||||
| 741 | // Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive resize (touch, pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). If triggered, the client will receive configure events with the "resize" state enum value and the expected sizes. See the "resize" enum value for more details about what is required. The client must also acknowledge configure events using "ack_configure". After the resize is completed, the client will receive another "configure" event without the resize state. If triggered, the surface also will lose the focus of the device (wl_pointer, wl_touch, etc) used for the resize. It is up to the compositor to visually indicate that the resize is taking place, such as updating a pointer cursor, during the resize. There is no guarantee that the device focus will return when the resize is completed. The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum. Values not matching a variant of the enum will cause the invalid_resize_edge protocol error. The compositor may use this information to update the surface position for example when dragging the top left corner. The compositor may also use this information to adapt its behavior, e.g. choose an appropriate cursor image. | 641 | // Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive resize (touch, pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). If triggered, the client will receive configure events with the "resize" state enum value and the expected sizes. See the "resize" enum value for more details about what is required. The client must also acknowledge configure events using "ack_configure". After the resize is completed, the client will receive another "configure" event without the resize state. If triggered, the surface also will lose the focus of the device (wl_pointer, wl_touch, etc) used for the resize. It is up to the compositor to visually indicate that the resize is taking place, such as updating a pointer cursor, during the resize. There is no guarantee that the device focus will return when the resize is completed. The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum. Values not matching a variant of the enum will cause the invalid_resize_edge protocol error. The compositor may use this information to update the surface position for example when dragging the top left corner. The compositor may also use this information to adapt its behavior, e.g. choose an appropriate cursor image. | ||
| 742 | func (o *XdgToplevel) Resize(seat *cross_wl_seat.Seat, serial uint32, edges uint32) error { | 642 | func (o *XdgToplevel) Resize(seat *cross_wl_seat.Seat, serial uint32, edges uint32) error { | ||
| 743 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 744 | - | return err | |||
| 745 | - | } | |||
| 746 | var arg0 wl.Object | 643 | var arg0 wl.Object | ||
| 747 | if seat != nil { | 644 | if seat != nil { | ||
| 748 | arg0 = seat | 645 | arg0 = seat | ||
| 749 | } | 646 | } | ||
| 750 | - | if err := o.Context().SendRequest(o, 6, arg0, serial, edges); err != nil { | 647 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "xdg_toplevel.resize"}, arg0, serial, edges); err != nil { |
| 751 | return err | 648 | return err | ||
| 752 | } | 649 | } | ||
| 753 | return nil | 650 | return nil | ||
| @@ -755,10 +652,7 @@ func (o *XdgToplevel) Resize(seat *cross_wl_seat.Seat, serial uint32, edges uint | |||||
| 755 | 652 | ||||
| 756 | // Set a maximum size for the window. The client can specify a maximum size so that the compositor does not try to configure the window beyond this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the maximum size. The compositor may decide to ignore the values set by the client and request a larger size. If never set, or a value of zero in the request, means that the client has no expected maximum size in the given dimension. As a result, a client wishing to reset the maximum size to an unspecified state can use zero for width and height in the request. Requesting a maximum size to be smaller than the minimum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width or height will result in an invalid_size error. | 653 | // Set a maximum size for the window. The client can specify a maximum size so that the compositor does not try to configure the window beyond this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the maximum size. The compositor may decide to ignore the values set by the client and request a larger size. If never set, or a value of zero in the request, means that the client has no expected maximum size in the given dimension. As a result, a client wishing to reset the maximum size to an unspecified state can use zero for width and height in the request. Requesting a maximum size to be smaller than the minimum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width or height will result in an invalid_size error. | ||
| 757 | func (o *XdgToplevel) SetMaxSize(width int32, height int32) error { | 654 | func (o *XdgToplevel) SetMaxSize(width int32, height int32) error { | ||
| 758 | - | if err := o.Context().CheckProxy(o); err != nil { | 655 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "xdg_toplevel.set_max_size"}, width, height); err != nil { |
| 759 | - | return err | |||
| 760 | - | } | |||
| 761 | - | if err := o.Context().SendRequest(o, 7, width, height); err != nil { | |||
| 762 | return err | 656 | return err | ||
| 763 | } | 657 | } | ||
| 764 | return nil | 658 | return nil | ||
| @@ -766,10 +660,7 @@ func (o *XdgToplevel) SetMaxSize(width int32, height int32) error { | |||||
| 766 | 660 | ||||
| 767 | // Set a minimum size for the window. The client can specify a minimum size so that the compositor does not try to configure the window below this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the minimum size. The compositor may decide to ignore the values set by the client and request a smaller size. If never set, or a value of zero in the request, means that the client has no expected minimum size in the given dimension. As a result, a client wishing to reset the minimum size to an unspecified state can use zero for width and height in the request. Requesting a minimum size to be larger than the maximum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width and height will result in an invalid_size error. | 661 | // Set a minimum size for the window. The client can specify a minimum size so that the compositor does not try to configure the window below this size. The width and height arguments are in window geometry coordinates. See xdg_surface.set_window_geometry. Values set in this way are double-buffered, see wl_surface.commit. The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations. Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way. The client should not rely on the compositor to obey the minimum size. The compositor may decide to ignore the values set by the client and request a smaller size. If never set, or a value of zero in the request, means that the client has no expected minimum size in the given dimension. As a result, a client wishing to reset the minimum size to an unspecified state can use zero for width and height in the request. Requesting a minimum size to be larger than the maximum size of a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width and height will result in an invalid_size error. | ||
| 768 | func (o *XdgToplevel) SetMinSize(width int32, height int32) error { | 662 | func (o *XdgToplevel) SetMinSize(width int32, height int32) error { | ||
| 769 | - | if err := o.Context().CheckProxy(o); err != nil { | 663 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "xdg_toplevel.set_min_size"}, width, height); err != nil { |
| 770 | - | return err | |||
| 771 | - | } | |||
| 772 | - | if err := o.Context().SendRequest(o, 8, width, height); err != nil { | |||
| 773 | return err | 664 | return err | ||
| 774 | } | 665 | } | ||
| 775 | return nil | 666 | return nil | ||
| @@ -777,10 +668,7 @@ func (o *XdgToplevel) SetMinSize(width int32, height int32) error { | |||||
| 777 | 668 | ||||
| 778 | // Maximize the surface. After requesting that the surface should be maximized, the compositor will respond by emitting a configure event. Whether this configure actually sets the window maximized is subject to compositor policies. The client must then update its content, drawing in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to decide how and where to maximize the surface, for example which output and what region of the screen should be used. If the surface was already maximized, the compositor will still emit a configure event with the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | 669 | // Maximize the surface. After requesting that the surface should be maximized, the compositor will respond by emitting a configure event. Whether this configure actually sets the window maximized is subject to compositor policies. The client must then update its content, drawing in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to decide how and where to maximize the surface, for example which output and what region of the screen should be used. If the surface was already maximized, the compositor will still emit a configure event with the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | ||
| 779 | func (o *XdgToplevel) SetMaximized() error { | 670 | func (o *XdgToplevel) SetMaximized() error { | ||
| 780 | - | if err := o.Context().CheckProxy(o); err != nil { | 671 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "xdg_toplevel.set_maximized"}); err != nil { |
| 781 | - | return err | |||
| 782 | - | } | |||
| 783 | - | if err := o.Context().SendRequest(o, 9); err != nil { | |||
| 784 | return err | 672 | return err | ||
| 785 | } | 673 | } | ||
| 786 | return nil | 674 | return nil | ||
| @@ -788,10 +676,7 @@ func (o *XdgToplevel) SetMaximized() error { | |||||
| 788 | 676 | ||||
| 789 | // Unmaximize the surface. After requesting that the surface should be unmaximized, the compositor will respond by emitting a configure event. Whether this actually un-maximizes the window is subject to compositor policies. If available and applicable, the compositor will include the window geometry dimensions the window had prior to being maximized in the configure event. The client must then update its content, drawing it in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if applicable. If the surface was already not maximized, the compositor will still emit a configure event without the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | 677 | // Unmaximize the surface. After requesting that the surface should be unmaximized, the compositor will respond by emitting a configure event. Whether this actually un-maximizes the window is subject to compositor policies. If available and applicable, the compositor will include the window geometry dimensions the window had prior to being maximized in the configure event. The client must then update its content, drawing it in the configured state. The client must also acknowledge the configure when committing the new content (see ack_configure). It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if applicable. If the surface was already not maximized, the compositor will still emit a configure event without the "maximized" state. If the surface is in a fullscreen state, this request has no direct effect. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor. | ||
| 790 | func (o *XdgToplevel) UnsetMaximized() error { | 678 | func (o *XdgToplevel) UnsetMaximized() error { | ||
| 791 | - | if err := o.Context().CheckProxy(o); err != nil { | 679 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "xdg_toplevel.unset_maximized"}); err != nil { |
| 792 | - | return err | |||
| 793 | - | } | |||
| 794 | - | if err := o.Context().SendRequest(o, 10); err != nil { | |||
| 795 | return err | 680 | return err | ||
| 796 | } | 681 | } | ||
| 797 | return nil | 682 | return nil | ||
| @@ -799,14 +684,11 @@ func (o *XdgToplevel) UnsetMaximized() error { | |||||
| 799 | 684 | ||||
| 800 | // Make the surface fullscreen. After requesting that the surface should be fullscreened, the compositor will respond by emitting a configure event. Whether the client is actually put into a fullscreen state is subject to compositor policies. The client must also acknowledge the configure when committing the new content (see ack_configure). The output passed by the request indicates the client's preference as to which display it should be set fullscreen on. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface. If the surface doesn't cover the whole output, the compositor will position the surface in the center of the output and compensate with border fill covering the rest of the output. The content of the border fill is undefined, but should be assumed to be in some way that attempts to blend into the surrounding area (e.g. solid black). If the fullscreened surface is not opaque, the compositor must make sure that other screen content not part of the same surface tree (made up of subsurfaces, popups or similarly coupled surfaces) are not visible below the fullscreened surface. | 685 | // Make the surface fullscreen. After requesting that the surface should be fullscreened, the compositor will respond by emitting a configure event. Whether the client is actually put into a fullscreen state is subject to compositor policies. The client must also acknowledge the configure when committing the new content (see ack_configure). The output passed by the request indicates the client's preference as to which display it should be set fullscreen on. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface. If the surface doesn't cover the whole output, the compositor will position the surface in the center of the output and compensate with border fill covering the rest of the output. The content of the border fill is undefined, but should be assumed to be in some way that attempts to blend into the surrounding area (e.g. solid black). If the fullscreened surface is not opaque, the compositor must make sure that other screen content not part of the same surface tree (made up of subsurfaces, popups or similarly coupled surfaces) are not visible below the fullscreened surface. | ||
| 801 | func (o *XdgToplevel) SetFullscreen(output *cross_wl_output.Output) error { | 686 | func (o *XdgToplevel) SetFullscreen(output *cross_wl_output.Output) error { | ||
| 802 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 803 | - | return err | |||
| 804 | - | } | |||
| 805 | var arg0 wl.Object | 687 | var arg0 wl.Object | ||
| 806 | if output != nil { | 688 | if output != nil { | ||
| 807 | arg0 = output | 689 | arg0 = output | ||
| 808 | } | 690 | } | ||
| 809 | - | if err := o.Context().SendRequest(o, 11, arg0); err != nil { | 691 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 11, Name: "xdg_toplevel.set_fullscreen"}, arg0); err != nil { |
| 810 | return err | 692 | return err | ||
| 811 | } | 693 | } | ||
| 812 | return nil | 694 | return nil | ||
| @@ -814,10 +696,7 @@ func (o *XdgToplevel) SetFullscreen(output *cross_wl_output.Output) error { | |||||
| 814 | 696 | ||||
| 815 | // Make the surface no longer fullscreen. After requesting that the surface should be unfullscreened, the compositor will respond by emitting a configure event. Whether this actually removes the fullscreen state of the client is subject to compositor policies. Making a surface unfullscreen sets states for the surface based on the following: * the state(s) it may have had before becoming fullscreen * any state(s) decided by the compositor * any state(s) requested by the client while the surface was fullscreen The compositor may include the previous window geometry dimensions in the configure event, if applicable. The client must also acknowledge the configure when committing the new content (see ack_configure). | 697 | // Make the surface no longer fullscreen. After requesting that the surface should be unfullscreened, the compositor will respond by emitting a configure event. Whether this actually removes the fullscreen state of the client is subject to compositor policies. Making a surface unfullscreen sets states for the surface based on the following: * the state(s) it may have had before becoming fullscreen * any state(s) decided by the compositor * any state(s) requested by the client while the surface was fullscreen The compositor may include the previous window geometry dimensions in the configure event, if applicable. The client must also acknowledge the configure when committing the new content (see ack_configure). | ||
| 816 | func (o *XdgToplevel) UnsetFullscreen() error { | 698 | func (o *XdgToplevel) UnsetFullscreen() error { | ||
| 817 | - | if err := o.Context().CheckProxy(o); err != nil { | 699 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 12, Name: "xdg_toplevel.unset_fullscreen"}); err != nil { |
| 818 | - | return err | |||
| 819 | - | } | |||
| 820 | - | if err := o.Context().SendRequest(o, 12); err != nil { | |||
| 821 | return err | 700 | return err | ||
| 822 | } | 701 | } | ||
| 823 | return nil | 702 | return nil | ||
| @@ -825,10 +704,7 @@ func (o *XdgToplevel) UnsetFullscreen() error { | |||||
| 825 | 704 | ||||
| 826 | // Request that the compositor minimize your surface. There is no way to know if the surface is currently minimized, nor is there any way to unset minimization on this surface. If you are looking to throttle redrawing when minimized, please instead use the wl_surface.frame event for this, as this will also work with live previews on windows in Alt-Tab, Expose or similar compositor features. | 705 | // Request that the compositor minimize your surface. There is no way to know if the surface is currently minimized, nor is there any way to unset minimization on this surface. If you are looking to throttle redrawing when minimized, please instead use the wl_surface.frame event for this, as this will also work with live previews on windows in Alt-Tab, Expose or similar compositor features. | ||
| 827 | func (o *XdgToplevel) SetMinimized() error { | 706 | func (o *XdgToplevel) SetMinimized() error { | ||
| 828 | - | if err := o.Context().CheckProxy(o); err != nil { | 707 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 13, Name: "xdg_toplevel.set_minimized"}); err != nil { |
| 829 | - | return err | |||
| 830 | - | } | |||
| 831 | - | if err := o.Context().SendRequest(o, 13); err != nil { | |||
| 832 | return err | 708 | return err | ||
| 833 | } | 709 | } | ||
| 834 | return nil | 710 | return nil | ||
| @@ -999,10 +875,7 @@ func NewXdgPopup(ctx *wl.Context) *XdgPopup { | |||||
| 999 | 875 | ||||
| 1000 | // This destroys the popup. Explicitly destroying the xdg_popup object will also dismiss the popup, and unmap the surface. If this xdg_popup is not the "topmost" popup, the xdg_wm_base.not_the_topmost_popup protocol error will be sent. | 876 | // This destroys the popup. Explicitly destroying the xdg_popup object will also dismiss the popup, and unmap the surface. If this xdg_popup is not the "topmost" popup, the xdg_wm_base.not_the_topmost_popup protocol error will be sent. | ||
| 1001 | func (o *XdgPopup) Destroy() error { | 877 | func (o *XdgPopup) Destroy() error { | ||
| 1002 | - | if err := o.Context().CheckProxy(o); err != nil { | 878 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_popup.destroy", Destructor: true}); err != nil { |
| 1003 | - | return err | |||
| 1004 | - | } | |||
| 1005 | - | if err := o.Context().SendDestructor(o, 0); err != nil { | |||
| 1006 | return err | 879 | return err | ||
| 1007 | } | 880 | } | ||
| 1008 | return nil | 881 | return nil | ||
| @@ -1010,14 +883,11 @@ func (o *XdgPopup) Destroy() error { | |||||
| 1010 | 883 | ||||
| 1011 | // This request makes the created popup take an explicit grab. An explicit grab will be dismissed when the user dismisses the popup, or when the client destroys the xdg_popup. This can be done by the user clicking outside the surface, using the keyboard, or even locking the screen through closing the lid or a timeout. If the compositor denies the grab, the popup will be immediately dismissed. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The serial number of the event should be passed as 'serial'. The parent of a grabbing popup must either be an xdg_toplevel surface or another xdg_popup with an explicit grab. If the parent is another xdg_popup it means that the popups are nested, with this popup now being the topmost popup. Nested popups must be destroyed in the reverse order they were created in, e.g. the only popup you are allowed to destroy at all times is the topmost one. When compositors choose to dismiss a popup, they may dismiss every nested grabbing popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client. If the topmost grabbing popup is destroyed, the grab will be returned to the parent of the popup, if that parent previously had an explicit grab. If the parent is a grabbing popup which has already been dismissed, this popup will be immediately dismissed. If the parent is a popup that did not take an explicit grab, an error will be raised. During a popup grab, the client owning the grab will receive pointer and touch events for all their surfaces as normal (similar to an "owner-events" grab in X11 parlance), while the top most grabbing popup will always have keyboard focus. | 884 | // This request makes the created popup take an explicit grab. An explicit grab will be dismissed when the user dismisses the popup, or when the client destroys the xdg_popup. This can be done by the user clicking outside the surface, using the keyboard, or even locking the screen through closing the lid or a timeout. If the compositor denies the grab, the popup will be immediately dismissed. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The serial number of the event should be passed as 'serial'. The parent of a grabbing popup must either be an xdg_toplevel surface or another xdg_popup with an explicit grab. If the parent is another xdg_popup it means that the popups are nested, with this popup now being the topmost popup. Nested popups must be destroyed in the reverse order they were created in, e.g. the only popup you are allowed to destroy at all times is the topmost one. When compositors choose to dismiss a popup, they may dismiss every nested grabbing popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client. If the topmost grabbing popup is destroyed, the grab will be returned to the parent of the popup, if that parent previously had an explicit grab. If the parent is a grabbing popup which has already been dismissed, this popup will be immediately dismissed. If the parent is a popup that did not take an explicit grab, an error will be raised. During a popup grab, the client owning the grab will receive pointer and touch events for all their surfaces as normal (similar to an "owner-events" grab in X11 parlance), while the top most grabbing popup will always have keyboard focus. | ||
| 1012 | func (o *XdgPopup) Grab(seat *cross_wl_seat.Seat, serial uint32) error { | 885 | func (o *XdgPopup) Grab(seat *cross_wl_seat.Seat, serial uint32) error { | ||
| 1013 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1014 | - | return err | |||
| 1015 | - | } | |||
| 1016 | var arg0 wl.Object | 886 | var arg0 wl.Object | ||
| 1017 | if seat != nil { | 887 | if seat != nil { | ||
| 1018 | arg0 = seat | 888 | arg0 = seat | ||
| 1019 | } | 889 | } | ||
| 1020 | - | if err := o.Context().SendRequest(o, 1, arg0, serial); err != nil { | 890 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_popup.grab"}, arg0, serial); err != nil { |
| 1021 | return err | 891 | return err | ||
| 1022 | } | 892 | } | ||
| 1023 | return nil | 893 | return nil | ||
| @@ -1025,17 +895,11 @@ func (o *XdgPopup) Grab(seat *cross_wl_seat.Seat, serial uint32) error { | |||||
| 1025 | 895 | ||||
| 1026 | // Reposition an already-mapped popup. The popup will be placed given the details in the passed xdg_positioner object, and a xdg_popup.repositioned followed by xdg_popup.configure and xdg_surface.configure will be emitted in response. Any parameters set by the previous positioner will be discarded. The passed token will be sent in the corresponding xdg_popup.repositioned event. The new popup position will not take effect until the corresponding configure event is acknowledged by the client. See xdg_popup.repositioned for details. The token itself is opaque, and has no other special meaning. If multiple reposition requests are sent, the compositor may skip all but the last one. If the popup is repositioned in response to a configure event for its parent, the client should send an xdg_positioner.set_parent_configure and possibly an xdg_positioner.set_parent_size request to allow the compositor to properly constrain the popup. If the popup is repositioned together with a parent that is being resized, but not in response to a configure event, the client should send an xdg_positioner.set_parent_size request. | 896 | // Reposition an already-mapped popup. The popup will be placed given the details in the passed xdg_positioner object, and a xdg_popup.repositioned followed by xdg_popup.configure and xdg_surface.configure will be emitted in response. Any parameters set by the previous positioner will be discarded. The passed token will be sent in the corresponding xdg_popup.repositioned event. The new popup position will not take effect until the corresponding configure event is acknowledged by the client. See xdg_popup.repositioned for details. The token itself is opaque, and has no other special meaning. If multiple reposition requests are sent, the compositor may skip all but the last one. If the popup is repositioned in response to a configure event for its parent, the client should send an xdg_positioner.set_parent_configure and possibly an xdg_positioner.set_parent_size request to allow the compositor to properly constrain the popup. If the popup is repositioned together with a parent that is being resized, but not in response to a configure event, the client should send an xdg_positioner.set_parent_size request. | ||
| 1027 | func (o *XdgPopup) Reposition(positioner *XdgPositioner, token uint32) error { | 897 | func (o *XdgPopup) Reposition(positioner *XdgPositioner, token uint32) error { | ||
| 1028 | - | if err := o.Context().CheckProxy(o); err != nil { | |||
| 1029 | - | return err | |||
| 1030 | - | } | |||
| 1031 | - | if err := wl.CheckVersion(o.Version(), 3, "xdg_popup.reposition"); err != nil { | |||
| 1032 | - | return err | |||
| 1033 | - | } | |||
| 1034 | var arg0 wl.Object | 898 | var arg0 wl.Object | ||
| 1035 | if positioner != nil { | 899 | if positioner != nil { | ||
| 1036 | arg0 = positioner | 900 | arg0 = positioner | ||
| 1037 | } | 901 | } | ||
| 1038 | - | if err := o.Context().SendRequest(o, 2, arg0, token); err != nil { | 902 | + | if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_popup.reposition", Since: 3}, arg0, token); err != nil { |
| 1039 | return err | 903 | return err | ||
| 1040 | } | 904 | } | ||
| 1041 | return nil | 905 | return nil | ||
M wl/wl.go +1 -0
| @@ -22,6 +22,7 @@ type ( | |||
| 22 | 22 | RegistryGlobalEvent = wlturbo.RegistryGlobalEvent | |
| 23 | 23 | RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent | |
| 24 | 24 | OwnedFD = wlturbo.OwnedFD | |
| 25 | + | Request = wlturbo.Request | |
| 25 | 26 | ||
| 26 | 27 | // Transport failures. Without these, a caller that imports this shim has to | |
| 27 | 28 | // import the root package as well just to classify an error. | |
| @@ -22,6 +22,7 @@ type ( | |||||
| 22 | RegistryGlobalEvent = wlturbo.RegistryGlobalEvent | 22 | RegistryGlobalEvent = wlturbo.RegistryGlobalEvent | ||
| 23 | RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent | 23 | RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent | ||
| 24 | OwnedFD = wlturbo.OwnedFD | 24 | OwnedFD = wlturbo.OwnedFD | ||
| 25 | + | Request = wlturbo.Request | |||
| 25 | 26 | ||||
| 26 | // Transport failures. Without these, a caller that imports this shim has to | 27 | // Transport failures. Without these, a caller that imports this shim has to | ||
| 27 | // import the root package as well just to classify an error. | 28 | // import the root package as well just to classify an error. | ||