Debian Codegraph @

src/screenshot.c

raw symbols SCIP
1 /*
2 * Copyright © 2016 Red Hat, Inc
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
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 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authors:
20 * Matthias Clasen <[email protected]>
21 */
22
23 #include "config.h"cxx . . $ `<file>/build/config.h`/
24
25 #include <stdio.h>
26 #include <string.h>
27 #include <errno.h>
28
29 #include <sys/types.h>
30 #include <sys/stat.h>
31 #include <fcntl.h>
32
33 #include <glib/gi18n.h>
34 #include <gio/gio.h>
35 #include <gio/gdesktopappinfo.h>
36
37 #include "screenshot.h"cxx . . $ `<file>/src/screenshot.h`/
38 #include "xdp-permissions.h"cxx . . $ `<file>/src/xdp-permissions.h`/
39 #include "xdp-request.h"cxx . . $ `<file>/src/xdp-request.h`/
40 #include "xdp-documents.h"cxx . . $ `<file>/src/xdp-documents.h`/
41 #include "xdp-dbus.h"cxx . . $ `<file>/build/src/xdp-dbus.h`/
42 #include "xdp-impl-dbus.h"cxx . . $ `<file>/build/src/xdp-impl-dbus.h`/
43 #include "xdp-utils.h"cxx . . $ `<file>/src/xdp-utils.h`/
44
45 #define PERMISSION_TABLEcxx . . $ `src/screenshot.c:45:9`! "screenshot"
46 #define PERMISSION_IDcxx . . $ `src/screenshot.c:46:9`! "screenshot"
47
48 typedef struct _Screenshotcxx . . $ _Screenshot# Screenshotcxx . . $ Screenshot#;
49 typedef struct _ScreenshotClasscxx . . $ _ScreenshotClass# ScreenshotClasscxx . . $ ScreenshotClass#;
50
51 struct _Screenshotcxx . . $ _Screenshot#
52 {
53 XdpDbusScreenshotSkeletoncxx . . $ XdpDbusScreenshotSkeleton# parent_instancecxx . . $ _Screenshot#parent_instance.;
54 };
55
56 struct _ScreenshotClasscxx . . $ _ScreenshotClass#
57 {
58 XdpDbusScreenshotSkeletonClasscxx . . $ XdpDbusScreenshotSkeletonClass# parent_classcxx . . $ _ScreenshotClass#parent_class.;
59 };
60
61 static XdpDbusImplScreenshotcxx . . $ XdpDbusImplScreenshot# *implcxx . . $ impl.;
62 static XdpDbusImplAccesscxx . . $ XdpDbusImplAccess# *access_implcxx . . $ access_impl.;
63 static guint32cxx . . $ guint32# impl_versioncxx . . $ impl_version.;
64 static Screenshotcxx . . $ Screenshot# *screenshotcxx . . $ screenshot.;
65
66 GTypecxx . . $ GType# screenshot_get_typecxx . . $ screenshot_get_type(f708dce9a8856c70). (void) G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!;
67 static void screenshot_iface_initcxx . . $ screenshot_iface_init(a989a243c4aad2bc). (XdpDbusScreenshotIfacecxx . . $ XdpDbusScreenshotIface# *iface);
68
69 G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (Screenshot, screenshot, XDP_DBUS_TYPE_SCREENSHOT_SKELETONcxx . . $ `build/src/xdp-dbus.h:7378:9`!,
70 G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (XDP_DBUS_TYPE_SCREENSHOTcxx . . $ `build/src/xdp-dbus.h:7201:9`!,
71 screenshot_iface_init));
72
73 static void
74 send_responsecxx . . $ send_response(9511a0e0d3f58956). (XdpRequestcxx . . $ XdpRequest# *request,
75 guintcxx . . $ guint# response,
76 GVariantcxx . . $ GVariant# *results)
77 {
78 if (request->exportedcxx . . $ _XdpRequest#exported.)
79 {
80 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("sending response: %d", response);
81 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6732:9`! (request), response, results);
82 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
83 }
84 else
85 {
86 g_variant_ref_sinkcxx . . $ g_variant_ref_sink(3606eab35379b54a). (results);
87 g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84). (results);
88 }
89 }
90
91 static void
92 send_response_in_thread_funccxx . . $ send_response_in_thread_func(4704ff26353eb8ae). (GTaskcxx . . $ GTask# *task,
93 gpointercxx . . $ gpointer# source_object,
94 gpointercxx . . $ gpointer# task_data,
95 GCancellablecxx . . $ GCancellable# *cancellable)
96 {
97 XdpRequestcxx . . $ XdpRequest# *request = task_data;
98 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) results =
99 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
100 guintcxx . . $ guint# response;
101 GVariantcxx . . $ GVariant# *options;
102 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
103 const char *retval;
104
105 REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:103:9`! (request);
106
107 response = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "response"));
108 options = (GVariantcxx . . $ GVariant# *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options");
109
110 if (response != 0)
111 goto out;
112
113 retval = g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (task), "retval");
114 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (retval, "url") == 0)
115 {
116 const char *uri;
117 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *ruri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
118
119 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "uri", "&s", &uri))
120 {
121 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("No URI was provided");
122 goto out;
123 }
124
125 if (xdp_app_info_is_hostcxx . . $ xdp_app_info_is_host(ac6b23a20a03546d). (request->app_infocxx . . $ _XdpRequest#app_info.))
126 ruri = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (uri);
127 else
128 ruri = xdp_register_documentcxx . . $ xdp_register_document(e16c043bff209580). (uri, xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.), XDP_DOCUMENT_FLAG_DELETABLEcxx . . $ XDP_DOCUMENT_FLAG_DELETABLE., &error);
129
130 if (ruri == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
131 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to register %s: %s", uri, error->message);
132 else
133 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&results, "{&sv}", "uri", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (ruri));
134 }
135 else if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (retval, "color") == 0)
136 {
137 double red, green, blue;
138
139 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "color", "(ddd)", &red, &green, &blue))
140 {
141 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("No color was provided");
142 goto out;
143 }
144
145 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&results, "{&sv}", "color", g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(ddd)", red, green, blue));
146 }
147 else
148 {
149 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Don't know what to return");
150 }
151
152 out:
153 send_responsecxx . . $ send_response(9511a0e0d3f58956). (request, response, g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&results));
154 }
155
156 static void
157 screenshot_donecxx . . $ screenshot_done(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
158 GAsyncResultcxx . . $ GAsyncResult# *result,
159 gpointercxx . . $ gpointer# data)
160 {
161 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpRequest) request = data;
162 guintcxx . . $ guint# response = 2;
163 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) options = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
164 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
165 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
166
167 if (!xdp_dbus_impl_screenshot_call_screenshot_finishcxx . . $ xdp_dbus_impl_screenshot_call_screenshot_finish(3fb82aff02c0d5e5). (XDP_DBUS_IMPL_SCREENSHOTcxx . . $ `build/src/xdp-impl-dbus.h:5178:9`! (source),
168 &response,
169 &options,
170 result,
171 &error))
172 {
173 g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error);
174 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("A backend call failed: %s", error->message);
175 }
176
177 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "response", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (response));
178 if (options)
179 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options", g_variant_refcxx . . $ g_variant_ref(3606eab35379b54a). (options), (GDestroyNotifycxx . . $ GDestroyNotify#)g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84).);
180
181 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
182 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
183 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (task), "retval", "url");
184 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, send_response_in_thread_funccxx . . $ send_response_in_thread_func(4704ff26353eb8ae).);
185 }
186
187 static XdpOptionKeycxx . . $ XdpOptionKey# screenshot_optionscxx . . $ screenshot_options.[] = {
188 { "modal", G_VARIANT_TYPE_BOOLEANcxx . . $ `<external>/14064154155447831270/gvarianttype.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
189 { "interactive", G_VARIANT_TYPE_BOOLEANcxx . . $ `<external>/14064154155447831270/gvarianttype.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }
190 };
191
192 static void
193 handle_screenshot_in_thread_funccxx . . $ handle_screenshot_in_thread_func(4704ff26353eb8ae). (GTaskcxx . . $ GTask# *task,
194 gpointercxx . . $ gpointer# source_object,
195 gpointercxx . . $ gpointer# task_data,
196 GCancellablecxx . . $ GCancellable# *cancellable)
197 {
198 XdpRequestcxx . . $ XdpRequest# *request = XDP_REQUESTcxx . . $ XDP_REQUEST(e3ad50a9247c4f2e). (task_data);
199 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
200 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpDbusImplRequest) impl_request = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
201 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) opt_builder =
202 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
203 XdpPermissioncxx . . $ XdpPermission# permission;
204 GVariantcxx . . $ GVariant# *options;
205 gbooleancxx . . $ gboolean# permission_store_checked = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
206 gbooleancxx . . $ gboolean# interactive;
207 gbooleancxx . . $ gboolean# modal;
208 const char *parent_window;
209 const char *app_id;
210
211 REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:103:9`! (request);
212
213 app_id = xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.);
214 parent_window = ((const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window"));
215 options = ((GVariantcxx . . $ GVariant# *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options"));
216
217 if (xdp_dbus_impl_screenshot_get_versioncxx . . $ xdp_dbus_impl_screenshot_get_version(d29ba791510407d4). (implcxx . . $ impl.) < 2)
218 goto query_impl;
219
220 permission = xdp_get_permission_synccxx . . $ xdp_get_permission_sync(ebdf098f7b403ac8). (app_id, PERMISSION_TABLEcxx . . $ `src/screenshot.c:45:9`!, PERMISSION_IDcxx . . $ `src/screenshot.c:46:9`!);
221
222 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "interactive", "b", &interactive))
223 interactive = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
224
225 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "modal", "b", &modal))
226 modal = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
227
228 if (!interactive && permission != XDP_PERMISSION_YEScxx . . $ XDP_PERMISSION_YES.)
229 {
230 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) access_results = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
231 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) access_opt_builder =
232 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
233 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *subtitle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
234 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *title = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
235 const gcharcxx . . $ gchar# *body;
236 guintcxx . . $ guint# access_response = 2;
237
238 if (permission == XDP_PERMISSION_NOcxx . . $ XDP_PERMISSION_NO.)
239 {
240 send_responsecxx . . $ send_response(9511a0e0d3f58956). (request, 2, g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder));
241 return;
242 }
243
244 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&access_opt_builder, "{sv}",
245 "deny_label", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Deny")));
246 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&access_opt_builder, "{sv}",
247 "grant_label", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Allow")));
248 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&access_opt_builder, "{sv}",
249 "icon", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). ("applets-screenshooter-symbolic"));
250 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&access_opt_builder, "{sv}",
251 "modal", g_variant_new_booleancxx . . $ g_variant_new_boolean(d662e1c280be90d3). (modal));
252
253 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (app_id, "") != 0)
254 {
255 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDesktopAppInfo) info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
256 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
257 const gcharcxx . . $ gchar# *name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
258
259 id = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). (app_id, ".desktop", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
260 info = g_desktop_app_info_newcxx . . $ g_desktop_app_info_new(eecce1e92d8304e9). (id);
261
262 if (info)
263 name = g_app_info_get_display_namecxx . . $ g_app_info_get_display_name(946cbaa9210a41). (G_APP_INFOcxx . . $ `<external>/6793221688627496808/gappinfo.h:35:9`! (info));
264 else
265 name = app_id;
266
267 title = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Allow %s to Take Screenshots?"), name);
268 subtitle = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("%s wants to be able to take screenshots at any time."), name);
269 }
270 else
271 {
272 /* Note: this will set the wallpaper permission for all unsandboxed
273 * apps for which an app ID can't be determined.
274 */
275 g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (xdp_app_info_is_host (request->app_info));
276 title = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Allow Applications to Take Screenshots?"));
277 subtitle = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (_cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("An application wants to be able to take screenshots at any time."));
278 }
279
280 body = _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("This permission can be changed at any time from the privacy settings.");
281
282 if (!xdp_dbus_impl_access_call_access_dialog_synccxx . . $ xdp_dbus_impl_access_call_access_dialog_sync(434f1c6fac184201). (access_implcxx . . $ access_impl.,
283 request->idcxx . . $ _XdpRequest#id.,
284 app_id,
285 parent_window,
286 title,
287 subtitle,
288 body,
289 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&access_opt_builder),
290 &access_response,
291 &access_results,
292 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
293 &error))
294 {
295 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to show access dialog: %s", error->message);
296 send_responsecxx . . $ send_response(9511a0e0d3f58956). (request, 2, g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder));
297 return;
298 }
299
300 if (permission == XDP_PERMISSION_UNSETcxx . . $ XDP_PERMISSION_UNSET.)
301 xdp_set_permission_synccxx . . $ xdp_set_permission_sync(25a2d507ac2781bd). (app_id, PERMISSION_TABLEcxx . . $ `src/screenshot.c:45:9`!, PERMISSION_IDcxx . . $ `src/screenshot.c:46:9`!, access_response == 0 ? XDP_PERMISSION_YEScxx . . $ XDP_PERMISSION_YES. : XDP_PERMISSION_NOcxx . . $ XDP_PERMISSION_NO.);
302
303 if (access_response != 0)
304 {
305 send_responsecxx . . $ send_response(9511a0e0d3f58956). (request, 2, g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder));
306 return;
307 }
308 }
309
310 permission_store_checked = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
311
312 query_impl:
313
314 impl_request =
315 xdp_dbus_impl_request_proxy_new_synccxx . . $ xdp_dbus_impl_request_proxy_new_sync(b36c38a372f8f089). (g_dbus_proxy_get_connectioncxx . . $ g_dbus_proxy_get_connection(fd0690ce15ac5ecf). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)),
316 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIEScxx . . $ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES.,
317 g_dbus_proxy_get_namecxx . . $ g_dbus_proxy_get_name(c2c3b8a4da378b0d). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)),
318 request->idcxx . . $ _XdpRequest#id.,
319 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error);
320 if (!impl_request)
321 {
322 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to to create screenshot implementation proxy: %s", error->message);
323 send_responsecxx . . $ send_response(9511a0e0d3f58956). (request, 2, g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder));
324 return;
325 }
326
327 xdp_request_set_impl_requestcxx . . $ xdp_request_set_impl_request(18bd0ab3b325ada4). (request, impl_request);
328
329 xdp_filter_optionscxx . . $ xdp_filter_options(d63f67045969ba55). (options, &opt_builder,
330 screenshot_optionscxx . . $ screenshot_options., G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (screenshot_options),
331 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
332 if (permission_store_checked)
333 {
334 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opt_builder, "{sv}", "permission_store_checked",
335 g_variant_new_booleancxx . . $ g_variant_new_boolean(d662e1c280be90d3). (TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!));
336 }
337
338 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Calling Screenshot with interactive=%d", interactive);
339 xdp_dbus_impl_screenshot_call_screenshotcxx . . $ xdp_dbus_impl_screenshot_call_screenshot(37fa477994aae43d). (implcxx . . $ impl.,
340 request->idcxx . . $ _XdpRequest#id.,
341 app_id,
342 parent_window,
343 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder),
344 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
345 screenshot_donecxx . . $ screenshot_done(aa1d200d824d915d).,
346 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request));
347
348 }
349
350 static gbooleancxx . . $ gboolean#
351 handle_screenshotcxx . . $ handle_screenshot(280f3a84b8fb2a3f). (XdpDbusScreenshotcxx . . $ XdpDbusScreenshot# *object,
352 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
353 const gcharcxx . . $ gchar# *arg_parent_window,
354 GVariantcxx . . $ GVariant# *arg_options)
355 {
356 XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation);
357 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
358
359 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Handle Screenshot");
360
361 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg_parent_window), g_freecxx . . $ g_free(5d22bdacc48458e8).);
362 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request),
363 "options",
364 g_variant_refcxx . . $ g_variant_ref(3606eab35379b54a). (arg_options),
365 (GDestroyNotifycxx . . $ GDestroyNotify#)g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84).);
366
367 xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation));
368 xdp_dbus_screenshot_complete_screenshotcxx . . $ xdp_dbus_screenshot_complete_screenshot(920a84f3212931c4). (object, invocation, request->idcxx . . $ _XdpRequest#id.);
369
370 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (object, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
371 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
372 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, handle_screenshot_in_thread_funccxx . . $ handle_screenshot_in_thread_func(4704ff26353eb8ae).);
373
374 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
375 }
376
377 static void
378 pick_color_donecxx . . $ pick_color_done(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
379 GAsyncResultcxx . . $ GAsyncResult# *result,
380 gpointercxx . . $ gpointer# data)
381 {
382 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpRequest) request = data;
383 guintcxx . . $ guint# response = 2;
384 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) options = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
385 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
386 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
387
388 if (!xdp_dbus_impl_screenshot_call_pick_color_finishcxx . . $ xdp_dbus_impl_screenshot_call_pick_color_finish(3fb82aff02c0d5e5). (XDP_DBUS_IMPL_SCREENSHOTcxx . . $ `build/src/xdp-impl-dbus.h:5178:9`! (source),
389 &response,
390 &options,
391 result,
392 &error))
393 {
394 g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error);
395 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("A backend call failed: %s", error->message);
396 }
397
398 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "response", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (response));
399 if (options)
400 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options", g_variant_refcxx . . $ g_variant_ref(3606eab35379b54a). (options), (GDestroyNotifycxx . . $ GDestroyNotify#)g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84).);
401
402 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
403 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
404 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (task), "retval", "color");
405 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, send_response_in_thread_funccxx . . $ send_response_in_thread_func(4704ff26353eb8ae).);
406 }
407
408 static XdpOptionKeycxx . . $ XdpOptionKey# pick_color_optionscxx . . $ pick_color_options.[] = {
409 };
410
411 static gbooleancxx . . $ gboolean#
412 handle_pick_colorcxx . . $ handle_pick_color(280f3a84b8fb2a3f). (XdpDbusScreenshotcxx . . $ XdpDbusScreenshot# *object,
413 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
414 const gcharcxx . . $ gchar# *arg_parent_window,
415 GVariantcxx . . $ GVariant# *arg_options)
416 {
417 XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation);
418 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
419 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpDbusImplRequest) impl_request = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
420 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) opt_builder =
421 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
422
423 REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:103:9`! (request);
424
425 impl_request =
426 xdp_dbus_impl_request_proxy_new_synccxx . . $ xdp_dbus_impl_request_proxy_new_sync(b36c38a372f8f089). (g_dbus_proxy_get_connectioncxx . . $ g_dbus_proxy_get_connection(fd0690ce15ac5ecf). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)),
427 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIEScxx . . $ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES.,
428 g_dbus_proxy_get_namecxx . . $ g_dbus_proxy_get_name(c2c3b8a4da378b0d). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)),
429 request->idcxx . . $ _XdpRequest#id.,
430 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error);
431 if (!impl_request)
432 {
433 g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error);
434 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
435 }
436
437 xdp_request_set_impl_requestcxx . . $ xdp_request_set_impl_request(18bd0ab3b325ada4). (request, impl_request);
438 xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation));
439
440 xdp_filter_optionscxx . . $ xdp_filter_options(d63f67045969ba55). (arg_options, &opt_builder,
441 pick_color_optionscxx . . $ pick_color_options., G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (pick_color_options),
442 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
443
444 xdp_dbus_impl_screenshot_call_pick_colorcxx . . $ xdp_dbus_impl_screenshot_call_pick_color(37fa477994aae43d). (implcxx . . $ impl.,
445 request->idcxx . . $ _XdpRequest#id.,
446 xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.),
447 arg_parent_window,
448 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder),
449 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
450 pick_color_donecxx . . $ pick_color_done(aa1d200d824d915d).,
451 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request));
452
453 xdp_dbus_screenshot_complete_pick_colorcxx . . $ xdp_dbus_screenshot_complete_pick_color(920a84f3212931c4). (object, invocation, request->idcxx . . $ _XdpRequest#id.);
454
455 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
456 }
457
458 static void
459 screenshot_iface_initcxx . . $ screenshot_iface_init(a989a243c4aad2bc). (XdpDbusScreenshotIfacecxx . . $ XdpDbusScreenshotIface# *iface)
460 {
461 iface->handle_screenshotcxx . . $ _XdpDbusScreenshotIface#handle_screenshot. = handle_screenshotcxx . . $ handle_screenshot(280f3a84b8fb2a3f).;
462 iface->handle_pick_colorcxx . . $ _XdpDbusScreenshotIface#handle_pick_color. = handle_pick_colorcxx . . $ handle_pick_color(280f3a84b8fb2a3f).;
463 }
464
465 static void
466 screenshot_initcxx . . $ screenshot_init(6de3a289389bd6dd). (Screenshotcxx . . $ Screenshot# *screenshot)
467 {
468 /* Before there was a version property, the version was hardcoded to 2, so
469 * make sure we retain that behaviour */
470 impl_versioncxx . . $ impl_version. = 2;
471 xdp_dbus_screenshot_set_versioncxx . . $ xdp_dbus_screenshot_set_version(657567683a8d7b74). (XDP_DBUS_SCREENSHOTcxx . . $ `build/src/xdp-dbus.h:7202:9`! (screenshot),
472 impl_versioncxx . . $ impl_version.);
473 }
474
475 static void
476 screenshot_class_initcxx . . $ screenshot_class_init(23ce98f9110823f7). (ScreenshotClasscxx . . $ ScreenshotClass# *klass)
477 {
478 }
479
480 GDBusInterfaceSkeletoncxx . . $ GDBusInterfaceSkeleton# *
481 screenshot_createcxx . . $ screenshot_create(62a3b994be72c646). (GDBusConnectioncxx . . $ GDBusConnection# *connection,
482 const char *dbus_name_access,
483 const char *dbus_name_screenshot)
484 {
485 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
486 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) version = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
487
488 implcxx . . $ impl. = xdp_dbus_impl_screenshot_proxy_new_synccxx . . $ xdp_dbus_impl_screenshot_proxy_new_sync(23a6e20181dbb532). (connection,
489 G_DBUS_PROXY_FLAGS_NONEcxx . . $ G_DBUS_PROXY_FLAGS_NONE.,
490 dbus_name_screenshot,
491 DESKTOP_PORTAL_OBJECT_PATHcxx . . $ `src/xdp-utils.h:37:9`!,
492 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
493 &error);
494 if (implcxx . . $ impl. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
495 {
496 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to create screenshot proxy: %s", error->message);
497 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
498 }
499
500 g_dbus_proxy_set_default_timeoutcxx . . $ g_dbus_proxy_set_default_timeout(c68bf28eca88e1d4). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl), G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!);
501
502 /* Set the version if supported; otherwise fallback to hardcoded version 2 */
503 version = g_dbus_proxy_get_cached_propertycxx . . $ g_dbus_proxy_get_cached_property(2997765c05144dbe). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl), "version");
504 impl_versioncxx . . $ impl_version. = (version != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ? g_variant_get_uint32cxx . . $ g_variant_get_uint32(59fb6aaaf011986f). (version) : 2;
505
506 screenshotcxx . . $ screenshot. = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (screenshot_get_typecxx . . $ screenshot_get_type(f708dce9a8856c70). (), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
507
508 access_implcxx . . $ access_impl. = xdp_dbus_impl_access_proxy_new_synccxx . . $ xdp_dbus_impl_access_proxy_new_sync(9e184c7775ccd278). (connection,
509 G_DBUS_PROXY_FLAGS_NONEcxx . . $ G_DBUS_PROXY_FLAGS_NONE.,
510 dbus_name_access,
511 DESKTOP_PORTAL_OBJECT_PATHcxx . . $ `src/xdp-utils.h:37:9`!,
512 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
513 &error);
514
515 return G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (screenshot);
516 }