package wayland

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

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

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


(** X primary selection emulation.
    
    The primary selection device manager is a singleton global object that
    provides access to the primary selection. It allows to create
    wp_primary_selection_source objects, as well as retrieving the per-seat
    wp_primary_selection_device objects. *)
module Zwp_primary_selection_device_manager_v1 = struct
  type 'v t = ([`Zwp_primary_selection_device_manager_v1], 'v, [`Client]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** Destroy the primary selection device manager.
      
      Destroy the primary selection device manager. *)
  let destroy (_t:([< `V1] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:2 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Create a new primary selection device.
      
      Create a new data device for a given seat. *)
  let get_device (_t:([< `V1] as 'v) t) (id:([`Zwp_primary_selection_device_v1], 'v, [`Client]) #Proxy.Handler.t) ~(seat:([`Wl_seat], _, [`Client]) Proxy.t) =
    let __id = Proxy.spawn _t id in
    let _msg = Proxy.alloc _t ~op:1 ~ints:2 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id __id);
    Msg.add_int _msg (Proxy.id seat);
    Proxy.send _t _msg;
    __id
  
  (** Create a new primary selection source.
      
      Create a new primary selection source. *)
  let create_source (_t:([< `V1] as 'v) t) (id:([`Zwp_primary_selection_source_v1], 'v, [`Client]) #Proxy.Handler.t) =
    let __id = Proxy.spawn _t id in
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id __id);
    Proxy.send _t _msg;
    __id
  
  (**/**)
  class ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wp_primary_selection_unstable_v1_proto.Zwp_primary_selection_device_manager_v1)
    method max_version = 1l
    
    
    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] as 'v] _handlers_unsafe
    (**/**)
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
end

module Zwp_primary_selection_device_v1 = struct
  type 'v t = ([`Zwp_primary_selection_device_v1], 'v, [`Client]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** Destroy the primary selection device.
      
      Destroy the primary selection device. *)
  let destroy (_t:([< `V1] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:1 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Set the primary selection.
      
      Replaces the current selection. The previous owner of the primary
      selection will receive a wp_primary_selection_source.cancelled event.
      
      To unset the selection, set the source to NULL. *)
  let set_selection (_t:([< `V1] as 'v) t) ~(source:([`Zwp_primary_selection_source_v1], _, [`Client]) Proxy.t option) ~serial =
    let _msg = Proxy.alloc _t ~op:0 ~ints:2 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id_opt source);
    Msg.add_int _msg serial;
    Proxy.send _t _msg
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wp_primary_selection_unstable_v1_proto.Zwp_primary_selection_device_v1)
    method max_version = 1l
    
    method private virtual on_data_offer : [> ] t -> ([`Zwp_primary_selection_offer_v1], 'v, [`Client]) Proxy.t -> unit
    
    method private virtual on_selection : [> ] t -> ([`Zwp_primary_selection_offer_v1], [> Imports.Zwp_primary_selection_offer_v1.versions], [`Client]) Proxy.t option ->
                                          unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let offer : ([`Zwp_primary_selection_offer_v1], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Zwp_primary_selection_offer_v1) in
        _self#on_data_offer _proxy offer
      | 1 ->
        let id : ([`Zwp_primary_selection_offer_v1], _, _) Proxy.t option =
          match Msg.get_int _msg with
          | 0l -> None
          | id ->
            let Proxy.Proxy p = Proxy.lookup_other _proxy id in
            match Proxy.ty p with
            | Imports.Zwp_primary_selection_offer_v1.T -> Some p
            | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"zwp_primary_selection_offer_v1" p
          in
        _self#on_selection _proxy id
      | _ -> 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] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_data_offer : [> `V1] t -> ([`Zwp_primary_selection_offer_v1], 'v, [`Client]) Proxy.t ->
                                           unit
    
    (** Introduce a new wp_primary_selection_offer.
        
        Introduces a new wp_primary_selection_offer object that may be used
        to receive the current primary selection. Immediately following this
        event, the new wp_primary_selection_offer object will send
        wp_primary_selection_offer.offer events to describe the offered mime
        types. *)
    
    method private virtual on_selection : [> `V1] t -> ([`Zwp_primary_selection_offer_v1], [> Imports.Zwp_primary_selection_offer_v1.versions], [`Client]) Proxy.t option ->
                                          unit
    
    (** Advertise a new primary selection.
        
        The wp_primary_selection_device.selection event is sent to notify the
        client of a new primary selection. This event is sent after the
        wp_primary_selection.data_offer event introducing this object, and after
        the offer has announced its mimetypes through
        wp_primary_selection_offer.offer.
        
        The data_offer is valid until a new offer or NULL is received
        or until the client loses keyboard focus. The client must destroy the
        previous selection data_offer, if any, upon receiving this event. *)
    
    method min_version = 1l
  end
end

(** Offer to transfer primary selection contents.
    
    A wp_primary_selection_offer represents an offer to transfer the contents
    of the primary selection clipboard to the client. Similar to
    wl_data_offer, the offer also describes the mime types that the data can
    be converted to and provides the mechanisms for transferring the data
    directly to the client. *)
module Zwp_primary_selection_offer_v1 = struct
  type 'v t = ([`Zwp_primary_selection_offer_v1], 'v, [`Client]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** Destroy the primary selection offer.
      
      Destroy the primary selection offer. *)
  let destroy (_t:([< `V1] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:1 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Request that the data is transferred.
      
      To transfer the contents of the primary selection clipboard, the client
      issues this request and indicates the mime type that it wants to
      receive. The transfer happens through the passed file descriptor
      (typically created with the pipe system call). The source client writes
      the data in the mime type representation requested and then closes the
      file descriptor.
      
      The receiving client reads from the read end of the pipe until EOF and
      closes its end, at which point the transfer is complete. *)
  let receive (_t:([< `V1] as 'v) t) ~mime_type ~fd =
    let _msg = Proxy.alloc _t ~op:0 ~ints:2 ~strings:[(Some mime_type)] ~arrays:[] in
    Msg.add_string _msg mime_type;
    Msg.add_fd _msg fd;
    Proxy.send _t _msg
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wp_primary_selection_unstable_v1_proto.Zwp_primary_selection_offer_v1)
    method max_version = 1l
    
    method private virtual on_offer : [> ] t -> mime_type:string -> unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let mime_type = Msg.get_string _msg in
        _self#on_offer _proxy ~mime_type
      | _ -> 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] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_offer : [> `V1] t -> mime_type:string -> unit
    
    (** Advertise offered mime type.
        
        Sent immediately after creating announcing the
        wp_primary_selection_offer through
        wp_primary_selection_device.data_offer. One event is sent per offered
        mime type. *)
    
    method min_version = 1l
  end
end

(** Offer to replace the contents of the primary selection.
    
    The source side of a wp_primary_selection_offer, it provides a way to
    describe the offered data and respond to requests to transfer the
    requested contents of the primary selection clipboard. *)
module Zwp_primary_selection_source_v1 = struct
  type 'v t = ([`Zwp_primary_selection_source_v1], 'v, [`Client]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** Destroy the primary selection source.
      
      Destroy the primary selection source. *)
  let destroy (_t:([< `V1] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:1 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg;
    Proxy.shutdown_send _t
  
  (** Add an offered mime type.
      
      This request adds a mime type to the set of mime types advertised to
      targets. Can be called several times to offer multiple types. *)
  let offer (_t:([< `V1] as 'v) t) ~mime_type =
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[(Some mime_type)] ~arrays:[] in
    Msg.add_string _msg mime_type;
    Proxy.send _t _msg
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Wp_primary_selection_unstable_v1_proto.Zwp_primary_selection_source_v1)
    method max_version = 1l
    
    method private virtual on_send : [> ] t -> mime_type:string -> fd:Unix.file_descr -> unit
    
    method private virtual on_cancelled : [> ] t -> unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let mime_type = Msg.get_string _msg in
        let fd = Msg.get_fd _msg in
        _self#on_send _proxy ~mime_type ~fd
      | 1 ->
        _self#on_cancelled _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] as 'v] _handlers_unsafe
    (**/**)
    method private virtual on_send : [> `V1] t -> mime_type:string -> fd:Unix.file_descr -> unit
    
    (** Send the primary selection contents.
        
        Request for the current primary selection contents from the client.
        Send the specified mime type over the passed file descriptor, then
        close it. *)
    
    method private virtual on_cancelled : [> `V1] t -> unit
    
    (** Request for primary selection contents was canceled.
        
        This primary selection source is no longer valid. The client should
        clean up and destroy this primary selection source. *)
    
    method min_version = 1l
  end
end
OCaml

Innovation. Community. Security.