Source file xdg_shell_proto.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
open struct
module Proxy = Wayland.Proxy
module Iface_reg = Wayland.Iface_reg
module Metadata = Wayland.Metadata
end
module Xdg_wm_base = struct
type t = [`Xdg_wm_base]
type _ Metadata.ty += T : [`Xdg_wm_base] Metadata.ty
type versions = [`V1 | `V2 | `V3 | `V4 | `V5 | `V6]
let interface = "xdg_wm_base"
let version = 6l
module Error = struct
type t =
| Role : t
| Defunct_surfaces : t
| Invalid_surface_state : t
| Invalid_positioner : t
| Unresponsive : t
let to_int32 = function
| Role -> 0l
| Defunct_surfaces -> 1l
| Not_the_topmost_popup -> 2l
| Invalid_popup_parent -> 3l
| Invalid_surface_state -> 4l
| Invalid_positioner -> 5l
| Unresponsive -> 6l
let of_int32 = function
| 0l -> Role
| 1l -> Defunct_surfaces
| 2l -> Not_the_topmost_popup
| 3l -> Invalid_popup_parent
| 4l -> Invalid_surface_state
| 5l -> Invalid_positioner
| 6l -> Unresponsive
| x -> Fmt.failwith "Invalid error enum value %ld" x
end
let requests = function
| 0 -> "destroy", []
| 1 -> "create_positioner", ["id", `New_ID (Some "xdg_positioner")]
| 2 -> "get_xdg_surface", ["id", `New_ID (Some "xdg_surface"); "surface", `Object (Some "wl_surface")]
| 3 -> "pong", ["serial", `Uint]
| i -> Proxy.unknown_request i, []
let events = function
| 0 -> "ping", ["serial", `Uint]
| i -> Proxy.unknown_event i, []
end
let () = Iface_reg.register (module Xdg_wm_base)
module Xdg_positioner = struct
type t = [`Xdg_positioner]
type _ Metadata.ty += T : [`Xdg_positioner] Metadata.ty
type versions = [`V1 | `V2 | `V3 | `V4 | `V5 | `V6]
let interface = "xdg_positioner"
let version = 6l
module Error = struct
type t =
| Invalid_input : t
let to_int32 = function
| Invalid_input -> 0l
let of_int32 = function
| 0l -> Invalid_input
| x -> Fmt.failwith "Invalid error enum value %ld" x
end
module Anchor = struct
type t =
| None : t
| Top : t
| Bottom : t
| Left : t
| Right : t
| Top_left : t
| Bottom_left : t
| Top_right : t
| Bottom_right : t
let to_int32 = function
| None -> 0l
| Top -> 1l
| Bottom -> 2l
| Left -> 3l
| Right -> 4l
| Top_left -> 5l
| Bottom_left -> 6l
| Top_right -> 7l
| Bottom_right -> 8l
let of_int32 = function
| 0l -> None
| 1l -> Top
| 2l -> Bottom
| 3l -> Left
| 4l -> Right
| 5l -> Top_left
| 6l -> Bottom_left
| 7l -> Top_right
| 8l -> Bottom_right
| x -> Fmt.failwith "Invalid anchor enum value %ld" x
end
module Gravity = struct
type t =
| None : t
| Top : t
| Bottom : t
| Left : t
| Right : t
| Top_left : t
| Bottom_left : t
| Top_right : t
| Bottom_right : t
let to_int32 = function
| None -> 0l
| Top -> 1l
| Bottom -> 2l
| Left -> 3l
| Right -> 4l
| Top_left -> 5l
| Bottom_left -> 6l
| Top_right -> 7l
| Bottom_right -> 8l
let of_int32 = function
| 0l -> None
| 1l -> Top
| 2l -> Bottom
| 3l -> Left
| 4l -> Right
| 5l -> Top_left
| 6l -> Bottom_left
| 7l -> Top_right
| 8l -> Bottom_right
| x -> Fmt.failwith "Invalid gravity enum value %ld" x
end
(** Constraint adjustments.
The constraint adjustment value define ways the compositor will adjust
the position of the surface, if the unadjusted position would result
in the surface being partly constrained.
Whether a surface is considered 'constrained' is left to the compositor
to determine. For example, the surface may be partly outside the
compositor's defined 'work area', thus necessitating the child surface's
position be adjusted until it is entirely inside the work area.
The adjustments can be combined, according to a defined precedence: 1)
Flip, 2) Slide, 3) Resize. *)
module Constraint_adjustment = struct
type t = int32
(** Don't move the child surface when constrained.
Don't alter the surface position even if it is constrained on some
axis, for example partially outside the edge of an output. *)
let none = 0l
(** Move along the x axis until unconstrained.
Slide the surface along the x axis until it is no longer constrained.
First try to slide towards the direction of the gravity on the x axis
until either the edge in the opposite direction of the gravity is
unconstrained or the edge in the direction of the gravity is
constrained.
Then try to slide towards the opposite direction of the gravity on the
x axis until either the edge in the direction of the gravity is
unconstrained or the edge in the opposite direction of the gravity is
constrained. *)
let slide_x = 1l
(** Move along the y axis until unconstrained.
Slide the surface along the y axis until it is no longer constrained.
First try to slide towards the direction of the gravity on the y axis
until either the edge in the opposite direction of the gravity is
unconstrained or the edge in the direction of the gravity is
constrained.
Then try to slide towards the opposite direction of the gravity on the
y axis until either the edge in the direction of the gravity is
unconstrained or the edge in the opposite direction of the gravity is
constrained. *)
let slide_y = 2l
(** Invert the anchor and gravity on the x axis.
Invert the anchor and gravity on the x axis if the surface is
constrained on the x axis. For example, if the left edge of the
surface is constrained, the gravity is 'left' and the anchor is
'left', change the gravity to 'right' and the anchor to 'right'.
If the adjusted position also ends up being constrained, the resulting
position of the flip_x adjustment will be the one before the
adjustment. *)
let flip_x = 4l
(** Invert the anchor and gravity on the y axis.
Invert the anchor and gravity on the y axis if the surface is
constrained on the y axis. For example, if the bottom edge of the
surface is constrained, the gravity is 'bottom' and the anchor is
'bottom', change the gravity to 'top' and the anchor to 'top'.
The adjusted position is calculated given the original anchor
rectangle and offset, but with the new flipped anchor and gravity
values.
If the adjusted position also ends up being constrained, the resulting
position of the flip_y adjustment will be the one before the
adjustment. *)
let flip_y = 8l
(** Horizontally resize the surface.
Resize the surface horizontally so that it is completely
unconstrained. *)
let resize_x = 16l
(** Vertically resize the surface.
Resize the surface vertically so that it is completely unconstrained. *)
let resize_y = 32l
let to_int32 = Fun.id
let of_int32 = Fun.id
end
let requests = function
| 0 -> "destroy", []
| 1 -> "set_size", ["width", `Int; "height", `Int]
| 2 -> "set_anchor_rect", ["x", `Int; "y", `Int; "width", `Int; "height", `Int]
| 3 -> "set_anchor", ["anchor", `Uint]
| 4 -> "set_gravity", ["gravity", `Uint]
| 5 -> "set_constraint_adjustment", ["constraint_adjustment", `Uint]
| 6 -> "set_offset", ["x", `Int; "y", `Int]
| 7 -> "set_reactive", []
| 8 -> "set_parent_size", ["parent_width", `Int; "parent_height", `Int]
| 9 -> "set_parent_configure", ["serial", `Uint]
| i -> Proxy.unknown_request i, []
let events = function
| i -> Proxy.unknown_event i, []
end
let () = Iface_reg.register (module Xdg_positioner)
module Xdg_surface = struct
type t = [`Xdg_surface]
type _ Metadata.ty += T : [`Xdg_surface] Metadata.ty
type versions = [`V1 | `V2 | `V3 | `V4 | `V5 | `V6]
let interface = "xdg_surface"
let version = 6l
module Error = struct
type t =
| Not_constructed : t
| Already_constructed : t
| Unconfigured_buffer : t
| Invalid_serial : t
| Invalid_size : t
| Defunct_role_object : t
let to_int32 = function
| Not_constructed -> 1l
| Already_constructed -> 2l
| Unconfigured_buffer -> 3l
| Invalid_serial -> 4l
| Invalid_size -> 5l
| Defunct_role_object -> 6l
let of_int32 = function
| 1l -> Not_constructed
| 2l -> Already_constructed
| 3l -> Unconfigured_buffer
| 4l -> Invalid_serial
| 5l -> Invalid_size
| 6l -> Defunct_role_object
| x -> Fmt.failwith "Invalid error enum value %ld" x
end
let requests = function
| 0 -> "destroy", []
| 1 -> "get_toplevel", ["id", `New_ID (Some "xdg_toplevel")]
| 2 -> "get_popup", ["id", `New_ID (Some "xdg_popup"); "parent", `Object (Some "xdg_surface");
"positioner", `Object (Some "xdg_positioner")]
| 3 -> "set_window_geometry", ["x", `Int; "y", `Int; "width", `Int; "height", `Int]
| 4 -> "ack_configure", ["serial", `Uint]
| i -> Proxy.unknown_request i, []
let events = function
| 0 -> "configure", ["serial", `Uint]
| i -> Proxy.unknown_event i, []
end
let () = Iface_reg.register (module Xdg_surface)
module Xdg_toplevel = struct
type t = [`Xdg_toplevel]
type _ Metadata.ty += T : [`Xdg_toplevel] Metadata.ty
type versions = [`V1 | `V2 | `V3 | `V4 | `V5 | `V6]
let interface = "xdg_toplevel"
let version = 6l
module Error = struct
type t =
| Invalid_resize_edge : t
| Invalid_parent : t
| Invalid_size : t
let to_int32 = function
| Invalid_resize_edge -> 0l
| Invalid_parent -> 1l
| Invalid_size -> 2l
let of_int32 = function
| 0l -> Invalid_resize_edge
| 1l -> Invalid_parent
| 2l -> Invalid_size
| x -> Fmt.failwith "Invalid error enum value %ld" x
end
(** Edge values for resizing.
These values are used to indicate which edge of a surface
is being dragged in a resize operation. *)
module Resize_edge = struct
type t =
| None : t
| Top : t
| Bottom : t
| Left : t
| Top_left : t
| Bottom_left : t
| Right : t
| Top_right : t
| Bottom_right : t
let to_int32 = function
| None -> 0l
| Top -> 1l
| Bottom -> 2l
| Left -> 4l
| Top_left -> 5l
| Bottom_left -> 6l
| Right -> 8l
| Top_right -> 9l
| Bottom_right -> 10l
let of_int32 = function
| 0l -> None
| 1l -> Top
| 2l -> Bottom
| 4l -> Left
| 5l -> Top_left
| 6l -> Bottom_left
| 8l -> Right
| 9l -> Top_right
| 10l -> Bottom_right
| x -> Fmt.failwith "Invalid resize_edge enum value %ld" x
end
(** Types of state on the surface.
The different state values used on the surface. This is designed for
state values like maximized, fullscreen. It is paired with the
configure event to ensure that both the client and the compositor
setting the state can be synchronized.
States set in this way are double-buffered. They will get applied on
the next commit. *)
module State = struct
type t =
| Maximized : t
(** The surface is maximized.
The surface is maximized. The window geometry specified in the configure
event must be obeyed by the client, or the xdg_wm_base.invalid_surface_state
error is raised.
The client should draw without shadow or other
decoration outside of the window geometry. *)
| Fullscreen : t
(** The surface is fullscreen.
The surface is fullscreen. The window geometry specified in the
configure event is a maximum; the client cannot resize beyond it. For
a surface to cover the whole fullscreened area, the geometry
dimensions must be obeyed by the client. For more details, see
xdg_toplevel.set_fullscreen. *)
| Resizing : t
(** The surface is being resized.
The surface is being resized. The window geometry specified in the
configure event is a maximum; the client cannot resize beyond it.
Clients that have aspect ratio or cell sizing configuration can use
a smaller size, however. *)
| Activated : t
(** The surface is now activated.
Client window decorations should be painted as if the window is
active. Do not assume this means that the window actually has
keyboard or pointer focus. *)
| Tiled_left : t
(** The surface’s left edge is tiled.
The window is currently in a tiled layout and the left edge is
considered to be adjacent to another part of the tiling grid.
The client should draw without shadow or other decoration outside of
the window geometry on the left edge. *)
| Tiled_right : t
(** The surface’s right edge is tiled.
The window is currently in a tiled layout and the right edge is
considered to be adjacent to another part of the tiling grid.
The client should draw without shadow or other decoration outside of
the window geometry on the right edge. *)
| Tiled_top : t
(** The surface’s top edge is tiled.
The window is currently in a tiled layout and the top edge is
considered to be adjacent to another part of the tiling grid.
The client should draw without shadow or other decoration outside of
the window geometry on the top edge. *)
| Tiled_bottom : t
(** The surface’s bottom edge is tiled.
The window is currently in a tiled layout and the bottom edge is
considered to be adjacent to another part of the tiling grid.
The client should draw without shadow or other decoration outside of
the window geometry on the bottom edge. *)
| Suspended : t
(** Surface repaint is suspended.
The surface is currently not ordinarily being repainted; for
example because its content is occluded by another window, or its
outputs are switched off due to screen locking. *)
let to_int32 = function
| Maximized -> 1l
| Fullscreen -> 2l
| Resizing -> 3l
| Activated -> 4l
| Tiled_left -> 5l
| Tiled_right -> 6l
| Tiled_top -> 7l
| Tiled_bottom -> 8l
| Suspended -> 9l
let of_int32 = function
| 1l -> Maximized
| 2l -> Fullscreen
| 3l -> Resizing
| 4l -> Activated
| 5l -> Tiled_left
| 6l -> Tiled_right
| 7l -> Tiled_top
| 8l -> Tiled_bottom
| 9l -> Suspended
| x -> Fmt.failwith "Invalid state enum value %ld" x
end
module Wm_capabilities = struct
type t =
| Maximize : t
| Fullscreen : t
| Minimize : t
let to_int32 = function
| Window_menu -> 1l
| Maximize -> 2l
| Fullscreen -> 3l
| Minimize -> 4l
let of_int32 = function
| 1l -> Window_menu
| 2l -> Maximize
| 3l -> Fullscreen
| 4l -> Minimize
| x -> Fmt.failwith "Invalid wm_capabilities enum value %ld" x
end
let requests = function
| 0 -> "destroy", []
| 1 -> "set_parent", ["parent", `Object (Some "xdg_toplevel")]
| 2 -> "set_title", ["title", `String]
| 3 -> "set_app_id", ["app_id", `String]
| 4 -> "show_window_menu", ["seat", `Object (Some "wl_seat"); "serial", `Uint; "x", `Int; "y", `Int]
| 5 -> "move", ["seat", `Object (Some "wl_seat"); "serial", `Uint]
| 6 -> "resize", ["seat", `Object (Some "wl_seat"); "serial", `Uint; "edges", `Uint]
| 7 -> "set_max_size", ["width", `Int; "height", `Int]
| 8 -> "set_min_size", ["width", `Int; "height", `Int]
| 9 -> "set_maximized", []
| 10 -> "unset_maximized", []
| 11 -> "set_fullscreen", ["output", `Object (Some "wl_output")]
| 12 -> "unset_fullscreen", []
| 13 -> "set_minimized", []
| i -> Proxy.unknown_request i, []
let events = function
| 0 -> "configure", ["width", `Int; "height", `Int; "states", `Array]
| 1 -> "close", []
| 2 -> "configure_bounds", ["width", `Int; "height", `Int]
| 3 -> "wm_capabilities", ["capabilities", `Array]
| i -> Proxy.unknown_event i, []
end
let () = Iface_reg.register (module Xdg_toplevel)
let () = Iface_reg.register (module Xdg_popup)