| 1 |
<?xml version="1.0"?> |
| 2 |
<!-- |
| 3 |
Copyright (C) 2019 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 |
This library is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
Lesser General Public License for more details. |
| 15 |
You should have received a copy of the GNU Lesser General Public |
| 16 |
License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
Author: Christian J. Kellner <[email protected]> |
| 18 |
--> |
| 19 |
|
| 20 |
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> |
| 21 |
<!-- |
| 22 |
org.freedesktop.portal.GameMode: |
| 23 |
@short_description: Portal for accessing GameMode |
| 24 |
|
| 25 |
Interface for accessing GameMode from within the sandbox. It |
| 26 |
is analogous to the com.feralinteractive.GameMode interface |
| 27 |
and will proxy request there, but with additional permission |
| 28 |
checking and pid mapping. The latter is necessary in the case |
| 29 |
that sandbox has pid namespace isolation enabled. See the man |
| 30 |
page for pid_namespaces(7) for more details, but briefly, it |
| 31 |
means that the sandbox has its own process id namespace which |
| 32 |
is separated from the one on the host. Thus there will be two |
| 33 |
separate process ids (PID) within two different namespaces |
| 34 |
that both identify same process. One id from the PID namespace |
| 35 |
inside the sandbox and one id from the host PID namespace. |
| 36 |
Since org.freedesktop.portal.GameMode expects pids from the host |
| 37 |
PID namespace but programs inside the sandbox can only know PID |
| 38 |
from the sandbox namespace, process ids need to be translated from |
| 39 |
the portal to the host namespace. The portal will do that transparently |
| 40 |
for all calls where this is necessary. |
| 41 |
|
| 42 |
Note: #org.freedesktop.portal.GameMode will monitor active clients, |
| 43 |
i.e. games and other programs that have successfully called |
| 44 |
org.freedesktop.portal.GameMode.RegisterGame(). |
| 45 |
In the event that a client terminates without a call to the |
| 46 |
org.freedesktop.portal.GameMode.UnregisterGame() method, GameMode will |
| 47 |
automatically un-register the client. This might happen with a (small) |
| 48 |
delay. |
| 49 |
|
| 50 |
This documentation describes version 4 of this interface. |
| 51 |
--> |
| 52 |
<interface name="org.freedesktop.portal.GameMode"> |
| 53 |
<!-- |
| 54 |
QueryStatus: |
| 55 |
@pid: Process id to query the GameMode status of |
| 56 |
@result: The GameMode status for @pid |
| 57 |
|
| 58 |
Query the GameMode status for a process. |
| 59 |
|
| 60 |
If the caller is running inside a sandbox with PID namespace |
| 61 |
isolation, the @pid will be translated to the respective host PID. |
| 62 |
|
| 63 |
See the general introduction for details. |
| 64 |
|
| 65 |
The @result will be one of: |
| 66 |
|
| 67 |
- `0` if GameMode is inactive |
| 68 |
- `1` if GameMode is active |
| 69 |
- `2` if GameMode is active and @pid is registered |
| 70 |
- `-1` if the query failed inside GameMode |
| 71 |
--> |
| 72 |
<method name="QueryStatus"> |
| 73 |
<arg type="i" name="pid" direction="in"/> |
| 74 |
<arg type="i" name="result" direction="out"/> |
| 75 |
</method> |
| 76 |
<!-- |
| 77 |
RegisterGame: |
| 78 |
@pid: Process id of the game to register |
| 79 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 80 |
|
| 81 |
Register a game with GameMode and thus request GameMode to |
| 82 |
be activated. |
| 83 |
|
| 84 |
If the caller is running inside a sandbox with PID namespace |
| 85 |
isolation, the @pid will be translated to the respective host PID. |
| 86 |
|
| 87 |
See the general introduction for details. |
| 88 |
|
| 89 |
If the GameMode has already been requested for @pid before, |
| 90 |
this call will fail, i.e. result will be -1. |
| 91 |
|
| 92 |
The @result will be one of: |
| 93 |
|
| 94 |
- `0` if the game with @pid was successfully registered |
| 95 |
- `-1` if the request was rejected by GameMode |
| 96 |
--> |
| 97 |
<method name="RegisterGame"> |
| 98 |
<arg type="i" name="pid" direction="in"/> |
| 99 |
<arg type="i" name="result" direction="out"/> |
| 100 |
</method> |
| 101 |
<!-- |
| 102 |
UnregisterGame: |
| 103 |
@pid: Process id of the game to un-register |
| 104 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 105 |
|
| 106 |
Un-register a game from GameMode. |
| 107 |
|
| 108 |
If the call is successful and there are no other games or clients |
| 109 |
registered, GameMode will be deactivated. |
| 110 |
|
| 111 |
If the caller is running inside a sandbox with PID namespace |
| 112 |
isolation, the @pid will be translated to the respective host PID. |
| 113 |
|
| 114 |
The @result will be one of: |
| 115 |
|
| 116 |
- `0` if the game with @pid was successfully un-registered |
| 117 |
- `-1` if the request was rejected by GameMode |
| 118 |
--> |
| 119 |
<method name="UnregisterGame"> |
| 120 |
<arg type="i" name="pid" direction="in"/> |
| 121 |
<arg type="i" name="result" direction="out"/> |
| 122 |
</method> |
| 123 |
|
| 124 |
<!-- |
| 125 |
QueryStatusByPid: |
| 126 |
@target: Process id to query the GameMode status of |
| 127 |
@requester: Process id of the process requesting the information |
| 128 |
@result: The GameMode status for @target |
| 129 |
|
| 130 |
Query the GameMode status for a process. |
| 131 |
|
| 132 |
Like org.freedesktop.portal.GameMode.QueryStatus() but @requester |
| 133 |
acting on behalf of @target. |
| 134 |
--> |
| 135 |
<method name="QueryStatusByPid"> |
| 136 |
<arg type="i" name="target" direction="in"/> |
| 137 |
<arg type="i" name="requester" direction="in"/> |
| 138 |
<arg type="i" name="result" direction="out"/> |
| 139 |
</method> |
| 140 |
|
| 141 |
<!-- |
| 142 |
RegisterGameByPid: |
| 143 |
@target: Process id of the game to register |
| 144 |
@requester: Process id of the process requesting the registration |
| 145 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 146 |
|
| 147 |
Register a game with GameMode. |
| 148 |
|
| 149 |
Like org.freedesktop.portal.GameMode.RegisterGame() but @requester |
| 150 |
acting on behalf of @target. |
| 151 |
--> |
| 152 |
<method name="RegisterGameByPid"> |
| 153 |
<arg type="i" name="target" direction="in"/> |
| 154 |
<arg type="i" name="requester" direction="in"/> |
| 155 |
<arg type="i" name="result" direction="out"/> |
| 156 |
</method> |
| 157 |
|
| 158 |
<!-- |
| 159 |
UnregisterGameByPid: |
| 160 |
@target: Process id of the game to un-register |
| 161 |
@requester: Process id of the process requesting the un-registration |
| 162 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 163 |
|
| 164 |
Un-register a game with GameMode. |
| 165 |
|
| 166 |
Like org.freedesktop.portal.GameMode.UnregisterGame() but @requester |
| 167 |
acting on behalf of @target. |
| 168 |
--> |
| 169 |
<method name="UnregisterGameByPid"> |
| 170 |
<arg type="i" name="target" direction="in"/> |
| 171 |
<arg type="i" name="requester" direction="in"/> |
| 172 |
<arg type="i" name="result" direction="out"/> |
| 173 |
</method> |
| 174 |
|
| 175 |
<!-- PidFd based APIs --> |
| 176 |
<!-- |
| 177 |
QueryStatusByPIDFd: |
| 178 |
@target: Pidfd to query the GameMode status of |
| 179 |
@requester: Pidfd of the process requesting the information |
| 180 |
@result: The GameMode status for @target |
| 181 |
|
| 182 |
Query the GameMode status for a process. |
| 183 |
|
| 184 |
Like org.freedesktop.portal.GameMode.QueryStatusByPid() but @requester |
| 185 |
and @target are pidfds representing the processes. |
| 186 |
--> |
| 187 |
<method name="QueryStatusByPIDFd"> |
| 188 |
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/> |
| 189 |
<arg type="h" name="target" direction="in"/> |
| 190 |
<arg type="h" name="requester" direction="in"/> |
| 191 |
<arg type="i" name="result" direction="out"/> |
| 192 |
</method> |
| 193 |
|
| 194 |
<!-- |
| 195 |
RegisterGameByPIDFd: |
| 196 |
@target: Pidfd of the game to register |
| 197 |
@requester: Pidfd of the process requesting the registration |
| 198 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 199 |
|
| 200 |
Register a game with GameMode. |
| 201 |
|
| 202 |
Like org.freedesktop.portal.GameMode.RegisterGameByPid() but @requester |
| 203 |
and @target are pidfds representing the processes. |
| 204 |
--> |
| 205 |
<method name="RegisterGameByPIDFd"> |
| 206 |
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/> |
| 207 |
<arg type="h" name="target" direction="in"/> |
| 208 |
<arg type="h" name="requester" direction="in"/> |
| 209 |
<arg type="i" name="result" direction="out"/> |
| 210 |
</method> |
| 211 |
|
| 212 |
<!-- |
| 213 |
UnregisterGameByPIDFd: |
| 214 |
@target: Pidfd of the game to un-register |
| 215 |
@requester: Pidfd of the process requesting the un-registration |
| 216 |
@result: Status of the request: 0 for success, -1 indicates an error |
| 217 |
|
| 218 |
Un-register a game with GameMode. |
| 219 |
|
| 220 |
Like org.freedesktop.portal.GameMode.UnregisterGameByPid() but @requester |
| 221 |
and @target are pidfds representing the processes. |
| 222 |
--> |
| 223 |
<method name="UnregisterGameByPIDFd"> |
| 224 |
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/> |
| 225 |
<arg type="h" name="target" direction="in"/> |
| 226 |
<arg type="h" name="requester" direction="in"/> |
| 227 |
<arg type="i" name="result" direction="out"/> |
| 228 |
</method> |
| 229 |
|
| 230 |
<!-- |
| 231 |
Active: |
| 232 |
|
| 233 |
Whether any pid on the system has enabled Game Mode. |
| 234 |
--> |
| 235 |
<property name="Active" type="b" access="read"/> |
| 236 |
|
| 237 |
<property name="version" type="u" access="read"/> |
| 238 |
</interface> |
| 239 |
</node> |