package wayland

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file wlr_screencopy_unstable_v1_client.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
(* This file was generated automatically by wayland-scanner-ocaml *)

[@@@ocaml.warning "-27"]
open struct
  module Imports = struct
    include Wlr_screencopy_unstable_v1_proto
    include Wayland.Wayland_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


(** Manager to inform clients and begin capturing.
    
    This object is a manager which offers requests to start capturing from a
    source. *)
module Zwlr_screencopy_manager_v1 = struct
  type 'v t = ([`Zwlr_screencopy_manager_v1], 'v, [`Client]) Proxy.t
  
  (** {2 Version 1, 2, 3} *)
  
  (** Destroy the manager.
      
      All objects created by the manager will still remain valid, until their
      appropriate destroy request has been called. *)
  let destroy (_t:([< `V1 | `V2 | `V3] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:2 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Capture an output's region.
      
      Capture the next frame of an output's region.
      
      The region is given in output logical coordinates, see
      xdg_output.logical_size. The region will be clipped to the output's
      extents. *)
  let capture_output_region (_t:([< `V1 | `V2 | `V3] as 'v) t) (frame:([`Zwlr_screencopy_frame_v1], 'v, [`Client]) #Proxy.Handler.t) ~overlay_cursor ~(output:([`Wl_output], _, [`Client]) Proxy.t) ~x ~y ~width ~height =
    let __frame = Proxy.spawn _t frame in
    let _msg = Proxy.alloc _t ~op:1 ~ints:7 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id __frame);
    Msg.add_int _msg overlay_cursor;
    Msg.add_int _msg (Proxy.id output);
    Msg.add_int _msg x;
    Msg.add_int _msg y;
    Msg.add_int _msg width;
    Msg.add_int _msg height;
    Proxy.send _t _msg;
    __frame
  
  (** Capture an output.
      
      Capture the next frame of an entire output. *)
  let capture_output (_t:([< `V1 | `V2 | `V3] as 'v) t) (frame:([`Zwlr_screencopy_frame_v1], 'v, [`Client]) #Proxy.Handler.t) ~overlay_cursor ~(output:([`Wl_output], _, [`Client]) Proxy.t) =
    let __frame = Proxy.spawn _t frame in
    let _msg = Proxy.alloc _t ~op:0 ~ints:3 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id __frame);
    Msg.add_int _msg overlay_cursor;
    Msg.add_int _msg (Proxy.id output);
    Proxy.send _t _msg;
    __frame
  
  (**/**)
  class ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wlr_screencopy_unstable_v1_proto.Zwlr_screencopy_manager_v1)
    method max_version = 3l
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | _ -> assert false
  end
  (**/**)
  
  (** {2 Handlers}
      Note: Servers will always want to use [v1].
   *)
  
  
  (** Handler for a proxy with version >= 1. *)
  class ['v] v1 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
    (**/**)
    inherit [[< `V1 | `V2 | `V3] as 'v] _handlers_unsafe
    (**/**)
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
  
  (** Handler for a proxy with version >= 2. *)
  class ['v] v2 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
    (**/**)
    inherit [[< `V2 | `V3] as 'v] _handlers_unsafe
    (**/**)
    method min_version = 2l
    method bind_version : [`V2] = `V2
  end
  
  (** Handler for a proxy with version >= 3. *)
  class ['v] v3 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
    (**/**)
    inherit [[< `V3] as 'v] _handlers_unsafe
    (**/**)
    method min_version = 3l
    method bind_version : [`V3] = `V3
  end
end

(** A frame ready for copy.
    
    This object represents a single frame.
    
    When created, a series of buffer events will be sent, each representing a
    supported buffer type. The "buffer_done" event is sent afterwards to
    indicate that all supported buffer types have been enumerated. The client
    will then be able to send a "copy" request. If the capture is successful,
    the compositor will send a "flags" followed by a "ready" event.
    
    For objects version 2 or lower, wl_shm buffers are always supported, ie.
    the "buffer" event is guaranteed to be sent.
    
    If the capture failed, the "failed" event is sent. This can happen anytime
    before the "ready" event.
    
    Once either a "ready" or a "failed" event is received, the client should
    destroy the frame. *)
module Zwlr_screencopy_frame_v1 = struct
  type 'v t = ([`Zwlr_screencopy_frame_v1], 'v, [`Client]) Proxy.t
  module Error = Wlr_screencopy_unstable_v1_proto.Zwlr_screencopy_frame_v1.Error
  
  module Flags = Wlr_screencopy_unstable_v1_proto.Zwlr_screencopy_frame_v1.Flags
  
  (** {2 Version 1} *)
  
  (** Delete this object, used or not.
      
      Destroys the frame. This request can be sent at any time by the client. *)
  let destroy (_t:([< `V1 | `V2 | `V3] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:1 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Copy the frame.
      
      Copy the frame to the supplied buffer. The buffer must have a the
      correct size, see zwlr_screencopy_frame_v1.buffer and
      zwlr_screencopy_frame_v1.linux_dmabuf. The buffer needs to have a
      supported format.
      
      If the frame is successfully copied, a "flags" and a "ready" events are
      sent. Otherwise, a "failed" event is sent. *)
  let copy (_t:([< `V1 | `V2 | `V3] as 'v) t) ~(buffer:([`Wl_buffer], _, [`Client]) Proxy.t) =
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id buffer);
    Proxy.send _t _msg
  
  
  (** {2 Version 2} *)
  
  (** Copy the frame when it's damaged.
      
      Same as copy, except it waits until there is damage to copy. *)
  let copy_with_damage (_t:([< `V2 | `V3] as 'v) t) ~(buffer:([`Wl_buffer], _, [`Client]) Proxy.t) =
    let _msg = Proxy.alloc _t ~op:2 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id buffer);
    Proxy.send _t _msg
  
  
  (** {2 Version 3} *)
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wlr_screencopy_unstable_v1_proto.Zwlr_screencopy_frame_v1)
    method max_version = 3l
    
    method private virtual on_buffer : [> ] t -> format:Imports.Wl_shm.Format.t -> width:int32 -> height:int32 ->
                                       stride:int32 -> unit
    
    method private virtual on_flags : [> ] t -> flags:Imports.Zwlr_screencopy_frame_v1.Flags.t -> unit
    
    method private virtual on_ready : [> ] t -> tv_sec_hi:int32 -> tv_sec_lo:int32 -> tv_nsec:int32 -> unit
    
    method private virtual on_failed : [> ] t -> unit
    
    method private virtual on_damage : [> ] t -> x:int32 -> y:int32 -> width:int32 -> height:int32 -> unit
    
    method private virtual on_linux_dmabuf : [> ] t -> format:int32 -> width:int32 -> height:int32 -> unit
    
    method private virtual on_buffer_done : [> ] t -> unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let format = Msg.get_int _msg |> Imports.Wl_shm.Format.of_int32 in
        let width = Msg.get_int _msg in
        let height = Msg.get_int _msg in
        let stride = Msg.get_int _msg in
        _self#on_buffer _proxy ~format ~width ~height ~stride
      | 1 ->
        let flags = Msg.get_int _msg |> Imports.Zwlr_screencopy_frame_v1.Flags.of_int32 in
        _self#on_flags _proxy ~flags
      | 2 ->
        let tv_sec_hi = Msg.get_int _msg in
        let tv_sec_lo = Msg.get_int _msg in
        let tv_nsec = Msg.get_int _msg in
        _self#on_ready _proxy ~tv_sec_hi ~tv_sec_lo ~tv_nsec
      | 3 ->
        _self#on_failed _proxy 
      | 4 ->
        let x = Msg.get_int _msg in
        let y = Msg.get_int _msg in
        let width = Msg.get_int _msg in
        let height = Msg.get_int _msg in
        _self#on_damage _proxy ~x ~y ~width ~height
      | 5 ->
        let format = Msg.get_int _msg in
        let width = Msg.get_int _msg in
        let height = Msg.get_int _msg in
        _self#on_linux_dmabuf _proxy ~format ~width ~height
      | 6 ->
        _self#on_buffer_done _proxy 
      | _ -> 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 | `V3] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_buffer : [> `V1 | `V2 | `V3] t -> format:Imports.Wl_shm.Format.t -> width:int32 ->
                                       height:int32 -> stride:int32 -> unit
    
    (** Wl_shm buffer information.
        
        Provides information about wl_shm buffer parameters that need to be
        used for this frame. This event is sent once after the frame is created
        if wl_shm buffers are supported. *)
    
    method private virtual on_flags : [> `V1 | `V2 | `V3] t -> flags:Imports.Zwlr_screencopy_frame_v1.Flags.t -> unit
    
    (** Frame flags.
        
        Provides flags about the frame. This event is sent once before the
        "ready" event. *)
    
    method private virtual on_ready : [> `V1 | `V2 | `V3] t -> tv_sec_hi:int32 -> tv_sec_lo:int32 -> tv_nsec:int32 ->
                                      unit
    
    (** Indicates frame is available for reading.
        
        Called as soon as the frame is copied, indicating it is available
        for reading. This event includes the time at which presentation happened
        at.
        
        The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
        each component being an unsigned 32-bit value. Whole seconds are in
        tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
        and the additional fractional part in tv_nsec as nanoseconds. Hence,
        for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part
        may have an arbitrary offset at start.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_failed : [> `V1 | `V2 | `V3] t -> unit
    
    (** Frame copy failed.
        
        This event indicates that the attempted frame copy has failed.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_damage : [> `V2 | `V3] t -> x:int32 -> y:int32 -> width:int32 -> height:int32 -> unit
    
    (** Carries the coordinates of the damaged region.
        
        This event is sent right before the ready event when copy_with_damage is
        requested. It may be generated multiple times for each copy_with_damage
        request.
        
        The arguments describe a box around an area that has changed since the
        last copy request that was derived from the current screencopy manager
        instance.
        
        The union of all regions received between the call to copy_with_damage
        and a ready event is the total damage since the prior ready event. *)
    
    method private virtual on_linux_dmabuf : [> `V3] t -> format:int32 -> width:int32 -> height:int32 -> unit
    
    (** Linux-dmabuf buffer information.
        
        Provides information about linux-dmabuf buffer parameters that need to
        be used for this frame. This event is sent once after the frame is
        created if linux-dmabuf buffers are supported. *)
    
    method private virtual on_buffer_done : [> `V3] t -> unit
    
    (** All buffer types reported.
        
        This event is sent once after all buffer events have been sent.
        
        The client should proceed to create a buffer of one of the supported
        types, and send a "copy" request. *)
    
    method min_version = 1l
  end
  
  (** Handler for a proxy with version >= 2. *)
  class virtual ['v] v2 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
    (**/**)
    inherit [[< `V2 | `V3] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_buffer : [> `V2 | `V3] t -> format:Imports.Wl_shm.Format.t -> width:int32 ->
                                       height:int32 -> stride:int32 -> unit
    
    (** Wl_shm buffer information.
        
        Provides information about wl_shm buffer parameters that need to be
        used for this frame. This event is sent once after the frame is created
        if wl_shm buffers are supported. *)
    
    method private virtual on_flags : [> `V2 | `V3] t -> flags:Imports.Zwlr_screencopy_frame_v1.Flags.t -> unit
    
    (** Frame flags.
        
        Provides flags about the frame. This event is sent once before the
        "ready" event. *)
    
    method private virtual on_ready : [> `V2 | `V3] t -> tv_sec_hi:int32 -> tv_sec_lo:int32 -> tv_nsec:int32 -> unit
    
    (** Indicates frame is available for reading.
        
        Called as soon as the frame is copied, indicating it is available
        for reading. This event includes the time at which presentation happened
        at.
        
        The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
        each component being an unsigned 32-bit value. Whole seconds are in
        tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
        and the additional fractional part in tv_nsec as nanoseconds. Hence,
        for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part
        may have an arbitrary offset at start.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_failed : [> `V2 | `V3] t -> unit
    
    (** Frame copy failed.
        
        This event indicates that the attempted frame copy has failed.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_damage : [> `V2 | `V3] t -> x:int32 -> y:int32 -> width:int32 -> height:int32 -> unit
    
    (** Carries the coordinates of the damaged region.
        
        This event is sent right before the ready event when copy_with_damage is
        requested. It may be generated multiple times for each copy_with_damage
        request.
        
        The arguments describe a box around an area that has changed since the
        last copy request that was derived from the current screencopy manager
        instance.
        
        The union of all regions received between the call to copy_with_damage
        and a ready event is the total damage since the prior ready event. *)
    
    method private virtual on_linux_dmabuf : [> `V3] t -> format:int32 -> width:int32 -> height:int32 -> unit
    
    (** Linux-dmabuf buffer information.
        
        Provides information about linux-dmabuf buffer parameters that need to
        be used for this frame. This event is sent once after the frame is
        created if linux-dmabuf buffers are supported. *)
    
    method private virtual on_buffer_done : [> `V3] t -> unit
    
    (** All buffer types reported.
        
        This event is sent once after all buffer events have been sent.
        
        The client should proceed to create a buffer of one of the supported
        types, and send a "copy" request. *)
    
    method min_version = 2l
  end
  
  (** Handler for a proxy with version >= 3. *)
  class virtual ['v] v3 = object (_ : (_, 'v, _) #Proxy.Service_handler.t)
    (**/**)
    inherit [[< `V3] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_buffer : [> `V3] t -> format:Imports.Wl_shm.Format.t -> width:int32 -> height:int32 ->
                                       stride:int32 -> unit
    
    (** Wl_shm buffer information.
        
        Provides information about wl_shm buffer parameters that need to be
        used for this frame. This event is sent once after the frame is created
        if wl_shm buffers are supported. *)
    
    method private virtual on_flags : [> `V3] t -> flags:Imports.Zwlr_screencopy_frame_v1.Flags.t -> unit
    
    (** Frame flags.
        
        Provides flags about the frame. This event is sent once before the
        "ready" event. *)
    
    method private virtual on_ready : [> `V3] t -> tv_sec_hi:int32 -> tv_sec_lo:int32 -> tv_nsec:int32 -> unit
    
    (** Indicates frame is available for reading.
        
        Called as soon as the frame is copied, indicating it is available
        for reading. This event includes the time at which presentation happened
        at.
        
        The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
        each component being an unsigned 32-bit value. Whole seconds are in
        tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
        and the additional fractional part in tv_nsec as nanoseconds. Hence,
        for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part
        may have an arbitrary offset at start.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_failed : [> `V3] t -> unit
    
    (** Frame copy failed.
        
        This event indicates that the attempted frame copy has failed.
        
        After receiving this event, the client should destroy the object. *)
    
    method private virtual on_damage : [> `V3] t -> x:int32 -> y:int32 -> width:int32 -> height:int32 -> unit
    
    (** Carries the coordinates of the damaged region.
        
        This event is sent right before the ready event when copy_with_damage is
        requested. It may be generated multiple times for each copy_with_damage
        request.
        
        The arguments describe a box around an area that has changed since the
        last copy request that was derived from the current screencopy manager
        instance.
        
        The union of all regions received between the call to copy_with_damage
        and a ready event is the total damage since the prior ready event. *)
    
    method private virtual on_linux_dmabuf : [> `V3] t -> format:int32 -> width:int32 -> height:int32 -> unit
    
    (** Linux-dmabuf buffer information.
        
        Provides information about linux-dmabuf buffer parameters that need to
        be used for this frame. This event is sent once after the frame is
        created if linux-dmabuf buffers are supported. *)
    
    method private virtual on_buffer_done : [> `V3] t -> unit
    
    (** All buffer types reported.
        
        This event is sent once after all buffer events have been sent.
        
        The client should proceed to create a buffer of one of the supported
        types, and send a "copy" request. *)
    
    method min_version = 3l
  end
end
OCaml

Innovation. Community. Security.