Source file cursor_shape_v1_server.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
[@@@ocaml.warning "-27-34"]
open struct
module Imports = struct
include Cursor_shape_v1_proto
include Wayland.Wayland_proto
include Tablet_v2_proto
end
module Proxy = Wayland.Proxy
module Msg = Wayland.Msg
module Fixed = Wayland.Fixed
module Iface_reg = Wayland.Iface_reg
module S = Wayland.S
end
(** Cursor shape manager.
This global offers an alternative, optional way to set cursor images. This
new way uses enumerated cursors instead of a wl_surface like
wl_pointer.set_cursor does.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension. *)
module Wp_cursor_shape_manager_v1 = struct
type 'v t = ([`Wp_cursor_shape_manager_v1], 'v, [`Server]) Proxy.t
(** {2 Version 1, 2} *)
(**/**)
class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
method user_data = S.No_data
method metadata = (module Cursor_shape_v1_proto.Wp_cursor_shape_manager_v1)
method max_version = 2l
method private virtual on_destroy : [> ] t -> unit
method private virtual on_get_pointer : [> ] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
pointer:([`Wl_pointer], [> Imports.Wl_pointer.versions], [`Server]) Proxy.t ->
unit
method private virtual on_get_tablet_tool_v2 : [> ] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
tablet_tool:([`Zwp_tablet_tool_v2], [> Imports.Zwp_tablet_tool_v2.versions], [`Server]) Proxy.t ->
unit
method dispatch (_proxy : 'v t) _msg =
let _proxy = Proxy.cast_version _proxy in
match Msg.op _msg with
| 0 ->
Proxy.shutdown_recv _proxy;
_self#on_destroy _proxy
| 1 ->
let cursor_shape_device : ([`Wp_cursor_shape_device_v1], _, _) Proxy.t =
Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Wp_cursor_shape_device_v1) in
let pointer : ([`Wl_pointer], _, _) Proxy.t =
let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
match Proxy.ty p with
| Imports.Wl_pointer.T -> p
| _ -> Proxy.wrong_type ~parent:_proxy ~expected:"wl_pointer" p
in
_self#on_get_pointer _proxy cursor_shape_device ~pointer
| 2 ->
let cursor_shape_device : ([`Wp_cursor_shape_device_v1], _, _) Proxy.t =
Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Wp_cursor_shape_device_v1) in
let tablet_tool : ([`Zwp_tablet_tool_v2], _, _) Proxy.t =
let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
match Proxy.ty p with
| Imports.Zwp_tablet_tool_v2.T -> p
| _ -> Proxy.wrong_type ~parent:_proxy ~expected:"zwp_tablet_tool_v2" p
in
_self#on_get_tablet_tool_v2 _proxy cursor_shape_device ~tablet_tool
| _ -> assert false
end
(**/**)
(** {2 Handlers}
Note: Servers will always want to use [v1].
*)
(** Handler for a proxy with version >= 1. *)
class virtual ['v] v1 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
(**/**)
inherit [[< `V1 | `V2] as 'v] _handlers_unsafe
(**/**)
method private virtual on_destroy : [> `V1 | `V2] t -> unit
(** Destroy the manager.
Destroy the cursor shape manager. *)
method private virtual on_get_pointer : [> `V1 | `V2] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
pointer:([`Wl_pointer], [> Imports.Wl_pointer.versions], [`Server]) Proxy.t ->
unit
(** Manage the cursor shape of a pointer device.
Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
When the pointer capability is removed from the wl_seat, the
wp_cursor_shape_device_v1 object becomes inert. *)
method private virtual on_get_tablet_tool_v2 : [> `V1 | `V2] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
tablet_tool:([`Zwp_tablet_tool_v2], [> Imports.Zwp_tablet_tool_v2.versions], [`Server]) Proxy.t ->
unit
(** Manage the cursor shape of a tablet tool device.
Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
object becomes inert. *)
method min_version = 1l
method bind_version : [`V1] = `V1
end
(** Handler for a proxy with version >= 2. *)
class virtual ['v] v2 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
(**/**)
inherit [[< `V2] as 'v] _handlers_unsafe
(**/**)
method private virtual on_destroy : [> `V2] t -> unit
(** Destroy the manager.
Destroy the cursor shape manager. *)
method private virtual on_get_pointer : [> `V2] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
pointer:([`Wl_pointer], [> Imports.Wl_pointer.versions], [`Server]) Proxy.t ->
unit
(** Manage the cursor shape of a pointer device.
Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
When the pointer capability is removed from the wl_seat, the
wp_cursor_shape_device_v1 object becomes inert. *)
method private virtual on_get_tablet_tool_v2 : [> `V2] t -> ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t ->
tablet_tool:([`Zwp_tablet_tool_v2], [> Imports.Zwp_tablet_tool_v2.versions], [`Server]) Proxy.t ->
unit
(** Manage the cursor shape of a tablet tool device.
Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
object becomes inert. *)
method min_version = 2l
method bind_version : [`V2] = `V2
end
end
(** Cursor shape for a device.
This interface allows clients to set the cursor shape. *)
module Wp_cursor_shape_device_v1 = struct
type 'v t = ([`Wp_cursor_shape_device_v1], 'v, [`Server]) Proxy.t
module Shape = Cursor_shape_v1_proto.Wp_cursor_shape_device_v1.Shape
module Error = Cursor_shape_v1_proto.Wp_cursor_shape_device_v1.Error
(** {2 Version 1, 2} *)
(**/**)
class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
method user_data = S.No_data
method metadata = (module Cursor_shape_v1_proto.Wp_cursor_shape_device_v1)
method max_version = 2l
method private virtual on_destroy : [> ] t -> unit
method private virtual on_set_shape : [> ] t -> serial:int32 -> shape:Imports.Wp_cursor_shape_device_v1.Shape.t ->
unit
method dispatch (_proxy : 'v t) _msg =
let _proxy = Proxy.cast_version _proxy in
match Msg.op _msg with
| 0 ->
Proxy.shutdown_recv _proxy;
_self#on_destroy _proxy
| 1 ->
let serial = Msg.get_int _msg in
let shape = Msg.get_int _msg |> Imports.Wp_cursor_shape_device_v1.Shape.of_int32 in
_self#on_set_shape _proxy ~serial ~shape
| _ -> assert false
end
(**/**)
(** {2 Handlers}
Note: Servers will always want to use [v1].
*)
(** Handler for a proxy with version >= 1. *)
class virtual ['v] v1 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
(**/**)
inherit [[< `V1 | `V2] as 'v] _handlers_unsafe
(**/**)
method private virtual on_destroy : [> `V1 | `V2] t -> unit
(** Destroy the cursor shape device.
Destroy the cursor shape device.
The device cursor shape remains unchanged. *)
method private virtual on_set_shape : [> `V1 | `V2] t -> serial:int32 ->
shape:Imports.Wp_cursor_shape_device_v1.Shape.t -> unit
(** Set device cursor to the shape.
Sets the device cursor to the specified shape. The compositor will
change the cursor image based on the specified shape.
The cursor actually changes only if the input device focus is one of
the requesting client's surfaces. If any, the previous cursor image
(surface or shape) is replaced.
The "shape" argument must be a valid enum entry, otherwise the
invalid_shape protocol error is raised.
This is similar to the wl_pointer.set_cursor and
zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
shape instead of contents in the form of a surface. Clients can mix
set_cursor and set_shape requests.
The serial parameter must match the latest wl_pointer.enter or
zwp_tablet_tool_v2.proximity_in serial number sent to the client.
Otherwise the request will be ignored. *)
method min_version = 1l
end
(** Handler for a proxy with version >= 2. *)
class virtual ['v] v2 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
(**/**)
inherit [[< `V2] as 'v] _handlers_unsafe
(**/**)
method private virtual on_destroy : [> `V2] t -> unit
(** Destroy the cursor shape device.
Destroy the cursor shape device.
The device cursor shape remains unchanged. *)
method private virtual on_set_shape : [> `V2] t -> serial:int32 ->
shape:Imports.Wp_cursor_shape_device_v1.Shape.t -> unit
(** Set device cursor to the shape.
Sets the device cursor to the specified shape. The compositor will
change the cursor image based on the specified shape.
The cursor actually changes only if the input device focus is one of
the requesting client's surfaces. If any, the previous cursor image
(surface or shape) is replaced.
The "shape" argument must be a valid enum entry, otherwise the
invalid_shape protocol error is raised.
This is similar to the wl_pointer.set_cursor and
zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
shape instead of contents in the form of a surface. Clients can mix
set_cursor and set_shape requests.
The serial parameter must match the latest wl_pointer.enter or
zwp_tablet_tool_v2.proximity_in serial number sent to the client.
Otherwise the request will be ignored. *)
method min_version = 2l
end
end