Debian Codegraph @

data/org.freedesktop.portal.InputCapture.xml

raw
1 <?xml version="1.0"?>
2 <!--
3 Copyright (C) 2022 Red Hat, Inc.
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
20 Author: Matthias Clasen <[email protected]>
21 -->
22
23 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24 <!--
25 org.freedesktop.portal.InputCapture:
26 @short_description: Portal for permitting input capture
27
28 The InputCapture portal allows capture input events from connected
29 physical or logical devices. Capturing input has two distinct states:
30 "enabled" where an application has requested that input should be captured
31 once certain conditions are met (but no input events are being delivered
32 yet) and "active", when input events are being delivered to the application.
33 An application can only control the "enabled" state, the compositor decides
34 when to switch into the "active" state - and which devices to capture.
35
36 Once the compositor activates input capturing, events from physical or
37 logical devices are sent directly to the application instead of using
38 those events to update the pointer position on-screen. The compositor
39 is in control of the input capturing and may filter events and/or stop
40 capturing at any time.
41
42 Input capturing is an asynchronous operation using "triggers". An
43 application sets up a number of triggers but it is the compositor who
44 decides when the trigger conditions are met. Currently, the only defined
45 trigger are pointer barriers: horizontal or vertical "lines" on the screen
46 that should trigger when the cursor moves across those lines.
47 See org.freedesktop.portal.InputCapture.SetPointerBarriers().
48
49 There is currently no way for an application to activate immediate input
50 capture.
51
52 The InputCapture portal merely *manages* the logic when input should be
53 captured. The transport of actual input events is delegated to a
54 transport layer, specifically libei. See org.freedesktop.portal.InputCapture.ConnectToEIS().
55
56 This documentation describes version 1 of this interface.
57 -->
58 <interface name="org.freedesktop.portal.InputCapture">
59 <!--
60 CreateSession:
61 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
62 @options: Vardict with optional further information
63 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
64
65 Create a capture input session. A successfully created session can at
66 any time be closed using :ref:`org.freedesktop.portal.Session.Close`, or may
67 at any time be closed by the portal implementation, which will be
68 signalled via :ref:`org.freedesktop.portal.Session::Closed`.
69
70 Supported keys in the @options vardict include:
71
72 * ``handle_token`` (``s``)
73
74 A string that will be used as the last element of the @handle. Must be a valid
75 object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
76 more information about the @handle.
77
78 * ``session_handle_token`` (``s``)
79
80 A string that will be used as the last element of the session handle. Must be a valid
81 object path element. See the :ref:`org.freedesktop.portal.Session` documentation for
82 more information about the session handle.
83
84 * ``capabilities`` (``u``)
85
86 Bitmask of requested capabilities, see the SupportedCapabilities property.
87 This value is required and must not be zero.
88
89 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
90
91 * ``session_handle`` (``o``)
92
93 The session handle. An object path for the
94 :ref:`org.freedesktop.portal.Session` object representing the created
95 session.
96
97 * ``capabilities`` (``u``)
98
99 The capabilities available to this session. This is always a
100 subset of the requested capabilities.
101 See the SupportedCapabilities property for details. Note that
102 while a capability may be available to a session, there is no
103 guarantee a device with that capability is currently available
104 or if one does become available that it will trigger input capture.
105
106 It is best to view this set as a negative confirmation - a
107 capability that was requested but is missing is an indication that
108 this application may not capture events of that capability.
109 -->
110 <method name="CreateSession">
111 <arg type="s" name="parent_window" direction="in"/>
112 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
113 <arg type="a{sv}" name="options" direction="in"/>
114 <arg type="o" name="handle" direction="out"/>
115 </method>
116
117 <!--
118 GetZones:
119 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
120 @options: Vardict with optional further information
121 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
122
123 Retrieve the set of currently available input zones for this session.
124 The zones may not be continuous and may be a logical representation
125 of the physical screens (e.g. a 4k screen may be represented as
126 low-resolution screen instead). A set of zones is identified by a unique
127 zone_set ID.
128
129 The name "Zone" was chosen to provide distinction with the libei
130 "Region".
131
132 If the zones change (e.g. a monitor is unplugged), the
133 #org.freedesktop.portal.InputCapture::ZonesChanged signal is emitted
134 and the application should re-request the current zones to update its
135 internal state.
136
137 Note that zones are session-specific, there is no guarantee that two
138 applications see the same screen zones. An empty zone list implies
139 that no pointer barriers can be set.
140
141 Whenever the application calls GetZones, the current
142 zone_set ID is returned that references the current set of zones. To
143 establish a pointer barrier, the application must pass this ID to
144 org.freedesktop.portal.InputCapture.SetPointerBarriers(). A mismatch of
145 zone_set IDs implies the application is not using the current zone set and
146 pointer barriers will fail.
147
148 The zone_set ID increases by an unspecified amount with each change to
149 the set of zones. Applications must be able to handle the zone_set ID
150 wrapping around. Implementations of this portal must to increase
151 the zone_set ID by a sensible amount to allow for
152 wrapping detection.
153
154 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
155
156 * ``zones`` (``a(uuii)``)
157
158 An array of regions, each specifying that zone's width, height,
159 x/y offset.
160
161 * ``zone_set`` (``u``)
162
163 A unique ID to be used in the
164 org.freedesktop.portal.InputCapture.SetPointerBarriers() method to refer to
165 this set of zones. This id increases by an unspecified
166 amount whenever the zones change and pointer barriers can only be set up
167 if the zone_set matches the most recent returned zone_set.
168 -->
169 <method name="GetZones">
170 <arg type="o" name="session_handle" direction="in"/>
171 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
172 <arg type="a{sv}" name="options" direction="in"/>
173 <arg type="o" name="handle" direction="out"/>
174 </method>
175
176 <!--
177 SetPointerBarriers:
178 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
179 @options: Vardict with optional further information
180 @barriers: An array of vardicts, each specifying one barrier
181 @zone_set: A unique zone_set ID referring to the zone set
182 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
183
184 Set up zero or more pointer barriers. Pointer barriers are horizontal
185 or vertical "lines" that should trigger the start of input capture when the cursor moves
186 across the pointer barrier. After a successful
187 org.freedesktop.portal.InputCapture.Enable() call and when the
188 compositor has deemed the pointer barrier to be crossed, input events
189 (from compositor-determined input devices) are sent to the application
190 via the transport layer.
191
192 Pointer barriers are situated on the top (for horizontal barriers) or left
193 (for vertical barriers) edge of their respective pixels and their width or height
194 is inclusive each pixel's width or height. In other words, a barrier spanning
195 x1=0, x2=1 is exactly two pixels wide. A pointer barrier must be situated at the
196 outside boundary of the union of all zones.
197 A pointer barrier must be fully contained within one zone.
198
199 For example, consider two zones of size 1920x1080 with offsets
200 0,0 and 1920,0, respectively. (i.e. a left-right dual-monitor setup).
201 The following pointer barriers are permitted:
202
203 - top edge of left screen: `x1=0, y1=0, x2=1919, y1=0`
204 - bottom edge of left screen: `x1=0, y1=1080, x2=1919, y1=1080`
205 - top edge of right screen: `x1=1920, y1=0, x2=3839, y1=0`
206 - bottom edge of right screen: `x1=1920, y1=1080, x2=3839, y1=1080`
207 - left edge of left screen: `x1=0, y1=0, x2=0, y1=1079`
208 - right edge of right screen: `x1=3840, y1=0, x2=3840, y1=1079`
209
210 A pointer barrier is considered triggered when the pointer would
211 logically move off that zone, even if the actual cusor movement is
212 clipped to the zone.
213
214 A zero-sized array of pointer barriers removes all existing pointer barriers
215 for this session. Setting pointer barriers immediately suspends the
216 current session and the application must call org.freedesktop.portal.InputCapture.Enable()
217 after this method.
218
219 The @zone_set must be equivalent to the last returned zone_set of the
220 org.freedesktop.portal.InputCapture.GetZones() method. A mismatch of ids
221 implies the application is not using the current zone set and
222 pointer barriers will fail.
223
224 Supported keys in the @options vardict include:
225
226 * ``handle_token`` (``s``)
227
228 A string that will be used as the last element of the @handle. Must be a valid
229 object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
230 more information about the @handle.
231
232 Supported keys in the @barriers vardicts include:
233
234 * ``barrier_id`` (``u``)
235
236 The non-zero id of this barrier. This id is used in the
237 #org.freedesktop.portal.InputCapture::Activated signal to inform
238 which barrier triggered input capture.
239
240 * ``position`` (``(iiii)``)
241
242 The x1/y1 x2/y2 position of the pointer barrier. A horizontal
243 pointer barrier must have y1 == y2, a vertical pointer barrier
244 must have x1 == x2. Diagonal pointer barriers are not supported.
245
246 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
247
248 * ``failed_barriers`` (``au``)
249
250 An array of barrier_ids of pointer barriers that have been denied. The
251 id matches the barrier_id of the entries in the @barriers argument.
252 -->
253 <method name="SetPointerBarriers">
254 <arg type="o" name="session_handle" direction="in"/>
255 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
256 <arg type="a{sv}" name="options" direction="in"/>
257 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QList&lt;QVariantMap&gt;"/>
258 <arg type="aa{sv}" name="barriers" direction="in"/>
259 <arg type="u" name="zone_set" direction="in"/>
260 <arg type="o" name="handle" direction="out"/>
261 </method>
262
263 <!--
264 Enable:
265 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
266 @options: Vardict with optional further information
267
268 Enable input capturing. This does not immediately trigger capture, it
269 merely enables the capturing to be triggered at some future point
270 (e.g. by the cursor moving across a barrier). If and when that happens,
271 the #org.freedesktop.portal.InputCapture::Activated signal is emitted.
272 -->
273 <method name="Enable">
274 <arg type="o" name="session_handle" direction="in"/>
275 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
276 <arg type="a{sv}" name="options" direction="in"/>
277 </method>
278
279 <!--
280 Disable:
281 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
282 @options: Vardict with optional further information
283
284 Disable input capturing. No
285 #org.freedesktop.portal.InputCapture::Disabled signal will be emitted.
286
287 If input capturing is currently ongoing, no
288 #org.freedesktop.portal.InputCapture::Deactivated signal will be
289 emitted.
290
291 Due to the asynchronous nature of this protocol,
292 #org.freedesktop.portal.InputCapture::Deactivated
293 and/or #org.freedesktop.portal.InputCapture::Deactivated signals may
294 nevertheless be received by the application after a call to
295 org.freedesktop.portal.InputCapture.Enable().
296
297 Input events will not be captured until a subsequent
298 org.freedesktop.portal.InputCapture.Enable() call.
299 -->
300 <method name="Disable">
301 <arg type="o" name="session_handle" direction="in"/>
302 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
303 <arg type="a{sv}" name="options" direction="in"/>
304 </method>
305
306 <!--
307 Release:
308 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
309 @options: Vardict with optional further information
310
311 Release any ongoing input capture. No
312 #org.freedesktop.portal.InputCapture::Deactivated signal will be emitted.
313
314 Due to the asynchronous nature of this protocol, a
315 #org.freedesktop.portal.InputCapture::Deactivated
316 signal may
317 nevertheless be received by the application after a call to
318 org.freedesktop.portal.InputCapture.Release().
319
320 The activation_id provided in the @options vardict specifies which
321 currently ongoing input capture should be terminated. The asynchronous
322 nature of this portal allows for an input capture to be Deactivated and
323 a new input capture to be Activated before the client requests the
324 Release for the previous input capture.
325
326 A compositor should ignore a
327 org.freedesktop.portal.InputCapture.Release() request for a no longer active
328 activation_id.
329
330 Supported keys in the @options vardict include:
331
332 * ``activation_id`` (``u``)
333
334 The same activation_id number as in the
335 #org.freedesktop.portal.InputCapture::Activated signal.
336
337 * ``cursor_position`` (``(dd)``)
338
339 The suggested cursor position within the Zones available in
340 this session.
341
342 This is a suggestion to the compositor to place the cursor in
343 the correct position to allow for fluent movement between virtual
344 screens. The compositor is not required to honor this suggestion.
345 -->
346 <method name="Release">
347 <arg type="o" name="session_handle" direction="in"/>
348 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
349 <arg type="a{sv}" name="options" direction="in"/>
350 </method>
351
352 <!--
353 ConnectToEIS:
354 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
355 @options: Vardict with optional further information
356 @fd: A file descriptor to an active EIS implementation that can be passed to a passive libei context
357
358 Set up the connection to an active EIS implementation. Once input capturing starts,
359 input events are sent via the EI protocol between the compositor and the application.
360 This call must be invoked before org.freedesktop.portal.InputCapture.Enable().
361
362 A session only needs to set this up once, the EIS implementation is not affected by
363 calls to org.freedesktop.portal.InputCapture.Disable() and org.freedesktop.portal.InputCapture.Enable() -
364 the same connection can be re-used until the session is closed.
365 -->
366 <method name="ConnectToEIS">
367 <annotation name="org.gtk.GDBus.C.Name" value="connect_to_eis"/>
368 <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
369 <arg type="o" name="session_handle" direction="in"/>
370 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
371 <arg type="a{sv}" name="options" direction="in"/>
372 <arg type="h" name="fd" direction="out"/>
373 </method>
374
375 <!--
376 Disabled:
377 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
378 @options: Vardict with optional further information
379
380 The Disabled signal is emitted when the application will no longer
381 receive captured input. If input capturing is currently ongoing, the
382 #org.freedesktop.portal.InputCapture::Deactivated signal is emitted
383 before this signal.
384
385 Applications must call org.freedesktop.portal.InputCapture.Enable() to
386 request future input capturing for this session.
387 -->
388 <signal name="Disabled">
389 <arg type="o" name="session_handle" direction="out"/>
390 <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
391 <arg type="a{sv}" name="options" direction="out"/>
392 </signal>
393
394 <!--
395 Activated:
396 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
397 @options: Vardict with optional further information
398
399 The Activated signal is emitted when input capture starts and input events
400 are about to be sent to the application.
401
402 This signal is only emitted after a prior call
403 to org.freedesktop.portal.InputCapture.Enable().
404
405 Supported keys in the @options vardict include:
406
407 * ``activation_id`` (``u``)
408
409 A number that can be used to synchronize with the
410 transport-layer. This number has no intrinsic meaning but
411 is guaranteed to increase by an unspecified amount on each call.
412
413 In particular: if the compositor sends a activation_id of N as
414 part of this request it will also set the sequence in EIS'
415 start_emulating event the same value N on the EIS connection
416 before the first event from a device is sent.
417 This allows an application to have a synchronization point and
418 attribute an event sequence to the portal interaction.
419
420 Applications must be able to handle the activation_id number
421 wrapping around. Implementations of this portal must increase
422 the activation_id number by a sensible amount to allow for
423 wrapping detection.
424
425 * ``cursor_position`` (``(dd)``)
426
427 The current cursor position in the same coordinate space as
428 the Zones. Note that this position is usually outside the Zones
429 available to this session as all PointerBarriers are at the edge
430 of their respective Zones.
431
432 For example, a fast movement against a barrier on the right edge
433 of a screen may logically put the cursor dozens of pixels into
434 the (non-existing) screen on the other side of the barrier.
435 It is the application's responsibility to calculate and adjust the
436 cursor position as necessary.
437
438 * ``barrier_id`` (``u``)
439
440 The barrier id of the barrier that triggered. If the value is
441 nonzero, it matches the barrier id as specified in
442 org.freedesktop.portal.InputCapture.SetPointerBarriers().
443
444 If the id is zero, the pointer barrier could not be determined.
445 If the id is missing, the input capture was not triggered by a
446 pointer barrier.
447
448 Where more than one pointer barrier are triggered by the same
449 movement it is up to the compositor to choose one barrier (or use
450 a barrier id of zero).
451 -->
452 <signal name="Activated">
453 <arg type="o" name="session_handle" direction="out"/>
454 <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
455 <arg type="a{sv}" name="options" direction="out"/>
456 </signal>
457
458 <!--
459 Deactivated:
460 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
461 @options: Vardict with optional further information
462
463 The Deactivated signal is emitted when input capture stopped and input events
464 are no longer sent to the application. To prevent future input
465 capture, an application must call org.freedesktop.portal.InputCapture.Disable().
466
467 Supported keys in the @options vardict include:
468
469 * ``activation_id`` (``u``)
470
471 The same activation_id number as in the corresponding
472 #org.freedesktop.portal.InputCapture::Activated signal.
473 -->
474 <signal name="Deactivated">
475 <arg type="o" name="session_handle" direction="out"/>
476 <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
477 <arg type="a{sv}" name="options" direction="out"/>
478 </signal>
479
480 <!--
481 ZonesChanged:
482 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
483 @options: Vardict with optional further information
484
485 The ZonesChanged signal is emitted when the set of zones
486 available **to this session** change. An application should immediately
487 call org.freedesktop.portal.InputCapture.GetZones() to update its state
488 of the zones followed by
489 org.freedesktop.portal.InputCapture.SetPointerBarriers() to re-establish
490 the pointer barriers.
491
492 The ZonesChanged signal includes the zone_set ID of the set of zones
493 invalidated, see #org.freedesktop.portal.InputCapture.GetZones().
494 Due to the asynchronous nature of this protocol, the zone_set ID may
495 identify a set of zones that the application has never (or not yet) seen.
496 Applications must be able to handle unknown zone_set IDs. In particular,
497 because the zone_set ID is guaranteed to increment, an application holding
498 a zone_set ID higher than the ID in this signal can usually simply
499 discard the signal.
500
501 Supported keys in the @options vardict include:
502
503 * ``zone_set`` (``u``)
504
505 The zone_set ID of the invalidated zone set as described in
506 org.freedesktop.portal.InputCapture.GetZones()
507 -->
508 <signal name="ZonesChanged">
509 <arg type="o" name="session_handle" direction="out"/>
510 <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
511 <arg type="a{sv}" name="options" direction="out"/>
512 </signal>
513
514 <!--
515 SupportedCapabilities:
516
517 A bitmask of supported capabilities. This list is constant, it is not the list of
518 capabilities currently available but rather which capabilies are
519 implemented by the portal.
520
521 Applications must ignore unknown capabilities.
522
523 Currently defined types are:
524
525 - ``1``: KEYBOARD
526 - ``2``: POINTER
527 - ``4``: TOUCHSCREEN
528 -->
529 <property name="SupportedCapabilities" type="u" access="read"/>
530 <property name="version" type="u" access="read"/>
531 </interface>
532 </node>