package wayland

  1. Overview
  2. Docs
Pure OCaml Wayland protocol library

Install

Dune Dependency

Authors

Maintainers

Sources

wayland-2.1.tbz
sha256=0ffb53958954f1ed4ef874a122c071a9cf3de77ae341b963eb7b513d8028f3c1
sha512=e391b91b4161ada44339bb97b0acf40a0ef3d3c8f62a114333a61155b70288b31b5904492ebbf187bad957849ff6e1df172d014f46ffc33db7140fa833449f5c

doc/src/wayland.protocols/xdg_decoration_unstable_v1_server.ml.html

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

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


(** Window decoration manager.
    
    This interface allows a compositor to announce support for server-side
    decorations.
    
    A window decoration is a set of window controls as deemed appropriate by
    the party managing them, such as user interface components used to move,
    resize and change a window's state.
    
    A client can use this protocol to request being decorated by a supporting
    compositor.
    
    If compositor and client do not negotiate the use of a server-side
    decoration using this protocol, clients continue to self-decorate as they
    see fit.
    
    Warning! The protocol described in this file is experimental and
    backward incompatible changes may be made. Backward compatible changes
    may be added together with the corresponding interface version bump.
    Backward incompatible changes are done by bumping the version number in
    the protocol and interface names and resetting the interface version.
    Once the protocol is to be declared stable, the 'z' prefix and the
    version number in the protocol and interface names are removed and the
    interface version number is reset. *)
module Zxdg_decoration_manager_v1 = struct
  type 'v t = ([`Zxdg_decoration_manager_v1], '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 Xdg_decoration_unstable_v1_proto.Zxdg_decoration_manager_v1)
    method max_version = 1l
    
    method private virtual on_destroy : [> ] t -> unit
    
    method private virtual on_get_toplevel_decoration : [> ] t -> ([`Zxdg_toplevel_decoration_v1], 'v, [`Server]) Proxy.t ->
                                                        toplevel:([`Xdg_toplevel], [> Imports.Xdg_toplevel.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 id : ([`Zxdg_toplevel_decoration_v1], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Zxdg_toplevel_decoration_v1) in
        let toplevel : ([`Xdg_toplevel], _, _) Proxy.t =
          let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
          match Proxy.ty p with
          | Imports.Xdg_toplevel.T -> p
          | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"xdg_toplevel" p
          in
        _self#on_get_toplevel_decoration _proxy id ~toplevel
      | _ -> 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_destroy : [> `V1] t -> unit
    
    (** Destroy the decoration manager object.
        
        Destroy the decoration manager. This doesn't destroy objects created
        with the manager. *)
    
    method private virtual on_get_toplevel_decoration : [> `V1] t -> ([`Zxdg_toplevel_decoration_v1], 'v, [`Server]) Proxy.t ->
                                                        toplevel:([`Xdg_toplevel], [> Imports.Xdg_toplevel.versions], [`Server]) Proxy.t ->
                                                        unit
    
    (** Create a new toplevel decoration object.
        
        Create a new decoration object associated with the given toplevel.
        
        Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
        buffer attached or committed is a client error, and any attempts by a
        client to attach or manipulate a buffer prior to the first
        xdg_toplevel_decoration.configure event must also be treated as
        errors. *)
    
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
end

(** Decoration object for a toplevel surface.
    
    The decoration object allows the compositor to toggle server-side window
    decorations for a toplevel surface. The client can request to switch to
    another mode.
    
    The xdg_toplevel_decoration object must be destroyed before its
    xdg_toplevel. *)
module Zxdg_toplevel_decoration_v1 = struct
  type 'v t = ([`Zxdg_toplevel_decoration_v1], 'v, [`Server]) Proxy.t
  module Error = Xdg_decoration_unstable_v1_proto.Zxdg_toplevel_decoration_v1.Error
  
  module Mode = Xdg_decoration_unstable_v1_proto.Zxdg_toplevel_decoration_v1.Mode
  
  (** {2 Version 1} *)
  
  (** Notify a decoration mode change.
      
      The configure event configures the effective decoration mode. The
      configured state should not be applied immediately. Clients must send an
      ack_configure in response to this event. See xdg_surface.configure and
      xdg_surface.ack_configure for details.
      
      A configure event can be sent at any time. The specified mode must be
      obeyed by the client. *)
  let configure (_t:([< `V1] as 'v) t) ~mode =
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg (Imports.Zxdg_toplevel_decoration_v1.Mode.to_int32 mode);
    Proxy.send _t _msg
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Xdg_decoration_unstable_v1_proto.Zxdg_toplevel_decoration_v1)
    method max_version = 1l
    
    method private virtual on_destroy : [> ] t -> unit
    
    method private virtual on_set_mode : [> ] t -> mode:Imports.Zxdg_toplevel_decoration_v1.Mode.t -> unit
    
    method private virtual on_unset_mode : [> ] 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 mode = Msg.get_int _msg |> Imports.Zxdg_toplevel_decoration_v1.Mode.of_int32 in
        _self#on_set_mode _proxy ~mode
      | 2 ->
        _self#on_unset_mode _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_destroy : [> `V1] t -> unit
    
    (** Destroy the decoration object.
        
        Switch back to a mode without any server-side decorations at the next
        commit. *)
    
    method private virtual on_set_mode : [> `V1] t -> mode:Imports.Zxdg_toplevel_decoration_v1.Mode.t -> unit
    
    (** Set the decoration mode.
        
        Set the toplevel surface decoration mode. This informs the compositor
        that the client prefers the provided decoration mode.
        
        After requesting a decoration mode, the compositor will respond by
        emitting an xdg_surface.configure event. The client should then update
        its content, drawing it without decorations if the received mode is
        server-side decorations. The client must also acknowledge the configure
        when committing the new content (see xdg_surface.ack_configure).
        
        The compositor can decide not to use the client's mode and enforce a
        different mode instead.
        
        Clients whose decoration mode depend on the xdg_toplevel state may send
        a set_mode request in response to an xdg_surface.configure event and wait
        for the next xdg_surface.configure event to prevent unwanted state.
        Such clients are responsible for preventing configure loops and must
        make sure not to send multiple successive set_mode requests with the
        same decoration mode. *)
    
    method private virtual on_unset_mode : [> `V1] t -> unit
    
    (** Unset the decoration mode.
        
        Unset the toplevel surface decoration mode. This informs the compositor
        that the client doesn't prefer a particular decoration mode.
        
        This request has the same semantics as set_mode. *)
    
    method min_version = 1l
  end
end
OCaml

Innovation. Community. Security.