feat(protocol): vendor wlr-layer-shell-unstable-v1
- commit
- e62a5543a1ff73237b677f11cefaae76346289e1
- author
- brice · · 2026-09-23 16:05 UTC
- parent
- c5f3abc
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +668 -0
M protocol/gen.go +1 -0
| @@ -3,3 +3,4 @@ package protocol | |||
| 3 | 3 | ||
| 4 | 4 | //go:generate go run ../cmd/wlgen -package wayland -out wayland/wayland.go ../protocols/wayland.xml | |
| 5 | 5 | //go:generate go run ../cmd/wlgen -package xdgshell -out xdgshell/xdgshell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-shell.xml | |
| 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.xml | |
| @@ -3,3 +3,4 @@ package protocol | |||||
| 3 | 3 | ||||
| 4 | //go:generate go run ../cmd/wlgen -package wayland -out wayland/wayland.go ../protocols/wayland.xml | 4 | //go:generate go run ../cmd/wlgen -package wayland -out wayland/wayland.go ../protocols/wayland.xml | ||
| 5 | //go:generate go run ../cmd/wlgen -package xdgshell -out xdgshell/xdgshell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-shell.xml | 5 | //go:generate go run ../cmd/wlgen -package xdgshell -out xdgshell/xdgshell.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/xdg-shell.xml | ||
| 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.xml | |||
A protocol/wlrlayershell/wlrlayershell.go +240 -0
| @@ -0,0 +1,240 @@ | |||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |
| 2 | + | package wlrlayershell | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "fmt" | |
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |
| 7 | + | xdgshell "github.com/bnema/purego-libwayland/protocol/xdgshell" | |
| 8 | + | "github.com/bnema/purego-libwayland/server" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | var ZwlrLayerShellV1Interface *server.Interface | |
| 12 | + | var ZwlrLayerSurfaceV1Interface *server.Interface | |
| 13 | + | ||
| 14 | + | func init() { | |
| 15 | + | ZwlrLayerShellV1Interface = &server.Interface{Name: "zwlr_layer_shell_v1", Version: 5} | |
| 16 | + | ZwlrLayerSurfaceV1Interface = &server.Interface{Name: "zwlr_layer_surface_v1", Version: 5} | |
| 17 | + | ZwlrLayerShellV1Interface.Requests = []server.Message{ | |
| 18 | + | {Name: "get_layer_surface", Signature: "no?ous", Types: []*server.Interface{ZwlrLayerSurfaceV1Interface, wayland.SurfaceInterface, wayland.OutputInterface, nil, nil}}, | |
| 19 | + | {Name: "destroy", Signature: "3", Types: []*server.Interface{}}, | |
| 20 | + | } | |
| 21 | + | ZwlrLayerShellV1Interface.Events = []server.Message{} | |
| 22 | + | ZwlrLayerSurfaceV1Interface.Requests = []server.Message{ | |
| 23 | + | {Name: "set_size", Signature: "uu", Types: []*server.Interface{nil, nil}}, | |
| 24 | + | {Name: "set_anchor", Signature: "u", Types: []*server.Interface{nil}}, | |
| 25 | + | {Name: "set_exclusive_zone", Signature: "i", Types: []*server.Interface{nil}}, | |
| 26 | + | {Name: "set_margin", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}}, | |
| 27 | + | {Name: "set_keyboard_interactivity", Signature: "u", Types: []*server.Interface{nil}}, | |
| 28 | + | {Name: "get_popup", Signature: "o", Types: []*server.Interface{xdgshell.PopupInterface}}, | |
| 29 | + | {Name: "ack_configure", Signature: "u", Types: []*server.Interface{nil}}, | |
| 30 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 31 | + | {Name: "set_layer", Signature: "2u", Types: []*server.Interface{nil}}, | |
| 32 | + | {Name: "set_exclusive_edge", Signature: "5u", Types: []*server.Interface{nil}}, | |
| 33 | + | } | |
| 34 | + | ZwlrLayerSurfaceV1Interface.Events = []server.Message{ | |
| 35 | + | {Name: "configure", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}}, | |
| 36 | + | {Name: "closed", Signature: "", Types: []*server.Interface{}}, | |
| 37 | + | } | |
| 38 | + | if err := server.NewInterfaces(ZwlrLayerShellV1Interface, ZwlrLayerSurfaceV1Interface); err != nil { | |
| 39 | + | panic(err) | |
| 40 | + | } | |
| 41 | + | } | |
| 42 | + | ||
| 43 | + | // ZwlrLayerShellV1 create surfaces that are layers of the desktop. | |
| 44 | + | type ZwlrLayerShellV1 struct{ *server.Resource } | |
| 45 | + | ||
| 46 | + | func WrapZwlrLayerShellV1(r *server.Resource) *ZwlrLayerShellV1 { | |
| 47 | + | if r == nil { | |
| 48 | + | return nil | |
| 49 | + | } | |
| 50 | + | return &ZwlrLayerShellV1{r} | |
| 51 | + | } | |
| 52 | + | ||
| 53 | + | const ZwlrLayerShellV1RequestGetLayerSurface uint32 = 0 | |
| 54 | + | const ZwlrLayerShellV1RequestDestroy uint32 = 1 | |
| 55 | + | ||
| 56 | + | // ZwlrLayerShellV1Error . | |
| 57 | + | type ZwlrLayerShellV1Error uint32 | |
| 58 | + | ||
| 59 | + | const ( | |
| 60 | + | ZwlrLayerShellV1ErrorRole ZwlrLayerShellV1Error = 0 | |
| 61 | + | ZwlrLayerShellV1ErrorInvalidLayer ZwlrLayerShellV1Error = 1 | |
| 62 | + | ZwlrLayerShellV1ErrorAlreadyConstructed ZwlrLayerShellV1Error = 2 | |
| 63 | + | ) | |
| 64 | + | ||
| 65 | + | // ZwlrLayerShellV1Layer available layers for surfaces. | |
| 66 | + | type ZwlrLayerShellV1Layer uint32 | |
| 67 | + | ||
| 68 | + | const ( | |
| 69 | + | ZwlrLayerShellV1LayerBackground ZwlrLayerShellV1Layer = 0 | |
| 70 | + | ZwlrLayerShellV1LayerBottom ZwlrLayerShellV1Layer = 1 | |
| 71 | + | ZwlrLayerShellV1LayerTop ZwlrLayerShellV1Layer = 2 | |
| 72 | + | ZwlrLayerShellV1LayerOverlay ZwlrLayerShellV1Layer = 3 | |
| 73 | + | ) | |
| 74 | + | ||
| 75 | + | // ZwlrLayerShellV1Handler handles zwlr_layer_shell_v1 requests. | |
| 76 | + | type ZwlrLayerShellV1Handler interface { | |
| 77 | + | GetLayerSurface(self *ZwlrLayerShellV1, id uint32, surface *wayland.Surface, output *wayland.Output, layer uint32, namespace string) | |
| 78 | + | Destroy(self *ZwlrLayerShellV1) | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | func NewZwlrLayerShellV1(c server.Client, version int32, id uint32, h ZwlrLayerShellV1Handler) (*ZwlrLayerShellV1, error) { | |
| 82 | + | if h == nil { | |
| 83 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_shell_v1") | |
| 84 | + | } | |
| 85 | + | var self *ZwlrLayerShellV1 | |
| 86 | + | r, err := c.CreateResource(ZwlrLayerShellV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 87 | + | switch opcode { | |
| 88 | + | case 0: | |
| 89 | + | h.GetLayerSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapOutput(args[2].Resource()), args[3].Uint(), args[4].String()) | |
| 90 | + | case 1: | |
| 91 | + | h.Destroy(self) | |
| 92 | + | self.Destroy() | |
| 93 | + | } | |
| 94 | + | }) | |
| 95 | + | if err != nil { | |
| 96 | + | return nil, err | |
| 97 | + | } | |
| 98 | + | self = WrapZwlrLayerShellV1(r) | |
| 99 | + | r.Data = self | |
| 100 | + | return self, nil | |
| 101 | + | } | |
| 102 | + | func NewZwlrLayerShellV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 103 | + | return d.CreateGlobal(ZwlrLayerShellV1Interface, version, bind) | |
| 104 | + | } | |
| 105 | + | ||
| 106 | + | // ZwlrLayerSurfaceV1 layer metadata interface. | |
| 107 | + | type ZwlrLayerSurfaceV1 struct{ *server.Resource } | |
| 108 | + | ||
| 109 | + | func WrapZwlrLayerSurfaceV1(r *server.Resource) *ZwlrLayerSurfaceV1 { | |
| 110 | + | if r == nil { | |
| 111 | + | return nil | |
| 112 | + | } | |
| 113 | + | return &ZwlrLayerSurfaceV1{r} | |
| 114 | + | } | |
| 115 | + | ||
| 116 | + | const ZwlrLayerSurfaceV1RequestSetSize uint32 = 0 | |
| 117 | + | const ZwlrLayerSurfaceV1RequestSetAnchor uint32 = 1 | |
| 118 | + | const ZwlrLayerSurfaceV1RequestSetExclusiveZone uint32 = 2 | |
| 119 | + | const ZwlrLayerSurfaceV1RequestSetMargin uint32 = 3 | |
| 120 | + | const ZwlrLayerSurfaceV1RequestSetKeyboardInteractivity uint32 = 4 | |
| 121 | + | const ZwlrLayerSurfaceV1RequestGetPopup uint32 = 5 | |
| 122 | + | const ZwlrLayerSurfaceV1RequestAckConfigure uint32 = 6 | |
| 123 | + | const ZwlrLayerSurfaceV1RequestDestroy uint32 = 7 | |
| 124 | + | const ZwlrLayerSurfaceV1RequestSetLayer uint32 = 8 | |
| 125 | + | const ZwlrLayerSurfaceV1RequestSetExclusiveEdge uint32 = 9 | |
| 126 | + | const ZwlrLayerSurfaceV1EventConfigure uint32 = 0 | |
| 127 | + | const ZwlrLayerSurfaceV1EventClosed uint32 = 1 | |
| 128 | + | ||
| 129 | + | // ZwlrLayerSurfaceV1KeyboardInteractivity types of keyboard interaction possible for a layer shell surface. | |
| 130 | + | type ZwlrLayerSurfaceV1KeyboardInteractivity uint32 | |
| 131 | + | ||
| 132 | + | const ( | |
| 133 | + | ZwlrLayerSurfaceV1KeyboardInteractivityNone ZwlrLayerSurfaceV1KeyboardInteractivity = 0 | |
| 134 | + | ZwlrLayerSurfaceV1KeyboardInteractivityExclusive ZwlrLayerSurfaceV1KeyboardInteractivity = 1 | |
| 135 | + | ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand ZwlrLayerSurfaceV1KeyboardInteractivity = 2 | |
| 136 | + | ) | |
| 137 | + | ||
| 138 | + | // ZwlrLayerSurfaceV1Error . | |
| 139 | + | type ZwlrLayerSurfaceV1Error uint32 | |
| 140 | + | ||
| 141 | + | const ( | |
| 142 | + | ZwlrLayerSurfaceV1ErrorInvalidSurfaceState ZwlrLayerSurfaceV1Error = 0 | |
| 143 | + | ZwlrLayerSurfaceV1ErrorInvalidSize ZwlrLayerSurfaceV1Error = 1 | |
| 144 | + | ZwlrLayerSurfaceV1ErrorInvalidAnchor ZwlrLayerSurfaceV1Error = 2 | |
| 145 | + | ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity ZwlrLayerSurfaceV1Error = 3 | |
| 146 | + | ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge ZwlrLayerSurfaceV1Error = 4 | |
| 147 | + | ) | |
| 148 | + | ||
| 149 | + | // ZwlrLayerSurfaceV1Anchor (bitfield). | |
| 150 | + | type ZwlrLayerSurfaceV1Anchor uint32 | |
| 151 | + | ||
| 152 | + | const ( | |
| 153 | + | ZwlrLayerSurfaceV1AnchorTop ZwlrLayerSurfaceV1Anchor = 1 | |
| 154 | + | ZwlrLayerSurfaceV1AnchorBottom ZwlrLayerSurfaceV1Anchor = 2 | |
| 155 | + | ZwlrLayerSurfaceV1AnchorLeft ZwlrLayerSurfaceV1Anchor = 4 | |
| 156 | + | ZwlrLayerSurfaceV1AnchorRight ZwlrLayerSurfaceV1Anchor = 8 | |
| 157 | + | ) | |
| 158 | + | ||
| 159 | + | // ZwlrLayerSurfaceV1Handler handles zwlr_layer_surface_v1 requests. | |
| 160 | + | type ZwlrLayerSurfaceV1Handler interface { | |
| 161 | + | SetSize(self *ZwlrLayerSurfaceV1, width uint32, height uint32) | |
| 162 | + | SetAnchor(self *ZwlrLayerSurfaceV1, anchor uint32) | |
| 163 | + | SetExclusiveZone(self *ZwlrLayerSurfaceV1, zone int32) | |
| 164 | + | SetMargin(self *ZwlrLayerSurfaceV1, top int32, right int32, bottom int32, left int32) | |
| 165 | + | SetKeyboardInteractivity(self *ZwlrLayerSurfaceV1, keyboardInteractivity uint32) | |
| 166 | + | GetPopup(self *ZwlrLayerSurfaceV1, popup *xdgshell.Popup) | |
| 167 | + | AckConfigure(self *ZwlrLayerSurfaceV1, serial uint32) | |
| 168 | + | Destroy(self *ZwlrLayerSurfaceV1) | |
| 169 | + | SetLayer(self *ZwlrLayerSurfaceV1, layer uint32) | |
| 170 | + | SetExclusiveEdge(self *ZwlrLayerSurfaceV1, edge uint32) | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | func NewZwlrLayerSurfaceV1(c server.Client, version int32, id uint32, h ZwlrLayerSurfaceV1Handler) (*ZwlrLayerSurfaceV1, error) { | |
| 174 | + | if h == nil { | |
| 175 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_surface_v1") | |
| 176 | + | } | |
| 177 | + | var self *ZwlrLayerSurfaceV1 | |
| 178 | + | r, err := c.CreateResource(ZwlrLayerSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 179 | + | switch opcode { | |
| 180 | + | case 0: | |
| 181 | + | h.SetSize(self, args[0].Uint(), args[1].Uint()) | |
| 182 | + | case 1: | |
| 183 | + | h.SetAnchor(self, args[0].Uint()) | |
| 184 | + | case 2: | |
| 185 | + | h.SetExclusiveZone(self, args[0].Int()) | |
| 186 | + | case 3: | |
| 187 | + | h.SetMargin(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int()) | |
| 188 | + | case 4: | |
| 189 | + | h.SetKeyboardInteractivity(self, args[0].Uint()) | |
| 190 | + | case 5: | |
| 191 | + | h.GetPopup(self, xdgshell.WrapPopup(args[0].Resource())) | |
| 192 | + | case 6: | |
| 193 | + | h.AckConfigure(self, args[0].Uint()) | |
| 194 | + | case 7: | |
| 195 | + | h.Destroy(self) | |
| 196 | + | self.Destroy() | |
| 197 | + | case 8: | |
| 198 | + | h.SetLayer(self, args[0].Uint()) | |
| 199 | + | case 9: | |
| 200 | + | h.SetExclusiveEdge(self, args[0].Uint()) | |
| 201 | + | } | |
| 202 | + | }) | |
| 203 | + | if err != nil { | |
| 204 | + | return nil, err | |
| 205 | + | } | |
| 206 | + | self = WrapZwlrLayerSurfaceV1(r) | |
| 207 | + | r.Data = self | |
| 208 | + | return self, nil | |
| 209 | + | } | |
| 210 | + | ||
| 211 | + | // SendConfigure suggest a surface change. | |
| 212 | + | func (self *ZwlrLayerSurfaceV1) SendConfigure(serial uint32, width uint32, height uint32) { | |
| 213 | + | self.PostEvent(ZwlrLayerSurfaceV1EventConfigure, server.Uint(serial), server.Uint(width), server.Uint(height)) | |
| 214 | + | } | |
| 215 | + | ||
| 216 | + | // SendClosed surface should be closed. | |
| 217 | + | func (self *ZwlrLayerSurfaceV1) SendClosed() { | |
| 218 | + | self.PostEvent(ZwlrLayerSurfaceV1EventClosed) | |
| 219 | + | } | |
| 220 | + | func NewZwlrLayerSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 221 | + | return d.CreateGlobal(ZwlrLayerSurfaceV1Interface, version, bind) | |
| 222 | + | } | |
| 223 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |
| 224 | + | if v == nil { | |
| 225 | + | return nil | |
| 226 | + | } | |
| 227 | + | return v.GetResource() | |
| 228 | + | } | |
| 229 | + | func (self *ZwlrLayerShellV1) GetResource() *server.Resource { | |
| 230 | + | if self == nil { | |
| 231 | + | return nil | |
| 232 | + | } | |
| 233 | + | return self.Resource | |
| 234 | + | } | |
| 235 | + | func (self *ZwlrLayerSurfaceV1) GetResource() *server.Resource { | |
| 236 | + | if self == nil { | |
| 237 | + | return nil | |
| 238 | + | } | |
| 239 | + | return self.Resource | |
| 240 | + | } | |
| @@ -0,0 +1,240 @@ | |||||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |||
| 2 | + | package wlrlayershell | |||
| 3 | + | ||||
| 4 | + | import ( | |||
| 5 | + | "fmt" | |||
| 6 | + | wayland "github.com/bnema/purego-libwayland/protocol/wayland" | |||
| 7 | + | xdgshell "github.com/bnema/purego-libwayland/protocol/xdgshell" | |||
| 8 | + | "github.com/bnema/purego-libwayland/server" | |||
| 9 | + | ) | |||
| 10 | + | ||||
| 11 | + | var ZwlrLayerShellV1Interface *server.Interface | |||
| 12 | + | var ZwlrLayerSurfaceV1Interface *server.Interface | |||
| 13 | + | ||||
| 14 | + | func init() { | |||
| 15 | + | ZwlrLayerShellV1Interface = &server.Interface{Name: "zwlr_layer_shell_v1", Version: 5} | |||
| 16 | + | ZwlrLayerSurfaceV1Interface = &server.Interface{Name: "zwlr_layer_surface_v1", Version: 5} | |||
| 17 | + | ZwlrLayerShellV1Interface.Requests = []server.Message{ | |||
| 18 | + | {Name: "get_layer_surface", Signature: "no?ous", Types: []*server.Interface{ZwlrLayerSurfaceV1Interface, wayland.SurfaceInterface, wayland.OutputInterface, nil, nil}}, | |||
| 19 | + | {Name: "destroy", Signature: "3", Types: []*server.Interface{}}, | |||
| 20 | + | } | |||
| 21 | + | ZwlrLayerShellV1Interface.Events = []server.Message{} | |||
| 22 | + | ZwlrLayerSurfaceV1Interface.Requests = []server.Message{ | |||
| 23 | + | {Name: "set_size", Signature: "uu", Types: []*server.Interface{nil, nil}}, | |||
| 24 | + | {Name: "set_anchor", Signature: "u", Types: []*server.Interface{nil}}, | |||
| 25 | + | {Name: "set_exclusive_zone", Signature: "i", Types: []*server.Interface{nil}}, | |||
| 26 | + | {Name: "set_margin", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}}, | |||
| 27 | + | {Name: "set_keyboard_interactivity", Signature: "u", Types: []*server.Interface{nil}}, | |||
| 28 | + | {Name: "get_popup", Signature: "o", Types: []*server.Interface{xdgshell.PopupInterface}}, | |||
| 29 | + | {Name: "ack_configure", Signature: "u", Types: []*server.Interface{nil}}, | |||
| 30 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 31 | + | {Name: "set_layer", Signature: "2u", Types: []*server.Interface{nil}}, | |||
| 32 | + | {Name: "set_exclusive_edge", Signature: "5u", Types: []*server.Interface{nil}}, | |||
| 33 | + | } | |||
| 34 | + | ZwlrLayerSurfaceV1Interface.Events = []server.Message{ | |||
| 35 | + | {Name: "configure", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}}, | |||
| 36 | + | {Name: "closed", Signature: "", Types: []*server.Interface{}}, | |||
| 37 | + | } | |||
| 38 | + | if err := server.NewInterfaces(ZwlrLayerShellV1Interface, ZwlrLayerSurfaceV1Interface); err != nil { | |||
| 39 | + | panic(err) | |||
| 40 | + | } | |||
| 41 | + | } | |||
| 42 | + | ||||
| 43 | + | // ZwlrLayerShellV1 create surfaces that are layers of the desktop. | |||
| 44 | + | type ZwlrLayerShellV1 struct{ *server.Resource } | |||
| 45 | + | ||||
| 46 | + | func WrapZwlrLayerShellV1(r *server.Resource) *ZwlrLayerShellV1 { | |||
| 47 | + | if r == nil { | |||
| 48 | + | return nil | |||
| 49 | + | } | |||
| 50 | + | return &ZwlrLayerShellV1{r} | |||
| 51 | + | } | |||
| 52 | + | ||||
| 53 | + | const ZwlrLayerShellV1RequestGetLayerSurface uint32 = 0 | |||
| 54 | + | const ZwlrLayerShellV1RequestDestroy uint32 = 1 | |||
| 55 | + | ||||
| 56 | + | // ZwlrLayerShellV1Error . | |||
| 57 | + | type ZwlrLayerShellV1Error uint32 | |||
| 58 | + | ||||
| 59 | + | const ( | |||
| 60 | + | ZwlrLayerShellV1ErrorRole ZwlrLayerShellV1Error = 0 | |||
| 61 | + | ZwlrLayerShellV1ErrorInvalidLayer ZwlrLayerShellV1Error = 1 | |||
| 62 | + | ZwlrLayerShellV1ErrorAlreadyConstructed ZwlrLayerShellV1Error = 2 | |||
| 63 | + | ) | |||
| 64 | + | ||||
| 65 | + | // ZwlrLayerShellV1Layer available layers for surfaces. | |||
| 66 | + | type ZwlrLayerShellV1Layer uint32 | |||
| 67 | + | ||||
| 68 | + | const ( | |||
| 69 | + | ZwlrLayerShellV1LayerBackground ZwlrLayerShellV1Layer = 0 | |||
| 70 | + | ZwlrLayerShellV1LayerBottom ZwlrLayerShellV1Layer = 1 | |||
| 71 | + | ZwlrLayerShellV1LayerTop ZwlrLayerShellV1Layer = 2 | |||
| 72 | + | ZwlrLayerShellV1LayerOverlay ZwlrLayerShellV1Layer = 3 | |||
| 73 | + | ) | |||
| 74 | + | ||||
| 75 | + | // ZwlrLayerShellV1Handler handles zwlr_layer_shell_v1 requests. | |||
| 76 | + | type ZwlrLayerShellV1Handler interface { | |||
| 77 | + | GetLayerSurface(self *ZwlrLayerShellV1, id uint32, surface *wayland.Surface, output *wayland.Output, layer uint32, namespace string) | |||
| 78 | + | Destroy(self *ZwlrLayerShellV1) | |||
| 79 | + | } | |||
| 80 | + | ||||
| 81 | + | func NewZwlrLayerShellV1(c server.Client, version int32, id uint32, h ZwlrLayerShellV1Handler) (*ZwlrLayerShellV1, error) { | |||
| 82 | + | if h == nil { | |||
| 83 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_shell_v1") | |||
| 84 | + | } | |||
| 85 | + | var self *ZwlrLayerShellV1 | |||
| 86 | + | r, err := c.CreateResource(ZwlrLayerShellV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 87 | + | switch opcode { | |||
| 88 | + | case 0: | |||
| 89 | + | h.GetLayerSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapOutput(args[2].Resource()), args[3].Uint(), args[4].String()) | |||
| 90 | + | case 1: | |||
| 91 | + | h.Destroy(self) | |||
| 92 | + | self.Destroy() | |||
| 93 | + | } | |||
| 94 | + | }) | |||
| 95 | + | if err != nil { | |||
| 96 | + | return nil, err | |||
| 97 | + | } | |||
| 98 | + | self = WrapZwlrLayerShellV1(r) | |||
| 99 | + | r.Data = self | |||
| 100 | + | return self, nil | |||
| 101 | + | } | |||
| 102 | + | func NewZwlrLayerShellV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 103 | + | return d.CreateGlobal(ZwlrLayerShellV1Interface, version, bind) | |||
| 104 | + | } | |||
| 105 | + | ||||
| 106 | + | // ZwlrLayerSurfaceV1 layer metadata interface. | |||
| 107 | + | type ZwlrLayerSurfaceV1 struct{ *server.Resource } | |||
| 108 | + | ||||
| 109 | + | func WrapZwlrLayerSurfaceV1(r *server.Resource) *ZwlrLayerSurfaceV1 { | |||
| 110 | + | if r == nil { | |||
| 111 | + | return nil | |||
| 112 | + | } | |||
| 113 | + | return &ZwlrLayerSurfaceV1{r} | |||
| 114 | + | } | |||
| 115 | + | ||||
| 116 | + | const ZwlrLayerSurfaceV1RequestSetSize uint32 = 0 | |||
| 117 | + | const ZwlrLayerSurfaceV1RequestSetAnchor uint32 = 1 | |||
| 118 | + | const ZwlrLayerSurfaceV1RequestSetExclusiveZone uint32 = 2 | |||
| 119 | + | const ZwlrLayerSurfaceV1RequestSetMargin uint32 = 3 | |||
| 120 | + | const ZwlrLayerSurfaceV1RequestSetKeyboardInteractivity uint32 = 4 | |||
| 121 | + | const ZwlrLayerSurfaceV1RequestGetPopup uint32 = 5 | |||
| 122 | + | const ZwlrLayerSurfaceV1RequestAckConfigure uint32 = 6 | |||
| 123 | + | const ZwlrLayerSurfaceV1RequestDestroy uint32 = 7 | |||
| 124 | + | const ZwlrLayerSurfaceV1RequestSetLayer uint32 = 8 | |||
| 125 | + | const ZwlrLayerSurfaceV1RequestSetExclusiveEdge uint32 = 9 | |||
| 126 | + | const ZwlrLayerSurfaceV1EventConfigure uint32 = 0 | |||
| 127 | + | const ZwlrLayerSurfaceV1EventClosed uint32 = 1 | |||
| 128 | + | ||||
| 129 | + | // ZwlrLayerSurfaceV1KeyboardInteractivity types of keyboard interaction possible for a layer shell surface. | |||
| 130 | + | type ZwlrLayerSurfaceV1KeyboardInteractivity uint32 | |||
| 131 | + | ||||
| 132 | + | const ( | |||
| 133 | + | ZwlrLayerSurfaceV1KeyboardInteractivityNone ZwlrLayerSurfaceV1KeyboardInteractivity = 0 | |||
| 134 | + | ZwlrLayerSurfaceV1KeyboardInteractivityExclusive ZwlrLayerSurfaceV1KeyboardInteractivity = 1 | |||
| 135 | + | ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand ZwlrLayerSurfaceV1KeyboardInteractivity = 2 | |||
| 136 | + | ) | |||
| 137 | + | ||||
| 138 | + | // ZwlrLayerSurfaceV1Error . | |||
| 139 | + | type ZwlrLayerSurfaceV1Error uint32 | |||
| 140 | + | ||||
| 141 | + | const ( | |||
| 142 | + | ZwlrLayerSurfaceV1ErrorInvalidSurfaceState ZwlrLayerSurfaceV1Error = 0 | |||
| 143 | + | ZwlrLayerSurfaceV1ErrorInvalidSize ZwlrLayerSurfaceV1Error = 1 | |||
| 144 | + | ZwlrLayerSurfaceV1ErrorInvalidAnchor ZwlrLayerSurfaceV1Error = 2 | |||
| 145 | + | ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity ZwlrLayerSurfaceV1Error = 3 | |||
| 146 | + | ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge ZwlrLayerSurfaceV1Error = 4 | |||
| 147 | + | ) | |||
| 148 | + | ||||
| 149 | + | // ZwlrLayerSurfaceV1Anchor (bitfield). | |||
| 150 | + | type ZwlrLayerSurfaceV1Anchor uint32 | |||
| 151 | + | ||||
| 152 | + | const ( | |||
| 153 | + | ZwlrLayerSurfaceV1AnchorTop ZwlrLayerSurfaceV1Anchor = 1 | |||
| 154 | + | ZwlrLayerSurfaceV1AnchorBottom ZwlrLayerSurfaceV1Anchor = 2 | |||
| 155 | + | ZwlrLayerSurfaceV1AnchorLeft ZwlrLayerSurfaceV1Anchor = 4 | |||
| 156 | + | ZwlrLayerSurfaceV1AnchorRight ZwlrLayerSurfaceV1Anchor = 8 | |||
| 157 | + | ) | |||
| 158 | + | ||||
| 159 | + | // ZwlrLayerSurfaceV1Handler handles zwlr_layer_surface_v1 requests. | |||
| 160 | + | type ZwlrLayerSurfaceV1Handler interface { | |||
| 161 | + | SetSize(self *ZwlrLayerSurfaceV1, width uint32, height uint32) | |||
| 162 | + | SetAnchor(self *ZwlrLayerSurfaceV1, anchor uint32) | |||
| 163 | + | SetExclusiveZone(self *ZwlrLayerSurfaceV1, zone int32) | |||
| 164 | + | SetMargin(self *ZwlrLayerSurfaceV1, top int32, right int32, bottom int32, left int32) | |||
| 165 | + | SetKeyboardInteractivity(self *ZwlrLayerSurfaceV1, keyboardInteractivity uint32) | |||
| 166 | + | GetPopup(self *ZwlrLayerSurfaceV1, popup *xdgshell.Popup) | |||
| 167 | + | AckConfigure(self *ZwlrLayerSurfaceV1, serial uint32) | |||
| 168 | + | Destroy(self *ZwlrLayerSurfaceV1) | |||
| 169 | + | SetLayer(self *ZwlrLayerSurfaceV1, layer uint32) | |||
| 170 | + | SetExclusiveEdge(self *ZwlrLayerSurfaceV1, edge uint32) | |||
| 171 | + | } | |||
| 172 | + | ||||
| 173 | + | func NewZwlrLayerSurfaceV1(c server.Client, version int32, id uint32, h ZwlrLayerSurfaceV1Handler) (*ZwlrLayerSurfaceV1, error) { | |||
| 174 | + | if h == nil { | |||
| 175 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_surface_v1") | |||
| 176 | + | } | |||
| 177 | + | var self *ZwlrLayerSurfaceV1 | |||
| 178 | + | r, err := c.CreateResource(ZwlrLayerSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 179 | + | switch opcode { | |||
| 180 | + | case 0: | |||
| 181 | + | h.SetSize(self, args[0].Uint(), args[1].Uint()) | |||
| 182 | + | case 1: | |||
| 183 | + | h.SetAnchor(self, args[0].Uint()) | |||
| 184 | + | case 2: | |||
| 185 | + | h.SetExclusiveZone(self, args[0].Int()) | |||
| 186 | + | case 3: | |||
| 187 | + | h.SetMargin(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int()) | |||
| 188 | + | case 4: | |||
| 189 | + | h.SetKeyboardInteractivity(self, args[0].Uint()) | |||
| 190 | + | case 5: | |||
| 191 | + | h.GetPopup(self, xdgshell.WrapPopup(args[0].Resource())) | |||
| 192 | + | case 6: | |||
| 193 | + | h.AckConfigure(self, args[0].Uint()) | |||
| 194 | + | case 7: | |||
| 195 | + | h.Destroy(self) | |||
| 196 | + | self.Destroy() | |||
| 197 | + | case 8: | |||
| 198 | + | h.SetLayer(self, args[0].Uint()) | |||
| 199 | + | case 9: | |||
| 200 | + | h.SetExclusiveEdge(self, args[0].Uint()) | |||
| 201 | + | } | |||
| 202 | + | }) | |||
| 203 | + | if err != nil { | |||
| 204 | + | return nil, err | |||
| 205 | + | } | |||
| 206 | + | self = WrapZwlrLayerSurfaceV1(r) | |||
| 207 | + | r.Data = self | |||
| 208 | + | return self, nil | |||
| 209 | + | } | |||
| 210 | + | ||||
| 211 | + | // SendConfigure suggest a surface change. | |||
| 212 | + | func (self *ZwlrLayerSurfaceV1) SendConfigure(serial uint32, width uint32, height uint32) { | |||
| 213 | + | self.PostEvent(ZwlrLayerSurfaceV1EventConfigure, server.Uint(serial), server.Uint(width), server.Uint(height)) | |||
| 214 | + | } | |||
| 215 | + | ||||
| 216 | + | // SendClosed surface should be closed. | |||
| 217 | + | func (self *ZwlrLayerSurfaceV1) SendClosed() { | |||
| 218 | + | self.PostEvent(ZwlrLayerSurfaceV1EventClosed) | |||
| 219 | + | } | |||
| 220 | + | func NewZwlrLayerSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 221 | + | return d.CreateGlobal(ZwlrLayerSurfaceV1Interface, version, bind) | |||
| 222 | + | } | |||
| 223 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |||
| 224 | + | if v == nil { | |||
| 225 | + | return nil | |||
| 226 | + | } | |||
| 227 | + | return v.GetResource() | |||
| 228 | + | } | |||
| 229 | + | func (self *ZwlrLayerShellV1) GetResource() *server.Resource { | |||
| 230 | + | if self == nil { | |||
| 231 | + | return nil | |||
| 232 | + | } | |||
| 233 | + | return self.Resource | |||
| 234 | + | } | |||
| 235 | + | func (self *ZwlrLayerSurfaceV1) GetResource() *server.Resource { | |||
| 236 | + | if self == nil { | |||
| 237 | + | return nil | |||
| 238 | + | } | |||
| 239 | + | return self.Resource | |||
| 240 | + | } | |||
A protocol/wlrlayershell/wlrlayershell_test.go +20 -0
| @@ -0,0 +1,20 @@ | |||
| 1 | + | package wlrlayershell | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "testing" | |
| 5 | + | ||
| 6 | + | "github.com/bnema/purego-libwayland/protocol/wayland" | |
| 7 | + | "github.com/bnema/purego-libwayland/protocol/xdgshell" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | func TestImportedInterfaces(t *testing.T) { | |
| 11 | + | if got := ZwlrLayerShellV1Interface.Requests[0].Types[1]; got != wayland.SurfaceInterface { | |
| 12 | + | t.Fatalf("surface type=%v", got) | |
| 13 | + | } | |
| 14 | + | if got := ZwlrLayerShellV1Interface.Requests[0].Types[2]; got != wayland.OutputInterface { | |
| 15 | + | t.Fatalf("output type=%v", got) | |
| 16 | + | } | |
| 17 | + | if got := ZwlrLayerSurfaceV1Interface.Requests[5].Types[0]; got != xdgshell.PopupInterface { | |
| 18 | + | t.Fatalf("popup type=%v", got) | |
| 19 | + | } | |
| 20 | + | } | |
| @@ -0,0 +1,20 @@ | |||||
| 1 | + | package wlrlayershell | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "testing" | |||
| 5 | + | ||||
| 6 | + | "github.com/bnema/purego-libwayland/protocol/wayland" | |||
| 7 | + | "github.com/bnema/purego-libwayland/protocol/xdgshell" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | func TestImportedInterfaces(t *testing.T) { | |||
| 11 | + | if got := ZwlrLayerShellV1Interface.Requests[0].Types[1]; got != wayland.SurfaceInterface { | |||
| 12 | + | t.Fatalf("surface type=%v", got) | |||
| 13 | + | } | |||
| 14 | + | if got := ZwlrLayerShellV1Interface.Requests[0].Types[2]; got != wayland.OutputInterface { | |||
| 15 | + | t.Fatalf("output type=%v", got) | |||
| 16 | + | } | |||
| 17 | + | if got := ZwlrLayerSurfaceV1Interface.Requests[5].Types[0]; got != xdgshell.PopupInterface { | |||
| 18 | + | t.Fatalf("popup type=%v", got) | |||
| 19 | + | } | |||
| 20 | + | } | |||
A protocols/wlr-layer-shell-unstable-v1.xml +407 -0
| @@ -0,0 +1,407 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <protocol name="wlr_layer_shell_unstable_v1"> | |
| 3 | + | <copyright> | |
| 4 | + | Copyright © 2017 Drew DeVault | |
| 5 | + | ||
| 6 | + | Permission to use, copy, modify, distribute, and sell this | |
| 7 | + | software and its documentation for any purpose is hereby granted | |
| 8 | + | without fee, provided that the above copyright notice appear in | |
| 9 | + | all copies and that both that copyright notice and this permission | |
| 10 | + | notice appear in supporting documentation, and that the name of | |
| 11 | + | the copyright holders not be used in advertising or publicity | |
| 12 | + | pertaining to distribution of the software without specific, | |
| 13 | + | written prior permission. The copyright holders make no | |
| 14 | + | representations about the suitability of this software for any | |
| 15 | + | purpose. It is provided "as is" without express or implied | |
| 16 | + | warranty. | |
| 17 | + | ||
| 18 | + | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | |
| 19 | + | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 20 | + | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 21 | + | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 22 | + | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |
| 23 | + | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
| 24 | + | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | |
| 25 | + | THIS SOFTWARE. | |
| 26 | + | </copyright> | |
| 27 | + | ||
| 28 | + | <interface name="zwlr_layer_shell_v1" version="5"> | |
| 29 | + | <description summary="create surfaces that are layers of the desktop"> | |
| 30 | + | Clients can use this interface to assign the surface_layer role to | |
| 31 | + | wl_surfaces. Such surfaces are assigned to a "layer" of the output and | |
| 32 | + | rendered with a defined z-depth respective to each other. They may also be | |
| 33 | + | anchored to the edges and corners of a screen and specify input handling | |
| 34 | + | semantics. This interface should be suitable for the implementation of | |
| 35 | + | many desktop shell components, and a broad number of other applications | |
| 36 | + | that interact with the desktop. | |
| 37 | + | </description> | |
| 38 | + | ||
| 39 | + | <request name="get_layer_surface"> | |
| 40 | + | <description summary="create a layer_surface from a surface"> | |
| 41 | + | Create a layer surface for an existing surface. This assigns the role of | |
| 42 | + | layer_surface, or raises a protocol error if another role is already | |
| 43 | + | assigned. | |
| 44 | + | ||
| 45 | + | Creating a layer surface from a wl_surface which has a buffer attached | |
| 46 | + | or committed is a client error, and any attempts by a client to attach | |
| 47 | + | or manipulate a buffer prior to the first layer_surface.configure call | |
| 48 | + | must also be treated as errors. | |
| 49 | + | ||
| 50 | + | After creating a layer_surface object and setting it up, the client | |
| 51 | + | must perform an initial commit without any buffer attached. | |
| 52 | + | The compositor will reply with a layer_surface.configure event. | |
| 53 | + | The client must acknowledge it and is then allowed to attach a buffer | |
| 54 | + | to map the surface. | |
| 55 | + | ||
| 56 | + | You may pass NULL for output to allow the compositor to decide which | |
| 57 | + | output to use. Generally this will be the one that the user most | |
| 58 | + | recently interacted with. | |
| 59 | + | ||
| 60 | + | Clients can specify a namespace that defines the purpose of the layer | |
| 61 | + | surface. | |
| 62 | + | </description> | |
| 63 | + | <arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/> | |
| 64 | + | <arg name="surface" type="object" interface="wl_surface"/> | |
| 65 | + | <arg name="output" type="object" interface="wl_output" allow-null="true"/> | |
| 66 | + | <arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/> | |
| 67 | + | <arg name="namespace" type="string" summary="namespace for the layer surface"/> | |
| 68 | + | </request> | |
| 69 | + | ||
| 70 | + | <enum name="error"> | |
| 71 | + | <entry name="role" value="0" summary="wl_surface has another role"/> | |
| 72 | + | <entry name="invalid_layer" value="1" summary="layer value is invalid"/> | |
| 73 | + | <entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/> | |
| 74 | + | </enum> | |
| 75 | + | ||
| 76 | + | <enum name="layer"> | |
| 77 | + | <description summary="available layers for surfaces"> | |
| 78 | + | These values indicate which layers a surface can be rendered in. They | |
| 79 | + | are ordered by z depth, bottom-most first. Traditional shell surfaces | |
| 80 | + | will typically be rendered between the bottom and top layers. | |
| 81 | + | Fullscreen shell surfaces are typically rendered at the top layer. | |
| 82 | + | Multiple surfaces can share a single layer, and ordering within a | |
| 83 | + | single layer is undefined. | |
| 84 | + | </description> | |
| 85 | + | ||
| 86 | + | <entry name="background" value="0"/> | |
| 87 | + | <entry name="bottom" value="1"/> | |
| 88 | + | <entry name="top" value="2"/> | |
| 89 | + | <entry name="overlay" value="3"/> | |
| 90 | + | </enum> | |
| 91 | + | ||
| 92 | + | <!-- Version 3 additions --> | |
| 93 | + | ||
| 94 | + | <request name="destroy" type="destructor" since="3"> | |
| 95 | + | <description summary="destroy the layer_shell object"> | |
| 96 | + | This request indicates that the client will not use the layer_shell | |
| 97 | + | object any more. Objects that have been created through this instance | |
| 98 | + | are not affected. | |
| 99 | + | </description> | |
| 100 | + | </request> | |
| 101 | + | </interface> | |
| 102 | + | ||
| 103 | + | <interface name="zwlr_layer_surface_v1" version="5"> | |
| 104 | + | <description summary="layer metadata interface"> | |
| 105 | + | An interface that may be implemented by a wl_surface, for surfaces that | |
| 106 | + | are designed to be rendered as a layer of a stacked desktop-like | |
| 107 | + | environment. | |
| 108 | + | ||
| 109 | + | Layer surface state (layer, size, anchor, exclusive zone, | |
| 110 | + | margin, interactivity) is double-buffered, and will be applied at the | |
| 111 | + | time wl_surface.commit of the corresponding wl_surface is called. | |
| 112 | + | ||
| 113 | + | Attaching a null buffer to a layer surface unmaps it. | |
| 114 | + | ||
| 115 | + | Unmapping a layer_surface means that the surface cannot be shown by the | |
| 116 | + | compositor until it is explicitly mapped again. The layer_surface | |
| 117 | + | returns to the state it had right after layer_shell.get_layer_surface. | |
| 118 | + | The client can re-map the surface by performing a commit without any | |
| 119 | + | buffer attached, waiting for a configure event and handling it as usual. | |
| 120 | + | </description> | |
| 121 | + | ||
| 122 | + | <request name="set_size"> | |
| 123 | + | <description summary="sets the size of the surface"> | |
| 124 | + | Sets the size of the surface in surface-local coordinates. The | |
| 125 | + | compositor will display the surface centered with respect to its | |
| 126 | + | anchors. | |
| 127 | + | ||
| 128 | + | If you pass 0 for either value, the compositor will assign it and | |
| 129 | + | inform you of the assignment in the configure event. You must set your | |
| 130 | + | anchor to opposite edges in the dimensions you omit; not doing so is a | |
| 131 | + | protocol error. Both values are 0 by default. | |
| 132 | + | ||
| 133 | + | Size is double-buffered, see wl_surface.commit. | |
| 134 | + | </description> | |
| 135 | + | <arg name="width" type="uint"/> | |
| 136 | + | <arg name="height" type="uint"/> | |
| 137 | + | </request> | |
| 138 | + | ||
| 139 | + | <request name="set_anchor"> | |
| 140 | + | <description summary="configures the anchor point of the surface"> | |
| 141 | + | Requests that the compositor anchor the surface to the specified edges | |
| 142 | + | and corners. If two orthogonal edges are specified (e.g. 'top' and | |
| 143 | + | 'left'), then the anchor point will be the intersection of the edges | |
| 144 | + | (e.g. the top left corner of the output); otherwise the anchor point | |
| 145 | + | will be centered on that edge, or in the center if none is specified. | |
| 146 | + | ||
| 147 | + | Anchor is double-buffered, see wl_surface.commit. | |
| 148 | + | </description> | |
| 149 | + | <arg name="anchor" type="uint" enum="anchor"/> | |
| 150 | + | </request> | |
| 151 | + | ||
| 152 | + | <request name="set_exclusive_zone"> | |
| 153 | + | <description summary="configures the exclusive geometry of this surface"> | |
| 154 | + | Requests that the compositor avoids occluding an area with other | |
| 155 | + | surfaces. The compositor's use of this information is | |
| 156 | + | implementation-dependent - do not assume that this region will not | |
| 157 | + | actually be occluded. | |
| 158 | + | ||
| 159 | + | A positive value is only meaningful if the surface is anchored to one | |
| 160 | + | edge or an edge and both perpendicular edges. If the surface is not | |
| 161 | + | anchored, anchored to only two perpendicular edges (a corner), anchored | |
| 162 | + | to only two parallel edges or anchored to all edges, a positive value | |
| 163 | + | will be treated the same as zero. | |
| 164 | + | ||
| 165 | + | A positive zone is the distance from the edge in surface-local | |
| 166 | + | coordinates to consider exclusive. | |
| 167 | + | ||
| 168 | + | Surfaces that do not wish to have an exclusive zone may instead specify | |
| 169 | + | how they should interact with surfaces that do. If set to zero, the | |
| 170 | + | surface indicates that it would like to be moved to avoid occluding | |
| 171 | + | surfaces with a positive exclusive zone. If set to -1, the surface | |
| 172 | + | indicates that it would not like to be moved to accommodate for other | |
| 173 | + | surfaces, and the compositor should extend it all the way to the edges | |
| 174 | + | it is anchored to. | |
| 175 | + | ||
| 176 | + | For example, a panel might set its exclusive zone to 10, so that | |
| 177 | + | maximized shell surfaces are not shown on top of it. A notification | |
| 178 | + | might set its exclusive zone to 0, so that it is moved to avoid | |
| 179 | + | occluding the panel, but shell surfaces are shown underneath it. A | |
| 180 | + | wallpaper or lock screen might set their exclusive zone to -1, so that | |
| 181 | + | they stretch below or over the panel. | |
| 182 | + | ||
| 183 | + | The default value is 0. | |
| 184 | + | ||
| 185 | + | Exclusive zone is double-buffered, see wl_surface.commit. | |
| 186 | + | </description> | |
| 187 | + | <arg name="zone" type="int"/> | |
| 188 | + | </request> | |
| 189 | + | ||
| 190 | + | <request name="set_margin"> | |
| 191 | + | <description summary="sets a margin from the anchor point"> | |
| 192 | + | Requests that the surface be placed some distance away from the anchor | |
| 193 | + | point on the output, in surface-local coordinates. Setting this value | |
| 194 | + | for edges you are not anchored to has no effect. | |
| 195 | + | ||
| 196 | + | The exclusive zone includes the margin. | |
| 197 | + | ||
| 198 | + | Margin is double-buffered, see wl_surface.commit. | |
| 199 | + | </description> | |
| 200 | + | <arg name="top" type="int"/> | |
| 201 | + | <arg name="right" type="int"/> | |
| 202 | + | <arg name="bottom" type="int"/> | |
| 203 | + | <arg name="left" type="int"/> | |
| 204 | + | </request> | |
| 205 | + | ||
| 206 | + | <enum name="keyboard_interactivity"> | |
| 207 | + | <description summary="types of keyboard interaction possible for a layer shell surface"> | |
| 208 | + | Types of keyboard interaction possible for layer shell surfaces. The | |
| 209 | + | rationale for this is twofold: (1) some applications are not interested | |
| 210 | + | in keyboard events and not allowing them to be focused can improve the | |
| 211 | + | desktop experience; (2) some applications will want to take exclusive | |
| 212 | + | keyboard focus. | |
| 213 | + | </description> | |
| 214 | + | ||
| 215 | + | <entry name="none" value="0"> | |
| 216 | + | <description summary="no keyboard focus is possible"> | |
| 217 | + | This value indicates that this surface is not interested in keyboard | |
| 218 | + | events and the compositor should never assign it the keyboard focus. | |
| 219 | + | ||
| 220 | + | This is the default value, set for newly created layer shell surfaces. | |
| 221 | + | ||
| 222 | + | This is useful for e.g. desktop widgets that display information or | |
| 223 | + | only have interaction with non-keyboard input devices. | |
| 224 | + | </description> | |
| 225 | + | </entry> | |
| 226 | + | <entry name="exclusive" value="1"> | |
| 227 | + | <description summary="request exclusive keyboard focus"> | |
| 228 | + | Request exclusive keyboard focus if this surface is above the shell surface layer. | |
| 229 | + | ||
| 230 | + | For the top and overlay layers, the seat will always give | |
| 231 | + | exclusive keyboard focus to the top-most layer which has keyboard | |
| 232 | + | interactivity set to exclusive. If this layer contains multiple | |
| 233 | + | surfaces with keyboard interactivity set to exclusive, the compositor | |
| 234 | + | determines the one receiving keyboard events in an implementation- | |
| 235 | + | defined manner. In this case, no guarantee is made when this surface | |
| 236 | + | will receive keyboard focus (if ever). | |
| 237 | + | ||
| 238 | + | For the bottom and background layers, the compositor is allowed to use | |
| 239 | + | normal focus semantics. | |
| 240 | + | ||
| 241 | + | This setting is mainly intended for applications that need to ensure | |
| 242 | + | they receive all keyboard events, such as a lock screen or a password | |
| 243 | + | prompt. | |
| 244 | + | </description> | |
| 245 | + | </entry> | |
| 246 | + | <entry name="on_demand" value="2" since="4"> | |
| 247 | + | <description summary="request regular keyboard focus semantics"> | |
| 248 | + | This requests the compositor to allow this surface to be focused and | |
| 249 | + | unfocused by the user in an implementation-defined manner. The user | |
| 250 | + | should be able to unfocus this surface even regardless of the layer | |
| 251 | + | it is on. | |
| 252 | + | ||
| 253 | + | Typically, the compositor will want to use its normal mechanism to | |
| 254 | + | manage keyboard focus between layer shell surfaces with this setting | |
| 255 | + | and regular toplevels on the desktop layer (e.g. click to focus). | |
| 256 | + | Nevertheless, it is possible for a compositor to require a special | |
| 257 | + | interaction to focus or unfocus layer shell surfaces (e.g. requiring | |
| 258 | + | a click even if focus follows the mouse normally, or providing a | |
| 259 | + | keybinding to switch focus between layers). | |
| 260 | + | ||
| 261 | + | This setting is mainly intended for desktop shell components (e.g. | |
| 262 | + | panels) that allow keyboard interaction. Using this option can allow | |
| 263 | + | implementing a desktop shell that can be fully usable without the | |
| 264 | + | mouse. | |
| 265 | + | </description> | |
| 266 | + | </entry> | |
| 267 | + | </enum> | |
| 268 | + | ||
| 269 | + | <request name="set_keyboard_interactivity"> | |
| 270 | + | <description summary="requests keyboard events"> | |
| 271 | + | Set how keyboard events are delivered to this surface. By default, | |
| 272 | + | layer shell surfaces do not receive keyboard events; this request can | |
| 273 | + | be used to change this. | |
| 274 | + | ||
| 275 | + | This setting is inherited by child surfaces set by the get_popup | |
| 276 | + | request. | |
| 277 | + | ||
| 278 | + | Layer surfaces receive pointer, touch, and tablet events normally. If | |
| 279 | + | you do not want to receive them, set the input region on your surface | |
| 280 | + | to an empty region. | |
| 281 | + | ||
| 282 | + | Keyboard interactivity is double-buffered, see wl_surface.commit. | |
| 283 | + | </description> | |
| 284 | + | <arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/> | |
| 285 | + | </request> | |
| 286 | + | ||
| 287 | + | <request name="get_popup"> | |
| 288 | + | <description summary="assign this layer_surface as an xdg_popup parent"> | |
| 289 | + | This assigns an xdg_popup's parent to this layer_surface. This popup | |
| 290 | + | should have been created via xdg_surface::get_popup with the parent set | |
| 291 | + | to NULL, and this request must be invoked before committing the popup's | |
| 292 | + | initial state. | |
| 293 | + | ||
| 294 | + | See the documentation of xdg_popup for more details about what an | |
| 295 | + | xdg_popup is and how it is used. | |
| 296 | + | </description> | |
| 297 | + | <arg name="popup" type="object" interface="xdg_popup"/> | |
| 298 | + | </request> | |
| 299 | + | ||
| 300 | + | <request name="ack_configure"> | |
| 301 | + | <description summary="ack a configure event"> | |
| 302 | + | When a configure event is received, if a client commits the | |
| 303 | + | surface in response to the configure event, then the client | |
| 304 | + | must make an ack_configure request sometime before the commit | |
| 305 | + | request, passing along the serial of the configure event. | |
| 306 | + | ||
| 307 | + | If the client receives multiple configure events before it | |
| 308 | + | can respond to one, it only has to ack the last configure event. | |
| 309 | + | ||
| 310 | + | A client is not required to commit immediately after sending | |
| 311 | + | an ack_configure request - it may even ack_configure several times | |
| 312 | + | before its next surface commit. | |
| 313 | + | ||
| 314 | + | A client may send multiple ack_configure requests before committing, but | |
| 315 | + | only the last request sent before a commit indicates which configure | |
| 316 | + | event the client really is responding to. | |
| 317 | + | </description> | |
| 318 | + | <arg name="serial" type="uint" summary="the serial from the configure event"/> | |
| 319 | + | </request> | |
| 320 | + | ||
| 321 | + | <request name="destroy" type="destructor"> | |
| 322 | + | <description summary="destroy the layer_surface"> | |
| 323 | + | This request destroys the layer surface. | |
| 324 | + | </description> | |
| 325 | + | </request> | |
| 326 | + | ||
| 327 | + | <event name="configure"> | |
| 328 | + | <description summary="suggest a surface change"> | |
| 329 | + | The configure event asks the client to resize its surface. | |
| 330 | + | ||
| 331 | + | Clients should arrange their surface for the new states, and then send | |
| 332 | + | an ack_configure request with the serial sent in this configure event at | |
| 333 | + | some point before committing the new surface. | |
| 334 | + | ||
| 335 | + | The client is free to dismiss all but the last configure event it | |
| 336 | + | received. | |
| 337 | + | ||
| 338 | + | The width and height arguments specify the size of the window in | |
| 339 | + | surface-local coordinates. | |
| 340 | + | ||
| 341 | + | The size is a hint, in the sense that the client is free to ignore it if | |
| 342 | + | it doesn't resize, pick a smaller size (to satisfy aspect ratio or | |
| 343 | + | resize in steps of NxM pixels). If the client picks a smaller size and | |
| 344 | + | is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the | |
| 345 | + | surface will be centered on this axis. | |
| 346 | + | ||
| 347 | + | If the width or height arguments are zero, it means the client should | |
| 348 | + | decide its own window dimension. | |
| 349 | + | </description> | |
| 350 | + | <arg name="serial" type="uint"/> | |
| 351 | + | <arg name="width" type="uint"/> | |
| 352 | + | <arg name="height" type="uint"/> | |
| 353 | + | </event> | |
| 354 | + | ||
| 355 | + | <event name="closed"> | |
| 356 | + | <description summary="surface should be closed"> | |
| 357 | + | The closed event is sent by the compositor when the surface will no | |
| 358 | + | longer be shown. The output may have been destroyed or the user may | |
| 359 | + | have asked for it to be removed. Further changes to the surface will be | |
| 360 | + | ignored. The client should destroy the resource after receiving this | |
| 361 | + | event, and create a new surface if they so choose. | |
| 362 | + | </description> | |
| 363 | + | </event> | |
| 364 | + | ||
| 365 | + | <enum name="error"> | |
| 366 | + | <entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/> | |
| 367 | + | <entry name="invalid_size" value="1" summary="size is invalid"/> | |
| 368 | + | <entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/> | |
| 369 | + | <entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/> | |
| 370 | + | <entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/> | |
| 371 | + | </enum> | |
| 372 | + | ||
| 373 | + | <enum name="anchor" bitfield="true"> | |
| 374 | + | <entry name="top" value="1" summary="the top edge of the anchor rectangle"/> | |
| 375 | + | <entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/> | |
| 376 | + | <entry name="left" value="4" summary="the left edge of the anchor rectangle"/> | |
| 377 | + | <entry name="right" value="8" summary="the right edge of the anchor rectangle"/> | |
| 378 | + | </enum> | |
| 379 | + | ||
| 380 | + | <!-- Version 2 additions --> | |
| 381 | + | ||
| 382 | + | <request name="set_layer" since="2"> | |
| 383 | + | <description summary="change the layer of the surface"> | |
| 384 | + | Change the layer that the surface is rendered on. | |
| 385 | + | ||
| 386 | + | Layer is double-buffered, see wl_surface.commit. | |
| 387 | + | </description> | |
| 388 | + | <arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/> | |
| 389 | + | </request> | |
| 390 | + | ||
| 391 | + | <!-- Version 5 additions --> | |
| 392 | + | ||
| 393 | + | <request name="set_exclusive_edge" since="5"> | |
| 394 | + | <description summary="set the edge the exclusive zone will be applied to"> | |
| 395 | + | Requests an edge for the exclusive zone to apply. The exclusive | |
| 396 | + | edge will be automatically deduced from anchor points when possible, | |
| 397 | + | but when the surface is anchored to a corner, it will be necessary | |
| 398 | + | to set it explicitly to disambiguate, as it is not possible to deduce | |
| 399 | + | which one of the two corner edges should be used. | |
| 400 | + | ||
| 401 | + | The edge must be one the surface is anchored to, otherwise the | |
| 402 | + | invalid_exclusive_edge protocol error will be raised. | |
| 403 | + | </description> | |
| 404 | + | <arg name="edge" type="uint" enum="anchor"/> | |
| 405 | + | </request> | |
| 406 | + | </interface> | |
| 407 | + | </protocol> | |
| @@ -0,0 +1,407 @@ | |||||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |||
| 2 | + | <protocol name="wlr_layer_shell_unstable_v1"> | |||
| 3 | + | <copyright> | |||
| 4 | + | Copyright © 2017 Drew DeVault | |||
| 5 | + | ||||
| 6 | + | Permission to use, copy, modify, distribute, and sell this | |||
| 7 | + | software and its documentation for any purpose is hereby granted | |||
| 8 | + | without fee, provided that the above copyright notice appear in | |||
| 9 | + | all copies and that both that copyright notice and this permission | |||
| 10 | + | notice appear in supporting documentation, and that the name of | |||
| 11 | + | the copyright holders not be used in advertising or publicity | |||
| 12 | + | pertaining to distribution of the software without specific, | |||
| 13 | + | written prior permission. The copyright holders make no | |||
| 14 | + | representations about the suitability of this software for any | |||
| 15 | + | purpose. It is provided "as is" without express or implied | |||
| 16 | + | warranty. | |||
| 17 | + | ||||
| 18 | + | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | |||
| 19 | + | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
| 20 | + | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | |||
| 21 | + | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |||
| 22 | + | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |||
| 23 | + | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |||
| 24 | + | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | |||
| 25 | + | THIS SOFTWARE. | |||
| 26 | + | </copyright> | |||
| 27 | + | ||||
| 28 | + | <interface name="zwlr_layer_shell_v1" version="5"> | |||
| 29 | + | <description summary="create surfaces that are layers of the desktop"> | |||
| 30 | + | Clients can use this interface to assign the surface_layer role to | |||
| 31 | + | wl_surfaces. Such surfaces are assigned to a "layer" of the output and | |||
| 32 | + | rendered with a defined z-depth respective to each other. They may also be | |||
| 33 | + | anchored to the edges and corners of a screen and specify input handling | |||
| 34 | + | semantics. This interface should be suitable for the implementation of | |||
| 35 | + | many desktop shell components, and a broad number of other applications | |||
| 36 | + | that interact with the desktop. | |||
| 37 | + | </description> | |||
| 38 | + | ||||
| 39 | + | <request name="get_layer_surface"> | |||
| 40 | + | <description summary="create a layer_surface from a surface"> | |||
| 41 | + | Create a layer surface for an existing surface. This assigns the role of | |||
| 42 | + | layer_surface, or raises a protocol error if another role is already | |||
| 43 | + | assigned. | |||
| 44 | + | ||||
| 45 | + | Creating a layer surface from a wl_surface which has a buffer attached | |||
| 46 | + | or committed is a client error, and any attempts by a client to attach | |||
| 47 | + | or manipulate a buffer prior to the first layer_surface.configure call | |||
| 48 | + | must also be treated as errors. | |||
| 49 | + | ||||
| 50 | + | After creating a layer_surface object and setting it up, the client | |||
| 51 | + | must perform an initial commit without any buffer attached. | |||
| 52 | + | The compositor will reply with a layer_surface.configure event. | |||
| 53 | + | The client must acknowledge it and is then allowed to attach a buffer | |||
| 54 | + | to map the surface. | |||
| 55 | + | ||||
| 56 | + | You may pass NULL for output to allow the compositor to decide which | |||
| 57 | + | output to use. Generally this will be the one that the user most | |||
| 58 | + | recently interacted with. | |||
| 59 | + | ||||
| 60 | + | Clients can specify a namespace that defines the purpose of the layer | |||
| 61 | + | surface. | |||
| 62 | + | </description> | |||
| 63 | + | <arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/> | |||
| 64 | + | <arg name="surface" type="object" interface="wl_surface"/> | |||
| 65 | + | <arg name="output" type="object" interface="wl_output" allow-null="true"/> | |||
| 66 | + | <arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/> | |||
| 67 | + | <arg name="namespace" type="string" summary="namespace for the layer surface"/> | |||
| 68 | + | </request> | |||
| 69 | + | ||||
| 70 | + | <enum name="error"> | |||
| 71 | + | <entry name="role" value="0" summary="wl_surface has another role"/> | |||
| 72 | + | <entry name="invalid_layer" value="1" summary="layer value is invalid"/> | |||
| 73 | + | <entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/> | |||
| 74 | + | </enum> | |||
| 75 | + | ||||
| 76 | + | <enum name="layer"> | |||
| 77 | + | <description summary="available layers for surfaces"> | |||
| 78 | + | These values indicate which layers a surface can be rendered in. They | |||
| 79 | + | are ordered by z depth, bottom-most first. Traditional shell surfaces | |||
| 80 | + | will typically be rendered between the bottom and top layers. | |||
| 81 | + | Fullscreen shell surfaces are typically rendered at the top layer. | |||
| 82 | + | Multiple surfaces can share a single layer, and ordering within a | |||
| 83 | + | single layer is undefined. | |||
| 84 | + | </description> | |||
| 85 | + | ||||
| 86 | + | <entry name="background" value="0"/> | |||
| 87 | + | <entry name="bottom" value="1"/> | |||
| 88 | + | <entry name="top" value="2"/> | |||
| 89 | + | <entry name="overlay" value="3"/> | |||
| 90 | + | </enum> | |||
| 91 | + | ||||
| 92 | + | <!-- Version 3 additions --> | |||
| 93 | + | ||||
| 94 | + | <request name="destroy" type="destructor" since="3"> | |||
| 95 | + | <description summary="destroy the layer_shell object"> | |||
| 96 | + | This request indicates that the client will not use the layer_shell | |||
| 97 | + | object any more. Objects that have been created through this instance | |||
| 98 | + | are not affected. | |||
| 99 | + | </description> | |||
| 100 | + | </request> | |||
| 101 | + | </interface> | |||
| 102 | + | ||||
| 103 | + | <interface name="zwlr_layer_surface_v1" version="5"> | |||
| 104 | + | <description summary="layer metadata interface"> | |||
| 105 | + | An interface that may be implemented by a wl_surface, for surfaces that | |||
| 106 | + | are designed to be rendered as a layer of a stacked desktop-like | |||
| 107 | + | environment. | |||
| 108 | + | ||||
| 109 | + | Layer surface state (layer, size, anchor, exclusive zone, | |||
| 110 | + | margin, interactivity) is double-buffered, and will be applied at the | |||
| 111 | + | time wl_surface.commit of the corresponding wl_surface is called. | |||
| 112 | + | ||||
| 113 | + | Attaching a null buffer to a layer surface unmaps it. | |||
| 114 | + | ||||
| 115 | + | Unmapping a layer_surface means that the surface cannot be shown by the | |||
| 116 | + | compositor until it is explicitly mapped again. The layer_surface | |||
| 117 | + | returns to the state it had right after layer_shell.get_layer_surface. | |||
| 118 | + | The client can re-map the surface by performing a commit without any | |||
| 119 | + | buffer attached, waiting for a configure event and handling it as usual. | |||
| 120 | + | </description> | |||
| 121 | + | ||||
| 122 | + | <request name="set_size"> | |||
| 123 | + | <description summary="sets the size of the surface"> | |||
| 124 | + | Sets the size of the surface in surface-local coordinates. The | |||
| 125 | + | compositor will display the surface centered with respect to its | |||
| 126 | + | anchors. | |||
| 127 | + | ||||
| 128 | + | If you pass 0 for either value, the compositor will assign it and | |||
| 129 | + | inform you of the assignment in the configure event. You must set your | |||
| 130 | + | anchor to opposite edges in the dimensions you omit; not doing so is a | |||
| 131 | + | protocol error. Both values are 0 by default. | |||
| 132 | + | ||||
| 133 | + | Size is double-buffered, see wl_surface.commit. | |||
| 134 | + | </description> | |||
| 135 | + | <arg name="width" type="uint"/> | |||
| 136 | + | <arg name="height" type="uint"/> | |||
| 137 | + | </request> | |||
| 138 | + | ||||
| 139 | + | <request name="set_anchor"> | |||
| 140 | + | <description summary="configures the anchor point of the surface"> | |||
| 141 | + | Requests that the compositor anchor the surface to the specified edges | |||
| 142 | + | and corners. If two orthogonal edges are specified (e.g. 'top' and | |||
| 143 | + | 'left'), then the anchor point will be the intersection of the edges | |||
| 144 | + | (e.g. the top left corner of the output); otherwise the anchor point | |||
| 145 | + | will be centered on that edge, or in the center if none is specified. | |||
| 146 | + | ||||
| 147 | + | Anchor is double-buffered, see wl_surface.commit. | |||
| 148 | + | </description> | |||
| 149 | + | <arg name="anchor" type="uint" enum="anchor"/> | |||
| 150 | + | </request> | |||
| 151 | + | ||||
| 152 | + | <request name="set_exclusive_zone"> | |||
| 153 | + | <description summary="configures the exclusive geometry of this surface"> | |||
| 154 | + | Requests that the compositor avoids occluding an area with other | |||
| 155 | + | surfaces. The compositor's use of this information is | |||
| 156 | + | implementation-dependent - do not assume that this region will not | |||
| 157 | + | actually be occluded. | |||
| 158 | + | ||||
| 159 | + | A positive value is only meaningful if the surface is anchored to one | |||
| 160 | + | edge or an edge and both perpendicular edges. If the surface is not | |||
| 161 | + | anchored, anchored to only two perpendicular edges (a corner), anchored | |||
| 162 | + | to only two parallel edges or anchored to all edges, a positive value | |||
| 163 | + | will be treated the same as zero. | |||
| 164 | + | ||||
| 165 | + | A positive zone is the distance from the edge in surface-local | |||
| 166 | + | coordinates to consider exclusive. | |||
| 167 | + | ||||
| 168 | + | Surfaces that do not wish to have an exclusive zone may instead specify | |||
| 169 | + | how they should interact with surfaces that do. If set to zero, the | |||
| 170 | + | surface indicates that it would like to be moved to avoid occluding | |||
| 171 | + | surfaces with a positive exclusive zone. If set to -1, the surface | |||
| 172 | + | indicates that it would not like to be moved to accommodate for other | |||
| 173 | + | surfaces, and the compositor should extend it all the way to the edges | |||
| 174 | + | it is anchored to. | |||
| 175 | + | ||||
| 176 | + | For example, a panel might set its exclusive zone to 10, so that | |||
| 177 | + | maximized shell surfaces are not shown on top of it. A notification | |||
| 178 | + | might set its exclusive zone to 0, so that it is moved to avoid | |||
| 179 | + | occluding the panel, but shell surfaces are shown underneath it. A | |||
| 180 | + | wallpaper or lock screen might set their exclusive zone to -1, so that | |||
| 181 | + | they stretch below or over the panel. | |||
| 182 | + | ||||
| 183 | + | The default value is 0. | |||
| 184 | + | ||||
| 185 | + | Exclusive zone is double-buffered, see wl_surface.commit. | |||
| 186 | + | </description> | |||
| 187 | + | <arg name="zone" type="int"/> | |||
| 188 | + | </request> | |||
| 189 | + | ||||
| 190 | + | <request name="set_margin"> | |||
| 191 | + | <description summary="sets a margin from the anchor point"> | |||
| 192 | + | Requests that the surface be placed some distance away from the anchor | |||
| 193 | + | point on the output, in surface-local coordinates. Setting this value | |||
| 194 | + | for edges you are not anchored to has no effect. | |||
| 195 | + | ||||
| 196 | + | The exclusive zone includes the margin. | |||
| 197 | + | ||||
| 198 | + | Margin is double-buffered, see wl_surface.commit. | |||
| 199 | + | </description> | |||
| 200 | + | <arg name="top" type="int"/> | |||
| 201 | + | <arg name="right" type="int"/> | |||
| 202 | + | <arg name="bottom" type="int"/> | |||
| 203 | + | <arg name="left" type="int"/> | |||
| 204 | + | </request> | |||
| 205 | + | ||||
| 206 | + | <enum name="keyboard_interactivity"> | |||
| 207 | + | <description summary="types of keyboard interaction possible for a layer shell surface"> | |||
| 208 | + | Types of keyboard interaction possible for layer shell surfaces. The | |||
| 209 | + | rationale for this is twofold: (1) some applications are not interested | |||
| 210 | + | in keyboard events and not allowing them to be focused can improve the | |||
| 211 | + | desktop experience; (2) some applications will want to take exclusive | |||
| 212 | + | keyboard focus. | |||
| 213 | + | </description> | |||
| 214 | + | ||||
| 215 | + | <entry name="none" value="0"> | |||
| 216 | + | <description summary="no keyboard focus is possible"> | |||
| 217 | + | This value indicates that this surface is not interested in keyboard | |||
| 218 | + | events and the compositor should never assign it the keyboard focus. | |||
| 219 | + | ||||
| 220 | + | This is the default value, set for newly created layer shell surfaces. | |||
| 221 | + | ||||
| 222 | + | This is useful for e.g. desktop widgets that display information or | |||
| 223 | + | only have interaction with non-keyboard input devices. | |||
| 224 | + | </description> | |||
| 225 | + | </entry> | |||
| 226 | + | <entry name="exclusive" value="1"> | |||
| 227 | + | <description summary="request exclusive keyboard focus"> | |||
| 228 | + | Request exclusive keyboard focus if this surface is above the shell surface layer. | |||
| 229 | + | ||||
| 230 | + | For the top and overlay layers, the seat will always give | |||
| 231 | + | exclusive keyboard focus to the top-most layer which has keyboard | |||
| 232 | + | interactivity set to exclusive. If this layer contains multiple | |||
| 233 | + | surfaces with keyboard interactivity set to exclusive, the compositor | |||
| 234 | + | determines the one receiving keyboard events in an implementation- | |||
| 235 | + | defined manner. In this case, no guarantee is made when this surface | |||
| 236 | + | will receive keyboard focus (if ever). | |||
| 237 | + | ||||
| 238 | + | For the bottom and background layers, the compositor is allowed to use | |||
| 239 | + | normal focus semantics. | |||
| 240 | + | ||||
| 241 | + | This setting is mainly intended for applications that need to ensure | |||
| 242 | + | they receive all keyboard events, such as a lock screen or a password | |||
| 243 | + | prompt. | |||
| 244 | + | </description> | |||
| 245 | + | </entry> | |||
| 246 | + | <entry name="on_demand" value="2" since="4"> | |||
| 247 | + | <description summary="request regular keyboard focus semantics"> | |||
| 248 | + | This requests the compositor to allow this surface to be focused and | |||
| 249 | + | unfocused by the user in an implementation-defined manner. The user | |||
| 250 | + | should be able to unfocus this surface even regardless of the layer | |||
| 251 | + | it is on. | |||
| 252 | + | ||||
| 253 | + | Typically, the compositor will want to use its normal mechanism to | |||
| 254 | + | manage keyboard focus between layer shell surfaces with this setting | |||
| 255 | + | and regular toplevels on the desktop layer (e.g. click to focus). | |||
| 256 | + | Nevertheless, it is possible for a compositor to require a special | |||
| 257 | + | interaction to focus or unfocus layer shell surfaces (e.g. requiring | |||
| 258 | + | a click even if focus follows the mouse normally, or providing a | |||
| 259 | + | keybinding to switch focus between layers). | |||
| 260 | + | ||||
| 261 | + | This setting is mainly intended for desktop shell components (e.g. | |||
| 262 | + | panels) that allow keyboard interaction. Using this option can allow | |||
| 263 | + | implementing a desktop shell that can be fully usable without the | |||
| 264 | + | mouse. | |||
| 265 | + | </description> | |||
| 266 | + | </entry> | |||
| 267 | + | </enum> | |||
| 268 | + | ||||
| 269 | + | <request name="set_keyboard_interactivity"> | |||
| 270 | + | <description summary="requests keyboard events"> | |||
| 271 | + | Set how keyboard events are delivered to this surface. By default, | |||
| 272 | + | layer shell surfaces do not receive keyboard events; this request can | |||
| 273 | + | be used to change this. | |||
| 274 | + | ||||
| 275 | + | This setting is inherited by child surfaces set by the get_popup | |||
| 276 | + | request. | |||
| 277 | + | ||||
| 278 | + | Layer surfaces receive pointer, touch, and tablet events normally. If | |||
| 279 | + | you do not want to receive them, set the input region on your surface | |||
| 280 | + | to an empty region. | |||
| 281 | + | ||||
| 282 | + | Keyboard interactivity is double-buffered, see wl_surface.commit. | |||
| 283 | + | </description> | |||
| 284 | + | <arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/> | |||
| 285 | + | </request> | |||
| 286 | + | ||||
| 287 | + | <request name="get_popup"> | |||
| 288 | + | <description summary="assign this layer_surface as an xdg_popup parent"> | |||
| 289 | + | This assigns an xdg_popup's parent to this layer_surface. This popup | |||
| 290 | + | should have been created via xdg_surface::get_popup with the parent set | |||
| 291 | + | to NULL, and this request must be invoked before committing the popup's | |||
| 292 | + | initial state. | |||
| 293 | + | ||||
| 294 | + | See the documentation of xdg_popup for more details about what an | |||
| 295 | + | xdg_popup is and how it is used. | |||
| 296 | + | </description> | |||
| 297 | + | <arg name="popup" type="object" interface="xdg_popup"/> | |||
| 298 | + | </request> | |||
| 299 | + | ||||
| 300 | + | <request name="ack_configure"> | |||
| 301 | + | <description summary="ack a configure event"> | |||
| 302 | + | When a configure event is received, if a client commits the | |||
| 303 | + | surface in response to the configure event, then the client | |||
| 304 | + | must make an ack_configure request sometime before the commit | |||
| 305 | + | request, passing along the serial of the configure event. | |||
| 306 | + | ||||
| 307 | + | If the client receives multiple configure events before it | |||
| 308 | + | can respond to one, it only has to ack the last configure event. | |||
| 309 | + | ||||
| 310 | + | A client is not required to commit immediately after sending | |||
| 311 | + | an ack_configure request - it may even ack_configure several times | |||
| 312 | + | before its next surface commit. | |||
| 313 | + | ||||
| 314 | + | A client may send multiple ack_configure requests before committing, but | |||
| 315 | + | only the last request sent before a commit indicates which configure | |||
| 316 | + | event the client really is responding to. | |||
| 317 | + | </description> | |||
| 318 | + | <arg name="serial" type="uint" summary="the serial from the configure event"/> | |||
| 319 | + | </request> | |||
| 320 | + | ||||
| 321 | + | <request name="destroy" type="destructor"> | |||
| 322 | + | <description summary="destroy the layer_surface"> | |||
| 323 | + | This request destroys the layer surface. | |||
| 324 | + | </description> | |||
| 325 | + | </request> | |||
| 326 | + | ||||
| 327 | + | <event name="configure"> | |||
| 328 | + | <description summary="suggest a surface change"> | |||
| 329 | + | The configure event asks the client to resize its surface. | |||
| 330 | + | ||||
| 331 | + | Clients should arrange their surface for the new states, and then send | |||
| 332 | + | an ack_configure request with the serial sent in this configure event at | |||
| 333 | + | some point before committing the new surface. | |||
| 334 | + | ||||
| 335 | + | The client is free to dismiss all but the last configure event it | |||
| 336 | + | received. | |||
| 337 | + | ||||
| 338 | + | The width and height arguments specify the size of the window in | |||
| 339 | + | surface-local coordinates. | |||
| 340 | + | ||||
| 341 | + | The size is a hint, in the sense that the client is free to ignore it if | |||
| 342 | + | it doesn't resize, pick a smaller size (to satisfy aspect ratio or | |||
| 343 | + | resize in steps of NxM pixels). If the client picks a smaller size and | |||
| 344 | + | is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the | |||
| 345 | + | surface will be centered on this axis. | |||
| 346 | + | ||||
| 347 | + | If the width or height arguments are zero, it means the client should | |||
| 348 | + | decide its own window dimension. | |||
| 349 | + | </description> | |||
| 350 | + | <arg name="serial" type="uint"/> | |||
| 351 | + | <arg name="width" type="uint"/> | |||
| 352 | + | <arg name="height" type="uint"/> | |||
| 353 | + | </event> | |||
| 354 | + | ||||
| 355 | + | <event name="closed"> | |||
| 356 | + | <description summary="surface should be closed"> | |||
| 357 | + | The closed event is sent by the compositor when the surface will no | |||
| 358 | + | longer be shown. The output may have been destroyed or the user may | |||
| 359 | + | have asked for it to be removed. Further changes to the surface will be | |||
| 360 | + | ignored. The client should destroy the resource after receiving this | |||
| 361 | + | event, and create a new surface if they so choose. | |||
| 362 | + | </description> | |||
| 363 | + | </event> | |||
| 364 | + | ||||
| 365 | + | <enum name="error"> | |||
| 366 | + | <entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/> | |||
| 367 | + | <entry name="invalid_size" value="1" summary="size is invalid"/> | |||
| 368 | + | <entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/> | |||
| 369 | + | <entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/> | |||
| 370 | + | <entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/> | |||
| 371 | + | </enum> | |||
| 372 | + | ||||
| 373 | + | <enum name="anchor" bitfield="true"> | |||
| 374 | + | <entry name="top" value="1" summary="the top edge of the anchor rectangle"/> | |||
| 375 | + | <entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/> | |||
| 376 | + | <entry name="left" value="4" summary="the left edge of the anchor rectangle"/> | |||
| 377 | + | <entry name="right" value="8" summary="the right edge of the anchor rectangle"/> | |||
| 378 | + | </enum> | |||
| 379 | + | ||||
| 380 | + | <!-- Version 2 additions --> | |||
| 381 | + | ||||
| 382 | + | <request name="set_layer" since="2"> | |||
| 383 | + | <description summary="change the layer of the surface"> | |||
| 384 | + | Change the layer that the surface is rendered on. | |||
| 385 | + | ||||
| 386 | + | Layer is double-buffered, see wl_surface.commit. | |||
| 387 | + | </description> | |||
| 388 | + | <arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/> | |||
| 389 | + | </request> | |||
| 390 | + | ||||
| 391 | + | <!-- Version 5 additions --> | |||
| 392 | + | ||||
| 393 | + | <request name="set_exclusive_edge" since="5"> | |||
| 394 | + | <description summary="set the edge the exclusive zone will be applied to"> | |||
| 395 | + | Requests an edge for the exclusive zone to apply. The exclusive | |||
| 396 | + | edge will be automatically deduced from anchor points when possible, | |||
| 397 | + | but when the surface is anchored to a corner, it will be necessary | |||
| 398 | + | to set it explicitly to disambiguate, as it is not possible to deduce | |||
| 399 | + | which one of the two corner edges should be used. | |||
| 400 | + | ||||
| 401 | + | The edge must be one the surface is anchored to, otherwise the | |||
| 402 | + | invalid_exclusive_edge protocol error will be raised. | |||
| 403 | + | </description> | |||
| 404 | + | <arg name="edge" type="uint" enum="anchor"/> | |||
| 405 | + | </request> | |||
| 406 | + | </interface> | |||
| 407 | + | </protocol> | |||