package wayland

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

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

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


(** Server side window decoration manager.
    
    This interface allows to coordinate whether the server should create
    a server-side window decoration around a wl_surface representing a
    shell surface (wl_shell_surface or similar). By announcing support
    for this interface the server indicates that it supports server
    side decorations. *)
module Org_kde_kwin_server_decoration_manager = struct
  type 'v t = ([`Org_kde_kwin_server_decoration_manager], 'v, [`Server]) Proxy.t
  module Mode = Server_decoration_proto.Org_kde_kwin_server_decoration_manager.Mode
  
  (** {2 Version 1} *)
  
  (** The default mode used on the server.
      
      This event is emitted directly after binding the interface. It contains
      the default mode for the decoration. When a new server decoration object
      is created this new object will be in the default mode until the first
      request_mode is requested.
      
      The server may change the default mode at any time. *)
  let default_mode (_t:([< `V1] as 'v) t) ~mode =
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg 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 Server_decoration_proto.Org_kde_kwin_server_decoration_manager)
    method max_version = 1l
    
    method private virtual on_create : [> ] t -> ([`Org_kde_kwin_server_decoration], 'v, [`Server]) Proxy.t ->
                                       surface:([`Wl_surface], [> Imports.Wl_surface.versions], [`Server]) Proxy.t ->
                                       unit
    
    
    method dispatch (_proxy : 'v t) _msg =
      let _proxy = Proxy.cast_version _proxy in
      match Msg.op _msg with
      | 0 ->
        let id : ([`Org_kde_kwin_server_decoration], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Org_kde_kwin_server_decoration) in
        let surface : ([`Wl_surface], _, _) Proxy.t =
          let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
          match Proxy.ty p with
          | Imports.Wl_surface.T -> p
          | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"wl_surface" p
          in
        _self#on_create _proxy id ~surface
      | _ -> 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 : [> `V1] t -> ([`Org_kde_kwin_server_decoration], 'v, [`Server]) Proxy.t ->
                                       surface:([`Wl_surface], [> Imports.Wl_surface.versions], [`Server]) Proxy.t ->
                                       unit
    
    (** Create a server-side decoration object for a given surface.
        
        When a client creates a server-side decoration object it indicates
        that it supports the protocol. The client is supposed to tell the
        server whether it wants server-side decorations or will provide
        client-side decorations.
        
        If the client does not create a server-side decoration object for
        a surface the server interprets this as lack of support for this
        protocol and considers it as client-side decorated. Nevertheless a
        client-side decorated surface should use this protocol to indicate
        to the server that it does not want a server-side deco. *)
    
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
end

module Org_kde_kwin_server_decoration = struct
  type 'v t = ([`Org_kde_kwin_server_decoration], 'v, [`Server]) Proxy.t
  module Mode = Server_decoration_proto.Org_kde_kwin_server_decoration.Mode
  
  (** {2 Version 1} *)
  
  (** The new decoration mode applied by the server.
      
      This event is emitted directly after the decoration is created and
      represents the base decoration policy by the server. E.g. a server
      which wants all surfaces to be client-side decorated will send Client,
      a server which wants server-side decoration will send Server.
      
      The client can request a different mode through the decoration request.
      The server will acknowledge this by another event with the same mode. So
      even if a server prefers server-side decoration it's possible to force a
      client-side decoration.
      
      The server may emit this event at any time. In this case the client can
      again request a different mode. It's the responsibility of the server to
      prevent a feedback loop. *)
  let mode (_t:([< `V1] as 'v) t) ~mode =
    let _msg = Proxy.alloc _t ~op:0 ~ints:1 ~strings:[] ~arrays:[] in
    Msg.add_int _msg 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 Server_decoration_proto.Org_kde_kwin_server_decoration)
    method max_version = 1l
    
    method private virtual on_release : [> ] t -> unit
    
    method private virtual on_request_mode : [> ] t -> mode:int32 -> 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_release _proxy 
      | 1 ->
        let mode = Msg.get_int _msg in
        _self#on_request_mode _proxy ~mode
      | _ -> 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_release : [> `V1] t -> unit
    
    (** Release the server decoration object.
        
         *)
    
    method private virtual on_request_mode : [> `V1] t -> mode:int32 -> unit
    
    (** The decoration mode the surface wants to use..
        
         *)
    
    method min_version = 1l
  end
end
OCaml

Innovation. Community. Security.