package wayland

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

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

[@@@ocaml.warning "-27"]
open struct
  module Imports = struct
    include Gtk_primary_selection_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 Gtk_primary_selection_device_manager = struct
  type 'v t = ([`Gtk_primary_selection_device_manager], 'v, [`Server]) Proxy.t
  
  (** {2 Version 1} *)
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Gtk_primary_selection_proto.Gtk_primary_selection_device_manager)
    method max_version = 1l
    
    method private virtual on_create_source : [> ] t -> ([`Gtk_primary_selection_source], 'v, [`Server]) Proxy.t ->
                                              unit
    
    method private virtual on_get_device : [> ] t -> ([`Gtk_primary_selection_device], 'v, [`Server]) Proxy.t ->
                                           seat:([`Wl_seat], [> Imports.Wl_seat.versions], [`Server]) Proxy.t -> unit
    
    method private virtual on_destroy : [> ] t -> unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let id : ([`Gtk_primary_selection_source], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Gtk_primary_selection_source) in
        _self#on_create_source _proxy id
      | 1 ->
        let id : ([`Gtk_primary_selection_device], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Gtk_primary_selection_device) in
        let seat : ([`Wl_seat], _, _) Proxy.t =
          let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
          match Proxy.ty p with
          | Imports.Wl_seat.T -> p
          | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"wl_seat" p
          in
        _self#on_get_device _proxy id ~seat
      | 2 ->
        Proxy.shutdown_recv _proxy;
        _self#on_destroy _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_create_source : [> `V1] t -> ([`Gtk_primary_selection_source], 'v, [`Server]) Proxy.t ->
                                              unit
    
    (** Create a new primary selection source.
        
        Create a new primary selection source. *)
    
    method private virtual on_get_device : [> `V1] t -> ([`Gtk_primary_selection_device], 'v, [`Server]) Proxy.t ->
                                           seat:([`Wl_seat], [> Imports.Wl_seat.versions], [`Server]) Proxy.t -> unit
    
    (** Create a new primary selection device.
        
        Create a new data device for a given seat. *)
    
    method private virtual on_destroy : [> `V1] t -> unit
    
    (** Destroy the primary selection device manager.
        
        Destroy the primary selection device manager. *)
    
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
end

module Gtk_primary_selection_device = struct
  type 'v t = ([`Gtk_primary_selection_device], 'v, [`Server]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** 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. *)
  let selection (_t:([< `V1] as 'v) t) (id:([`Gtk_primary_selection_offer], _, [`Server]) Proxy.t option) =
    let _msg = Proxy.alloc _t ~op:1 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id_opt id);
    Proxy.send _t _msg
  
  (** 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. *)
  let data_offer (_t:([< `V1] as 'v) t) (offer:([`Gtk_primary_selection_offer], 'v, [`Server]) #Proxy.Handler.t) =
    let __offer = Proxy.spawn _t offer in
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Proxy.id __offer);
    Proxy.send _t _msg;
    __offer
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Gtk_primary_selection_proto.Gtk_primary_selection_device)
    method max_version = 1l
    
    method private virtual on_set_selection : [> ] t -> source:([`Gtk_primary_selection_source], [> Imports.Gtk_primary_selection_source.versions], [`Server]) Proxy.t option ->
                                              serial:int32 -> unit
    
    method private virtual on_destroy : [> ] t -> unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let source : ([`Gtk_primary_selection_source], _, _) 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.Gtk_primary_selection_source.T -> Some p
            | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"gtk_primary_selection_source" p
          in
        let serial = Msg.get_int _msg in
        _self#on_set_selection _proxy ~source ~serial
      | 1 ->
        Proxy.shutdown_recv _proxy;
        _self#on_destroy _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_set_selection : [> `V1] t -> source:([`Gtk_primary_selection_source], [> Imports.Gtk_primary_selection_source.versions], [`Server]) Proxy.t option ->
                                              serial:int32 -> unit
    
    (** 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. *)
    
    method private virtual on_destroy : [> `V1] t -> unit
    
    (** Destroy the primary selection device.
        
        Destroy the primary selection device. *)
    
    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 source
    will transferthat the
    data can be converted to and provides the mechanisms for transferring the
    data directly to the client. *)
module Gtk_primary_selection_offer = struct
  type 'v t = ([`Gtk_primary_selection_offer], 'v, [`Server]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** 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. *)
  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 Gtk_primary_selection_proto.Gtk_primary_selection_offer)
    method max_version = 1l
    
    method private virtual on_receive : [> ] t -> mime_type:string -> fd:Unix.file_descr -> unit
    
    method private virtual on_destroy : [> ] 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_receive _proxy ~mime_type ~fd
      | 1 ->
        Proxy.shutdown_recv _proxy;
        _self#on_destroy _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_receive : [> `V1] t -> mime_type:string -> fd:Unix.file_descr -> unit
    
    (** 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. *)
    
    method private virtual on_destroy : [> `V1] t -> unit
    
    (** Destroy the primary selection offer.
        
        Destroy the primary selection offer. *)
    
    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 Gtk_primary_selection_source = struct
  type 'v t = ([`Gtk_primary_selection_source], 'v, [`Server]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** 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. *)
  let cancelled (_t:([< `V1] as 'v) t)  =
    let _msg = Proxy.alloc _t ~op:1 ~ints:0 ~strings:[] ~arrays:[] in
    Proxy.send _t _msg
  
  (** 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. *)
  let send (_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 Gtk_primary_selection_proto.Gtk_primary_selection_source)
    method max_version = 1l
    
    method private virtual on_offer : [> ] t -> mime_type:string -> unit
    
    method private virtual on_destroy : [> ] 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
        _self#on_offer _proxy ~mime_type
      | 1 ->
        Proxy.shutdown_recv _proxy;
        _self#on_destroy _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_offer : [> `V1] t -> mime_type:string -> unit
    
    (** 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. *)
    
    method private virtual on_destroy : [> `V1] t -> unit
    
    (** Destroy the primary selection source.
        
        Destroy the primary selection source. *)
    
    method min_version = 1l
  end
end
OCaml

Innovation. Community. Security.