package wayland

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

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

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


(** Get relative pointer objects.
    
    A global interface used for getting the relative pointer object for a
    given pointer. *)
module Zwp_relative_pointer_manager_v1 = struct
  type 'v t = ([`Zwp_relative_pointer_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 Relative_pointer_unstable_v1_proto.Zwp_relative_pointer_manager_v1)
    method max_version = 1l
    
    method private virtual on_destroy : [> ] t -> unit
    
    method private virtual on_get_relative_pointer : [> ] t -> ([`Zwp_relative_pointer_v1], 'v, [`Server]) Proxy.t ->
                                                     pointer:([`Wl_pointer], [> Imports.Wl_pointer.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 : ([`Zwp_relative_pointer_v1], _, _) Proxy.t =
          Msg.get_int _msg |> Proxy.Handler.accept_new _proxy (module Imports.Zwp_relative_pointer_v1) in
        let pointer : ([`Wl_pointer], _, _) Proxy.t =
          let Proxy.Proxy p = Msg.get_int _msg |> Proxy.lookup_other _proxy in
          match Proxy.ty p with
          | Imports.Wl_pointer.T -> p
          | _ -> Proxy.wrong_type ~parent:_proxy ~expected:"wl_pointer" p
          in
        _self#on_get_relative_pointer _proxy id ~pointer
      | _ -> 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 relative pointer manager object.
        
        Used by the client to notify the server that it will no longer use this
        relative pointer manager object. *)
    
    method private virtual on_get_relative_pointer : [> `V1] t -> ([`Zwp_relative_pointer_v1], 'v, [`Server]) Proxy.t ->
                                                     pointer:([`Wl_pointer], [> Imports.Wl_pointer.versions], [`Server]) Proxy.t ->
                                                     unit
    
    (** Get a relative pointer object.
        
        Create a relative pointer interface given a wl_pointer object. See the
        wp_relative_pointer interface for more details. *)
    
    method min_version = 1l
    method bind_version : [`V1] = `V1
  end
end

(** Relative pointer object.
    
    A wp_relative_pointer object is an extension to the wl_pointer interface
    used for emitting relative pointer events. It shares the same focus as
    wl_pointer objects of the same seat and will only emit events when it has
    focus. *)
module Zwp_relative_pointer_v1 = struct
  type 'v t = ([`Zwp_relative_pointer_v1], 'v, [`Server]) Proxy.t
  
  (** {2 Version 1} *)
  
  (** Relative pointer motion.
      
      Relative x/y pointer motion from the pointer of the seat associated with
      this object.
      
      A relative motion is in the same dimension as regular wl_pointer motion
      events, except they do not represent an absolute position. For example,
      moving a pointer from (x, y) to (x', y') would have the equivalent
      relative motion (x' - x, y' - y). If a pointer motion caused the
      absolute pointer position to be clipped by for example the edge of the
      monitor, the relative motion is unaffected by the clipping and will
      represent the unclipped motion.
      
      This event also contains non-accelerated motion deltas. The
      non-accelerated delta is, when applicable, the regular pointer motion
      delta as it was before having applied motion acceleration and other
      transformations such as normalization.
      
      Note that the non-accelerated delta does not represent 'raw' events as
      they were read from some device. Pointer motion acceleration is device-
      and configuration-specific and non-accelerated deltas and accelerated
      deltas may have the same value on some devices.
      
      Relative motions are not coupled to wl_pointer.motion events, and can be
      sent in combination with such events, but also independently. There may
      also be scenarios where wl_pointer.motion is sent, but there is no
      relative motion. The order of an absolute and relative motion event
      originating from the same physical motion is not guaranteed.
      
      If the client needs button events or focus state, it can receive them
      from a wl_pointer object of the same seat that the wp_relative_pointer
      object is associated with. *)
  let relative_motion (_t:([< `V1] as 'v) t) ~utime_hi ~utime_lo ~dx ~dy ~dx_unaccel ~dy_unaccel =
    let _msg = Proxy.alloc _t ~op:0 ~ints:6 ~strings:[] ~arrays:[] in
    Msg.add_int _msg utime_hi;
    Msg.add_int _msg utime_lo;
    Msg.add_fixed _msg dx;
    Msg.add_fixed _msg dy;
    Msg.add_fixed _msg dx_unaccel;
    Msg.add_fixed _msg dy_unaccel;
    Proxy.send _t _msg
  
  (**/**)
  class virtual ['v] _handlers_unsafe = object (_self : (_, 'v, _) #Proxy.Handler.t)
    method user_data = S.No_data
    method metadata = (module Relative_pointer_unstable_v1_proto.Zwp_relative_pointer_v1)
    method max_version = 1l
    
    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 ->
        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_destroy : [> `V1] t -> unit
    
    (** Release the relative pointer object.
        
         *)
    
    method min_version = 1l
  end
end
OCaml

Innovation. Community. Security.