feat(protocol): relative-pointer-v1 and pointer-constraints-v1 bindings
- commit
- 9c7707caee06002f75cd434578fe8734178b0c54
- author
- brice · · 2026-09-25 12:15 UTC
- parent
- 69eba44
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +857 -0
M protocol/gen.go +2 -0
| @@ -14,3 +14,5 @@ package protocol | |||
| 14 | 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | |
| 15 | 15 | //go:generate go run ../cmd/wlgen -package primaryselection -out primaryselection/primaryselection.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/primary-selection-unstable-v1.xml | |
| 16 | 16 | //go:generate go run ../cmd/wlgen -package extdatacontrol -out extdatacontrol/extdatacontrol.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/ext-data-control-v1.xml | |
| 17 | + | //go:generate go run ../cmd/wlgen -package relativepointer -out relativepointer/relativepointer.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/relative-pointer-unstable-v1.xml | |
| 18 | + | //go:generate go run ../cmd/wlgen -package pointerconstraints -out pointerconstraints/pointerconstraints.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/pointer-constraints-unstable-v1.xml | |
| @@ -14,3 +14,5 @@ package protocol | |||||
| 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | 14 | //go:generate go run ../cmd/wlgen -package cursorshape -out cursorshape/cursorshape.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml -import tabletv2=github.com/bnema/purego-libwayland/protocol/tabletv2 -import-xml tabletv2=../protocols/tablet-v2.xml ../protocols/cursor-shape-v1.xml | ||
| 15 | //go:generate go run ../cmd/wlgen -package primaryselection -out primaryselection/primaryselection.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/primary-selection-unstable-v1.xml | 15 | //go:generate go run ../cmd/wlgen -package primaryselection -out primaryselection/primaryselection.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/primary-selection-unstable-v1.xml | ||
| 16 | //go:generate go run ../cmd/wlgen -package extdatacontrol -out extdatacontrol/extdatacontrol.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/ext-data-control-v1.xml | 16 | //go:generate go run ../cmd/wlgen -package extdatacontrol -out extdatacontrol/extdatacontrol.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/ext-data-control-v1.xml | ||
| 17 | + | //go:generate go run ../cmd/wlgen -package relativepointer -out relativepointer/relativepointer.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/relative-pointer-unstable-v1.xml | |||
| 18 | + | //go:generate go run ../cmd/wlgen -package pointerconstraints -out pointerconstraints/pointerconstraints.go -import wayland=github.com/bnema/purego-libwayland/protocol/wayland -import-xml wayland=../protocols/wayland.xml ../protocols/pointer-constraints-unstable-v1.xml | |||
A protocol/pointerconstraints/pointerconstraints.go +247 -0
| @@ -0,0 +1,247 @@ | |||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |
| 2 | + | package pointerconstraints | |
| 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 ZwpPointerConstraintsV1Interface *server.Interface | |
| 11 | + | var ZwpLockedPointerV1Interface *server.Interface | |
| 12 | + | var ZwpConfinedPointerV1Interface *server.Interface | |
| 13 | + | ||
| 14 | + | func init() { | |
| 15 | + | ZwpPointerConstraintsV1Interface = &server.Interface{Name: "zwp_pointer_constraints_v1", Version: 1} | |
| 16 | + | ZwpLockedPointerV1Interface = &server.Interface{Name: "zwp_locked_pointer_v1", Version: 1} | |
| 17 | + | ZwpConfinedPointerV1Interface = &server.Interface{Name: "zwp_confined_pointer_v1", Version: 1} | |
| 18 | + | ZwpPointerConstraintsV1Interface.Requests = []server.Message{ | |
| 19 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 20 | + | {Name: "lock_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpLockedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, | |
| 21 | + | {Name: "confine_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpConfinedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, | |
| 22 | + | } | |
| 23 | + | ZwpPointerConstraintsV1Interface.Events = []server.Message{} | |
| 24 | + | ZwpLockedPointerV1Interface.Requests = []server.Message{ | |
| 25 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 26 | + | {Name: "set_cursor_position_hint", Signature: "ff", Types: []*server.Interface{nil, nil}}, | |
| 27 | + | {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, | |
| 28 | + | } | |
| 29 | + | ZwpLockedPointerV1Interface.Events = []server.Message{ | |
| 30 | + | {Name: "locked", Signature: "", Types: []*server.Interface{}}, | |
| 31 | + | {Name: "unlocked", Signature: "", Types: []*server.Interface{}}, | |
| 32 | + | } | |
| 33 | + | ZwpConfinedPointerV1Interface.Requests = []server.Message{ | |
| 34 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 35 | + | {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, | |
| 36 | + | } | |
| 37 | + | ZwpConfinedPointerV1Interface.Events = []server.Message{ | |
| 38 | + | {Name: "confined", Signature: "", Types: []*server.Interface{}}, | |
| 39 | + | {Name: "unconfined", Signature: "", Types: []*server.Interface{}}, | |
| 40 | + | } | |
| 41 | + | if err := server.NewInterfaces(ZwpPointerConstraintsV1Interface, ZwpLockedPointerV1Interface, ZwpConfinedPointerV1Interface); err != nil { | |
| 42 | + | panic(err) | |
| 43 | + | } | |
| 44 | + | } | |
| 45 | + | ||
| 46 | + | // ZwpPointerConstraintsV1 constrain the movement of a pointer. | |
| 47 | + | type ZwpPointerConstraintsV1 struct{ *server.Resource } | |
| 48 | + | ||
| 49 | + | func WrapZwpPointerConstraintsV1(r *server.Resource) *ZwpPointerConstraintsV1 { | |
| 50 | + | if r == nil { | |
| 51 | + | return nil | |
| 52 | + | } | |
| 53 | + | return &ZwpPointerConstraintsV1{r} | |
| 54 | + | } | |
| 55 | + | ||
| 56 | + | const ZwpPointerConstraintsV1RequestDestroy uint32 = 0 | |
| 57 | + | const ZwpPointerConstraintsV1RequestLockPointer uint32 = 1 | |
| 58 | + | const ZwpPointerConstraintsV1RequestConfinePointer uint32 = 2 | |
| 59 | + | ||
| 60 | + | // ZwpPointerConstraintsV1Error wp_pointer_constraints error values. | |
| 61 | + | type ZwpPointerConstraintsV1Error uint32 | |
| 62 | + | ||
| 63 | + | const ( | |
| 64 | + | ZwpPointerConstraintsV1ErrorAlreadyConstrained ZwpPointerConstraintsV1Error = 1 | |
| 65 | + | ) | |
| 66 | + | ||
| 67 | + | // ZwpPointerConstraintsV1Lifetime constraint lifetime. | |
| 68 | + | type ZwpPointerConstraintsV1Lifetime uint32 | |
| 69 | + | ||
| 70 | + | const ( | |
| 71 | + | ZwpPointerConstraintsV1LifetimeOneshot ZwpPointerConstraintsV1Lifetime = 1 | |
| 72 | + | ZwpPointerConstraintsV1LifetimePersistent ZwpPointerConstraintsV1Lifetime = 2 | |
| 73 | + | ) | |
| 74 | + | ||
| 75 | + | // ZwpPointerConstraintsV1Handler handles zwp_pointer_constraints_v1 requests. | |
| 76 | + | type ZwpPointerConstraintsV1Handler interface { | |
| 77 | + | Destroy(self *ZwpPointerConstraintsV1) | |
| 78 | + | LockPointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) | |
| 79 | + | ConfinePointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) | |
| 80 | + | } | |
| 81 | + | ||
| 82 | + | func NewZwpPointerConstraintsV1(c server.Client, version int32, id uint32, h ZwpPointerConstraintsV1Handler) (*ZwpPointerConstraintsV1, error) { | |
| 83 | + | if h == nil { | |
| 84 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_constraints_v1") | |
| 85 | + | } | |
| 86 | + | var self *ZwpPointerConstraintsV1 | |
| 87 | + | r, err := c.CreateResource(ZwpPointerConstraintsV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 88 | + | switch opcode { | |
| 89 | + | case 0: | |
| 90 | + | h.Destroy(self) | |
| 91 | + | self.Destroy() | |
| 92 | + | case 1: | |
| 93 | + | h.LockPointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) | |
| 94 | + | case 2: | |
| 95 | + | h.ConfinePointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) | |
| 96 | + | } | |
| 97 | + | }) | |
| 98 | + | if err != nil { | |
| 99 | + | return nil, err | |
| 100 | + | } | |
| 101 | + | self = WrapZwpPointerConstraintsV1(r) | |
| 102 | + | r.Data = self | |
| 103 | + | return self, nil | |
| 104 | + | } | |
| 105 | + | func NewZwpPointerConstraintsV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 106 | + | return d.CreateGlobal(ZwpPointerConstraintsV1Interface, version, bind) | |
| 107 | + | } | |
| 108 | + | ||
| 109 | + | // ZwpLockedPointerV1 receive relative pointer motion events. | |
| 110 | + | type ZwpLockedPointerV1 struct{ *server.Resource } | |
| 111 | + | ||
| 112 | + | func WrapZwpLockedPointerV1(r *server.Resource) *ZwpLockedPointerV1 { | |
| 113 | + | if r == nil { | |
| 114 | + | return nil | |
| 115 | + | } | |
| 116 | + | return &ZwpLockedPointerV1{r} | |
| 117 | + | } | |
| 118 | + | ||
| 119 | + | const ZwpLockedPointerV1RequestDestroy uint32 = 0 | |
| 120 | + | const ZwpLockedPointerV1RequestSetCursorPositionHint uint32 = 1 | |
| 121 | + | const ZwpLockedPointerV1RequestSetRegion uint32 = 2 | |
| 122 | + | const ZwpLockedPointerV1EventLocked uint32 = 0 | |
| 123 | + | const ZwpLockedPointerV1EventUnlocked uint32 = 1 | |
| 124 | + | ||
| 125 | + | // ZwpLockedPointerV1Handler handles zwp_locked_pointer_v1 requests. | |
| 126 | + | type ZwpLockedPointerV1Handler interface { | |
| 127 | + | Destroy(self *ZwpLockedPointerV1) | |
| 128 | + | SetCursorPositionHint(self *ZwpLockedPointerV1, surfaceX server.Fixed, surfaceY server.Fixed) | |
| 129 | + | SetRegion(self *ZwpLockedPointerV1, region *wayland.Region) | |
| 130 | + | } | |
| 131 | + | ||
| 132 | + | func NewZwpLockedPointerV1(c server.Client, version int32, id uint32, h ZwpLockedPointerV1Handler) (*ZwpLockedPointerV1, error) { | |
| 133 | + | if h == nil { | |
| 134 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_locked_pointer_v1") | |
| 135 | + | } | |
| 136 | + | var self *ZwpLockedPointerV1 | |
| 137 | + | r, err := c.CreateResource(ZwpLockedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 138 | + | switch opcode { | |
| 139 | + | case 0: | |
| 140 | + | h.Destroy(self) | |
| 141 | + | self.Destroy() | |
| 142 | + | case 1: | |
| 143 | + | h.SetCursorPositionHint(self, args[0].Fixed(), args[1].Fixed()) | |
| 144 | + | case 2: | |
| 145 | + | h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) | |
| 146 | + | } | |
| 147 | + | }) | |
| 148 | + | if err != nil { | |
| 149 | + | return nil, err | |
| 150 | + | } | |
| 151 | + | self = WrapZwpLockedPointerV1(r) | |
| 152 | + | r.Data = self | |
| 153 | + | return self, nil | |
| 154 | + | } | |
| 155 | + | ||
| 156 | + | // SendLocked lock activation event. | |
| 157 | + | func (self *ZwpLockedPointerV1) SendLocked() { | |
| 158 | + | self.PostEvent(ZwpLockedPointerV1EventLocked) | |
| 159 | + | } | |
| 160 | + | ||
| 161 | + | // SendUnlocked lock deactivation event. | |
| 162 | + | func (self *ZwpLockedPointerV1) SendUnlocked() { | |
| 163 | + | self.PostEvent(ZwpLockedPointerV1EventUnlocked) | |
| 164 | + | } | |
| 165 | + | func NewZwpLockedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 166 | + | return d.CreateGlobal(ZwpLockedPointerV1Interface, version, bind) | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | // ZwpConfinedPointerV1 confined pointer object. | |
| 170 | + | type ZwpConfinedPointerV1 struct{ *server.Resource } | |
| 171 | + | ||
| 172 | + | func WrapZwpConfinedPointerV1(r *server.Resource) *ZwpConfinedPointerV1 { | |
| 173 | + | if r == nil { | |
| 174 | + | return nil | |
| 175 | + | } | |
| 176 | + | return &ZwpConfinedPointerV1{r} | |
| 177 | + | } | |
| 178 | + | ||
| 179 | + | const ZwpConfinedPointerV1RequestDestroy uint32 = 0 | |
| 180 | + | const ZwpConfinedPointerV1RequestSetRegion uint32 = 1 | |
| 181 | + | const ZwpConfinedPointerV1EventConfined uint32 = 0 | |
| 182 | + | const ZwpConfinedPointerV1EventUnconfined uint32 = 1 | |
| 183 | + | ||
| 184 | + | // ZwpConfinedPointerV1Handler handles zwp_confined_pointer_v1 requests. | |
| 185 | + | type ZwpConfinedPointerV1Handler interface { | |
| 186 | + | Destroy(self *ZwpConfinedPointerV1) | |
| 187 | + | SetRegion(self *ZwpConfinedPointerV1, region *wayland.Region) | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | func NewZwpConfinedPointerV1(c server.Client, version int32, id uint32, h ZwpConfinedPointerV1Handler) (*ZwpConfinedPointerV1, error) { | |
| 191 | + | if h == nil { | |
| 192 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_confined_pointer_v1") | |
| 193 | + | } | |
| 194 | + | var self *ZwpConfinedPointerV1 | |
| 195 | + | r, err := c.CreateResource(ZwpConfinedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 196 | + | switch opcode { | |
| 197 | + | case 0: | |
| 198 | + | h.Destroy(self) | |
| 199 | + | self.Destroy() | |
| 200 | + | case 1: | |
| 201 | + | h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) | |
| 202 | + | } | |
| 203 | + | }) | |
| 204 | + | if err != nil { | |
| 205 | + | return nil, err | |
| 206 | + | } | |
| 207 | + | self = WrapZwpConfinedPointerV1(r) | |
| 208 | + | r.Data = self | |
| 209 | + | return self, nil | |
| 210 | + | } | |
| 211 | + | ||
| 212 | + | // SendConfined pointer confined. | |
| 213 | + | func (self *ZwpConfinedPointerV1) SendConfined() { | |
| 214 | + | self.PostEvent(ZwpConfinedPointerV1EventConfined) | |
| 215 | + | } | |
| 216 | + | ||
| 217 | + | // SendUnconfined pointer unconfined. | |
| 218 | + | func (self *ZwpConfinedPointerV1) SendUnconfined() { | |
| 219 | + | self.PostEvent(ZwpConfinedPointerV1EventUnconfined) | |
| 220 | + | } | |
| 221 | + | func NewZwpConfinedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 222 | + | return d.CreateGlobal(ZwpConfinedPointerV1Interface, version, bind) | |
| 223 | + | } | |
| 224 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |
| 225 | + | if v == nil { | |
| 226 | + | return nil | |
| 227 | + | } | |
| 228 | + | return v.GetResource() | |
| 229 | + | } | |
| 230 | + | func (self *ZwpPointerConstraintsV1) GetResource() *server.Resource { | |
| 231 | + | if self == nil { | |
| 232 | + | return nil | |
| 233 | + | } | |
| 234 | + | return self.Resource | |
| 235 | + | } | |
| 236 | + | func (self *ZwpLockedPointerV1) GetResource() *server.Resource { | |
| 237 | + | if self == nil { | |
| 238 | + | return nil | |
| 239 | + | } | |
| 240 | + | return self.Resource | |
| 241 | + | } | |
| 242 | + | func (self *ZwpConfinedPointerV1) GetResource() *server.Resource { | |
| 243 | + | if self == nil { | |
| 244 | + | return nil | |
| 245 | + | } | |
| 246 | + | return self.Resource | |
| 247 | + | } | |
| @@ -0,0 +1,247 @@ | |||||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |||
| 2 | + | package pointerconstraints | |||
| 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 ZwpPointerConstraintsV1Interface *server.Interface | |||
| 11 | + | var ZwpLockedPointerV1Interface *server.Interface | |||
| 12 | + | var ZwpConfinedPointerV1Interface *server.Interface | |||
| 13 | + | ||||
| 14 | + | func init() { | |||
| 15 | + | ZwpPointerConstraintsV1Interface = &server.Interface{Name: "zwp_pointer_constraints_v1", Version: 1} | |||
| 16 | + | ZwpLockedPointerV1Interface = &server.Interface{Name: "zwp_locked_pointer_v1", Version: 1} | |||
| 17 | + | ZwpConfinedPointerV1Interface = &server.Interface{Name: "zwp_confined_pointer_v1", Version: 1} | |||
| 18 | + | ZwpPointerConstraintsV1Interface.Requests = []server.Message{ | |||
| 19 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 20 | + | {Name: "lock_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpLockedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, | |||
| 21 | + | {Name: "confine_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpConfinedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, | |||
| 22 | + | } | |||
| 23 | + | ZwpPointerConstraintsV1Interface.Events = []server.Message{} | |||
| 24 | + | ZwpLockedPointerV1Interface.Requests = []server.Message{ | |||
| 25 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 26 | + | {Name: "set_cursor_position_hint", Signature: "ff", Types: []*server.Interface{nil, nil}}, | |||
| 27 | + | {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, | |||
| 28 | + | } | |||
| 29 | + | ZwpLockedPointerV1Interface.Events = []server.Message{ | |||
| 30 | + | {Name: "locked", Signature: "", Types: []*server.Interface{}}, | |||
| 31 | + | {Name: "unlocked", Signature: "", Types: []*server.Interface{}}, | |||
| 32 | + | } | |||
| 33 | + | ZwpConfinedPointerV1Interface.Requests = []server.Message{ | |||
| 34 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 35 | + | {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, | |||
| 36 | + | } | |||
| 37 | + | ZwpConfinedPointerV1Interface.Events = []server.Message{ | |||
| 38 | + | {Name: "confined", Signature: "", Types: []*server.Interface{}}, | |||
| 39 | + | {Name: "unconfined", Signature: "", Types: []*server.Interface{}}, | |||
| 40 | + | } | |||
| 41 | + | if err := server.NewInterfaces(ZwpPointerConstraintsV1Interface, ZwpLockedPointerV1Interface, ZwpConfinedPointerV1Interface); err != nil { | |||
| 42 | + | panic(err) | |||
| 43 | + | } | |||
| 44 | + | } | |||
| 45 | + | ||||
| 46 | + | // ZwpPointerConstraintsV1 constrain the movement of a pointer. | |||
| 47 | + | type ZwpPointerConstraintsV1 struct{ *server.Resource } | |||
| 48 | + | ||||
| 49 | + | func WrapZwpPointerConstraintsV1(r *server.Resource) *ZwpPointerConstraintsV1 { | |||
| 50 | + | if r == nil { | |||
| 51 | + | return nil | |||
| 52 | + | } | |||
| 53 | + | return &ZwpPointerConstraintsV1{r} | |||
| 54 | + | } | |||
| 55 | + | ||||
| 56 | + | const ZwpPointerConstraintsV1RequestDestroy uint32 = 0 | |||
| 57 | + | const ZwpPointerConstraintsV1RequestLockPointer uint32 = 1 | |||
| 58 | + | const ZwpPointerConstraintsV1RequestConfinePointer uint32 = 2 | |||
| 59 | + | ||||
| 60 | + | // ZwpPointerConstraintsV1Error wp_pointer_constraints error values. | |||
| 61 | + | type ZwpPointerConstraintsV1Error uint32 | |||
| 62 | + | ||||
| 63 | + | const ( | |||
| 64 | + | ZwpPointerConstraintsV1ErrorAlreadyConstrained ZwpPointerConstraintsV1Error = 1 | |||
| 65 | + | ) | |||
| 66 | + | ||||
| 67 | + | // ZwpPointerConstraintsV1Lifetime constraint lifetime. | |||
| 68 | + | type ZwpPointerConstraintsV1Lifetime uint32 | |||
| 69 | + | ||||
| 70 | + | const ( | |||
| 71 | + | ZwpPointerConstraintsV1LifetimeOneshot ZwpPointerConstraintsV1Lifetime = 1 | |||
| 72 | + | ZwpPointerConstraintsV1LifetimePersistent ZwpPointerConstraintsV1Lifetime = 2 | |||
| 73 | + | ) | |||
| 74 | + | ||||
| 75 | + | // ZwpPointerConstraintsV1Handler handles zwp_pointer_constraints_v1 requests. | |||
| 76 | + | type ZwpPointerConstraintsV1Handler interface { | |||
| 77 | + | Destroy(self *ZwpPointerConstraintsV1) | |||
| 78 | + | LockPointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) | |||
| 79 | + | ConfinePointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) | |||
| 80 | + | } | |||
| 81 | + | ||||
| 82 | + | func NewZwpPointerConstraintsV1(c server.Client, version int32, id uint32, h ZwpPointerConstraintsV1Handler) (*ZwpPointerConstraintsV1, error) { | |||
| 83 | + | if h == nil { | |||
| 84 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_constraints_v1") | |||
| 85 | + | } | |||
| 86 | + | var self *ZwpPointerConstraintsV1 | |||
| 87 | + | r, err := c.CreateResource(ZwpPointerConstraintsV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 88 | + | switch opcode { | |||
| 89 | + | case 0: | |||
| 90 | + | h.Destroy(self) | |||
| 91 | + | self.Destroy() | |||
| 92 | + | case 1: | |||
| 93 | + | h.LockPointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) | |||
| 94 | + | case 2: | |||
| 95 | + | h.ConfinePointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) | |||
| 96 | + | } | |||
| 97 | + | }) | |||
| 98 | + | if err != nil { | |||
| 99 | + | return nil, err | |||
| 100 | + | } | |||
| 101 | + | self = WrapZwpPointerConstraintsV1(r) | |||
| 102 | + | r.Data = self | |||
| 103 | + | return self, nil | |||
| 104 | + | } | |||
| 105 | + | func NewZwpPointerConstraintsV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 106 | + | return d.CreateGlobal(ZwpPointerConstraintsV1Interface, version, bind) | |||
| 107 | + | } | |||
| 108 | + | ||||
| 109 | + | // ZwpLockedPointerV1 receive relative pointer motion events. | |||
| 110 | + | type ZwpLockedPointerV1 struct{ *server.Resource } | |||
| 111 | + | ||||
| 112 | + | func WrapZwpLockedPointerV1(r *server.Resource) *ZwpLockedPointerV1 { | |||
| 113 | + | if r == nil { | |||
| 114 | + | return nil | |||
| 115 | + | } | |||
| 116 | + | return &ZwpLockedPointerV1{r} | |||
| 117 | + | } | |||
| 118 | + | ||||
| 119 | + | const ZwpLockedPointerV1RequestDestroy uint32 = 0 | |||
| 120 | + | const ZwpLockedPointerV1RequestSetCursorPositionHint uint32 = 1 | |||
| 121 | + | const ZwpLockedPointerV1RequestSetRegion uint32 = 2 | |||
| 122 | + | const ZwpLockedPointerV1EventLocked uint32 = 0 | |||
| 123 | + | const ZwpLockedPointerV1EventUnlocked uint32 = 1 | |||
| 124 | + | ||||
| 125 | + | // ZwpLockedPointerV1Handler handles zwp_locked_pointer_v1 requests. | |||
| 126 | + | type ZwpLockedPointerV1Handler interface { | |||
| 127 | + | Destroy(self *ZwpLockedPointerV1) | |||
| 128 | + | SetCursorPositionHint(self *ZwpLockedPointerV1, surfaceX server.Fixed, surfaceY server.Fixed) | |||
| 129 | + | SetRegion(self *ZwpLockedPointerV1, region *wayland.Region) | |||
| 130 | + | } | |||
| 131 | + | ||||
| 132 | + | func NewZwpLockedPointerV1(c server.Client, version int32, id uint32, h ZwpLockedPointerV1Handler) (*ZwpLockedPointerV1, error) { | |||
| 133 | + | if h == nil { | |||
| 134 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_locked_pointer_v1") | |||
| 135 | + | } | |||
| 136 | + | var self *ZwpLockedPointerV1 | |||
| 137 | + | r, err := c.CreateResource(ZwpLockedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 138 | + | switch opcode { | |||
| 139 | + | case 0: | |||
| 140 | + | h.Destroy(self) | |||
| 141 | + | self.Destroy() | |||
| 142 | + | case 1: | |||
| 143 | + | h.SetCursorPositionHint(self, args[0].Fixed(), args[1].Fixed()) | |||
| 144 | + | case 2: | |||
| 145 | + | h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) | |||
| 146 | + | } | |||
| 147 | + | }) | |||
| 148 | + | if err != nil { | |||
| 149 | + | return nil, err | |||
| 150 | + | } | |||
| 151 | + | self = WrapZwpLockedPointerV1(r) | |||
| 152 | + | r.Data = self | |||
| 153 | + | return self, nil | |||
| 154 | + | } | |||
| 155 | + | ||||
| 156 | + | // SendLocked lock activation event. | |||
| 157 | + | func (self *ZwpLockedPointerV1) SendLocked() { | |||
| 158 | + | self.PostEvent(ZwpLockedPointerV1EventLocked) | |||
| 159 | + | } | |||
| 160 | + | ||||
| 161 | + | // SendUnlocked lock deactivation event. | |||
| 162 | + | func (self *ZwpLockedPointerV1) SendUnlocked() { | |||
| 163 | + | self.PostEvent(ZwpLockedPointerV1EventUnlocked) | |||
| 164 | + | } | |||
| 165 | + | func NewZwpLockedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 166 | + | return d.CreateGlobal(ZwpLockedPointerV1Interface, version, bind) | |||
| 167 | + | } | |||
| 168 | + | ||||
| 169 | + | // ZwpConfinedPointerV1 confined pointer object. | |||
| 170 | + | type ZwpConfinedPointerV1 struct{ *server.Resource } | |||
| 171 | + | ||||
| 172 | + | func WrapZwpConfinedPointerV1(r *server.Resource) *ZwpConfinedPointerV1 { | |||
| 173 | + | if r == nil { | |||
| 174 | + | return nil | |||
| 175 | + | } | |||
| 176 | + | return &ZwpConfinedPointerV1{r} | |||
| 177 | + | } | |||
| 178 | + | ||||
| 179 | + | const ZwpConfinedPointerV1RequestDestroy uint32 = 0 | |||
| 180 | + | const ZwpConfinedPointerV1RequestSetRegion uint32 = 1 | |||
| 181 | + | const ZwpConfinedPointerV1EventConfined uint32 = 0 | |||
| 182 | + | const ZwpConfinedPointerV1EventUnconfined uint32 = 1 | |||
| 183 | + | ||||
| 184 | + | // ZwpConfinedPointerV1Handler handles zwp_confined_pointer_v1 requests. | |||
| 185 | + | type ZwpConfinedPointerV1Handler interface { | |||
| 186 | + | Destroy(self *ZwpConfinedPointerV1) | |||
| 187 | + | SetRegion(self *ZwpConfinedPointerV1, region *wayland.Region) | |||
| 188 | + | } | |||
| 189 | + | ||||
| 190 | + | func NewZwpConfinedPointerV1(c server.Client, version int32, id uint32, h ZwpConfinedPointerV1Handler) (*ZwpConfinedPointerV1, error) { | |||
| 191 | + | if h == nil { | |||
| 192 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_confined_pointer_v1") | |||
| 193 | + | } | |||
| 194 | + | var self *ZwpConfinedPointerV1 | |||
| 195 | + | r, err := c.CreateResource(ZwpConfinedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 196 | + | switch opcode { | |||
| 197 | + | case 0: | |||
| 198 | + | h.Destroy(self) | |||
| 199 | + | self.Destroy() | |||
| 200 | + | case 1: | |||
| 201 | + | h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) | |||
| 202 | + | } | |||
| 203 | + | }) | |||
| 204 | + | if err != nil { | |||
| 205 | + | return nil, err | |||
| 206 | + | } | |||
| 207 | + | self = WrapZwpConfinedPointerV1(r) | |||
| 208 | + | r.Data = self | |||
| 209 | + | return self, nil | |||
| 210 | + | } | |||
| 211 | + | ||||
| 212 | + | // SendConfined pointer confined. | |||
| 213 | + | func (self *ZwpConfinedPointerV1) SendConfined() { | |||
| 214 | + | self.PostEvent(ZwpConfinedPointerV1EventConfined) | |||
| 215 | + | } | |||
| 216 | + | ||||
| 217 | + | // SendUnconfined pointer unconfined. | |||
| 218 | + | func (self *ZwpConfinedPointerV1) SendUnconfined() { | |||
| 219 | + | self.PostEvent(ZwpConfinedPointerV1EventUnconfined) | |||
| 220 | + | } | |||
| 221 | + | func NewZwpConfinedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 222 | + | return d.CreateGlobal(ZwpConfinedPointerV1Interface, version, bind) | |||
| 223 | + | } | |||
| 224 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |||
| 225 | + | if v == nil { | |||
| 226 | + | return nil | |||
| 227 | + | } | |||
| 228 | + | return v.GetResource() | |||
| 229 | + | } | |||
| 230 | + | func (self *ZwpPointerConstraintsV1) GetResource() *server.Resource { | |||
| 231 | + | if self == nil { | |||
| 232 | + | return nil | |||
| 233 | + | } | |||
| 234 | + | return self.Resource | |||
| 235 | + | } | |||
| 236 | + | func (self *ZwpLockedPointerV1) GetResource() *server.Resource { | |||
| 237 | + | if self == nil { | |||
| 238 | + | return nil | |||
| 239 | + | } | |||
| 240 | + | return self.Resource | |||
| 241 | + | } | |||
| 242 | + | func (self *ZwpConfinedPointerV1) GetResource() *server.Resource { | |||
| 243 | + | if self == nil { | |||
| 244 | + | return nil | |||
| 245 | + | } | |||
| 246 | + | return self.Resource | |||
| 247 | + | } | |||
A protocol/relativepointer/relativepointer.go +138 -0
| @@ -0,0 +1,138 @@ | |||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |
| 2 | + | package relativepointer | |
| 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 ZwpRelativePointerManagerV1Interface *server.Interface | |
| 11 | + | var ZwpRelativePointerV1Interface *server.Interface | |
| 12 | + | ||
| 13 | + | func init() { | |
| 14 | + | ZwpRelativePointerManagerV1Interface = &server.Interface{Name: "zwp_relative_pointer_manager_v1", Version: 1} | |
| 15 | + | ZwpRelativePointerV1Interface = &server.Interface{Name: "zwp_relative_pointer_v1", Version: 1} | |
| 16 | + | ZwpRelativePointerManagerV1Interface.Requests = []server.Message{ | |
| 17 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 18 | + | {Name: "get_relative_pointer", Signature: "no", Types: []*server.Interface{ZwpRelativePointerV1Interface, wayland.PointerInterface}}, | |
| 19 | + | } | |
| 20 | + | ZwpRelativePointerManagerV1Interface.Events = []server.Message{} | |
| 21 | + | ZwpRelativePointerV1Interface.Requests = []server.Message{ | |
| 22 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |
| 23 | + | } | |
| 24 | + | ZwpRelativePointerV1Interface.Events = []server.Message{ | |
| 25 | + | {Name: "relative_motion", Signature: "uuffff", Types: []*server.Interface{nil, nil, nil, nil, nil, nil}}, | |
| 26 | + | } | |
| 27 | + | if err := server.NewInterfaces(ZwpRelativePointerManagerV1Interface, ZwpRelativePointerV1Interface); err != nil { | |
| 28 | + | panic(err) | |
| 29 | + | } | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | // ZwpRelativePointerManagerV1 get relative pointer objects. | |
| 33 | + | type ZwpRelativePointerManagerV1 struct{ *server.Resource } | |
| 34 | + | ||
| 35 | + | func WrapZwpRelativePointerManagerV1(r *server.Resource) *ZwpRelativePointerManagerV1 { | |
| 36 | + | if r == nil { | |
| 37 | + | return nil | |
| 38 | + | } | |
| 39 | + | return &ZwpRelativePointerManagerV1{r} | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | const ZwpRelativePointerManagerV1RequestDestroy uint32 = 0 | |
| 43 | + | const ZwpRelativePointerManagerV1RequestGetRelativePointer uint32 = 1 | |
| 44 | + | ||
| 45 | + | // ZwpRelativePointerManagerV1Handler handles zwp_relative_pointer_manager_v1 requests. | |
| 46 | + | type ZwpRelativePointerManagerV1Handler interface { | |
| 47 | + | Destroy(self *ZwpRelativePointerManagerV1) | |
| 48 | + | GetRelativePointer(self *ZwpRelativePointerManagerV1, id uint32, pointer *wayland.Pointer) | |
| 49 | + | } | |
| 50 | + | ||
| 51 | + | func NewZwpRelativePointerManagerV1(c server.Client, version int32, id uint32, h ZwpRelativePointerManagerV1Handler) (*ZwpRelativePointerManagerV1, error) { | |
| 52 | + | if h == nil { | |
| 53 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_relative_pointer_manager_v1") | |
| 54 | + | } | |
| 55 | + | var self *ZwpRelativePointerManagerV1 | |
| 56 | + | r, err := c.CreateResource(ZwpRelativePointerManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 57 | + | switch opcode { | |
| 58 | + | case 0: | |
| 59 | + | h.Destroy(self) | |
| 60 | + | self.Destroy() | |
| 61 | + | case 1: | |
| 62 | + | h.GetRelativePointer(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource())) | |
| 63 | + | } | |
| 64 | + | }) | |
| 65 | + | if err != nil { | |
| 66 | + | return nil, err | |
| 67 | + | } | |
| 68 | + | self = WrapZwpRelativePointerManagerV1(r) | |
| 69 | + | r.Data = self | |
| 70 | + | return self, nil | |
| 71 | + | } | |
| 72 | + | func NewZwpRelativePointerManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 73 | + | return d.CreateGlobal(ZwpRelativePointerManagerV1Interface, version, bind) | |
| 74 | + | } | |
| 75 | + | ||
| 76 | + | // ZwpRelativePointerV1 relative pointer object. | |
| 77 | + | type ZwpRelativePointerV1 struct{ *server.Resource } | |
| 78 | + | ||
| 79 | + | func WrapZwpRelativePointerV1(r *server.Resource) *ZwpRelativePointerV1 { | |
| 80 | + | if r == nil { | |
| 81 | + | return nil | |
| 82 | + | } | |
| 83 | + | return &ZwpRelativePointerV1{r} | |
| 84 | + | } | |
| 85 | + | ||
| 86 | + | const ZwpRelativePointerV1RequestDestroy uint32 = 0 | |
| 87 | + | const ZwpRelativePointerV1EventRelativeMotion uint32 = 0 | |
| 88 | + | ||
| 89 | + | // ZwpRelativePointerV1Handler handles zwp_relative_pointer_v1 requests. | |
| 90 | + | type ZwpRelativePointerV1Handler interface { | |
| 91 | + | Destroy(self *ZwpRelativePointerV1) | |
| 92 | + | } | |
| 93 | + | ||
| 94 | + | func NewZwpRelativePointerV1(c server.Client, version int32, id uint32, h ZwpRelativePointerV1Handler) (*ZwpRelativePointerV1, error) { | |
| 95 | + | if h == nil { | |
| 96 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_relative_pointer_v1") | |
| 97 | + | } | |
| 98 | + | var self *ZwpRelativePointerV1 | |
| 99 | + | r, err := c.CreateResource(ZwpRelativePointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |
| 100 | + | switch opcode { | |
| 101 | + | case 0: | |
| 102 | + | h.Destroy(self) | |
| 103 | + | self.Destroy() | |
| 104 | + | } | |
| 105 | + | }) | |
| 106 | + | if err != nil { | |
| 107 | + | return nil, err | |
| 108 | + | } | |
| 109 | + | self = WrapZwpRelativePointerV1(r) | |
| 110 | + | r.Data = self | |
| 111 | + | return self, nil | |
| 112 | + | } | |
| 113 | + | ||
| 114 | + | // SendRelativeMotion relative pointer motion. | |
| 115 | + | func (self *ZwpRelativePointerV1) SendRelativeMotion(utimeHi uint32, utimeLo uint32, dx server.Fixed, dy server.Fixed, dxUnaccel server.Fixed, dyUnaccel server.Fixed) { | |
| 116 | + | self.PostEvent(ZwpRelativePointerV1EventRelativeMotion, server.Uint(utimeHi), server.Uint(utimeLo), server.FixedArg(dx), server.FixedArg(dy), server.FixedArg(dxUnaccel), server.FixedArg(dyUnaccel)) | |
| 117 | + | } | |
| 118 | + | func NewZwpRelativePointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |
| 119 | + | return d.CreateGlobal(ZwpRelativePointerV1Interface, version, bind) | |
| 120 | + | } | |
| 121 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |
| 122 | + | if v == nil { | |
| 123 | + | return nil | |
| 124 | + | } | |
| 125 | + | return v.GetResource() | |
| 126 | + | } | |
| 127 | + | func (self *ZwpRelativePointerManagerV1) GetResource() *server.Resource { | |
| 128 | + | if self == nil { | |
| 129 | + | return nil | |
| 130 | + | } | |
| 131 | + | return self.Resource | |
| 132 | + | } | |
| 133 | + | func (self *ZwpRelativePointerV1) GetResource() *server.Resource { | |
| 134 | + | if self == nil { | |
| 135 | + | return nil | |
| 136 | + | } | |
| 137 | + | return self.Resource | |
| 138 | + | } | |
| @@ -0,0 +1,138 @@ | |||||
| 1 | + | // Code generated by wlgen; DO NOT EDIT. | |||
| 2 | + | package relativepointer | |||
| 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 ZwpRelativePointerManagerV1Interface *server.Interface | |||
| 11 | + | var ZwpRelativePointerV1Interface *server.Interface | |||
| 12 | + | ||||
| 13 | + | func init() { | |||
| 14 | + | ZwpRelativePointerManagerV1Interface = &server.Interface{Name: "zwp_relative_pointer_manager_v1", Version: 1} | |||
| 15 | + | ZwpRelativePointerV1Interface = &server.Interface{Name: "zwp_relative_pointer_v1", Version: 1} | |||
| 16 | + | ZwpRelativePointerManagerV1Interface.Requests = []server.Message{ | |||
| 17 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 18 | + | {Name: "get_relative_pointer", Signature: "no", Types: []*server.Interface{ZwpRelativePointerV1Interface, wayland.PointerInterface}}, | |||
| 19 | + | } | |||
| 20 | + | ZwpRelativePointerManagerV1Interface.Events = []server.Message{} | |||
| 21 | + | ZwpRelativePointerV1Interface.Requests = []server.Message{ | |||
| 22 | + | {Name: "destroy", Signature: "", Types: []*server.Interface{}}, | |||
| 23 | + | } | |||
| 24 | + | ZwpRelativePointerV1Interface.Events = []server.Message{ | |||
| 25 | + | {Name: "relative_motion", Signature: "uuffff", Types: []*server.Interface{nil, nil, nil, nil, nil, nil}}, | |||
| 26 | + | } | |||
| 27 | + | if err := server.NewInterfaces(ZwpRelativePointerManagerV1Interface, ZwpRelativePointerV1Interface); err != nil { | |||
| 28 | + | panic(err) | |||
| 29 | + | } | |||
| 30 | + | } | |||
| 31 | + | ||||
| 32 | + | // ZwpRelativePointerManagerV1 get relative pointer objects. | |||
| 33 | + | type ZwpRelativePointerManagerV1 struct{ *server.Resource } | |||
| 34 | + | ||||
| 35 | + | func WrapZwpRelativePointerManagerV1(r *server.Resource) *ZwpRelativePointerManagerV1 { | |||
| 36 | + | if r == nil { | |||
| 37 | + | return nil | |||
| 38 | + | } | |||
| 39 | + | return &ZwpRelativePointerManagerV1{r} | |||
| 40 | + | } | |||
| 41 | + | ||||
| 42 | + | const ZwpRelativePointerManagerV1RequestDestroy uint32 = 0 | |||
| 43 | + | const ZwpRelativePointerManagerV1RequestGetRelativePointer uint32 = 1 | |||
| 44 | + | ||||
| 45 | + | // ZwpRelativePointerManagerV1Handler handles zwp_relative_pointer_manager_v1 requests. | |||
| 46 | + | type ZwpRelativePointerManagerV1Handler interface { | |||
| 47 | + | Destroy(self *ZwpRelativePointerManagerV1) | |||
| 48 | + | GetRelativePointer(self *ZwpRelativePointerManagerV1, id uint32, pointer *wayland.Pointer) | |||
| 49 | + | } | |||
| 50 | + | ||||
| 51 | + | func NewZwpRelativePointerManagerV1(c server.Client, version int32, id uint32, h ZwpRelativePointerManagerV1Handler) (*ZwpRelativePointerManagerV1, error) { | |||
| 52 | + | if h == nil { | |||
| 53 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_relative_pointer_manager_v1") | |||
| 54 | + | } | |||
| 55 | + | var self *ZwpRelativePointerManagerV1 | |||
| 56 | + | r, err := c.CreateResource(ZwpRelativePointerManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 57 | + | switch opcode { | |||
| 58 | + | case 0: | |||
| 59 | + | h.Destroy(self) | |||
| 60 | + | self.Destroy() | |||
| 61 | + | case 1: | |||
| 62 | + | h.GetRelativePointer(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource())) | |||
| 63 | + | } | |||
| 64 | + | }) | |||
| 65 | + | if err != nil { | |||
| 66 | + | return nil, err | |||
| 67 | + | } | |||
| 68 | + | self = WrapZwpRelativePointerManagerV1(r) | |||
| 69 | + | r.Data = self | |||
| 70 | + | return self, nil | |||
| 71 | + | } | |||
| 72 | + | func NewZwpRelativePointerManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 73 | + | return d.CreateGlobal(ZwpRelativePointerManagerV1Interface, version, bind) | |||
| 74 | + | } | |||
| 75 | + | ||||
| 76 | + | // ZwpRelativePointerV1 relative pointer object. | |||
| 77 | + | type ZwpRelativePointerV1 struct{ *server.Resource } | |||
| 78 | + | ||||
| 79 | + | func WrapZwpRelativePointerV1(r *server.Resource) *ZwpRelativePointerV1 { | |||
| 80 | + | if r == nil { | |||
| 81 | + | return nil | |||
| 82 | + | } | |||
| 83 | + | return &ZwpRelativePointerV1{r} | |||
| 84 | + | } | |||
| 85 | + | ||||
| 86 | + | const ZwpRelativePointerV1RequestDestroy uint32 = 0 | |||
| 87 | + | const ZwpRelativePointerV1EventRelativeMotion uint32 = 0 | |||
| 88 | + | ||||
| 89 | + | // ZwpRelativePointerV1Handler handles zwp_relative_pointer_v1 requests. | |||
| 90 | + | type ZwpRelativePointerV1Handler interface { | |||
| 91 | + | Destroy(self *ZwpRelativePointerV1) | |||
| 92 | + | } | |||
| 93 | + | ||||
| 94 | + | func NewZwpRelativePointerV1(c server.Client, version int32, id uint32, h ZwpRelativePointerV1Handler) (*ZwpRelativePointerV1, error) { | |||
| 95 | + | if h == nil { | |||
| 96 | + | return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_relative_pointer_v1") | |||
| 97 | + | } | |||
| 98 | + | var self *ZwpRelativePointerV1 | |||
| 99 | + | r, err := c.CreateResource(ZwpRelativePointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { | |||
| 100 | + | switch opcode { | |||
| 101 | + | case 0: | |||
| 102 | + | h.Destroy(self) | |||
| 103 | + | self.Destroy() | |||
| 104 | + | } | |||
| 105 | + | }) | |||
| 106 | + | if err != nil { | |||
| 107 | + | return nil, err | |||
| 108 | + | } | |||
| 109 | + | self = WrapZwpRelativePointerV1(r) | |||
| 110 | + | r.Data = self | |||
| 111 | + | return self, nil | |||
| 112 | + | } | |||
| 113 | + | ||||
| 114 | + | // SendRelativeMotion relative pointer motion. | |||
| 115 | + | func (self *ZwpRelativePointerV1) SendRelativeMotion(utimeHi uint32, utimeLo uint32, dx server.Fixed, dy server.Fixed, dxUnaccel server.Fixed, dyUnaccel server.Fixed) { | |||
| 116 | + | self.PostEvent(ZwpRelativePointerV1EventRelativeMotion, server.Uint(utimeHi), server.Uint(utimeLo), server.FixedArg(dx), server.FixedArg(dy), server.FixedArg(dxUnaccel), server.FixedArg(dyUnaccel)) | |||
| 117 | + | } | |||
| 118 | + | func NewZwpRelativePointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { | |||
| 119 | + | return d.CreateGlobal(ZwpRelativePointerV1Interface, version, bind) | |||
| 120 | + | } | |||
| 121 | + | func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { | |||
| 122 | + | if v == nil { | |||
| 123 | + | return nil | |||
| 124 | + | } | |||
| 125 | + | return v.GetResource() | |||
| 126 | + | } | |||
| 127 | + | func (self *ZwpRelativePointerManagerV1) GetResource() *server.Resource { | |||
| 128 | + | if self == nil { | |||
| 129 | + | return nil | |||
| 130 | + | } | |||
| 131 | + | return self.Resource | |||
| 132 | + | } | |||
| 133 | + | func (self *ZwpRelativePointerV1) GetResource() *server.Resource { | |||
| 134 | + | if self == nil { | |||
| 135 | + | return nil | |||
| 136 | + | } | |||
| 137 | + | return self.Resource | |||
| 138 | + | } | |||
A protocols/pointer-constraints-unstable-v1.xml +334 -0
| @@ -0,0 +1,334 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <protocol name="pointer_constraints_unstable_v1"> | |
| 3 | + | ||
| 4 | + | <copyright> | |
| 5 | + | Copyright © 2014 Jonas Ådahl | |
| 6 | + | Copyright © 2015 Red Hat Inc. | |
| 7 | + | ||
| 8 | + | Permission is hereby granted, free of charge, to any person obtaining a | |
| 9 | + | copy of this software and associated documentation files (the "Software"), | |
| 10 | + | to deal in the Software without restriction, including without limitation | |
| 11 | + | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 12 | + | and/or sell copies of the Software, and to permit persons to whom the | |
| 13 | + | Software is furnished to do so, subject to the following conditions: | |
| 14 | + | ||
| 15 | + | The above copyright notice and this permission notice (including the next | |
| 16 | + | paragraph) shall be included in all copies or substantial portions of the | |
| 17 | + | Software. | |
| 18 | + | ||
| 19 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 20 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 21 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 22 | + | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 23 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 24 | + | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 25 | + | DEALINGS IN THE SOFTWARE. | |
| 26 | + | </copyright> | |
| 27 | + | ||
| 28 | + | <description summary="protocol for constraining pointer motions"> | |
| 29 | + | This protocol specifies a set of interfaces used for adding constraints to | |
| 30 | + | the motion of a pointer. Possible constraints include confining pointer | |
| 31 | + | motions to a given region, or locking it to its current position. | |
| 32 | + | ||
| 33 | + | In order to constrain the pointer, a client must first bind the global | |
| 34 | + | interface "wp_pointer_constraints" which, if a compositor supports pointer | |
| 35 | + | constraints, is exposed by the registry. Using the bound global object, the | |
| 36 | + | client uses the request that corresponds to the type of constraint it wants | |
| 37 | + | to make. See wp_pointer_constraints for more details. | |
| 38 | + | ||
| 39 | + | Warning! The protocol described in this file is experimental and backward | |
| 40 | + | incompatible changes may be made. Backward compatible changes may be added | |
| 41 | + | together with the corresponding interface version bump. Backward | |
| 42 | + | incompatible changes are done by bumping the version number in the protocol | |
| 43 | + | and interface names and resetting the interface version. Once the protocol | |
| 44 | + | is to be declared stable, the 'z' prefix and the version number in the | |
| 45 | + | protocol and interface names are removed and the interface version number is | |
| 46 | + | reset. | |
| 47 | + | </description> | |
| 48 | + | ||
| 49 | + | <interface name="zwp_pointer_constraints_v1" version="1"> | |
| 50 | + | <description summary="constrain the movement of a pointer"> | |
| 51 | + | The global interface exposing pointer constraining functionality. It | |
| 52 | + | exposes two requests: lock_pointer for locking the pointer to its | |
| 53 | + | position, and confine_pointer for locking the pointer to a region. | |
| 54 | + | ||
| 55 | + | The lock_pointer and confine_pointer requests create the objects | |
| 56 | + | wp_locked_pointer and wp_confined_pointer respectively, and the client can | |
| 57 | + | use these objects to interact with the lock. | |
| 58 | + | ||
| 59 | + | For any surface, only one lock or confinement may be active across all | |
| 60 | + | wl_pointer objects of the same seat. If a lock or confinement is requested | |
| 61 | + | when another lock or confinement is active or requested on the same surface | |
| 62 | + | and with any of the wl_pointer objects of the same seat, an | |
| 63 | + | 'already_constrained' error will be raised. | |
| 64 | + | </description> | |
| 65 | + | ||
| 66 | + | <enum name="error"> | |
| 67 | + | <description summary="wp_pointer_constraints error values"> | |
| 68 | + | These errors can be emitted in response to wp_pointer_constraints | |
| 69 | + | requests. | |
| 70 | + | </description> | |
| 71 | + | <entry name="already_constrained" value="1" | |
| 72 | + | summary="pointer constraint already requested on that surface"/> | |
| 73 | + | </enum> | |
| 74 | + | ||
| 75 | + | <enum name="lifetime"> | |
| 76 | + | <description summary="constraint lifetime"> | |
| 77 | + | These values represent different lifetime semantics. They are passed | |
| 78 | + | as arguments to the factory requests to specify how the constraint | |
| 79 | + | lifetimes should be managed. | |
| 80 | + | </description> | |
| 81 | + | <entry name="oneshot" value="1"> | |
| 82 | + | <description summary="the pointer constraint is defunct once deactivated"> | |
| 83 | + | A oneshot pointer constraint will never reactivate once it has been | |
| 84 | + | deactivated. See the corresponding deactivation event | |
| 85 | + | (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for | |
| 86 | + | details. | |
| 87 | + | </description> | |
| 88 | + | </entry> | |
| 89 | + | <entry name="persistent" value="2"> | |
| 90 | + | <description summary="the pointer constraint may reactivate"> | |
| 91 | + | A persistent pointer constraint may again reactivate once it has | |
| 92 | + | been deactivated. See the corresponding deactivation event | |
| 93 | + | (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for | |
| 94 | + | details. | |
| 95 | + | </description> | |
| 96 | + | </entry> | |
| 97 | + | </enum> | |
| 98 | + | ||
| 99 | + | <request name="destroy" type="destructor"> | |
| 100 | + | <description summary="destroy the pointer constraints manager object"> | |
| 101 | + | Used by the client to notify the server that it will no longer use this | |
| 102 | + | pointer constraints object. | |
| 103 | + | </description> | |
| 104 | + | </request> | |
| 105 | + | ||
| 106 | + | <request name="lock_pointer"> | |
| 107 | + | <description summary="lock pointer to a position"> | |
| 108 | + | The lock_pointer request lets the client request to disable movements of | |
| 109 | + | the virtual pointer (i.e. the cursor), effectively locking the pointer | |
| 110 | + | to a position. This request may not take effect immediately; in the | |
| 111 | + | future, when the compositor deems implementation-specific constraints | |
| 112 | + | are satisfied, the pointer lock will be activated and the compositor | |
| 113 | + | sends a locked event. | |
| 114 | + | ||
| 115 | + | The protocol provides no guarantee that the constraints are ever | |
| 116 | + | satisfied, and does not require the compositor to send an error if the | |
| 117 | + | constraints cannot ever be satisfied. It is thus possible to request a | |
| 118 | + | lock that will never activate. | |
| 119 | + | ||
| 120 | + | There may not be another pointer constraint of any kind requested or | |
| 121 | + | active on the surface for any of the wl_pointer objects of the seat of | |
| 122 | + | the passed pointer when requesting a lock. If there is, an error will be | |
| 123 | + | raised. See general pointer lock documentation for more details. | |
| 124 | + | ||
| 125 | + | The intersection of the region passed with this request and the input | |
| 126 | + | region of the surface is used to determine where the pointer must be | |
| 127 | + | in order for the lock to activate. It is up to the compositor whether to | |
| 128 | + | warp the pointer or require some kind of user interaction for the lock | |
| 129 | + | to activate. If the region is null the surface input region is used. | |
| 130 | + | ||
| 131 | + | A surface may receive pointer focus without the lock being activated. | |
| 132 | + | ||
| 133 | + | The request creates a new object wp_locked_pointer which is used to | |
| 134 | + | interact with the lock as well as receive updates about its state. See | |
| 135 | + | the the description of wp_locked_pointer for further information. | |
| 136 | + | ||
| 137 | + | Note that while a pointer is locked, the wl_pointer objects of the | |
| 138 | + | corresponding seat will not emit any wl_pointer.motion events, but | |
| 139 | + | relative motion events will still be emitted via wp_relative_pointer | |
| 140 | + | objects of the same seat. wl_pointer.axis and wl_pointer.button events | |
| 141 | + | are unaffected. | |
| 142 | + | </description> | |
| 143 | + | <arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/> | |
| 144 | + | <arg name="surface" type="object" interface="wl_surface" | |
| 145 | + | summary="surface to lock pointer to"/> | |
| 146 | + | <arg name="pointer" type="object" interface="wl_pointer" | |
| 147 | + | summary="the pointer that should be locked"/> | |
| 148 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |
| 149 | + | summary="region of surface"/> | |
| 150 | + | <arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/> | |
| 151 | + | </request> | |
| 152 | + | ||
| 153 | + | <request name="confine_pointer"> | |
| 154 | + | <description summary="confine pointer to a region"> | |
| 155 | + | The confine_pointer request lets the client request to confine the | |
| 156 | + | pointer cursor to a given region. This request may not take effect | |
| 157 | + | immediately; in the future, when the compositor deems implementation- | |
| 158 | + | specific constraints are satisfied, the pointer confinement will be | |
| 159 | + | activated and the compositor sends a confined event. | |
| 160 | + | ||
| 161 | + | The intersection of the region passed with this request and the input | |
| 162 | + | region of the surface is used to determine where the pointer must be | |
| 163 | + | in order for the confinement to activate. It is up to the compositor | |
| 164 | + | whether to warp the pointer or require some kind of user interaction for | |
| 165 | + | the confinement to activate. If the region is null the surface input | |
| 166 | + | region is used. | |
| 167 | + | ||
| 168 | + | The request will create a new object wp_confined_pointer which is used | |
| 169 | + | to interact with the confinement as well as receive updates about its | |
| 170 | + | state. See the the description of wp_confined_pointer for further | |
| 171 | + | information. | |
| 172 | + | </description> | |
| 173 | + | <arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/> | |
| 174 | + | <arg name="surface" type="object" interface="wl_surface" | |
| 175 | + | summary="surface to lock pointer to"/> | |
| 176 | + | <arg name="pointer" type="object" interface="wl_pointer" | |
| 177 | + | summary="the pointer that should be confined"/> | |
| 178 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |
| 179 | + | summary="region of surface"/> | |
| 180 | + | <arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/> | |
| 181 | + | </request> | |
| 182 | + | </interface> | |
| 183 | + | ||
| 184 | + | <interface name="zwp_locked_pointer_v1" version="1"> | |
| 185 | + | <description summary="receive relative pointer motion events"> | |
| 186 | + | The wp_locked_pointer interface represents a locked pointer state. | |
| 187 | + | ||
| 188 | + | While the lock of this object is active, the wl_pointer objects of the | |
| 189 | + | associated seat will not emit any wl_pointer.motion events. | |
| 190 | + | ||
| 191 | + | This object will send the event 'locked' when the lock is activated. | |
| 192 | + | Whenever the lock is activated, it is guaranteed that the locked surface | |
| 193 | + | will already have received pointer focus and that the pointer will be | |
| 194 | + | within the region passed to the request creating this object. | |
| 195 | + | ||
| 196 | + | To unlock the pointer, send the destroy request. This will also destroy | |
| 197 | + | the wp_locked_pointer object. | |
| 198 | + | ||
| 199 | + | If the compositor decides to unlock the pointer the unlocked event is | |
| 200 | + | sent. See wp_locked_pointer.unlock for details. | |
| 201 | + | ||
| 202 | + | When unlocking, the compositor may warp the cursor position to the set | |
| 203 | + | cursor position hint. If it does, it will not result in any relative | |
| 204 | + | motion events emitted via wp_relative_pointer. | |
| 205 | + | ||
| 206 | + | If the surface the lock was requested on is destroyed and the lock is not | |
| 207 | + | yet activated, the wp_locked_pointer object is now defunct and must be | |
| 208 | + | destroyed. | |
| 209 | + | </description> | |
| 210 | + | ||
| 211 | + | <request name="destroy" type="destructor"> | |
| 212 | + | <description summary="destroy the locked pointer object"> | |
| 213 | + | Destroy the locked pointer object. If applicable, the compositor will | |
| 214 | + | unlock the pointer. | |
| 215 | + | </description> | |
| 216 | + | </request> | |
| 217 | + | ||
| 218 | + | <request name="set_cursor_position_hint"> | |
| 219 | + | <description summary="set the pointer cursor position hint"> | |
| 220 | + | Set the cursor position hint relative to the top left corner of the | |
| 221 | + | surface. | |
| 222 | + | ||
| 223 | + | If the client is drawing its own cursor, it should update the position | |
| 224 | + | hint to the position of its own cursor. A compositor may use this | |
| 225 | + | information to warp the pointer upon unlock in order to avoid pointer | |
| 226 | + | jumps. | |
| 227 | + | ||
| 228 | + | The cursor position hint is double-buffered state, see | |
| 229 | + | wl_surface.commit. | |
| 230 | + | </description> | |
| 231 | + | <arg name="surface_x" type="fixed" | |
| 232 | + | summary="surface-local x coordinate"/> | |
| 233 | + | <arg name="surface_y" type="fixed" | |
| 234 | + | summary="surface-local y coordinate"/> | |
| 235 | + | </request> | |
| 236 | + | ||
| 237 | + | <request name="set_region"> | |
| 238 | + | <description summary="set a new lock region"> | |
| 239 | + | Set a new region used to lock the pointer. | |
| 240 | + | ||
| 241 | + | The new lock region is double-buffered, see wl_surface.commit. | |
| 242 | + | ||
| 243 | + | For details about the lock region, see wp_locked_pointer. | |
| 244 | + | </description> | |
| 245 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |
| 246 | + | summary="region of surface"/> | |
| 247 | + | </request> | |
| 248 | + | ||
| 249 | + | <event name="locked"> | |
| 250 | + | <description summary="lock activation event"> | |
| 251 | + | Notification that the pointer lock of the seat's pointer is activated. | |
| 252 | + | </description> | |
| 253 | + | </event> | |
| 254 | + | ||
| 255 | + | <event name="unlocked"> | |
| 256 | + | <description summary="lock deactivation event"> | |
| 257 | + | Notification that the pointer lock of the seat's pointer is no longer | |
| 258 | + | active. If this is a oneshot pointer lock (see | |
| 259 | + | wp_pointer_constraints.lifetime) this object is now defunct and should | |
| 260 | + | be destroyed. If this is a persistent pointer lock (see | |
| 261 | + | wp_pointer_constraints.lifetime) this pointer lock may again | |
| 262 | + | reactivate in the future. | |
| 263 | + | </description> | |
| 264 | + | </event> | |
| 265 | + | </interface> | |
| 266 | + | ||
| 267 | + | <interface name="zwp_confined_pointer_v1" version="1"> | |
| 268 | + | <description summary="confined pointer object"> | |
| 269 | + | The wp_confined_pointer interface represents a confined pointer state. | |
| 270 | + | ||
| 271 | + | This object will send the event 'confined' when the confinement is | |
| 272 | + | activated. Whenever the confinement is activated, it is guaranteed that | |
| 273 | + | the surface the pointer is confined to will already have received pointer | |
| 274 | + | focus and that the pointer will be within the region passed to the request | |
| 275 | + | creating this object. It is up to the compositor to decide whether this | |
| 276 | + | requires some user interaction and if the pointer will warp to within the | |
| 277 | + | passed region if outside. | |
| 278 | + | ||
| 279 | + | To unconfine the pointer, send the destroy request. This will also destroy | |
| 280 | + | the wp_confined_pointer object. | |
| 281 | + | ||
| 282 | + | If the compositor decides to unconfine the pointer the unconfined event is | |
| 283 | + | sent. The wp_confined_pointer object is at this point defunct and should | |
| 284 | + | be destroyed. | |
| 285 | + | </description> | |
| 286 | + | ||
| 287 | + | <request name="destroy" type="destructor"> | |
| 288 | + | <description summary="destroy the confined pointer object"> | |
| 289 | + | Destroy the confined pointer object. If applicable, the compositor will | |
| 290 | + | unconfine the pointer. | |
| 291 | + | </description> | |
| 292 | + | </request> | |
| 293 | + | ||
| 294 | + | <request name="set_region"> | |
| 295 | + | <description summary="set a new confine region"> | |
| 296 | + | Set a new region used to confine the pointer. | |
| 297 | + | ||
| 298 | + | The new confine region is double-buffered, see wl_surface.commit. | |
| 299 | + | ||
| 300 | + | If the confinement is active when the new confinement region is applied | |
| 301 | + | and the pointer ends up outside of newly applied region, the pointer may | |
| 302 | + | warped to a position within the new confinement region. If warped, a | |
| 303 | + | wl_pointer.motion event will be emitted, but no | |
| 304 | + | wp_relative_pointer.relative_motion event. | |
| 305 | + | ||
| 306 | + | The compositor may also, instead of using the new region, unconfine the | |
| 307 | + | pointer. | |
| 308 | + | ||
| 309 | + | For details about the confine region, see wp_confined_pointer. | |
| 310 | + | </description> | |
| 311 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |
| 312 | + | summary="region of surface"/> | |
| 313 | + | </request> | |
| 314 | + | ||
| 315 | + | <event name="confined"> | |
| 316 | + | <description summary="pointer confined"> | |
| 317 | + | Notification that the pointer confinement of the seat's pointer is | |
| 318 | + | activated. | |
| 319 | + | </description> | |
| 320 | + | </event> | |
| 321 | + | ||
| 322 | + | <event name="unconfined"> | |
| 323 | + | <description summary="pointer unconfined"> | |
| 324 | + | Notification that the pointer confinement of the seat's pointer is no | |
| 325 | + | longer active. If this is a oneshot pointer confinement (see | |
| 326 | + | wp_pointer_constraints.lifetime) this object is now defunct and should | |
| 327 | + | be destroyed. If this is a persistent pointer confinement (see | |
| 328 | + | wp_pointer_constraints.lifetime) this pointer confinement may again | |
| 329 | + | reactivate in the future. | |
| 330 | + | </description> | |
| 331 | + | </event> | |
| 332 | + | </interface> | |
| 333 | + | ||
| 334 | + | </protocol> | |
| @@ -0,0 +1,334 @@ | |||||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |||
| 2 | + | <protocol name="pointer_constraints_unstable_v1"> | |||
| 3 | + | ||||
| 4 | + | <copyright> | |||
| 5 | + | Copyright © 2014 Jonas Ådahl | |||
| 6 | + | Copyright © 2015 Red Hat Inc. | |||
| 7 | + | ||||
| 8 | + | Permission is hereby granted, free of charge, to any person obtaining a | |||
| 9 | + | copy of this software and associated documentation files (the "Software"), | |||
| 10 | + | to deal in the Software without restriction, including without limitation | |||
| 11 | + | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||
| 12 | + | and/or sell copies of the Software, and to permit persons to whom the | |||
| 13 | + | Software is furnished to do so, subject to the following conditions: | |||
| 14 | + | ||||
| 15 | + | The above copyright notice and this permission notice (including the next | |||
| 16 | + | paragraph) shall be included in all copies or substantial portions of the | |||
| 17 | + | Software. | |||
| 18 | + | ||||
| 19 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| 20 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 21 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||
| 22 | + | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| 23 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||
| 24 | + | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
| 25 | + | DEALINGS IN THE SOFTWARE. | |||
| 26 | + | </copyright> | |||
| 27 | + | ||||
| 28 | + | <description summary="protocol for constraining pointer motions"> | |||
| 29 | + | This protocol specifies a set of interfaces used for adding constraints to | |||
| 30 | + | the motion of a pointer. Possible constraints include confining pointer | |||
| 31 | + | motions to a given region, or locking it to its current position. | |||
| 32 | + | ||||
| 33 | + | In order to constrain the pointer, a client must first bind the global | |||
| 34 | + | interface "wp_pointer_constraints" which, if a compositor supports pointer | |||
| 35 | + | constraints, is exposed by the registry. Using the bound global object, the | |||
| 36 | + | client uses the request that corresponds to the type of constraint it wants | |||
| 37 | + | to make. See wp_pointer_constraints for more details. | |||
| 38 | + | ||||
| 39 | + | Warning! The protocol described in this file is experimental and backward | |||
| 40 | + | incompatible changes may be made. Backward compatible changes may be added | |||
| 41 | + | together with the corresponding interface version bump. Backward | |||
| 42 | + | incompatible changes are done by bumping the version number in the protocol | |||
| 43 | + | and interface names and resetting the interface version. Once the protocol | |||
| 44 | + | is to be declared stable, the 'z' prefix and the version number in the | |||
| 45 | + | protocol and interface names are removed and the interface version number is | |||
| 46 | + | reset. | |||
| 47 | + | </description> | |||
| 48 | + | ||||
| 49 | + | <interface name="zwp_pointer_constraints_v1" version="1"> | |||
| 50 | + | <description summary="constrain the movement of a pointer"> | |||
| 51 | + | The global interface exposing pointer constraining functionality. It | |||
| 52 | + | exposes two requests: lock_pointer for locking the pointer to its | |||
| 53 | + | position, and confine_pointer for locking the pointer to a region. | |||
| 54 | + | ||||
| 55 | + | The lock_pointer and confine_pointer requests create the objects | |||
| 56 | + | wp_locked_pointer and wp_confined_pointer respectively, and the client can | |||
| 57 | + | use these objects to interact with the lock. | |||
| 58 | + | ||||
| 59 | + | For any surface, only one lock or confinement may be active across all | |||
| 60 | + | wl_pointer objects of the same seat. If a lock or confinement is requested | |||
| 61 | + | when another lock or confinement is active or requested on the same surface | |||
| 62 | + | and with any of the wl_pointer objects of the same seat, an | |||
| 63 | + | 'already_constrained' error will be raised. | |||
| 64 | + | </description> | |||
| 65 | + | ||||
| 66 | + | <enum name="error"> | |||
| 67 | + | <description summary="wp_pointer_constraints error values"> | |||
| 68 | + | These errors can be emitted in response to wp_pointer_constraints | |||
| 69 | + | requests. | |||
| 70 | + | </description> | |||
| 71 | + | <entry name="already_constrained" value="1" | |||
| 72 | + | summary="pointer constraint already requested on that surface"/> | |||
| 73 | + | </enum> | |||
| 74 | + | ||||
| 75 | + | <enum name="lifetime"> | |||
| 76 | + | <description summary="constraint lifetime"> | |||
| 77 | + | These values represent different lifetime semantics. They are passed | |||
| 78 | + | as arguments to the factory requests to specify how the constraint | |||
| 79 | + | lifetimes should be managed. | |||
| 80 | + | </description> | |||
| 81 | + | <entry name="oneshot" value="1"> | |||
| 82 | + | <description summary="the pointer constraint is defunct once deactivated"> | |||
| 83 | + | A oneshot pointer constraint will never reactivate once it has been | |||
| 84 | + | deactivated. See the corresponding deactivation event | |||
| 85 | + | (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for | |||
| 86 | + | details. | |||
| 87 | + | </description> | |||
| 88 | + | </entry> | |||
| 89 | + | <entry name="persistent" value="2"> | |||
| 90 | + | <description summary="the pointer constraint may reactivate"> | |||
| 91 | + | A persistent pointer constraint may again reactivate once it has | |||
| 92 | + | been deactivated. See the corresponding deactivation event | |||
| 93 | + | (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for | |||
| 94 | + | details. | |||
| 95 | + | </description> | |||
| 96 | + | </entry> | |||
| 97 | + | </enum> | |||
| 98 | + | ||||
| 99 | + | <request name="destroy" type="destructor"> | |||
| 100 | + | <description summary="destroy the pointer constraints manager object"> | |||
| 101 | + | Used by the client to notify the server that it will no longer use this | |||
| 102 | + | pointer constraints object. | |||
| 103 | + | </description> | |||
| 104 | + | </request> | |||
| 105 | + | ||||
| 106 | + | <request name="lock_pointer"> | |||
| 107 | + | <description summary="lock pointer to a position"> | |||
| 108 | + | The lock_pointer request lets the client request to disable movements of | |||
| 109 | + | the virtual pointer (i.e. the cursor), effectively locking the pointer | |||
| 110 | + | to a position. This request may not take effect immediately; in the | |||
| 111 | + | future, when the compositor deems implementation-specific constraints | |||
| 112 | + | are satisfied, the pointer lock will be activated and the compositor | |||
| 113 | + | sends a locked event. | |||
| 114 | + | ||||
| 115 | + | The protocol provides no guarantee that the constraints are ever | |||
| 116 | + | satisfied, and does not require the compositor to send an error if the | |||
| 117 | + | constraints cannot ever be satisfied. It is thus possible to request a | |||
| 118 | + | lock that will never activate. | |||
| 119 | + | ||||
| 120 | + | There may not be another pointer constraint of any kind requested or | |||
| 121 | + | active on the surface for any of the wl_pointer objects of the seat of | |||
| 122 | + | the passed pointer when requesting a lock. If there is, an error will be | |||
| 123 | + | raised. See general pointer lock documentation for more details. | |||
| 124 | + | ||||
| 125 | + | The intersection of the region passed with this request and the input | |||
| 126 | + | region of the surface is used to determine where the pointer must be | |||
| 127 | + | in order for the lock to activate. It is up to the compositor whether to | |||
| 128 | + | warp the pointer or require some kind of user interaction for the lock | |||
| 129 | + | to activate. If the region is null the surface input region is used. | |||
| 130 | + | ||||
| 131 | + | A surface may receive pointer focus without the lock being activated. | |||
| 132 | + | ||||
| 133 | + | The request creates a new object wp_locked_pointer which is used to | |||
| 134 | + | interact with the lock as well as receive updates about its state. See | |||
| 135 | + | the the description of wp_locked_pointer for further information. | |||
| 136 | + | ||||
| 137 | + | Note that while a pointer is locked, the wl_pointer objects of the | |||
| 138 | + | corresponding seat will not emit any wl_pointer.motion events, but | |||
| 139 | + | relative motion events will still be emitted via wp_relative_pointer | |||
| 140 | + | objects of the same seat. wl_pointer.axis and wl_pointer.button events | |||
| 141 | + | are unaffected. | |||
| 142 | + | </description> | |||
| 143 | + | <arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/> | |||
| 144 | + | <arg name="surface" type="object" interface="wl_surface" | |||
| 145 | + | summary="surface to lock pointer to"/> | |||
| 146 | + | <arg name="pointer" type="object" interface="wl_pointer" | |||
| 147 | + | summary="the pointer that should be locked"/> | |||
| 148 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |||
| 149 | + | summary="region of surface"/> | |||
| 150 | + | <arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/> | |||
| 151 | + | </request> | |||
| 152 | + | ||||
| 153 | + | <request name="confine_pointer"> | |||
| 154 | + | <description summary="confine pointer to a region"> | |||
| 155 | + | The confine_pointer request lets the client request to confine the | |||
| 156 | + | pointer cursor to a given region. This request may not take effect | |||
| 157 | + | immediately; in the future, when the compositor deems implementation- | |||
| 158 | + | specific constraints are satisfied, the pointer confinement will be | |||
| 159 | + | activated and the compositor sends a confined event. | |||
| 160 | + | ||||
| 161 | + | The intersection of the region passed with this request and the input | |||
| 162 | + | region of the surface is used to determine where the pointer must be | |||
| 163 | + | in order for the confinement to activate. It is up to the compositor | |||
| 164 | + | whether to warp the pointer or require some kind of user interaction for | |||
| 165 | + | the confinement to activate. If the region is null the surface input | |||
| 166 | + | region is used. | |||
| 167 | + | ||||
| 168 | + | The request will create a new object wp_confined_pointer which is used | |||
| 169 | + | to interact with the confinement as well as receive updates about its | |||
| 170 | + | state. See the the description of wp_confined_pointer for further | |||
| 171 | + | information. | |||
| 172 | + | </description> | |||
| 173 | + | <arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/> | |||
| 174 | + | <arg name="surface" type="object" interface="wl_surface" | |||
| 175 | + | summary="surface to lock pointer to"/> | |||
| 176 | + | <arg name="pointer" type="object" interface="wl_pointer" | |||
| 177 | + | summary="the pointer that should be confined"/> | |||
| 178 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |||
| 179 | + | summary="region of surface"/> | |||
| 180 | + | <arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/> | |||
| 181 | + | </request> | |||
| 182 | + | </interface> | |||
| 183 | + | ||||
| 184 | + | <interface name="zwp_locked_pointer_v1" version="1"> | |||
| 185 | + | <description summary="receive relative pointer motion events"> | |||
| 186 | + | The wp_locked_pointer interface represents a locked pointer state. | |||
| 187 | + | ||||
| 188 | + | While the lock of this object is active, the wl_pointer objects of the | |||
| 189 | + | associated seat will not emit any wl_pointer.motion events. | |||
| 190 | + | ||||
| 191 | + | This object will send the event 'locked' when the lock is activated. | |||
| 192 | + | Whenever the lock is activated, it is guaranteed that the locked surface | |||
| 193 | + | will already have received pointer focus and that the pointer will be | |||
| 194 | + | within the region passed to the request creating this object. | |||
| 195 | + | ||||
| 196 | + | To unlock the pointer, send the destroy request. This will also destroy | |||
| 197 | + | the wp_locked_pointer object. | |||
| 198 | + | ||||
| 199 | + | If the compositor decides to unlock the pointer the unlocked event is | |||
| 200 | + | sent. See wp_locked_pointer.unlock for details. | |||
| 201 | + | ||||
| 202 | + | When unlocking, the compositor may warp the cursor position to the set | |||
| 203 | + | cursor position hint. If it does, it will not result in any relative | |||
| 204 | + | motion events emitted via wp_relative_pointer. | |||
| 205 | + | ||||
| 206 | + | If the surface the lock was requested on is destroyed and the lock is not | |||
| 207 | + | yet activated, the wp_locked_pointer object is now defunct and must be | |||
| 208 | + | destroyed. | |||
| 209 | + | </description> | |||
| 210 | + | ||||
| 211 | + | <request name="destroy" type="destructor"> | |||
| 212 | + | <description summary="destroy the locked pointer object"> | |||
| 213 | + | Destroy the locked pointer object. If applicable, the compositor will | |||
| 214 | + | unlock the pointer. | |||
| 215 | + | </description> | |||
| 216 | + | </request> | |||
| 217 | + | ||||
| 218 | + | <request name="set_cursor_position_hint"> | |||
| 219 | + | <description summary="set the pointer cursor position hint"> | |||
| 220 | + | Set the cursor position hint relative to the top left corner of the | |||
| 221 | + | surface. | |||
| 222 | + | ||||
| 223 | + | If the client is drawing its own cursor, it should update the position | |||
| 224 | + | hint to the position of its own cursor. A compositor may use this | |||
| 225 | + | information to warp the pointer upon unlock in order to avoid pointer | |||
| 226 | + | jumps. | |||
| 227 | + | ||||
| 228 | + | The cursor position hint is double-buffered state, see | |||
| 229 | + | wl_surface.commit. | |||
| 230 | + | </description> | |||
| 231 | + | <arg name="surface_x" type="fixed" | |||
| 232 | + | summary="surface-local x coordinate"/> | |||
| 233 | + | <arg name="surface_y" type="fixed" | |||
| 234 | + | summary="surface-local y coordinate"/> | |||
| 235 | + | </request> | |||
| 236 | + | ||||
| 237 | + | <request name="set_region"> | |||
| 238 | + | <description summary="set a new lock region"> | |||
| 239 | + | Set a new region used to lock the pointer. | |||
| 240 | + | ||||
| 241 | + | The new lock region is double-buffered, see wl_surface.commit. | |||
| 242 | + | ||||
| 243 | + | For details about the lock region, see wp_locked_pointer. | |||
| 244 | + | </description> | |||
| 245 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |||
| 246 | + | summary="region of surface"/> | |||
| 247 | + | </request> | |||
| 248 | + | ||||
| 249 | + | <event name="locked"> | |||
| 250 | + | <description summary="lock activation event"> | |||
| 251 | + | Notification that the pointer lock of the seat's pointer is activated. | |||
| 252 | + | </description> | |||
| 253 | + | </event> | |||
| 254 | + | ||||
| 255 | + | <event name="unlocked"> | |||
| 256 | + | <description summary="lock deactivation event"> | |||
| 257 | + | Notification that the pointer lock of the seat's pointer is no longer | |||
| 258 | + | active. If this is a oneshot pointer lock (see | |||
| 259 | + | wp_pointer_constraints.lifetime) this object is now defunct and should | |||
| 260 | + | be destroyed. If this is a persistent pointer lock (see | |||
| 261 | + | wp_pointer_constraints.lifetime) this pointer lock may again | |||
| 262 | + | reactivate in the future. | |||
| 263 | + | </description> | |||
| 264 | + | </event> | |||
| 265 | + | </interface> | |||
| 266 | + | ||||
| 267 | + | <interface name="zwp_confined_pointer_v1" version="1"> | |||
| 268 | + | <description summary="confined pointer object"> | |||
| 269 | + | The wp_confined_pointer interface represents a confined pointer state. | |||
| 270 | + | ||||
| 271 | + | This object will send the event 'confined' when the confinement is | |||
| 272 | + | activated. Whenever the confinement is activated, it is guaranteed that | |||
| 273 | + | the surface the pointer is confined to will already have received pointer | |||
| 274 | + | focus and that the pointer will be within the region passed to the request | |||
| 275 | + | creating this object. It is up to the compositor to decide whether this | |||
| 276 | + | requires some user interaction and if the pointer will warp to within the | |||
| 277 | + | passed region if outside. | |||
| 278 | + | ||||
| 279 | + | To unconfine the pointer, send the destroy request. This will also destroy | |||
| 280 | + | the wp_confined_pointer object. | |||
| 281 | + | ||||
| 282 | + | If the compositor decides to unconfine the pointer the unconfined event is | |||
| 283 | + | sent. The wp_confined_pointer object is at this point defunct and should | |||
| 284 | + | be destroyed. | |||
| 285 | + | </description> | |||
| 286 | + | ||||
| 287 | + | <request name="destroy" type="destructor"> | |||
| 288 | + | <description summary="destroy the confined pointer object"> | |||
| 289 | + | Destroy the confined pointer object. If applicable, the compositor will | |||
| 290 | + | unconfine the pointer. | |||
| 291 | + | </description> | |||
| 292 | + | </request> | |||
| 293 | + | ||||
| 294 | + | <request name="set_region"> | |||
| 295 | + | <description summary="set a new confine region"> | |||
| 296 | + | Set a new region used to confine the pointer. | |||
| 297 | + | ||||
| 298 | + | The new confine region is double-buffered, see wl_surface.commit. | |||
| 299 | + | ||||
| 300 | + | If the confinement is active when the new confinement region is applied | |||
| 301 | + | and the pointer ends up outside of newly applied region, the pointer may | |||
| 302 | + | warped to a position within the new confinement region. If warped, a | |||
| 303 | + | wl_pointer.motion event will be emitted, but no | |||
| 304 | + | wp_relative_pointer.relative_motion event. | |||
| 305 | + | ||||
| 306 | + | The compositor may also, instead of using the new region, unconfine the | |||
| 307 | + | pointer. | |||
| 308 | + | ||||
| 309 | + | For details about the confine region, see wp_confined_pointer. | |||
| 310 | + | </description> | |||
| 311 | + | <arg name="region" type="object" interface="wl_region" allow-null="true" | |||
| 312 | + | summary="region of surface"/> | |||
| 313 | + | </request> | |||
| 314 | + | ||||
| 315 | + | <event name="confined"> | |||
| 316 | + | <description summary="pointer confined"> | |||
| 317 | + | Notification that the pointer confinement of the seat's pointer is | |||
| 318 | + | activated. | |||
| 319 | + | </description> | |||
| 320 | + | </event> | |||
| 321 | + | ||||
| 322 | + | <event name="unconfined"> | |||
| 323 | + | <description summary="pointer unconfined"> | |||
| 324 | + | Notification that the pointer confinement of the seat's pointer is no | |||
| 325 | + | longer active. If this is a oneshot pointer confinement (see | |||
| 326 | + | wp_pointer_constraints.lifetime) this object is now defunct and should | |||
| 327 | + | be destroyed. If this is a persistent pointer confinement (see | |||
| 328 | + | wp_pointer_constraints.lifetime) this pointer confinement may again | |||
| 329 | + | reactivate in the future. | |||
| 330 | + | </description> | |||
| 331 | + | </event> | |||
| 332 | + | </interface> | |||
| 333 | + | ||||
| 334 | + | </protocol> | |||
A protocols/relative-pointer-unstable-v1.xml +136 -0
| @@ -0,0 +1,136 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <protocol name="relative_pointer_unstable_v1"> | |
| 3 | + | ||
| 4 | + | <copyright> | |
| 5 | + | Copyright © 2014 Jonas Ådahl | |
| 6 | + | Copyright © 2015 Red Hat Inc. | |
| 7 | + | ||
| 8 | + | Permission is hereby granted, free of charge, to any person obtaining a | |
| 9 | + | copy of this software and associated documentation files (the "Software"), | |
| 10 | + | to deal in the Software without restriction, including without limitation | |
| 11 | + | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 12 | + | and/or sell copies of the Software, and to permit persons to whom the | |
| 13 | + | Software is furnished to do so, subject to the following conditions: | |
| 14 | + | ||
| 15 | + | The above copyright notice and this permission notice (including the next | |
| 16 | + | paragraph) shall be included in all copies or substantial portions of the | |
| 17 | + | Software. | |
| 18 | + | ||
| 19 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 20 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 21 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 22 | + | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 23 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 24 | + | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 25 | + | DEALINGS IN THE SOFTWARE. | |
| 26 | + | </copyright> | |
| 27 | + | ||
| 28 | + | <description summary="protocol for relative pointer motion events"> | |
| 29 | + | This protocol specifies a set of interfaces used for making clients able to | |
| 30 | + | receive relative pointer events not obstructed by barriers (such as the | |
| 31 | + | monitor edge or other pointer barriers). | |
| 32 | + | ||
| 33 | + | To start receiving relative pointer events, a client must first bind the | |
| 34 | + | global interface "wp_relative_pointer_manager" which, if a compositor | |
| 35 | + | supports relative pointer motion events, is exposed by the registry. After | |
| 36 | + | having created the relative pointer manager proxy object, the client uses | |
| 37 | + | it to create the actual relative pointer object using the | |
| 38 | + | "get_relative_pointer" request given a wl_pointer. The relative pointer | |
| 39 | + | motion events will then, when applicable, be transmitted via the proxy of | |
| 40 | + | the newly created relative pointer object. See the documentation of the | |
| 41 | + | relative pointer interface for more details. | |
| 42 | + | ||
| 43 | + | Warning! The protocol described in this file is experimental and backward | |
| 44 | + | incompatible changes may be made. Backward compatible changes may be added | |
| 45 | + | together with the corresponding interface version bump. Backward | |
| 46 | + | incompatible changes are done by bumping the version number in the protocol | |
| 47 | + | and interface names and resetting the interface version. Once the protocol | |
| 48 | + | is to be declared stable, the 'z' prefix and the version number in the | |
| 49 | + | protocol and interface names are removed and the interface version number is | |
| 50 | + | reset. | |
| 51 | + | </description> | |
| 52 | + | ||
| 53 | + | <interface name="zwp_relative_pointer_manager_v1" version="1"> | |
| 54 | + | <description summary="get relative pointer objects"> | |
| 55 | + | A global interface used for getting the relative pointer object for a | |
| 56 | + | given pointer. | |
| 57 | + | </description> | |
| 58 | + | ||
| 59 | + | <request name="destroy" type="destructor"> | |
| 60 | + | <description summary="destroy the relative pointer manager object"> | |
| 61 | + | Used by the client to notify the server that it will no longer use this | |
| 62 | + | relative pointer manager object. | |
| 63 | + | </description> | |
| 64 | + | </request> | |
| 65 | + | ||
| 66 | + | <request name="get_relative_pointer"> | |
| 67 | + | <description summary="get a relative pointer object"> | |
| 68 | + | Create a relative pointer interface given a wl_pointer object. See the | |
| 69 | + | wp_relative_pointer interface for more details. | |
| 70 | + | </description> | |
| 71 | + | <arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/> | |
| 72 | + | <arg name="pointer" type="object" interface="wl_pointer"/> | |
| 73 | + | </request> | |
| 74 | + | </interface> | |
| 75 | + | ||
| 76 | + | <interface name="zwp_relative_pointer_v1" version="1"> | |
| 77 | + | <description summary="relative pointer object"> | |
| 78 | + | A wp_relative_pointer object is an extension to the wl_pointer interface | |
| 79 | + | used for emitting relative pointer events. It shares the same focus as | |
| 80 | + | wl_pointer objects of the same seat and will only emit events when it has | |
| 81 | + | focus. | |
| 82 | + | </description> | |
| 83 | + | ||
| 84 | + | <request name="destroy" type="destructor"> | |
| 85 | + | <description summary="release the relative pointer object"/> | |
| 86 | + | </request> | |
| 87 | + | ||
| 88 | + | <event name="relative_motion"> | |
| 89 | + | <description summary="relative pointer motion"> | |
| 90 | + | Relative x/y pointer motion from the pointer of the seat associated with | |
| 91 | + | this object. | |
| 92 | + | ||
| 93 | + | A relative motion is in the same dimension as regular wl_pointer motion | |
| 94 | + | events, except they do not represent an absolute position. For example, | |
| 95 | + | moving a pointer from (x, y) to (x', y') would have the equivalent | |
| 96 | + | relative motion (x' - x, y' - y). If a pointer motion caused the | |
| 97 | + | absolute pointer position to be clipped by for example the edge of the | |
| 98 | + | monitor, the relative motion is unaffected by the clipping and will | |
| 99 | + | represent the unclipped motion. | |
| 100 | + | ||
| 101 | + | This event also contains non-accelerated motion deltas. The | |
| 102 | + | non-accelerated delta is, when applicable, the regular pointer motion | |
| 103 | + | delta as it was before having applied motion acceleration and other | |
| 104 | + | transformations such as normalization. | |
| 105 | + | ||
| 106 | + | Note that the non-accelerated delta does not represent 'raw' events as | |
| 107 | + | they were read from some device. Pointer motion acceleration is device- | |
| 108 | + | and configuration-specific and non-accelerated deltas and accelerated | |
| 109 | + | deltas may have the same value on some devices. | |
| 110 | + | ||
| 111 | + | Relative motions are not coupled to wl_pointer.motion events, and can be | |
| 112 | + | sent in combination with such events, but also independently. There may | |
| 113 | + | also be scenarios where wl_pointer.motion is sent, but there is no | |
| 114 | + | relative motion. The order of an absolute and relative motion event | |
| 115 | + | originating from the same physical motion is not guaranteed. | |
| 116 | + | ||
| 117 | + | If the client needs button events or focus state, it can receive them | |
| 118 | + | from a wl_pointer object of the same seat that the wp_relative_pointer | |
| 119 | + | object is associated with. | |
| 120 | + | </description> | |
| 121 | + | <arg name="utime_hi" type="uint" | |
| 122 | + | summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/> | |
| 123 | + | <arg name="utime_lo" type="uint" | |
| 124 | + | summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/> | |
| 125 | + | <arg name="dx" type="fixed" | |
| 126 | + | summary="the x component of the motion vector"/> | |
| 127 | + | <arg name="dy" type="fixed" | |
| 128 | + | summary="the y component of the motion vector"/> | |
| 129 | + | <arg name="dx_unaccel" type="fixed" | |
| 130 | + | summary="the x component of the unaccelerated motion vector"/> | |
| 131 | + | <arg name="dy_unaccel" type="fixed" | |
| 132 | + | summary="the y component of the unaccelerated motion vector"/> | |
| 133 | + | </event> | |
| 134 | + | </interface> | |
| 135 | + | ||
| 136 | + | </protocol> | |
| @@ -0,0 +1,136 @@ | |||||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |||
| 2 | + | <protocol name="relative_pointer_unstable_v1"> | |||
| 3 | + | ||||
| 4 | + | <copyright> | |||
| 5 | + | Copyright © 2014 Jonas Ådahl | |||
| 6 | + | Copyright © 2015 Red Hat Inc. | |||
| 7 | + | ||||
| 8 | + | Permission is hereby granted, free of charge, to any person obtaining a | |||
| 9 | + | copy of this software and associated documentation files (the "Software"), | |||
| 10 | + | to deal in the Software without restriction, including without limitation | |||
| 11 | + | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||
| 12 | + | and/or sell copies of the Software, and to permit persons to whom the | |||
| 13 | + | Software is furnished to do so, subject to the following conditions: | |||
| 14 | + | ||||
| 15 | + | The above copyright notice and this permission notice (including the next | |||
| 16 | + | paragraph) shall be included in all copies or substantial portions of the | |||
| 17 | + | Software. | |||
| 18 | + | ||||
| 19 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| 20 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 21 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||
| 22 | + | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| 23 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||
| 24 | + | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
| 25 | + | DEALINGS IN THE SOFTWARE. | |||
| 26 | + | </copyright> | |||
| 27 | + | ||||
| 28 | + | <description summary="protocol for relative pointer motion events"> | |||
| 29 | + | This protocol specifies a set of interfaces used for making clients able to | |||
| 30 | + | receive relative pointer events not obstructed by barriers (such as the | |||
| 31 | + | monitor edge or other pointer barriers). | |||
| 32 | + | ||||
| 33 | + | To start receiving relative pointer events, a client must first bind the | |||
| 34 | + | global interface "wp_relative_pointer_manager" which, if a compositor | |||
| 35 | + | supports relative pointer motion events, is exposed by the registry. After | |||
| 36 | + | having created the relative pointer manager proxy object, the client uses | |||
| 37 | + | it to create the actual relative pointer object using the | |||
| 38 | + | "get_relative_pointer" request given a wl_pointer. The relative pointer | |||
| 39 | + | motion events will then, when applicable, be transmitted via the proxy of | |||
| 40 | + | the newly created relative pointer object. See the documentation of the | |||
| 41 | + | relative pointer interface for more details. | |||
| 42 | + | ||||
| 43 | + | Warning! The protocol described in this file is experimental and backward | |||
| 44 | + | incompatible changes may be made. Backward compatible changes may be added | |||
| 45 | + | together with the corresponding interface version bump. Backward | |||
| 46 | + | incompatible changes are done by bumping the version number in the protocol | |||
| 47 | + | and interface names and resetting the interface version. Once the protocol | |||
| 48 | + | is to be declared stable, the 'z' prefix and the version number in the | |||
| 49 | + | protocol and interface names are removed and the interface version number is | |||
| 50 | + | reset. | |||
| 51 | + | </description> | |||
| 52 | + | ||||
| 53 | + | <interface name="zwp_relative_pointer_manager_v1" version="1"> | |||
| 54 | + | <description summary="get relative pointer objects"> | |||
| 55 | + | A global interface used for getting the relative pointer object for a | |||
| 56 | + | given pointer. | |||
| 57 | + | </description> | |||
| 58 | + | ||||
| 59 | + | <request name="destroy" type="destructor"> | |||
| 60 | + | <description summary="destroy the relative pointer manager object"> | |||
| 61 | + | Used by the client to notify the server that it will no longer use this | |||
| 62 | + | relative pointer manager object. | |||
| 63 | + | </description> | |||
| 64 | + | </request> | |||
| 65 | + | ||||
| 66 | + | <request name="get_relative_pointer"> | |||
| 67 | + | <description summary="get a relative pointer object"> | |||
| 68 | + | Create a relative pointer interface given a wl_pointer object. See the | |||
| 69 | + | wp_relative_pointer interface for more details. | |||
| 70 | + | </description> | |||
| 71 | + | <arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/> | |||
| 72 | + | <arg name="pointer" type="object" interface="wl_pointer"/> | |||
| 73 | + | </request> | |||
| 74 | + | </interface> | |||
| 75 | + | ||||
| 76 | + | <interface name="zwp_relative_pointer_v1" version="1"> | |||
| 77 | + | <description summary="relative pointer object"> | |||
| 78 | + | A wp_relative_pointer object is an extension to the wl_pointer interface | |||
| 79 | + | used for emitting relative pointer events. It shares the same focus as | |||
| 80 | + | wl_pointer objects of the same seat and will only emit events when it has | |||
| 81 | + | focus. | |||
| 82 | + | </description> | |||
| 83 | + | ||||
| 84 | + | <request name="destroy" type="destructor"> | |||
| 85 | + | <description summary="release the relative pointer object"/> | |||
| 86 | + | </request> | |||
| 87 | + | ||||
| 88 | + | <event name="relative_motion"> | |||
| 89 | + | <description summary="relative pointer motion"> | |||
| 90 | + | Relative x/y pointer motion from the pointer of the seat associated with | |||
| 91 | + | this object. | |||
| 92 | + | ||||
| 93 | + | A relative motion is in the same dimension as regular wl_pointer motion | |||
| 94 | + | events, except they do not represent an absolute position. For example, | |||
| 95 | + | moving a pointer from (x, y) to (x', y') would have the equivalent | |||
| 96 | + | relative motion (x' - x, y' - y). If a pointer motion caused the | |||
| 97 | + | absolute pointer position to be clipped by for example the edge of the | |||
| 98 | + | monitor, the relative motion is unaffected by the clipping and will | |||
| 99 | + | represent the unclipped motion. | |||
| 100 | + | ||||
| 101 | + | This event also contains non-accelerated motion deltas. The | |||
| 102 | + | non-accelerated delta is, when applicable, the regular pointer motion | |||
| 103 | + | delta as it was before having applied motion acceleration and other | |||
| 104 | + | transformations such as normalization. | |||
| 105 | + | ||||
| 106 | + | Note that the non-accelerated delta does not represent 'raw' events as | |||
| 107 | + | they were read from some device. Pointer motion acceleration is device- | |||
| 108 | + | and configuration-specific and non-accelerated deltas and accelerated | |||
| 109 | + | deltas may have the same value on some devices. | |||
| 110 | + | ||||
| 111 | + | Relative motions are not coupled to wl_pointer.motion events, and can be | |||
| 112 | + | sent in combination with such events, but also independently. There may | |||
| 113 | + | also be scenarios where wl_pointer.motion is sent, but there is no | |||
| 114 | + | relative motion. The order of an absolute and relative motion event | |||
| 115 | + | originating from the same physical motion is not guaranteed. | |||
| 116 | + | ||||
| 117 | + | If the client needs button events or focus state, it can receive them | |||
| 118 | + | from a wl_pointer object of the same seat that the wp_relative_pointer | |||
| 119 | + | object is associated with. | |||
| 120 | + | </description> | |||
| 121 | + | <arg name="utime_hi" type="uint" | |||
| 122 | + | summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/> | |||
| 123 | + | <arg name="utime_lo" type="uint" | |||
| 124 | + | summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/> | |||
| 125 | + | <arg name="dx" type="fixed" | |||
| 126 | + | summary="the x component of the motion vector"/> | |||
| 127 | + | <arg name="dy" type="fixed" | |||
| 128 | + | summary="the y component of the motion vector"/> | |||
| 129 | + | <arg name="dx_unaccel" type="fixed" | |||
| 130 | + | summary="the x component of the unaccelerated motion vector"/> | |||
| 131 | + | <arg name="dy_unaccel" type="fixed" | |||
| 132 | + | summary="the y component of the unaccelerated motion vector"/> | |||
| 133 | + | </event> | |||
| 134 | + | </interface> | |||
| 135 | + | ||||
| 136 | + | </protocol> | |||