detached 4df41d0

merge: viewporter and fractional-scale bindings

commit
4df41d057732e0d6d7b0a8f03eaf27e70ea5305f
author
brice · · 2026-09-24 14:25 UTC
merge of
8628cd3 + e5508a6 · diff against the first parent
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +583 -0
A protocol/fractionalscale/fractionalscale.go +145 -0
@@ -0,0 +1,145 @@
1+// Code generated by wlgen; DO NOT EDIT.
2+package fractionalscale
3+
4+import (
5+ "fmt"
6+ wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7+ "github.com/bnema/purego-libwayland/server"
8+)
9+
10+var WpFractionalScaleManagerV1Interface *server.Interface
11+var WpFractionalScaleV1Interface *server.Interface
12+
13+func init() {
14+ WpFractionalScaleManagerV1Interface = &server.Interface{Name: "wp_fractional_scale_manager_v1", Version: 1}
15+ WpFractionalScaleV1Interface = &server.Interface{Name: "wp_fractional_scale_v1", Version: 1}
16+ WpFractionalScaleManagerV1Interface.Requests = []server.Message{
17+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
18+ {Name: "get_fractional_scale", Signature: "no", Types: []*server.Interface{WpFractionalScaleV1Interface, wayland.SurfaceInterface}},
19+ }
20+ WpFractionalScaleManagerV1Interface.Events = []server.Message{}
21+ WpFractionalScaleV1Interface.Requests = []server.Message{
22+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
23+ }
24+ WpFractionalScaleV1Interface.Events = []server.Message{
25+ {Name: "preferred_scale", Signature: "u", Types: []*server.Interface{nil}},
26+ }
27+ if err := server.NewInterfaces(WpFractionalScaleManagerV1Interface, WpFractionalScaleV1Interface); err != nil {
28+ panic(err)
29+ }
30+}
31+
32+// WpFractionalScaleManagerV1 fractional surface scale information.
33+type WpFractionalScaleManagerV1 struct{ *server.Resource }
34+
35+func WrapWpFractionalScaleManagerV1(r *server.Resource) *WpFractionalScaleManagerV1 {
36+ if r == nil {
37+ return nil
38+ }
39+ return &WpFractionalScaleManagerV1{r}
40+}
41+
42+const WpFractionalScaleManagerV1RequestDestroy uint32 = 0
43+const WpFractionalScaleManagerV1RequestGetFractionalScale uint32 = 1
44+
45+// WpFractionalScaleManagerV1Error .
46+type WpFractionalScaleManagerV1Error uint32
47+
48+const (
49+ WpFractionalScaleManagerV1ErrorFractionalScaleExists WpFractionalScaleManagerV1Error = 0
50+)
51+
52+// WpFractionalScaleManagerV1Handler handles wp_fractional_scale_manager_v1 requests.
53+type WpFractionalScaleManagerV1Handler interface {
54+ Destroy(self *WpFractionalScaleManagerV1)
55+ GetFractionalScale(self *WpFractionalScaleManagerV1, id uint32, surface *wayland.Surface)
56+}
57+
58+func NewWpFractionalScaleManagerV1(c server.Client, version int32, id uint32, h WpFractionalScaleManagerV1Handler) (*WpFractionalScaleManagerV1, error) {
59+ if h == nil {
60+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fractional_scale_manager_v1")
61+ }
62+ var self *WpFractionalScaleManagerV1
63+ r, err := c.CreateResource(WpFractionalScaleManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
64+ switch opcode {
65+ case 0:
66+ h.Destroy(self)
67+ self.Destroy()
68+ case 1:
69+ h.GetFractionalScale(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
70+ }
71+ })
72+ if err != nil {
73+ return nil, err
74+ }
75+ self = WrapWpFractionalScaleManagerV1(r)
76+ r.Data = self
77+ return self, nil
78+}
79+func NewWpFractionalScaleManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
80+ return d.CreateGlobal(WpFractionalScaleManagerV1Interface, version, bind)
81+}
82+
83+// WpFractionalScaleV1 fractional scale interface to a wl_surface.
84+type WpFractionalScaleV1 struct{ *server.Resource }
85+
86+func WrapWpFractionalScaleV1(r *server.Resource) *WpFractionalScaleV1 {
87+ if r == nil {
88+ return nil
89+ }
90+ return &WpFractionalScaleV1{r}
91+}
92+
93+const WpFractionalScaleV1RequestDestroy uint32 = 0
94+const WpFractionalScaleV1EventPreferredScale uint32 = 0
95+
96+// WpFractionalScaleV1Handler handles wp_fractional_scale_v1 requests.
97+type WpFractionalScaleV1Handler interface {
98+ Destroy(self *WpFractionalScaleV1)
99+}
100+
101+func NewWpFractionalScaleV1(c server.Client, version int32, id uint32, h WpFractionalScaleV1Handler) (*WpFractionalScaleV1, error) {
102+ if h == nil {
103+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fractional_scale_v1")
104+ }
105+ var self *WpFractionalScaleV1
106+ r, err := c.CreateResource(WpFractionalScaleV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
107+ switch opcode {
108+ case 0:
109+ h.Destroy(self)
110+ self.Destroy()
111+ }
112+ })
113+ if err != nil {
114+ return nil, err
115+ }
116+ self = WrapWpFractionalScaleV1(r)
117+ r.Data = self
118+ return self, nil
119+}
120+
121+// SendPreferredScale notify of new preferred scale.
122+func (self *WpFractionalScaleV1) SendPreferredScale(scale uint32) {
123+ self.PostEvent(WpFractionalScaleV1EventPreferredScale, server.Uint(scale))
124+}
125+func NewWpFractionalScaleV1Global(d *server.Display, version int32, bind server.BindFunc) error {
126+ return d.CreateGlobal(WpFractionalScaleV1Interface, version, bind)
127+}
128+func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
129+ if v == nil {
130+ return nil
131+ }
132+ return v.GetResource()
133+}
134+func (self *WpFractionalScaleManagerV1) GetResource() *server.Resource {
135+ if self == nil {
136+ return nil
137+ }
138+ return self.Resource
139+}
140+func (self *WpFractionalScaleV1) GetResource() *server.Resource {
141+ if self == nil {
142+ return nil
143+ }
144+ return self.Resource
145+}
@@ -0,0 +1,145 @@
1+// Code generated by wlgen; DO NOT EDIT.
2+package fractionalscale
3+
4+import (
5+ "fmt"
6+ wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7+ "github.com/bnema/purego-libwayland/server"
8+)
9+
10+var WpFractionalScaleManagerV1Interface *server.Interface
11+var WpFractionalScaleV1Interface *server.Interface
12+
13+func init() {
14+ WpFractionalScaleManagerV1Interface = &server.Interface{Name: "wp_fractional_scale_manager_v1", Version: 1}
15+ WpFractionalScaleV1Interface = &server.Interface{Name: "wp_fractional_scale_v1", Version: 1}
16+ WpFractionalScaleManagerV1Interface.Requests = []server.Message{
17+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
18+ {Name: "get_fractional_scale", Signature: "no", Types: []*server.Interface{WpFractionalScaleV1Interface, wayland.SurfaceInterface}},
19+ }
20+ WpFractionalScaleManagerV1Interface.Events = []server.Message{}
21+ WpFractionalScaleV1Interface.Requests = []server.Message{
22+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
23+ }
24+ WpFractionalScaleV1Interface.Events = []server.Message{
25+ {Name: "preferred_scale", Signature: "u", Types: []*server.Interface{nil}},
26+ }
27+ if err := server.NewInterfaces(WpFractionalScaleManagerV1Interface, WpFractionalScaleV1Interface); err != nil {
28+ panic(err)
29+ }
30+}
31+
32+// WpFractionalScaleManagerV1 fractional surface scale information.
33+type WpFractionalScaleManagerV1 struct{ *server.Resource }
34+
35+func WrapWpFractionalScaleManagerV1(r *server.Resource) *WpFractionalScaleManagerV1 {
36+ if r == nil {
37+ return nil
38+ }
39+ return &WpFractionalScaleManagerV1{r}
40+}
41+
42+const WpFractionalScaleManagerV1RequestDestroy uint32 = 0
43+const WpFractionalScaleManagerV1RequestGetFractionalScale uint32 = 1
44+
45+// WpFractionalScaleManagerV1Error .
46+type WpFractionalScaleManagerV1Error uint32
47+
48+const (
49+ WpFractionalScaleManagerV1ErrorFractionalScaleExists WpFractionalScaleManagerV1Error = 0
50+)
51+
52+// WpFractionalScaleManagerV1Handler handles wp_fractional_scale_manager_v1 requests.
53+type WpFractionalScaleManagerV1Handler interface {
54+ Destroy(self *WpFractionalScaleManagerV1)
55+ GetFractionalScale(self *WpFractionalScaleManagerV1, id uint32, surface *wayland.Surface)
56+}
57+
58+func NewWpFractionalScaleManagerV1(c server.Client, version int32, id uint32, h WpFractionalScaleManagerV1Handler) (*WpFractionalScaleManagerV1, error) {
59+ if h == nil {
60+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fractional_scale_manager_v1")
61+ }
62+ var self *WpFractionalScaleManagerV1
63+ r, err := c.CreateResource(WpFractionalScaleManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
64+ switch opcode {
65+ case 0:
66+ h.Destroy(self)
67+ self.Destroy()
68+ case 1:
69+ h.GetFractionalScale(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
70+ }
71+ })
72+ if err != nil {
73+ return nil, err
74+ }
75+ self = WrapWpFractionalScaleManagerV1(r)
76+ r.Data = self
77+ return self, nil
78+}
79+func NewWpFractionalScaleManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
80+ return d.CreateGlobal(WpFractionalScaleManagerV1Interface, version, bind)
81+}
82+
83+// WpFractionalScaleV1 fractional scale interface to a wl_surface.
84+type WpFractionalScaleV1 struct{ *server.Resource }
85+
86+func WrapWpFractionalScaleV1(r *server.Resource) *WpFractionalScaleV1 {
87+ if r == nil {
88+ return nil
89+ }
90+ return &WpFractionalScaleV1{r}
91+}
92+
93+const WpFractionalScaleV1RequestDestroy uint32 = 0
94+const WpFractionalScaleV1EventPreferredScale uint32 = 0
95+
96+// WpFractionalScaleV1Handler handles wp_fractional_scale_v1 requests.
97+type WpFractionalScaleV1Handler interface {
98+ Destroy(self *WpFractionalScaleV1)
99+}
100+
101+func NewWpFractionalScaleV1(c server.Client, version int32, id uint32, h WpFractionalScaleV1Handler) (*WpFractionalScaleV1, error) {
102+ if h == nil {
103+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fractional_scale_v1")
104+ }
105+ var self *WpFractionalScaleV1
106+ r, err := c.CreateResource(WpFractionalScaleV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
107+ switch opcode {
108+ case 0:
109+ h.Destroy(self)
110+ self.Destroy()
111+ }
112+ })
113+ if err != nil {
114+ return nil, err
115+ }
116+ self = WrapWpFractionalScaleV1(r)
117+ r.Data = self
118+ return self, nil
119+}
120+
121+// SendPreferredScale notify of new preferred scale.
122+func (self *WpFractionalScaleV1) SendPreferredScale(scale uint32) {
123+ self.PostEvent(WpFractionalScaleV1EventPreferredScale, server.Uint(scale))
124+}
125+func NewWpFractionalScaleV1Global(d *server.Display, version int32, bind server.BindFunc) error {
126+ return d.CreateGlobal(WpFractionalScaleV1Interface, version, bind)
127+}
128+func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
129+ if v == nil {
130+ return nil
131+ }
132+ return v.GetResource()
133+}
134+func (self *WpFractionalScaleManagerV1) GetResource() *server.Resource {
135+ if self == nil {
136+ return nil
137+ }
138+ return self.Resource
139+}
140+func (self *WpFractionalScaleV1) GetResource() *server.Resource {
141+ if self == nil {
142+ return nil
143+ }
144+ return self.Resource
145+}
M protocol/gen.go +2 -0
@@ -6,3 +6,5 @@ package protocol
66 //go:generate go run ../cmd/wlgen -package wlrlayershell -out wlrlayershell/wlrlayershell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/wlr-layer-shell-unstable-v1.xml
77 //go:generate go run ../cmd/wlgen -package xdgoutput -out xdgoutput/xdgoutput.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-output-unstable-v1.xml
88 //go:generate go run ../cmd/wlgen -package xdgdecoration -out xdgdecoration/xdgdecoration.go -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/xdg-decoration-unstable-v1.xml
9+//go:generate go run ../cmd/wlgen -package viewporter -out viewporter/viewporter.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/viewporter.xml
10+//go:generate go run ../cmd/wlgen -package fractionalscale -out fractionalscale/fractionalscale.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/fractional-scale-v1.xml
@@ -6,3 +6,5 @@ package protocol
6 //go:generate go run ../cmd/wlgen -package wlrlayershell -out wlrlayershell/wlrlayershell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/wlr-layer-shell-unstable-v1.xml6 //go:generate go run ../cmd/wlgen -package wlrlayershell -out wlrlayershell/wlrlayershell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/wlr-layer-shell-unstable-v1.xml
7 //go:generate go run ../cmd/wlgen -package xdgoutput -out xdgoutput/xdgoutput.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-output-unstable-v1.xml7 //go:generate go run ../cmd/wlgen -package xdgoutput -out xdgoutput/xdgoutput.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-output-unstable-v1.xml
8 //go:generate go run ../cmd/wlgen -package xdgdecoration -out xdgdecoration/xdgdecoration.go -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/xdg-decoration-unstable-v1.xml8 //go:generate go run ../cmd/wlgen -package xdgdecoration -out xdgdecoration/xdgdecoration.go -import xdgshell=github.com/bnema/purego-libwayland/protocol/xdgshell -import-xml xdgshell=../protocols/xdg-shell.xml ../protocols/xdg-decoration-unstable-v1.xml
9+//go:generate go run ../cmd/wlgen -package viewporter -out viewporter/viewporter.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/viewporter.xml
10+//go:generate go run ../cmd/wlgen -package fractionalscale -out fractionalscale/fractionalscale.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/fractional-scale-v1.xml
A protocol/viewporter/viewporter.go +157 -0
@@ -0,0 +1,157 @@
1+// Code generated by wlgen; DO NOT EDIT.
2+package viewporter
3+
4+import (
5+ "fmt"
6+ wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7+ "github.com/bnema/purego-libwayland/server"
8+)
9+
10+var WpViewporterInterface *server.Interface
11+var WpViewportInterface *server.Interface
12+
13+func init() {
14+ WpViewporterInterface = &server.Interface{Name: "wp_viewporter", Version: 1}
15+ WpViewportInterface = &server.Interface{Name: "wp_viewport", Version: 1}
16+ WpViewporterInterface.Requests = []server.Message{
17+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
18+ {Name: "get_viewport", Signature: "no", Types: []*server.Interface{WpViewportInterface, wayland.SurfaceInterface}},
19+ }
20+ WpViewporterInterface.Events = []server.Message{}
21+ WpViewportInterface.Requests = []server.Message{
22+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
23+ {Name: "set_source", Signature: "ffff", Types: []*server.Interface{nil, nil, nil, nil}},
24+ {Name: "set_destination", Signature: "ii", Types: []*server.Interface{nil, nil}},
25+ }
26+ WpViewportInterface.Events = []server.Message{}
27+ if err := server.NewInterfaces(WpViewporterInterface, WpViewportInterface); err != nil {
28+ panic(err)
29+ }
30+}
31+
32+// WpViewporter surface cropping and scaling.
33+type WpViewporter struct{ *server.Resource }
34+
35+func WrapWpViewporter(r *server.Resource) *WpViewporter {
36+ if r == nil {
37+ return nil
38+ }
39+ return &WpViewporter{r}
40+}
41+
42+const WpViewporterRequestDestroy uint32 = 0
43+const WpViewporterRequestGetViewport uint32 = 1
44+
45+// WpViewporterError .
46+type WpViewporterError uint32
47+
48+const (
49+ WpViewporterErrorViewportExists WpViewporterError = 0
50+)
51+
52+// WpViewporterHandler handles wp_viewporter requests.
53+type WpViewporterHandler interface {
54+ Destroy(self *WpViewporter)
55+ GetViewport(self *WpViewporter, id uint32, surface *wayland.Surface)
56+}
57+
58+func NewWpViewporter(c server.Client, version int32, id uint32, h WpViewporterHandler) (*WpViewporter, error) {
59+ if h == nil {
60+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_viewporter")
61+ }
62+ var self *WpViewporter
63+ r, err := c.CreateResource(WpViewporterInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
64+ switch opcode {
65+ case 0:
66+ h.Destroy(self)
67+ self.Destroy()
68+ case 1:
69+ h.GetViewport(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
70+ }
71+ })
72+ if err != nil {
73+ return nil, err
74+ }
75+ self = WrapWpViewporter(r)
76+ r.Data = self
77+ return self, nil
78+}
79+func NewWpViewporterGlobal(d *server.Display, version int32, bind server.BindFunc) error {
80+ return d.CreateGlobal(WpViewporterInterface, version, bind)
81+}
82+
83+// WpViewport crop and scale interface to a wl_surface.
84+type WpViewport struct{ *server.Resource }
85+
86+func WrapWpViewport(r *server.Resource) *WpViewport {
87+ if r == nil {
88+ return nil
89+ }
90+ return &WpViewport{r}
91+}
92+
93+const WpViewportRequestDestroy uint32 = 0
94+const WpViewportRequestSetSource uint32 = 1
95+const WpViewportRequestSetDestination uint32 = 2
96+
97+// WpViewportError .
98+type WpViewportError uint32
99+
100+const (
101+ WpViewportErrorBadValue WpViewportError = 0
102+ WpViewportErrorBadSize WpViewportError = 1
103+ WpViewportErrorOutOfBuffer WpViewportError = 2
104+ WpViewportErrorNoSurface WpViewportError = 3
105+)
106+
107+// WpViewportHandler handles wp_viewport requests.
108+type WpViewportHandler interface {
109+ Destroy(self *WpViewport)
110+ SetSource(self *WpViewport, x server.Fixed, y server.Fixed, width server.Fixed, height server.Fixed)
111+ SetDestination(self *WpViewport, width int32, height int32)
112+}
113+
114+func NewWpViewport(c server.Client, version int32, id uint32, h WpViewportHandler) (*WpViewport, error) {
115+ if h == nil {
116+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_viewport")
117+ }
118+ var self *WpViewport
119+ r, err := c.CreateResource(WpViewportInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
120+ switch opcode {
121+ case 0:
122+ h.Destroy(self)
123+ self.Destroy()
124+ case 1:
125+ h.SetSource(self, args[0].Fixed(), args[1].Fixed(), args[2].Fixed(), args[3].Fixed())
126+ case 2:
127+ h.SetDestination(self, args[0].Int(), args[1].Int())
128+ }
129+ })
130+ if err != nil {
131+ return nil, err
132+ }
133+ self = WrapWpViewport(r)
134+ r.Data = self
135+ return self, nil
136+}
137+func NewWpViewportGlobal(d *server.Display, version int32, bind server.BindFunc) error {
138+ return d.CreateGlobal(WpViewportInterface, version, bind)
139+}
140+func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
141+ if v == nil {
142+ return nil
143+ }
144+ return v.GetResource()
145+}
146+func (self *WpViewporter) GetResource() *server.Resource {
147+ if self == nil {
148+ return nil
149+ }
150+ return self.Resource
151+}
152+func (self *WpViewport) GetResource() *server.Resource {
153+ if self == nil {
154+ return nil
155+ }
156+ return self.Resource
157+}
@@ -0,0 +1,157 @@
1+// Code generated by wlgen; DO NOT EDIT.
2+package viewporter
3+
4+import (
5+ "fmt"
6+ wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7+ "github.com/bnema/purego-libwayland/server"
8+)
9+
10+var WpViewporterInterface *server.Interface
11+var WpViewportInterface *server.Interface
12+
13+func init() {
14+ WpViewporterInterface = &server.Interface{Name: "wp_viewporter", Version: 1}
15+ WpViewportInterface = &server.Interface{Name: "wp_viewport", Version: 1}
16+ WpViewporterInterface.Requests = []server.Message{
17+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
18+ {Name: "get_viewport", Signature: "no", Types: []*server.Interface{WpViewportInterface, wayland.SurfaceInterface}},
19+ }
20+ WpViewporterInterface.Events = []server.Message{}
21+ WpViewportInterface.Requests = []server.Message{
22+ {Name: "destroy", Signature: "", Types: []*server.Interface{}},
23+ {Name: "set_source", Signature: "ffff", Types: []*server.Interface{nil, nil, nil, nil}},
24+ {Name: "set_destination", Signature: "ii", Types: []*server.Interface{nil, nil}},
25+ }
26+ WpViewportInterface.Events = []server.Message{}
27+ if err := server.NewInterfaces(WpViewporterInterface, WpViewportInterface); err != nil {
28+ panic(err)
29+ }
30+}
31+
32+// WpViewporter surface cropping and scaling.
33+type WpViewporter struct{ *server.Resource }
34+
35+func WrapWpViewporter(r *server.Resource) *WpViewporter {
36+ if r == nil {
37+ return nil
38+ }
39+ return &WpViewporter{r}
40+}
41+
42+const WpViewporterRequestDestroy uint32 = 0
43+const WpViewporterRequestGetViewport uint32 = 1
44+
45+// WpViewporterError .
46+type WpViewporterError uint32
47+
48+const (
49+ WpViewporterErrorViewportExists WpViewporterError = 0
50+)
51+
52+// WpViewporterHandler handles wp_viewporter requests.
53+type WpViewporterHandler interface {
54+ Destroy(self *WpViewporter)
55+ GetViewport(self *WpViewporter, id uint32, surface *wayland.Surface)
56+}
57+
58+func NewWpViewporter(c server.Client, version int32, id uint32, h WpViewporterHandler) (*WpViewporter, error) {
59+ if h == nil {
60+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_viewporter")
61+ }
62+ var self *WpViewporter
63+ r, err := c.CreateResource(WpViewporterInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
64+ switch opcode {
65+ case 0:
66+ h.Destroy(self)
67+ self.Destroy()
68+ case 1:
69+ h.GetViewport(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
70+ }
71+ })
72+ if err != nil {
73+ return nil, err
74+ }
75+ self = WrapWpViewporter(r)
76+ r.Data = self
77+ return self, nil
78+}
79+func NewWpViewporterGlobal(d *server.Display, version int32, bind server.BindFunc) error {
80+ return d.CreateGlobal(WpViewporterInterface, version, bind)
81+}
82+
83+// WpViewport crop and scale interface to a wl_surface.
84+type WpViewport struct{ *server.Resource }
85+
86+func WrapWpViewport(r *server.Resource) *WpViewport {
87+ if r == nil {
88+ return nil
89+ }
90+ return &WpViewport{r}
91+}
92+
93+const WpViewportRequestDestroy uint32 = 0
94+const WpViewportRequestSetSource uint32 = 1
95+const WpViewportRequestSetDestination uint32 = 2
96+
97+// WpViewportError .
98+type WpViewportError uint32
99+
100+const (
101+ WpViewportErrorBadValue WpViewportError = 0
102+ WpViewportErrorBadSize WpViewportError = 1
103+ WpViewportErrorOutOfBuffer WpViewportError = 2
104+ WpViewportErrorNoSurface WpViewportError = 3
105+)
106+
107+// WpViewportHandler handles wp_viewport requests.
108+type WpViewportHandler interface {
109+ Destroy(self *WpViewport)
110+ SetSource(self *WpViewport, x server.Fixed, y server.Fixed, width server.Fixed, height server.Fixed)
111+ SetDestination(self *WpViewport, width int32, height int32)
112+}
113+
114+func NewWpViewport(c server.Client, version int32, id uint32, h WpViewportHandler) (*WpViewport, error) {
115+ if h == nil {
116+ return nil, fmt.Errorf("purego-libwayland: nil handler for wp_viewport")
117+ }
118+ var self *WpViewport
119+ r, err := c.CreateResource(WpViewportInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
120+ switch opcode {
121+ case 0:
122+ h.Destroy(self)
123+ self.Destroy()
124+ case 1:
125+ h.SetSource(self, args[0].Fixed(), args[1].Fixed(), args[2].Fixed(), args[3].Fixed())
126+ case 2:
127+ h.SetDestination(self, args[0].Int(), args[1].Int())
128+ }
129+ })
130+ if err != nil {
131+ return nil, err
132+ }
133+ self = WrapWpViewport(r)
134+ r.Data = self
135+ return self, nil
136+}
137+func NewWpViewportGlobal(d *server.Display, version int32, bind server.BindFunc) error {
138+ return d.CreateGlobal(WpViewportInterface, version, bind)
139+}
140+func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
141+ if v == nil {
142+ return nil
143+ }
144+ return v.GetResource()
145+}
146+func (self *WpViewporter) GetResource() *server.Resource {
147+ if self == nil {
148+ return nil
149+ }
150+ return self.Resource
151+}
152+func (self *WpViewport) GetResource() *server.Resource {
153+ if self == nil {
154+ return nil
155+ }
156+ return self.Resource
157+}
A protocols/fractional-scale-v1.xml +102 -0
@@ -0,0 +1,102 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="fractional_scale_v1">
3+ <copyright>
4+ Copyright © 2022 Kenny Levinsen
5+
6+ Permission is hereby granted, free of charge, to any person obtaining a
7+ copy of this software and associated documentation files (the "Software"),
8+ to deal in the Software without restriction, including without limitation
9+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+ and/or sell copies of the Software, and to permit persons to whom the
11+ Software is furnished to do so, subject to the following conditions:
12+
13+ The above copyright notice and this permission notice (including the next
14+ paragraph) shall be included in all copies or substantial portions of the
15+ Software.
16+
17+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+ DEALINGS IN THE SOFTWARE.
24+ </copyright>
25+
26+ <description summary="Protocol for requesting fractional surface scales">
27+ This protocol allows a compositor to suggest for surfaces to render at
28+ fractional scales.
29+
30+ A client can submit scaled content by utilizing wp_viewport. This is done by
31+ creating a wp_viewport object for the surface and setting the destination
32+ rectangle to the surface size before the scale factor is applied.
33+
34+ The buffer size is calculated by multiplying the surface size by the
35+ intended scale.
36+
37+ The wl_surface buffer scale should remain set to 1.
38+
39+ If a surface has a surface-local size of 100 px by 50 px and wishes to
40+ submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
41+ be used and the wp_viewport destination rectangle should be 100 px by 50 px.
42+
43+ For toplevel surfaces, the size is rounded halfway away from zero. The
44+ rounding algorithm for subsurface position and size is not defined.
45+ </description>
46+
47+ <interface name="wp_fractional_scale_manager_v1" version="1">
48+ <description summary="fractional surface scale information">
49+ A global interface for requesting surfaces to use fractional scales.
50+ </description>
51+
52+ <request name="destroy" type="destructor">
53+ <description summary="unbind the fractional surface scale interface">
54+ Informs the server that the client will not be using this protocol
55+ object anymore. This does not affect any other objects,
56+ wp_fractional_scale_v1 objects included.
57+ </description>
58+ </request>
59+
60+ <enum name="error">
61+ <entry name="fractional_scale_exists" value="0"
62+ summary="the surface already has a fractional_scale object associated"/>
63+ </enum>
64+
65+ <request name="get_fractional_scale">
66+ <description summary="extend surface interface for scale information">
67+ Create an add-on object for the the wl_surface to let the compositor
68+ request fractional scales. If the given wl_surface already has a
69+ wp_fractional_scale_v1 object associated, the fractional_scale_exists
70+ protocol error is raised.
71+ </description>
72+ <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
73+ summary="the new surface scale info interface id"/>
74+ <arg name="surface" type="object" interface="wl_surface"
75+ summary="the surface"/>
76+ </request>
77+ </interface>
78+
79+ <interface name="wp_fractional_scale_v1" version="1">
80+ <description summary="fractional scale interface to a wl_surface">
81+ An additional interface to a wl_surface object which allows the compositor
82+ to inform the client of the preferred scale.
83+ </description>
84+
85+ <request name="destroy" type="destructor">
86+ <description summary="remove surface scale information for surface">
87+ Destroy the fractional scale object. When this object is destroyed,
88+ preferred_scale events will no longer be sent.
89+ </description>
90+ </request>
91+
92+ <event name="preferred_scale">
93+ <description summary="notify of new preferred scale">
94+ Notification of a new preferred scale for this surface that the
95+ compositor suggests that the client should use.
96+
97+ The sent scale is the numerator of a fraction with a denominator of 120.
98+ </description>
99+ <arg name="scale" type="uint" summary="the new preferred scale"/>
100+ </event>
101+ </interface>
102+</protocol>
@@ -0,0 +1,102 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="fractional_scale_v1">
3+ <copyright>
4+ Copyright © 2022 Kenny Levinsen
5+
6+ Permission is hereby granted, free of charge, to any person obtaining a
7+ copy of this software and associated documentation files (the "Software"),
8+ to deal in the Software without restriction, including without limitation
9+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+ and/or sell copies of the Software, and to permit persons to whom the
11+ Software is furnished to do so, subject to the following conditions:
12+
13+ The above copyright notice and this permission notice (including the next
14+ paragraph) shall be included in all copies or substantial portions of the
15+ Software.
16+
17+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+ DEALINGS IN THE SOFTWARE.
24+ </copyright>
25+
26+ <description summary="Protocol for requesting fractional surface scales">
27+ This protocol allows a compositor to suggest for surfaces to render at
28+ fractional scales.
29+
30+ A client can submit scaled content by utilizing wp_viewport. This is done by
31+ creating a wp_viewport object for the surface and setting the destination
32+ rectangle to the surface size before the scale factor is applied.
33+
34+ The buffer size is calculated by multiplying the surface size by the
35+ intended scale.
36+
37+ The wl_surface buffer scale should remain set to 1.
38+
39+ If a surface has a surface-local size of 100 px by 50 px and wishes to
40+ submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
41+ be used and the wp_viewport destination rectangle should be 100 px by 50 px.
42+
43+ For toplevel surfaces, the size is rounded halfway away from zero. The
44+ rounding algorithm for subsurface position and size is not defined.
45+ </description>
46+
47+ <interface name="wp_fractional_scale_manager_v1" version="1">
48+ <description summary="fractional surface scale information">
49+ A global interface for requesting surfaces to use fractional scales.
50+ </description>
51+
52+ <request name="destroy" type="destructor">
53+ <description summary="unbind the fractional surface scale interface">
54+ Informs the server that the client will not be using this protocol
55+ object anymore. This does not affect any other objects,
56+ wp_fractional_scale_v1 objects included.
57+ </description>
58+ </request>
59+
60+ <enum name="error">
61+ <entry name="fractional_scale_exists" value="0"
62+ summary="the surface already has a fractional_scale object associated"/>
63+ </enum>
64+
65+ <request name="get_fractional_scale">
66+ <description summary="extend surface interface for scale information">
67+ Create an add-on object for the the wl_surface to let the compositor
68+ request fractional scales. If the given wl_surface already has a
69+ wp_fractional_scale_v1 object associated, the fractional_scale_exists
70+ protocol error is raised.
71+ </description>
72+ <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
73+ summary="the new surface scale info interface id"/>
74+ <arg name="surface" type="object" interface="wl_surface"
75+ summary="the surface"/>
76+ </request>
77+ </interface>
78+
79+ <interface name="wp_fractional_scale_v1" version="1">
80+ <description summary="fractional scale interface to a wl_surface">
81+ An additional interface to a wl_surface object which allows the compositor
82+ to inform the client of the preferred scale.
83+ </description>
84+
85+ <request name="destroy" type="destructor">
86+ <description summary="remove surface scale information for surface">
87+ Destroy the fractional scale object. When this object is destroyed,
88+ preferred_scale events will no longer be sent.
89+ </description>
90+ </request>
91+
92+ <event name="preferred_scale">
93+ <description summary="notify of new preferred scale">
94+ Notification of a new preferred scale for this surface that the
95+ compositor suggests that the client should use.
96+
97+ The sent scale is the numerator of a fraction with a denominator of 120.
98+ </description>
99+ <arg name="scale" type="uint" summary="the new preferred scale"/>
100+ </event>
101+ </interface>
102+</protocol>
A protocols/viewporter.xml +177 -0
@@ -0,0 +1,177 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="viewporter">
3+
4+ <copyright>
5+ Copyright © 2013-2016 Collabora, Ltd.
6+
7+ Permission is hereby granted, free of charge, to any person obtaining a
8+ copy of this software and associated documentation files (the "Software"),
9+ to deal in the Software without restriction, including without limitation
10+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
11+ and/or sell copies of the Software, and to permit persons to whom the
12+ Software is furnished to do so, subject to the following conditions:
13+
14+ The above copyright notice and this permission notice (including the next
15+ paragraph) shall be included in all copies or substantial portions of the
16+ Software.
17+
18+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24+ DEALINGS IN THE SOFTWARE.
25+ </copyright>
26+
27+ <interface name="wp_viewporter" version="1">
28+ <description summary="surface cropping and scaling">
29+ The global interface exposing surface cropping and scaling
30+ capabilities is used to instantiate an interface extension for a
31+ wl_surface object. This extended interface will then allow
32+ cropping and scaling the surface contents, effectively
33+ disconnecting the direct relationship between the buffer and the
34+ surface size.
35+ </description>
36+
37+ <request name="destroy" type="destructor">
38+ <description summary="unbind from the cropping and scaling interface">
39+ Informs the server that the client will not be using this
40+ protocol object anymore. This does not affect any other objects,
41+ wp_viewport objects included.
42+ </description>
43+ </request>
44+
45+ <enum name="error">
46+ <entry name="viewport_exists" value="0"
47+ summary="the surface already has a viewport object associated"/>
48+ </enum>
49+
50+ <request name="get_viewport">
51+ <description summary="extend surface interface for crop and scale">
52+ Instantiate an interface extension for the given wl_surface to
53+ crop and scale its content. If the given wl_surface already has
54+ a wp_viewport object associated, the viewport_exists
55+ protocol error is raised.
56+ </description>
57+ <arg name="id" type="new_id" interface="wp_viewport"
58+ summary="the new viewport interface id"/>
59+ <arg name="surface" type="object" interface="wl_surface"
60+ summary="the surface"/>
61+ </request>
62+ </interface>
63+
64+ <interface name="wp_viewport" version="1">
65+ <description summary="crop and scale interface to a wl_surface">
66+ An additional interface to a wl_surface object, which allows the
67+ client to specify the cropping and scaling of the surface
68+ contents.
69+
70+ This interface works with two concepts: the source rectangle (src_x,
71+ src_y, src_width, src_height), and the destination size (dst_width,
72+ dst_height). The contents of the source rectangle are scaled to the
73+ destination size, and content outside the source rectangle is ignored.
74+ This state is double-buffered, see wl_surface.commit.
75+
76+ The two parts of crop and scale state are independent: the source
77+ rectangle, and the destination size. Initially both are unset, that
78+ is, no scaling is applied. The whole of the current wl_buffer is
79+ used as the source, and the surface size is as defined in
80+ wl_surface.attach.
81+
82+ If the destination size is set, it causes the surface size to become
83+ dst_width, dst_height. The source (rectangle) is scaled to exactly
84+ this size. This overrides whatever the attached wl_buffer size is,
85+ unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
86+ has no content and therefore no size. Otherwise, the size is always
87+ at least 1x1 in surface local coordinates.
88+
89+ If the source rectangle is set, it defines what area of the wl_buffer is
90+ taken as the source. If the source rectangle is set and the destination
91+ size is not set, then src_width and src_height must be integers, and the
92+ surface size becomes the source rectangle size. This results in cropping
93+ without scaling. If src_width or src_height are not integers and
94+ destination size is not set, the bad_size protocol error is raised when
95+ the surface state is applied.
96+
97+ The coordinate transformations from buffer pixel coordinates up to
98+ the surface-local coordinates happen in the following order:
99+ 1. buffer_transform (wl_surface.set_buffer_transform)
100+ 2. buffer_scale (wl_surface.set_buffer_scale)
101+ 3. crop and scale (wp_viewport.set*)
102+ This means, that the source rectangle coordinates of crop and scale
103+ are given in the coordinates after the buffer transform and scale,
104+ i.e. in the coordinates that would be the surface-local coordinates
105+ if the crop and scale was not applied.
106+
107+ If src_x or src_y are negative, the bad_value protocol error is raised.
108+ Otherwise, if the source rectangle is partially or completely outside of
109+ the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
110+ when the surface state is applied. A NULL wl_buffer does not raise the
111+ out_of_buffer error.
112+
113+ If the wl_surface associated with the wp_viewport is destroyed,
114+ all wp_viewport requests except 'destroy' raise the protocol error
115+ no_surface.
116+
117+ If the wp_viewport object is destroyed, the crop and scale
118+ state is removed from the wl_surface. The change will be applied
119+ on the next wl_surface.commit.
120+ </description>
121+
122+ <request name="destroy" type="destructor">
123+ <description summary="remove scaling and cropping from the surface">
124+ The associated wl_surface's crop and scale state is removed.
125+ The change is applied on the next wl_surface.commit.
126+ </description>
127+ </request>
128+
129+ <enum name="error">
130+ <entry name="bad_value" value="0"
131+ summary="negative or zero values in width or height"/>
132+ <entry name="bad_size" value="1"
133+ summary="destination size is not integer"/>
134+ <entry name="out_of_buffer" value="2"
135+ summary="source rectangle extends outside of the content area"/>
136+ <entry name="no_surface" value="3"
137+ summary="the wl_surface was destroyed"/>
138+ </enum>
139+
140+ <request name="set_source">
141+ <description summary="set the source rectangle for cropping">
142+ Set the source rectangle of the associated wl_surface. See
143+ wp_viewport for the description, and relation to the wl_buffer
144+ size.
145+
146+ If all of x, y, width and height are -1.0, the source rectangle is
147+ unset instead. Any other set of values where width or height are zero
148+ or negative, or x or y are negative, raise the bad_value protocol
149+ error.
150+
151+ The crop and scale state is double-buffered, see wl_surface.commit.
152+ </description>
153+ <arg name="x" type="fixed" summary="source rectangle x"/>
154+ <arg name="y" type="fixed" summary="source rectangle y"/>
155+ <arg name="width" type="fixed" summary="source rectangle width"/>
156+ <arg name="height" type="fixed" summary="source rectangle height"/>
157+ </request>
158+
159+ <request name="set_destination">
160+ <description summary="set the surface size for scaling">
161+ Set the destination size of the associated wl_surface. See
162+ wp_viewport for the description, and relation to the wl_buffer
163+ size.
164+
165+ If width is -1 and height is -1, the destination size is unset
166+ instead. Any other pair of values for width and height that
167+ contains zero or negative values raises the bad_value protocol
168+ error.
169+
170+ The crop and scale state is double-buffered, see wl_surface.commit.
171+ </description>
172+ <arg name="width" type="int" summary="surface width"/>
173+ <arg name="height" type="int" summary="surface height"/>
174+ </request>
175+ </interface>
176+
177+</protocol>
@@ -0,0 +1,177 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="viewporter">
3+
4+ <copyright>
5+ Copyright © 2013-2016 Collabora, Ltd.
6+
7+ Permission is hereby granted, free of charge, to any person obtaining a
8+ copy of this software and associated documentation files (the "Software"),
9+ to deal in the Software without restriction, including without limitation
10+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
11+ and/or sell copies of the Software, and to permit persons to whom the
12+ Software is furnished to do so, subject to the following conditions:
13+
14+ The above copyright notice and this permission notice (including the next
15+ paragraph) shall be included in all copies or substantial portions of the
16+ Software.
17+
18+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24+ DEALINGS IN THE SOFTWARE.
25+ </copyright>
26+
27+ <interface name="wp_viewporter" version="1">
28+ <description summary="surface cropping and scaling">
29+ The global interface exposing surface cropping and scaling
30+ capabilities is used to instantiate an interface extension for a
31+ wl_surface object. This extended interface will then allow
32+ cropping and scaling the surface contents, effectively
33+ disconnecting the direct relationship between the buffer and the
34+ surface size.
35+ </description>
36+
37+ <request name="destroy" type="destructor">
38+ <description summary="unbind from the cropping and scaling interface">
39+ Informs the server that the client will not be using this
40+ protocol object anymore. This does not affect any other objects,
41+ wp_viewport objects included.
42+ </description>
43+ </request>
44+
45+ <enum name="error">
46+ <entry name="viewport_exists" value="0"
47+ summary="the surface already has a viewport object associated"/>
48+ </enum>
49+
50+ <request name="get_viewport">
51+ <description summary="extend surface interface for crop and scale">
52+ Instantiate an interface extension for the given wl_surface to
53+ crop and scale its content. If the given wl_surface already has
54+ a wp_viewport object associated, the viewport_exists
55+ protocol error is raised.
56+ </description>
57+ <arg name="id" type="new_id" interface="wp_viewport"
58+ summary="the new viewport interface id"/>
59+ <arg name="surface" type="object" interface="wl_surface"
60+ summary="the surface"/>
61+ </request>
62+ </interface>
63+
64+ <interface name="wp_viewport" version="1">
65+ <description summary="crop and scale interface to a wl_surface">
66+ An additional interface to a wl_surface object, which allows the
67+ client to specify the cropping and scaling of the surface
68+ contents.
69+
70+ This interface works with two concepts: the source rectangle (src_x,
71+ src_y, src_width, src_height), and the destination size (dst_width,
72+ dst_height). The contents of the source rectangle are scaled to the
73+ destination size, and content outside the source rectangle is ignored.
74+ This state is double-buffered, see wl_surface.commit.
75+
76+ The two parts of crop and scale state are independent: the source
77+ rectangle, and the destination size. Initially both are unset, that
78+ is, no scaling is applied. The whole of the current wl_buffer is
79+ used as the source, and the surface size is as defined in
80+ wl_surface.attach.
81+
82+ If the destination size is set, it causes the surface size to become
83+ dst_width, dst_height. The source (rectangle) is scaled to exactly
84+ this size. This overrides whatever the attached wl_buffer size is,
85+ unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
86+ has no content and therefore no size. Otherwise, the size is always
87+ at least 1x1 in surface local coordinates.
88+
89+ If the source rectangle is set, it defines what area of the wl_buffer is
90+ taken as the source. If the source rectangle is set and the destination
91+ size is not set, then src_width and src_height must be integers, and the
92+ surface size becomes the source rectangle size. This results in cropping
93+ without scaling. If src_width or src_height are not integers and
94+ destination size is not set, the bad_size protocol error is raised when
95+ the surface state is applied.
96+
97+ The coordinate transformations from buffer pixel coordinates up to
98+ the surface-local coordinates happen in the following order:
99+ 1. buffer_transform (wl_surface.set_buffer_transform)
100+ 2. buffer_scale (wl_surface.set_buffer_scale)
101+ 3. crop and scale (wp_viewport.set*)
102+ This means, that the source rectangle coordinates of crop and scale
103+ are given in the coordinates after the buffer transform and scale,
104+ i.e. in the coordinates that would be the surface-local coordinates
105+ if the crop and scale was not applied.
106+
107+ If src_x or src_y are negative, the bad_value protocol error is raised.
108+ Otherwise, if the source rectangle is partially or completely outside of
109+ the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
110+ when the surface state is applied. A NULL wl_buffer does not raise the
111+ out_of_buffer error.
112+
113+ If the wl_surface associated with the wp_viewport is destroyed,
114+ all wp_viewport requests except 'destroy' raise the protocol error
115+ no_surface.
116+
117+ If the wp_viewport object is destroyed, the crop and scale
118+ state is removed from the wl_surface. The change will be applied
119+ on the next wl_surface.commit.
120+ </description>
121+
122+ <request name="destroy" type="destructor">
123+ <description summary="remove scaling and cropping from the surface">
124+ The associated wl_surface's crop and scale state is removed.
125+ The change is applied on the next wl_surface.commit.
126+ </description>
127+ </request>
128+
129+ <enum name="error">
130+ <entry name="bad_value" value="0"
131+ summary="negative or zero values in width or height"/>
132+ <entry name="bad_size" value="1"
133+ summary="destination size is not integer"/>
134+ <entry name="out_of_buffer" value="2"
135+ summary="source rectangle extends outside of the content area"/>
136+ <entry name="no_surface" value="3"
137+ summary="the wl_surface was destroyed"/>
138+ </enum>
139+
140+ <request name="set_source">
141+ <description summary="set the source rectangle for cropping">
142+ Set the source rectangle of the associated wl_surface. See
143+ wp_viewport for the description, and relation to the wl_buffer
144+ size.
145+
146+ If all of x, y, width and height are -1.0, the source rectangle is
147+ unset instead. Any other set of values where width or height are zero
148+ or negative, or x or y are negative, raise the bad_value protocol
149+ error.
150+
151+ The crop and scale state is double-buffered, see wl_surface.commit.
152+ </description>
153+ <arg name="x" type="fixed" summary="source rectangle x"/>
154+ <arg name="y" type="fixed" summary="source rectangle y"/>
155+ <arg name="width" type="fixed" summary="source rectangle width"/>
156+ <arg name="height" type="fixed" summary="source rectangle height"/>
157+ </request>
158+
159+ <request name="set_destination">
160+ <description summary="set the surface size for scaling">
161+ Set the destination size of the associated wl_surface. See
162+ wp_viewport for the description, and relation to the wl_buffer
163+ size.
164+
165+ If width is -1 and height is -1, the destination size is unset
166+ instead. Any other pair of values for width and height that
167+ contains zero or negative values raises the bad_value protocol
168+ error.
169+
170+ The crop and scale state is double-buffered, see wl_surface.commit.
171+ </description>
172+ <arg name="width" type="int" summary="surface width"/>
173+ <arg name="height" type="int" summary="surface height"/>
174+ </request>
175+ </interface>
176+
177+</protocol>

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 14

↑↓ moveenter openesc close