Support XDG Desktop Portal as color picker provider

Wayland and XWayland fallback implementation uses XDP in
order to query picked color from desktop.
This commit is contained in:
2025-06-24 16:41:32 +03:00
parent d0b552d74a
commit 6d337464f7
46 changed files with 3636 additions and 14 deletions

View File

@@ -326,8 +326,11 @@ namespace FlaxEditor.GUI.Dialogs
// Update eye dropper tool
if (_activeEyedropper)
{
// Try reading the color under the cursor in realtime if supported by the platform
Float2 mousePosition = Platform.MousePosition;
SelectedColor = ScreenUtilities.GetColorAt(mousePosition);
Color color = ScreenUtilities.GetColorAt(mousePosition);
if (color != Color.Transparent)
SelectedColor = color;
}
}

View File

@@ -22,7 +22,7 @@ public:
/// Gets the pixel color at the specified coordinates.
/// </summary>
/// <param name="pos">Screen-space coordinate to read.</param>
/// <returns>Pixel color at the specified coordinates.</returns>
/// <returns>Pixel color at the specified coordinates, or transparent color when color couldn't be picked up.</returns>
API_FUNCTION() static Color32 GetColorAt(const Float2& pos)
{
return Color32::Transparent;

View File

@@ -7,12 +7,25 @@
#include "Engine/Core/Math/Vector2.h"
#include "Engine/Core/Delegate.h"
#include "Engine/Core/Log.h"
#include "Engine/Core/Math/Vector4.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Platform/Linux/LinuxPlatform.h"
#include "Engine/Platform/Linux/IncludeX11.h"
#include <libportal/portal-enums.h>
#include <libportal/screenshot.h>
Delegate<Color32> ScreenUtilitiesBase::PickColorDone;
namespace PortalImpl
{
XdpPortal* Portal = nullptr;
int64 MainLoopReady = 0;
gpointer GLibMainLoop(gpointer data);
void PickColorCallback(GObject* source, GAsyncResult* result, gpointer data);
}
Color32 LinuxScreenUtilities::GetColorAt(const Float2& pos)
{
X11::Display* display = (X11::Display*)Platform::GetXDisplay();
@@ -38,16 +51,11 @@ Color32 LinuxScreenUtilities::GetColorAt(const Float2& pos)
}
else
{
// XWayland doesn't support XGetImage...
// TODO: Fallback to Wayland implementation here?
return Color32::Black;
// XWayland doesn't support XGetImage
}
}
else
{
// TODO: Wayland
ASSERT(false);
}
return Color32::Transparent;
}
void OnScreenUtilsXEventCallback(void* eventPtr)
@@ -83,12 +91,68 @@ void LinuxScreenUtilities::PickColor()
X11::XFreeCursor(display, cursor);
LinuxPlatform::xEventReceived.Bind(OnScreenUtilsXEventCallback);
return;
}
else
if (PortalImpl::MainLoopReady == 0)
{
// TODO: Wayland
ASSERT(false);
// Initialize portal
GError* error = nullptr;
PortalImpl::Portal = xdp_portal_initable_new(&error);
if (error != nullptr)
{
PortalImpl::MainLoopReady = 2;
LOG(Error, "Failed to initialize XDP Portal");
return;
}
// Run the GLib main loop in other thread in order to process asynchronous callbacks
g_thread_new(nullptr, PortalImpl::GLibMainLoop, nullptr);
while (Platform::AtomicRead(&PortalImpl::MainLoopReady) != 1)
Platform::Sleep(1);
}
if (PortalImpl::Portal != nullptr)
{
// Enter color picking mode, the callback receives the final color
xdp_portal_pick_color(PortalImpl::Portal, nullptr, nullptr, PortalImpl::PickColorCallback, nullptr);
}
}
gpointer PortalImpl::GLibMainLoop(gpointer data)
{
GMainContext* mainContext = g_main_context_get_thread_default();
GMainLoop* mainLoop = g_main_loop_new(mainContext, false);
Platform::AtomicStore(&PortalImpl::MainLoopReady, 1);
g_main_loop_run(mainLoop);
g_main_loop_unref(mainLoop);
return nullptr;
}
void PortalImpl::PickColorCallback(GObject* source, GAsyncResult* result, gpointer data)
{
GError* error = nullptr;
GVariant* variant = xdp_portal_pick_color_finish(PortalImpl::Portal, result, &error);
if (error)
{
if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
LOG(Info, "XDP Portal pick color cancelled");
else
LOG(Error, "XDP Portal pick color failed: {}", String(error->message));
return;
}
// The color is stored in a triple double variant, extract the values
Double4 colorDouble;
g_variant_get(variant, "(ddd)", &colorDouble.X, &colorDouble.Y, &colorDouble.Z);
g_variant_unref(variant);
colorDouble.W = 1.0f;
Vector4 colorVector = colorDouble;
Color32 color = Color32(colorVector);
ScreenUtilities::PickColorDone(color);
}
#endif

View File

@@ -42,6 +42,9 @@ public class SDL : DepsModule
break;
case TargetPlatform.Linux:
options.OutputFiles.Add(Path.Combine(depsRoot, "libSDL3.a"));
options.PublicDependencies.Add("libportal");
break;
case TargetPlatform.Mac:
options.OutputFiles.Add(Path.Combine(depsRoot, "libSDL3.a"));
break;

165
Source/ThirdParty/libportal/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
typedef enum {
XDP_USER_INFORMATION_FLAG_NONE = 0
} XdpUserInformationFlags;
XDP_PUBLIC
void xdp_portal_get_user_information (XdpPortal *portal,
XdpParent *parent,
const char *reason,
XdpUserInformationFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant * xdp_portal_get_user_information_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpBackgroundFlags:
* @XDP_BACKGROUND_FLAG_NONE: No options
* @XDP_BACKGROUND_FLAG_AUTOSTART: Request autostart as well
* @XDP_BACKGROUND_FLAG_ACTIVATABLE: Whether the application is D-Bus-activatable
*
* Options to use when requesting background.
*/
typedef enum {
XDP_BACKGROUND_FLAG_NONE = 0,
XDP_BACKGROUND_FLAG_AUTOSTART = 1 << 0,
XDP_BACKGROUND_FLAG_ACTIVATABLE = 1 << 1
} XdpBackgroundFlags;
XDP_PUBLIC
void xdp_portal_request_background (XdpPortal *portal,
XdpParent *parent,
char *reason,
GPtrArray *commandline,
XdpBackgroundFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
XDP_PUBLIC
gboolean xdp_portal_request_background_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_set_background_status (XdpPortal *portal,
const char *status_message,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_set_background_status_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
XDP_PUBLIC
gboolean xdp_portal_is_camera_present (XdpPortal *portal);
typedef enum {
XDP_CAMERA_FLAG_NONE = 0
} XdpCameraFlags;
XDP_PUBLIC
void xdp_portal_access_camera (XdpPortal *portal,
XdpParent *parent,
XdpCameraFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_access_camera_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
int xdp_portal_open_pipewire_remote_for_camera (XdpPortal *portal);
G_END_DECLS

View File

@@ -0,0 +1,92 @@
/*
* Copyright (C) 2022, Matthew Leeds
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpLauncherType:
* @XDP_LAUNCHER_APPLICATION: a launcher for a regular application
* @XDP_LAUNCHER_WEBAPP: a launcher for a web app
*
* The type of a launcher.
*/
typedef enum {
XDP_LAUNCHER_APPLICATION = 1 << 0,
XDP_LAUNCHER_WEBAPP = 1 << 1
} XdpLauncherType;
XDP_PUBLIC
void xdp_portal_dynamic_launcher_prepare_install (XdpPortal *portal,
XdpParent *parent,
const char *name,
GVariant *icon_v,
XdpLauncherType launcher_type,
const char *target,
gboolean editable_name,
gboolean editable_icon,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant *xdp_portal_dynamic_launcher_prepare_install_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
char *xdp_portal_dynamic_launcher_request_install_token (XdpPortal *portal,
const char *name,
GVariant *icon_v,
GError **error);
XDP_PUBLIC
gboolean xdp_portal_dynamic_launcher_install (XdpPortal *portal,
const char *token,
const char *desktop_file_id,
const char *desktop_entry,
GError **error);
XDP_PUBLIC
gboolean xdp_portal_dynamic_launcher_uninstall (XdpPortal *portal,
const char *desktop_file_id,
GError **error);
XDP_PUBLIC
char *xdp_portal_dynamic_launcher_get_desktop_entry (XdpPortal *portal,
const char *desktop_file_id,
GError **error);
XDP_PUBLIC
GVariant *xdp_portal_dynamic_launcher_get_icon (XdpPortal *portal,
const char *desktop_file_id,
char **out_icon_format,
guint *out_icon_size,
GError **error);
XDP_PUBLIC
gboolean xdp_portal_dynamic_launcher_launch (XdpPortal *portal,
const char *desktop_file_id,
const char *activation_token,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
typedef enum {
XDP_EMAIL_FLAG_NONE = 0
} XdpEmailFlags;
XDP_PUBLIC
void xdp_portal_compose_email (XdpPortal *portal,
XdpParent *parent,
const char *const *addresses,
const char *const *cc,
const char *const *bcc,
const char *subject,
const char *body,
const char *const *attachments,
XdpEmailFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_compose_email_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,97 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpOpenFileFlags:
* @XDP_OPEN_FILE_FLAG_NONE: No options
* @XDP_OPEN_FILE_FLAG_MULTIPLE: Allow selecting multiple files
*
* Options for opening files.
*/
typedef enum {
XDP_OPEN_FILE_FLAG_NONE = 0,
XDP_OPEN_FILE_FLAG_MULTIPLE = 1 << 0,
} XdpOpenFileFlags;
XDP_PUBLIC
void xdp_portal_open_file (XdpPortal *portal,
XdpParent *parent,
const char *title,
GVariant *filters,
GVariant *current_filter,
GVariant *choices,
XdpOpenFileFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant *xdp_portal_open_file_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
typedef enum {
XDP_SAVE_FILE_FLAG_NONE = 0
} XdpSaveFileFlags;
XDP_PUBLIC
void xdp_portal_save_file (XdpPortal *portal,
XdpParent *parent,
const char *title,
const char *current_name,
const char *current_folder,
const char *current_file,
GVariant *filters,
GVariant *current_filter,
GVariant *choices,
XdpSaveFileFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant *xdp_portal_save_file_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_save_files (XdpPortal *portal,
XdpParent *parent,
const char *title,
const char *current_name,
const char *current_folder,
GVariant *files,
GVariant *choices,
XdpSaveFileFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant *xdp_portal_save_files_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,81 @@
/*
* Copyright © 2024 GNOME Foundation Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <errno.h>
#include <glib/gstdio.h>
#if !GLIB_CHECK_VERSION(2, 76, 0)
static inline gboolean
g_clear_fd (int *fd_ptr,
GError **error)
{
int fd = *fd_ptr;
*fd_ptr = -1;
if (fd < 0)
return TRUE;
/* Suppress "Not available before" warning */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return g_close (fd, error);
G_GNUC_END_IGNORE_DEPRECATIONS
}
static inline void
_g_clear_fd_ignore_error (int *fd_ptr)
{
/* Don't overwrite thread-local errno if closing the fd fails */
int errsv = errno;
/* Suppress "Not available before" warning */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!g_clear_fd (fd_ptr, NULL))
{
/* Do nothing: we ignore all errors, except for EBADF which
* is a programming error, checked for by g_close(). */
}
G_GNUC_END_IGNORE_DEPRECATIONS
errno = errsv;
}
#define g_autofd __attribute__((cleanup(_g_clear_fd_ignore_error)))
#endif
#if !GLIB_CHECK_VERSION(2, 84, 0)
static inline unsigned int
backport_steal_handle_id (unsigned int *handle_pointer)
{
unsigned int handle;
handle = *handle_pointer;
*handle_pointer = 0;
return handle;
}
#define g_steal_handle_id(hp) backport_steal_handle_id (hp)
#endif

View File

@@ -0,0 +1,100 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpInhibitFlags:
* @XDP_INHIBIT_FLAG_LOGOUT: Inhibit logout
* @XDP_INHIBIT_FLAG_USER_SWITCH: Inhibit user switching
* @XDP_INHIBIT_FLAG_SUSPEND: Inhibit suspend
* @XDP_INHIBIT_FLAG_IDLE: Inhibit the session going idle
*
* Flags that determine what session status changes are inhibited.
*/
typedef enum {
XDP_INHIBIT_FLAG_LOGOUT = 1 << 0,
XDP_INHIBIT_FLAG_USER_SWITCH = 1 << 1,
XDP_INHIBIT_FLAG_SUSPEND = 1 << 2,
XDP_INHIBIT_FLAG_IDLE = 1 << 3
} XdpInhibitFlags;
XDP_PUBLIC
void xdp_portal_session_inhibit (XdpPortal *portal,
XdpParent *parent,
const char *reason,
XdpInhibitFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
int xdp_portal_session_inhibit_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_session_uninhibit (XdpPortal *portal,
int id);
/**
* XdpLoginSessionState:
* @XDP_LOGIN_SESSION_RUNNING: the session is running
* @XDP_LOGIN_SESSION_QUERY_END: the session is in the query end phase,
* during which applications can save their state or inhibit the
* session from ending
* @XDP_LOGIN_SESSION_ENDING: the session is about to end
*
* The values of this enum are returned in the [signal@Portal::session-state-changed] signal
* to indicate the current state of the user session.
*/
typedef enum {
XDP_LOGIN_SESSION_RUNNING = 1,
XDP_LOGIN_SESSION_QUERY_END = 2,
XDP_LOGIN_SESSION_ENDING = 3,
} XdpLoginSessionState;
typedef enum {
XDP_SESSION_MONITOR_FLAG_NONE = 0
} XdpSessionMonitorFlags;
XDP_PUBLIC
void xdp_portal_session_monitor_start (XdpPortal *portal,
XdpParent *parent,
XdpSessionMonitorFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_session_monitor_start_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_session_monitor_stop (XdpPortal *portal);
XDP_PUBLIC
void xdp_portal_session_monitor_query_end_response (XdpPortal *portal);
G_END_DECLS

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022, Red Hat, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal-helpers.h>
G_BEGIN_DECLS
#define XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER (xdp_input_capture_pointer_barrier_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpInputCapturePointerBarrier, xdp_input_capture_pointer_barrier, XDP, INPUT_CAPTURE_POINTER_BARRIER, GObject)
G_END_DECLS

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2022, Red Hat, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include "inputcapture-pointerbarrier.h"
#include "inputcapture-zone.h"
guint
_xdp_input_capture_pointer_barrier_get_id (XdpInputCapturePointerBarrier *barrier);
void
_xdp_input_capture_pointer_barrier_set_is_active (XdpInputCapturePointerBarrier *barrier, gboolean active);
void
_xdp_input_capture_zone_invalidate_and_free (XdpInputCaptureZone *zone);

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022, Red Hat, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal-helpers.h>
G_BEGIN_DECLS
#define XDP_TYPE_INPUT_CAPTURE_ZONE (xdp_input_capture_zone_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpInputCaptureZone, xdp_input_capture_zone, XDP, INPUT_CAPTURE_ZONE, GObject)
G_END_DECLS

View File

@@ -0,0 +1,103 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal-helpers.h>
#include <libportal/session.h>
#include <libportal/inputcapture-zone.h>
#include <libportal/inputcapture-pointerbarrier.h>
#include <stdint.h>
G_BEGIN_DECLS
#define XDP_TYPE_INPUT_CAPTURE_SESSION (xdp_input_capture_session_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpInputCaptureSession, xdp_input_capture_session, XDP, INPUT_CAPTURE_SESSION, GObject)
/**
* XdpInputCapability:
* @XDP_INPUT_CAPABILITY_NONE: no device
* @XDP_INPUT_CAPABILITY_KEYBOARD: capture the keyboard
* @XDP_INPUT_CAPABILITY_POINTER: capture pointer events
* @XDP_INPUT_CAPABILITY_TOUCHSCREEN: capture touchscreen events
*
* Flags to specify what input device capabilities should be captured
*/
typedef enum {
XDP_INPUT_CAPABILITY_NONE = 0,
XDP_INPUT_CAPABILITY_KEYBOARD = 1 << 0,
XDP_INPUT_CAPABILITY_POINTER = 1 << 1,
XDP_INPUT_CAPABILITY_TOUCHSCREEN = 1 << 2
} XdpInputCapability;
XDP_PUBLIC
void xdp_portal_create_input_capture_session (XdpPortal *portal,
XdpParent *parent,
XdpInputCapability capabilities,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
XdpInputCaptureSession * xdp_portal_create_input_capture_session_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
XdpSession *xdp_input_capture_session_get_session (XdpInputCaptureSession *session);
XDP_PUBLIC
GList * xdp_input_capture_session_get_zones (XdpInputCaptureSession *session);
XDP_PUBLIC
void xdp_input_capture_session_set_pointer_barriers (XdpInputCaptureSession *session,
GList *barriers,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GList * xdp_input_capture_session_set_pointer_barriers_finish (XdpInputCaptureSession *session,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_input_capture_session_enable (XdpInputCaptureSession *session);
XDP_PUBLIC
void xdp_input_capture_session_disable (XdpInputCaptureSession *session);
XDP_PUBLIC
void xdp_input_capture_session_release_at (XdpInputCaptureSession *session,
guint activation_id,
gdouble cursor_x_position,
gdouble cursor_y_position);
XDP_PUBLIC
void xdp_input_capture_session_release (XdpInputCaptureSession *session,
guint activation_id);
XDP_PUBLIC
int xdp_input_capture_session_connect_to_eis (XdpInputCaptureSession *session,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,70 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpLocationAccuracy:
* @XDP_LOCATION_ACCURACY_NONE: No particular accuracy
* @XDP_LOCATION_ACCURACY_COUNTRY: Country-level accuracy
* @XDP_LOCATION_ACCURACY_CITY: City-level accuracy
* @XDP_LOCATION_ACCURACY_NEIGHBORHOOD: Neighborhood-level accuracy
* @XDP_LOCATION_ACCURACY_STREET: Street-level accuracy
* @XDP_LOCATION_ACCURACY_EXACT: Maximum accuracy
*
* The values of this enum indicate the desired level
* of accuracy for location information.
*/
typedef enum {
XDP_LOCATION_ACCURACY_NONE,
XDP_LOCATION_ACCURACY_COUNTRY,
XDP_LOCATION_ACCURACY_CITY,
XDP_LOCATION_ACCURACY_NEIGHBORHOOD,
XDP_LOCATION_ACCURACY_STREET,
XDP_LOCATION_ACCURACY_EXACT
} XdpLocationAccuracy;
typedef enum {
XDP_LOCATION_MONITOR_FLAG_NONE = 0
} XdpLocationMonitorFlags;
XDP_PUBLIC
void xdp_portal_location_monitor_start (XdpPortal *portal,
XdpParent *parent,
guint distance_threshold,
guint time_threshold,
XdpLocationAccuracy accuracy,
XdpLocationMonitorFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_location_monitor_start_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_location_monitor_stop (XdpPortal *portal);
G_END_DECLS

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
typedef enum {
XDP_NOTIFICATION_FLAG_NONE = 0
} XdpNotificationFlags;
XDP_PUBLIC
void xdp_portal_add_notification (XdpPortal *portal,
const char *id,
GVariant *notification,
XdpNotificationFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_add_notification_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_remove_notification (XdpPortal *portal,
const char *id);
XDP_PUBLIC
GVariant *xdp_portal_get_supported_notification_options (XdpPortal *portal,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpOpenUriFlags:
* @XDP_OPEN_URI_FLAG_NONE: No options
* @XDP_OPEN_URI_FLAG_ASK: Use an application chooser for the given uri
* @XDP_OPEN_URI_FLAG_WRITABLE: Allow writing to file (if uri points to a local file that is exported in the document portal and app is sandboxed itself)
*
* Options for opening uris.
*/
typedef enum {
XDP_OPEN_URI_FLAG_NONE = 0,
XDP_OPEN_URI_FLAG_ASK = 1 << 0,
XDP_OPEN_URI_FLAG_WRITABLE = 1 << 1
} XdpOpenUriFlags;
XDP_PUBLIC
void xdp_portal_open_uri (XdpPortal *portal,
XdpParent *parent,
const char *uri,
XdpOpenUriFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_open_uri_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_open_directory (XdpPortal *portal,
XdpParent *parent,
const char *uri,
XdpOpenUriFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_open_directory_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2021, Georges Basile Stavracas Neto
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include "parent.h"
G_BEGIN_DECLS
typedef void (* XdpParentExported) (XdpParent *parent,
const char *handle,
gpointer data);
typedef gboolean (* XdpParentExport) (XdpParent *parent,
XdpParentExported callback,
gpointer data);
typedef void (* XdpParentUnexport) (XdpParent *parent);
struct _XdpParent {
/*< private >*/
XdpParentExport parent_export;
XdpParentUnexport parent_unexport;
GObject *object;
XdpParentExported callback;
char *exported_handle;
gpointer data;
};
G_END_DECLS

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2021, Georges Basile Stavracas Neto
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
#define XDP_TYPE_PARENT (xdp_parent_get_type ())
XDP_PUBLIC
GType xdp_parent_get_type (void) G_GNUC_CONST;
XDP_PUBLIC
XdpParent *xdp_parent_copy (XdpParent *source);
XDP_PUBLIC
void xdp_parent_free (XdpParent *parent);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdpParent, xdp_parent_free)
G_END_DECLS

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION(3,96,0) || GTK_CHECK_VERSION(4,0,0)
#error "To use libportal with GTK4, include portal-gtk4.h"
#endif
G_BEGIN_DECLS
XDP_PUBLIC
XdpParent *xdp_parent_new_gtk (GtkWindow *window);
G_END_DECLS

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal.h>
#include <gtk/gtk.h>
#if !(GTK_CHECK_VERSION(3,96,0) || GTK_CHECK_VERSION(4,0,0))
#error "To use libportal with GTK3, include portal-gtk3.h"
#endif
G_BEGIN_DECLS
XDP_PUBLIC
XdpParent *xdp_parent_new_gtk (GtkWindow *window);
G_END_DECLS

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2018, Matthias Clasen
* Copyright (C) 2024 GNOME Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*
* Authors:
* Matthias Clasen
* Hubert Figuière <hub@figuiere.net>
*/
#pragma once
#include <gio/gio.h>
#include <libportal/types.h>
G_BEGIN_DECLS
#ifndef XDP_PUBLIC
#define XDP_PUBLIC extern
#endif
#define XDP_TYPE_PORTAL (xdp_portal_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpPortal, xdp_portal, XDP, PORTAL, GObject)
XDP_PUBLIC
XdpPortal *xdp_portal_new (void);
XDP_PUBLIC
XdpPortal *xdp_portal_initable_new (GError **error);
XDP_PUBLIC
gboolean xdp_portal_running_under_flatpak (void);
XDP_PUBLIC
gboolean xdp_portal_running_under_snap (GError **error);
XDP_PUBLIC
gboolean xdp_portal_running_under_sandbox (void);
XDP_PUBLIC
XdpSettings *xdp_portal_get_settings (XdpPortal *portal);
G_END_DECLS

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include "glib-backports.h"
#include "parent-private.h"
#include "portal-helpers.h"
struct _XdpPortal {
GObject parent_instance;
GError *init_error;
GDBusConnection *bus;
char *sender;
/* inhibit */
int next_inhibit_id;
GHashTable *inhibit_handles;
char *session_monitor_handle;
guint state_changed_signal;
/* spawn */
guint spawn_exited_signal;
/* updates */
char *update_monitor_handle;
guint update_available_signal;
guint update_progress_signal;
/* location */
char *location_monitor_handle;
guint location_updated_signal;
/* notification */
guint action_invoked_signal;
guint notification_interface_version;
GVariant *supported_notification_options;
/* screencast */
guint screencast_interface_version;
guint remote_desktop_interface_version;
/* background */
guint background_interface_version;
};
const char * portal_get_bus_name (void);
#define PORTAL_BUS_NAME (portal_get_bus_name ())
#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop"
#define REQUEST_PATH_PREFIX "/org/freedesktop/portal/desktop/request/"
#define SESSION_PATH_PREFIX "/org/freedesktop/portal/desktop/session/"
#define REQUEST_INTERFACE "org.freedesktop.portal.Request"
#define SESSION_INTERFACE "org.freedesktop.portal.Session"
#define SETTINGS_INTERFACE "org.freedesktop.portal.Settings"
#define FLATPAK_PORTAL_BUS_NAME "org.freedesktop.portal.Flatpak"
#define FLATPAK_PORTAL_OBJECT_PATH "/org/freedesktop/portal/Flatpak"
#define FLATPAK_PORTAL_INTERFACE "org.freedesktop.portal.Flatpak"

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2020-2022, Jan Grulich
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal.h>
#include <QMap>
#include <QStringList>
#include <QSharedPointer>
#include <QVariant>
#include <QWindow>
XDP_PUBLIC
XdpParent *xdp_parent_new_qt (QWindow *window);
namespace XdpQt {
// Returns a global instance of XdpPortal object and takes care
// of its deletion
XDP_PUBLIC
XdpPortal *globalPortalObject();
// Account portal helpers
struct GetUserInformationResult {
QString id;
QString name;
QString image;
};
XDP_PUBLIC
GetUserInformationResult getUserInformationResultFromGVariant(GVariant *variant);
// FileChooser portal helpers
enum FileChooserFilterRuleType{
Pattern = 0,
Mimetype = 1
};
struct FileChooserFilterRule {
FileChooserFilterRuleType type;
QString rule;
};
struct FileChooserFilter {
QString label;
QList<FileChooserFilterRule> rules;
};
struct FileChooserChoice {
QString id;
QString label;
QMap<QString, QString> options;
QString selected;
};
XDP_PUBLIC
GVariant *filechooserFilesToGVariant(const QStringList &files);
XDP_PUBLIC
GVariant *filechooserFilterToGVariant(const FileChooserFilter &filter);
XDP_PUBLIC
GVariant *filechooserFiltersToGVariant(const QList<FileChooserFilter> &filters);
XDP_PUBLIC
GVariant *filechooserChoicesToGVariant(const QList<FileChooserChoice> &choices);
struct FileChooserResult {
QMap<QString, QString> choices;
QStringList uris;
};
XDP_PUBLIC
FileChooserResult filechooserResultFromGVariant(GVariant *variant);
// Notification portal helpers
struct NotificationButton {
QString label;
QString action;
QVariant target;
};
struct Notification {
QString title;
QString body;
QString icon;
QPixmap pixmap;
QString priority;
QString defaultAction;
QVariant defaultTarget;
QList<NotificationButton> buttons;
};
XDP_PUBLIC
GVariant *notificationToGVariant(const Notification &notification);
XDP_PUBLIC
QVariant GVariantToQVariant(GVariant *variant);
} // namespace XdpQt

View File

@@ -0,0 +1,118 @@
/*
* Copyright (C) 2020-2022, Jan Grulich
* Copyright (C) 2023, Neal Gompa
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal.h>
#include <QMap>
#include <QStringList>
#include <QSharedPointer>
#include <QVariant>
#include <QWindow>
XDP_PUBLIC
XdpParent *xdp_parent_new_qt (QWindow *window);
namespace XdpQt {
// Returns a global instance of XdpPortal object and takes care
// of its deletion
XDP_PUBLIC
XdpPortal *globalPortalObject();
// Account portal helpers
struct GetUserInformationResult {
QString id;
QString name;
QString image;
};
XDP_PUBLIC
GetUserInformationResult getUserInformationResultFromGVariant(GVariant *variant);
// FileChooser portal helpers
enum FileChooserFilterRuleType{
Pattern = 0,
Mimetype = 1
};
struct FileChooserFilterRule {
FileChooserFilterRuleType type;
QString rule;
};
struct FileChooserFilter {
QString label;
QList<FileChooserFilterRule> rules;
};
struct FileChooserChoice {
QString id;
QString label;
QMap<QString, QString> options;
QString selected;
};
XDP_PUBLIC
GVariant *filechooserFilesToGVariant(const QStringList &files);
XDP_PUBLIC
GVariant *filechooserFilterToGVariant(const FileChooserFilter &filter);
XDP_PUBLIC
GVariant *filechooserFiltersToGVariant(const QList<FileChooserFilter> &filters);
XDP_PUBLIC
GVariant *filechooserChoicesToGVariant(const QList<FileChooserChoice> &choices);
struct FileChooserResult {
QMap<QString, QString> choices;
QStringList uris;
};
XDP_PUBLIC
FileChooserResult filechooserResultFromGVariant(GVariant *variant);
// Notification portal helpers
struct NotificationButton {
QString label;
QString action;
QVariant target;
};
struct Notification {
QString title;
QString body;
QString icon;
QPixmap pixmap;
QString priority;
QString defaultAction;
QVariant defaultTarget;
QList<NotificationButton> buttons;
};
XDP_PUBLIC
GVariant *notificationToGVariant(const Notification &notification);
XDP_PUBLIC
QVariant GVariantToQVariant(GVariant *variant);
} // namespace XdpQt

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/portal-enums.h>
#include <libportal/account.h>
#include <libportal/background.h>
#include <libportal/camera.h>
#include <libportal/dynamic-launcher.h>
#include <libportal/email.h>
#include <libportal/filechooser.h>
#include <libportal/inhibit.h>
#include <libportal/inputcapture.h>
#include <libportal/location.h>
#include <libportal/notification.h>
#include <libportal/openuri.h>
#include <libportal/parent.h>
#include <libportal/print.h>
#include <libportal/remote.h>
#include <libportal/screenshot.h>
#include <libportal/session.h>
#include <libportal/spawn.h>
#include <libportal/trash.h>
#include <libportal/types.h>
#include <libportal/updates.h>
#include <libportal/wallpaper.h>

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
typedef enum {
XDP_PRINT_FLAG_NONE = 0
} XdpPrintFlags;
XDP_PUBLIC
void xdp_portal_prepare_print (XdpPortal *portal,
XdpParent *parent,
const char *title,
GVariant *settings,
GVariant *page_setup,
XdpPrintFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant *xdp_portal_prepare_print_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_print_file (XdpPortal *portal,
XdpParent *parent,
const char *title,
guint token,
const char *file,
XdpPrintFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_print_file_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,293 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
#include <libportal/session.h>
G_BEGIN_DECLS
/**
* XdpSessionState:
* @XDP_SESSION_INITIAL: the session has not been started.
* @XDP_SESSION_ACTIVE: the session is active.
* @XDP_SESSION_CLOSED: the session is no longer active.
*
* The state of a session.
*/
typedef enum {
XDP_SESSION_INITIAL,
XDP_SESSION_ACTIVE,
XDP_SESSION_CLOSED
} XdpSessionState;
/**
* XdpOutputType:
* @XDP_OUTPUT_NONE: do not select any output
* @XDP_OUTPUT_MONITOR: allow selecting monitors
* @XDP_OUTPUT_WINDOW: allow selecting individual application windows
* @XDP_OUTPUT_VIRTUAL: allow creating new virtual displays
*
* Flags to specify what kind of sources to offer for a screencast session.
*/
typedef enum {
XDP_OUTPUT_NONE = 0,
XDP_OUTPUT_MONITOR = 1 << 0,
XDP_OUTPUT_WINDOW = 1 << 1,
XDP_OUTPUT_VIRTUAL = 1 << 2,
} XdpOutputType;
/**
* XdpDeviceType:
* @XDP_DEVICE_NONE: no device
* @XDP_DEVICE_KEYBOARD: control the keyboard.
* @XDP_DEVICE_POINTER: control the pointer.
* @XDP_DEVICE_TOUCHSCREEN: control the touchscreen.
*
* Flags to specify what input devices to control for a remote desktop session.
*/
typedef enum {
XDP_DEVICE_NONE = 0,
XDP_DEVICE_KEYBOARD = 1 << 0,
XDP_DEVICE_POINTER = 1 << 1,
XDP_DEVICE_TOUCHSCREEN = 1 << 2
} XdpDeviceType;
/**
* XdpScreencastFlags:
* @XDP_SCREENCAST_FLAG_NONE: No options
* @XDP_SCREENCAST_FLAG_MULTIPLE: allow opening multiple streams
*
* Options for starting screen casts.
*/
typedef enum {
XDP_SCREENCAST_FLAG_NONE = 0,
XDP_SCREENCAST_FLAG_MULTIPLE = 1 << 0
} XdpScreencastFlags;
/**
* XdpCursorMode:
* @XDP_CURSOR_MODE_HIDDEN: no cursor
* @XDP_CURSOR_MODE_EMBEDDED: cursor is embedded on the stream
* @XDP_CURSOR_MODE_METADATA: cursor is sent as metadata of the stream
*
* Options for how the cursor is handled.
*/
typedef enum {
XDP_CURSOR_MODE_HIDDEN = 1 << 0,
XDP_CURSOR_MODE_EMBEDDED = 1 << 1,
XDP_CURSOR_MODE_METADATA = 1 << 2,
} XdpCursorMode;
/**
* XdpPersistMode:
* @XDP_PERSIST_MODE_NONE: do not persist
* @XDP_PERSIST_MODE_TRANSIENT: persist as long as the application is alive
* @XDP_PERSIST_MODE_PERSISTENT: persist until the user revokes this permission
*
* Options for how the screencast session should persist.
*/
typedef enum {
XDP_PERSIST_MODE_NONE,
XDP_PERSIST_MODE_TRANSIENT,
XDP_PERSIST_MODE_PERSISTENT,
} XdpPersistMode;
XDP_PUBLIC
void xdp_portal_create_screencast_session (XdpPortal *portal,
XdpOutputType outputs,
XdpScreencastFlags flags,
XdpCursorMode cursor_mode,
XdpPersistMode persist_mode,
const char *restore_token,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
XdpSession *xdp_portal_create_screencast_session_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
/**
* XdpRemoteDesktopFlags:
* @XDP_REMOTE_DESKTOP_FLAG_NONE: No options
* @XDP_REMOTE_DESKTOP_FLAG_MULTIPLE: allow opening multiple streams
*
* Options for starting remote desktop sessions.
*/
typedef enum {
XDP_REMOTE_DESKTOP_FLAG_NONE = 0,
XDP_REMOTE_DESKTOP_FLAG_MULTIPLE = 1 << 0
} XdpRemoteDesktopFlags;
XDP_PUBLIC
void xdp_portal_create_remote_desktop_session (XdpPortal *portal,
XdpDeviceType devices,
XdpOutputType outputs,
XdpRemoteDesktopFlags flags,
XdpCursorMode cursor_mode,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
void xdp_portal_create_remote_desktop_session_full (XdpPortal *portal,
XdpDeviceType devices,
XdpOutputType outputs,
XdpRemoteDesktopFlags flags,
XdpCursorMode cursor_mode,
XdpPersistMode persist_mode,
const char *restore_token,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
XdpSession *xdp_portal_create_remote_desktop_session_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
XdpSessionState xdp_session_get_session_state (XdpSession *session);
XDP_PUBLIC
void xdp_session_start (XdpSession *session,
XdpParent *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_session_start_finish (XdpSession *session,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
int xdp_session_open_pipewire_remote (XdpSession *session);
XDP_PUBLIC
XdpDeviceType xdp_session_get_devices (XdpSession *session);
XDP_PUBLIC
GVariant * xdp_session_get_streams (XdpSession *session);
XDP_PUBLIC
int xdp_session_connect_to_eis (XdpSession *session,
GError **error);
XDP_PUBLIC
void xdp_session_pointer_motion (XdpSession *session,
double dx,
double dy);
XDP_PUBLIC
void xdp_session_pointer_position (XdpSession *session,
guint stream,
double x,
double y);
/**
* XdpButtonState:
* @XDP_BUTTON_RELEASED: the button is down
* @XDP_BUTTON_PRESSED: the button is up
*
* The XdpButtonState enumeration is used to describe
* the state of buttons.
*/
typedef enum {
XDP_BUTTON_RELEASED = 0,
XDP_BUTTON_PRESSED = 1
} XdpButtonState;
XDP_PUBLIC
void xdp_session_pointer_button (XdpSession *session,
int button,
XdpButtonState state);
XDP_PUBLIC
void xdp_session_pointer_axis (XdpSession *session,
gboolean finish,
double dx,
double dy);
/**
* XdpDiscreteAxis:
* @XDP_AXIS_HORIZONTAL_SCROLL: the horizontal scroll axis
* @XDP_AXIS_VERTICAL_SCROLL: the horizontal scroll axis
*
* The `XdpDiscreteAxis` enumeration is used to describe
* the discrete scroll axes.
*/
typedef enum {
XDP_AXIS_HORIZONTAL_SCROLL = 0,
XDP_AXIS_VERTICAL_SCROLL = 1
} XdpDiscreteAxis;
XDP_PUBLIC
void xdp_session_pointer_axis_discrete (XdpSession *session,
XdpDiscreteAxis axis,
int steps);
/**
* XdpKeyState:
* @XDP_KEY_RELEASED: the key is down
* @XDP_KEY_PRESSED: the key is up
*
* The `XdpKeyState` enumeration is used to describe
* the state of keys.
*/
typedef enum {
XDP_KEY_RELEASED = 0,
XDP_KEY_PRESSED = 1
} XdpKeyState;
XDP_PUBLIC
void xdp_session_keyboard_key (XdpSession *session,
gboolean keysym,
int key,
XdpKeyState state);
XDP_PUBLIC
void xdp_session_touch_down (XdpSession *session,
guint stream,
guint slot,
double x,
double y);
XDP_PUBLIC
void xdp_session_touch_position (XdpSession *session,
guint stream,
guint slot,
double x,
double y);
XDP_PUBLIC
void xdp_session_touch_up (XdpSession *session,
guint slot);
XDP_PUBLIC
XdpPersistMode xdp_session_get_persist_mode (XdpSession *session);
XDP_PUBLIC
char *xdp_session_get_restore_token (XdpSession *session);
G_END_DECLS

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
typedef enum {
XDP_SCREENSHOT_FLAG_NONE = 0,
XDP_SCREENSHOT_FLAG_INTERACTIVE = 1 << 0
} XdpScreenshotFlags;
XDP_PUBLIC
void xdp_portal_take_screenshot (XdpPortal *portal,
XdpParent *parent,
XdpScreenshotFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
char * xdp_portal_take_screenshot_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_pick_color (XdpPortal *portal,
XdpParent *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
GVariant * xdp_portal_pick_color_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/remote.h>
#include <libportal/inputcapture.h>
struct _XdpSession {
GObject parent_instance;
/* Generic Session implementation */
XdpPortal *portal;
char *id;
gboolean is_closed;
XdpSessionType type;
guint signal_id;
/* RemoteDesktop/ScreenCast */
XdpSessionState state;
XdpDeviceType devices;
GVariant *streams;
XdpPersistMode persist_mode;
char *restore_token;
gboolean uses_eis;
/* InputCapture */
XdpInputCaptureSession *input_capture_session; /* weak ref */
};
XdpSession * _xdp_session_new (XdpPortal *portal,
const char *id,
XdpSessionType type);
void _xdp_session_set_session_state (XdpSession *session,
XdpSessionState state);
void _xdp_session_set_devices (XdpSession *session,
XdpDeviceType devices);
void _xdp_session_set_streams (XdpSession *session,
GVariant *streams);
void _xdp_session_close (XdpSession *session);

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
#define XDP_TYPE_SESSION (xdp_session_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpSession, xdp_session, XDP, SESSION, GObject)
/**
* XdpSessionType:
* @XDP_SESSION_SCREENCAST: a screencast session.
* @XDP_SESSION_REMOTE_DESKTOP: a remote desktop session.
* @XDP_SESSION_INPUT_CAPTURE: an input capture session.
*
* The type of a session.
*/
typedef enum {
XDP_SESSION_SCREENCAST,
XDP_SESSION_REMOTE_DESKTOP,
XDP_SESSION_INPUT_CAPTURE,
} XdpSessionType;
XDP_PUBLIC
void xdp_session_close (XdpSession *session);
XDP_PUBLIC
XdpSessionType xdp_session_get_session_type (XdpSession *session);
G_END_DECLS

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2024 GNOME Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*
* Authors:
* Hubert Figuière <hub@figuiere.net>
*/
#pragma once
#include <libportal/types.h>
#include "settings.h"
G_BEGIN_DECLS
XdpSettings * _xdp_settings_new (XdpPortal *portal);
G_END_DECLS

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2024 GNOME Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*
* Authors:
* Hubert Figuière <hub@figuiere.net>
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
#define XDP_TYPE_SETTINGS (xdp_settings_get_type ())
XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpSettings, xdp_settings, XDP, SETTINGS, GObject)
XDP_PUBLIC
GVariant *xdp_settings_read_value (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
XDP_PUBLIC
void
xdp_settings_read (XdpSettings *settings, const char *namespace,
const gchar *key,
GCancellable *cancellable, GError **error,
const gchar *format, ...);
XDP_PUBLIC
guint xdp_settings_read_uint (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
XDP_PUBLIC
char *xdp_settings_read_string (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
XDP_PUBLIC
GVariant *xdp_settings_read_all_values (XdpSettings *settings, const char *const *namespaces, GCancellable *cancellable, GError **error);
G_END_DECLS

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpSpawnFlags:
* @XDP_SPAWN_FLAG_NONE: No flags
* @XDP_SPAWN_FLAG_CLEARENV: Clear the environment
* @XDP_SPAWN_FLAG_LATEST: Spawn the latest version of the app
* @XDP_SPAWN_FLAG_SANDBOX: Spawn in a sandbox (equivalent to the --sandbox option of flatpak run)
* @XDP_SPAWN_FLAG_NO_NETWORK: Spawn without network (equivalent to the --unshare=network option of flatpak run)
* @XDP_SPAWN_FLAG_WATCH: Kill the sandbox when the caller disappears from the session bus
*
* Flags influencing the spawn operation and how the
* new sandbox is created.
*/
typedef enum {
XDP_SPAWN_FLAG_NONE = 0,
XDP_SPAWN_FLAG_CLEARENV = 1 << 0,
XDP_SPAWN_FLAG_LATEST = 1 << 1,
XDP_SPAWN_FLAG_SANDBOX = 1 << 2,
XDP_SPAWN_FLAG_NO_NETWORK = 1 << 3,
XDP_SPAWN_FLAG_WATCH = 1 << 4,
} XdpSpawnFlags;
XDP_PUBLIC
void xdp_portal_spawn (XdpPortal *portal,
const char *cwd,
const char * const *argv,
int *fds,
int *map_to,
int n_fds,
const char * const *env,
XdpSpawnFlags flags,
const char * const *sandbox_expose,
const char * const *sandbox_expose_ro,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
pid_t xdp_portal_spawn_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_spawn_signal (XdpPortal *portal,
pid_t pid,
int signal,
gboolean to_process_group);
G_END_DECLS

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
XDP_PUBLIC
void xdp_portal_trash_file (XdpPortal *portal,
const char *path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_trash_file_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2021, Georges Basile Stavracas Neto
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
typedef struct _XdpParent XdpParent;
typedef struct _XdpPortal XdpPortal;
typedef struct _XdpSettings XdpSettings;

View File

@@ -0,0 +1,82 @@
/*
* Copyright (C) 2018, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpUpdateStatus:
* @XDP_UPDATE_STATUS_RUNNING: Installation in progress
* @XDP_UPDATE_STATUS_EMPTY: Nothing to install
* @XDP_UPDATE_STATUS_DONE: Installation finished successfully
* @XDP_UPDATE_STATUS_FAILED: Installation failed
*
* The values of this enum are returned in the
* [signal@Portal::update-progress] signal to indicate
* the current progress of an installation.
*/
typedef enum {
XDP_UPDATE_STATUS_RUNNING,
XDP_UPDATE_STATUS_EMPTY,
XDP_UPDATE_STATUS_DONE,
XDP_UPDATE_STATUS_FAILED
} XdpUpdateStatus;
typedef enum
{
XDP_UPDATE_MONITOR_FLAG_NONE = 0,
} XdpUpdateMonitorFlags;
XDP_PUBLIC
void xdp_portal_update_monitor_start (XdpPortal *portal,
XdpUpdateMonitorFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_update_monitor_start_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
XDP_PUBLIC
void xdp_portal_update_monitor_stop (XdpPortal *portal);
typedef enum
{
XDP_UPDATE_INSTALL_FLAG_NONE = 0,
} XdpUpdateInstallFlags;
XDP_PUBLIC
void xdp_portal_update_install (XdpPortal *portal,
XdpParent *parent,
XdpUpdateInstallFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_update_install_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2019, Matthias Clasen
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.0 of the
* License.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-3.0-only
*/
#pragma once
#include <libportal/types.h>
G_BEGIN_DECLS
/**
* XdpWallpaperFlags:
* @XDP_WALLPAPER_FLAG_NONE: No flags
* @XDP_WALLPAPER_FLAG_BACKGROUND: Set wallpaper on the desktop background
* @XDP_WALLPAPER_FLAG_LOCKSCREEN: Set wallpaper on the lockscreen
* @XDP_WALLPAPER_FLAG_PREVIEW: Request the preview to be shown
*
* The values of this enumeration determine where the wallpaper is being set.
*/
typedef enum {
XDP_WALLPAPER_FLAG_NONE = 0,
XDP_WALLPAPER_FLAG_BACKGROUND = 1 << 0,
XDP_WALLPAPER_FLAG_LOCKSCREEN = 1 << 1,
XDP_WALLPAPER_FLAG_PREVIEW = 1 << 2
} XdpWallpaperFlags;
#define XDP_WALLPAPER_TARGET_BOTH (XDP_WALLPAPER_TARGET_BACKGROUND|XDP_WALLPAPER_TARGET_LOCKSCREEN)
XDP_PUBLIC
void xdp_portal_set_wallpaper (XdpPortal *portal,
XdpParent *parent,
const char *uri,
XdpWallpaperFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer data);
XDP_PUBLIC
gboolean xdp_portal_set_wallpaper_finish (XdpPortal *portal,
GAsyncResult *result,
GError **error);
G_END_DECLS

View File

@@ -0,0 +1,148 @@
/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
#pragma once
#include <gio/gio.h>
#include <libportal/portal-helpers.h>
G_BEGIN_DECLS
/* enumerations from "account.h" */
XDP_PUBLIC
GType xdp_user_information_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_USER_INFORMATION_FLAGS (xdp_user_information_flags_get_type ())
/* enumerations from "background.h" */
XDP_PUBLIC
GType xdp_background_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_BACKGROUND_FLAGS (xdp_background_flags_get_type ())
/* enumerations from "camera.h" */
XDP_PUBLIC
GType xdp_camera_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_CAMERA_FLAGS (xdp_camera_flags_get_type ())
/* enumerations from "dynamic-launcher.h" */
XDP_PUBLIC
GType xdp_launcher_type_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_LAUNCHER_TYPE (xdp_launcher_type_get_type ())
/* enumerations from "email.h" */
XDP_PUBLIC
GType xdp_email_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_EMAIL_FLAGS (xdp_email_flags_get_type ())
/* enumerations from "filechooser.h" */
XDP_PUBLIC
GType xdp_open_file_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_OPEN_FILE_FLAGS (xdp_open_file_flags_get_type ())
XDP_PUBLIC
GType xdp_save_file_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SAVE_FILE_FLAGS (xdp_save_file_flags_get_type ())
/* enumerations from "inhibit.h" */
XDP_PUBLIC
GType xdp_inhibit_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_INHIBIT_FLAGS (xdp_inhibit_flags_get_type ())
XDP_PUBLIC
GType xdp_login_session_state_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_LOGIN_SESSION_STATE (xdp_login_session_state_get_type ())
XDP_PUBLIC
GType xdp_session_monitor_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SESSION_MONITOR_FLAGS (xdp_session_monitor_flags_get_type ())
/* enumerations from "inputcapture.h" */
XDP_PUBLIC
GType xdp_input_capability_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_INPUT_CAPABILITY (xdp_input_capability_get_type ())
/* enumerations from "location.h" */
XDP_PUBLIC
GType xdp_location_accuracy_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_LOCATION_ACCURACY (xdp_location_accuracy_get_type ())
XDP_PUBLIC
GType xdp_location_monitor_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_LOCATION_MONITOR_FLAGS (xdp_location_monitor_flags_get_type ())
/* enumerations from "notification.h" */
XDP_PUBLIC
GType xdp_notification_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_NOTIFICATION_FLAGS (xdp_notification_flags_get_type ())
/* enumerations from "openuri.h" */
XDP_PUBLIC
GType xdp_open_uri_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_OPEN_URI_FLAGS (xdp_open_uri_flags_get_type ())
/* enumerations from "print.h" */
XDP_PUBLIC
GType xdp_print_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_PRINT_FLAGS (xdp_print_flags_get_type ())
/* enumerations from "remote.h" */
XDP_PUBLIC
GType xdp_session_state_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SESSION_STATE (xdp_session_state_get_type ())
XDP_PUBLIC
GType xdp_output_type_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_OUTPUT_TYPE (xdp_output_type_get_type ())
XDP_PUBLIC
GType xdp_device_type_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_DEVICE_TYPE (xdp_device_type_get_type ())
XDP_PUBLIC
GType xdp_screencast_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SCREENCAST_FLAGS (xdp_screencast_flags_get_type ())
XDP_PUBLIC
GType xdp_cursor_mode_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_CURSOR_MODE (xdp_cursor_mode_get_type ())
XDP_PUBLIC
GType xdp_persist_mode_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_PERSIST_MODE (xdp_persist_mode_get_type ())
XDP_PUBLIC
GType xdp_remote_desktop_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_REMOTE_DESKTOP_FLAGS (xdp_remote_desktop_flags_get_type ())
XDP_PUBLIC
GType xdp_button_state_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_BUTTON_STATE (xdp_button_state_get_type ())
XDP_PUBLIC
GType xdp_discrete_axis_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_DISCRETE_AXIS (xdp_discrete_axis_get_type ())
XDP_PUBLIC
GType xdp_key_state_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_KEY_STATE (xdp_key_state_get_type ())
/* enumerations from "screenshot.h" */
XDP_PUBLIC
GType xdp_screenshot_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SCREENSHOT_FLAGS (xdp_screenshot_flags_get_type ())
/* enumerations from "session.h" */
XDP_PUBLIC
GType xdp_session_type_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SESSION_TYPE (xdp_session_type_get_type ())
/* enumerations from "spawn.h" */
XDP_PUBLIC
GType xdp_spawn_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_SPAWN_FLAGS (xdp_spawn_flags_get_type ())
/* enumerations from "updates.h" */
XDP_PUBLIC
GType xdp_update_status_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_UPDATE_STATUS (xdp_update_status_get_type ())
XDP_PUBLIC
GType xdp_update_monitor_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_UPDATE_MONITOR_FLAGS (xdp_update_monitor_flags_get_type ())
XDP_PUBLIC
GType xdp_update_install_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_UPDATE_INSTALL_FLAGS (xdp_update_install_flags_get_type ())
/* enumerations from "wallpaper.h" */
XDP_PUBLIC
GType xdp_wallpaper_flags_get_type (void) G_GNUC_CONST;
#define XDP_TYPE_WALLPAPER_FLAGS (xdp_wallpaper_flags_get_type ())
G_END_DECLS
/* Generated data ends here */

View File

@@ -0,0 +1,47 @@
// Copyright (c) 2012-2025 Wojciech Figat. All rights reserved.
using System.IO;
using Flax.Build;
using Flax.Build.NativeCpp;
/// <summary>
/// https://github.com/flatpak/libportal
/// </summary>
public class libportal : DepsModule
{
/// <inheritdoc />
public override void Init()
{
base.Init();
LicenseType = LicenseTypes.Custom;
LicenseFilePath = "LICENSE.txt";
// Merge third-party modules into engine binary
BinaryModuleName = "FlaxEngine";
}
/// <inheritdoc />
public override void Setup(BuildOptions options)
{
base.Setup(options);
var depsRoot = options.DepsFolder;
switch (options.Platform.Target)
{
case TargetPlatform.Linux:
options.OutputFiles.Add(Path.Combine(depsRoot, "libportal.a"));
options.PublicIncludePaths.Add("/usr/include/glib-2.0");
options.PublicIncludePaths.Add("/usr/lib/glib-2.0/include");
//options.SourceFiles.Add(Path.Combine(FolderPath, "portal-enums.c"));
options.SourceFiles.AddRange(Directory.GetFiles(FolderPath, "*.c", SearchOption.TopDirectoryOnly));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}
options.PublicIncludePaths.Add(Path.Combine(Globals.EngineRoot, @"Source\ThirdParty\libportal\include"));
}
}

View File

@@ -0,0 +1,673 @@
/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
#include "config.h"
#include <libportal/portal.h>
/* enumerations from "account.h" */
GType
xdp_user_information_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_USER_INFORMATION_FLAG_NONE, "XDP_USER_INFORMATION_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpUserInformationFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "background.h" */
GType
xdp_background_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_BACKGROUND_FLAG_NONE, "XDP_BACKGROUND_FLAG_NONE", "none" },
{ XDP_BACKGROUND_FLAG_AUTOSTART, "XDP_BACKGROUND_FLAG_AUTOSTART", "autostart" },
{ XDP_BACKGROUND_FLAG_ACTIVATABLE, "XDP_BACKGROUND_FLAG_ACTIVATABLE", "activatable" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpBackgroundFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "camera.h" */
GType
xdp_camera_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_CAMERA_FLAG_NONE, "XDP_CAMERA_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpCameraFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "dynamic-launcher.h" */
GType
xdp_launcher_type_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_LAUNCHER_APPLICATION, "XDP_LAUNCHER_APPLICATION", "application" },
{ XDP_LAUNCHER_WEBAPP, "XDP_LAUNCHER_WEBAPP", "webapp" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpLauncherType"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "email.h" */
GType
xdp_email_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_EMAIL_FLAG_NONE, "XDP_EMAIL_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpEmailFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "filechooser.h" */
GType
xdp_open_file_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_OPEN_FILE_FLAG_NONE, "XDP_OPEN_FILE_FLAG_NONE", "none" },
{ XDP_OPEN_FILE_FLAG_MULTIPLE, "XDP_OPEN_FILE_FLAG_MULTIPLE", "multiple" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpOpenFileFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_save_file_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_SAVE_FILE_FLAG_NONE, "XDP_SAVE_FILE_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpSaveFileFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "inhibit.h" */
GType
xdp_inhibit_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_INHIBIT_FLAG_LOGOUT, "XDP_INHIBIT_FLAG_LOGOUT", "logout" },
{ XDP_INHIBIT_FLAG_USER_SWITCH, "XDP_INHIBIT_FLAG_USER_SWITCH", "user-switch" },
{ XDP_INHIBIT_FLAG_SUSPEND, "XDP_INHIBIT_FLAG_SUSPEND", "suspend" },
{ XDP_INHIBIT_FLAG_IDLE, "XDP_INHIBIT_FLAG_IDLE", "idle" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpInhibitFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_login_session_state_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_LOGIN_SESSION_RUNNING, "XDP_LOGIN_SESSION_RUNNING", "running" },
{ XDP_LOGIN_SESSION_QUERY_END, "XDP_LOGIN_SESSION_QUERY_END", "query-end" },
{ XDP_LOGIN_SESSION_ENDING, "XDP_LOGIN_SESSION_ENDING", "ending" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpLoginSessionState"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_session_monitor_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_SESSION_MONITOR_FLAG_NONE, "XDP_SESSION_MONITOR_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpSessionMonitorFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "inputcapture.h" */
GType
xdp_input_capability_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_INPUT_CAPABILITY_NONE, "XDP_INPUT_CAPABILITY_NONE", "none" },
{ XDP_INPUT_CAPABILITY_KEYBOARD, "XDP_INPUT_CAPABILITY_KEYBOARD", "keyboard" },
{ XDP_INPUT_CAPABILITY_POINTER, "XDP_INPUT_CAPABILITY_POINTER", "pointer" },
{ XDP_INPUT_CAPABILITY_TOUCHSCREEN, "XDP_INPUT_CAPABILITY_TOUCHSCREEN", "touchscreen" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpInputCapability"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "location.h" */
GType
xdp_location_accuracy_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_LOCATION_ACCURACY_NONE, "XDP_LOCATION_ACCURACY_NONE", "none" },
{ XDP_LOCATION_ACCURACY_COUNTRY, "XDP_LOCATION_ACCURACY_COUNTRY", "country" },
{ XDP_LOCATION_ACCURACY_CITY, "XDP_LOCATION_ACCURACY_CITY", "city" },
{ XDP_LOCATION_ACCURACY_NEIGHBORHOOD, "XDP_LOCATION_ACCURACY_NEIGHBORHOOD", "neighborhood" },
{ XDP_LOCATION_ACCURACY_STREET, "XDP_LOCATION_ACCURACY_STREET", "street" },
{ XDP_LOCATION_ACCURACY_EXACT, "XDP_LOCATION_ACCURACY_EXACT", "exact" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpLocationAccuracy"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_location_monitor_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_LOCATION_MONITOR_FLAG_NONE, "XDP_LOCATION_MONITOR_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpLocationMonitorFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "notification.h" */
GType
xdp_notification_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_NOTIFICATION_FLAG_NONE, "XDP_NOTIFICATION_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpNotificationFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "openuri.h" */
GType
xdp_open_uri_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_OPEN_URI_FLAG_NONE, "XDP_OPEN_URI_FLAG_NONE", "none" },
{ XDP_OPEN_URI_FLAG_ASK, "XDP_OPEN_URI_FLAG_ASK", "ask" },
{ XDP_OPEN_URI_FLAG_WRITABLE, "XDP_OPEN_URI_FLAG_WRITABLE", "writable" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpOpenUriFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "print.h" */
GType
xdp_print_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_PRINT_FLAG_NONE, "XDP_PRINT_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpPrintFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "remote.h" */
GType
xdp_session_state_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_SESSION_INITIAL, "XDP_SESSION_INITIAL", "initial" },
{ XDP_SESSION_ACTIVE, "XDP_SESSION_ACTIVE", "active" },
{ XDP_SESSION_CLOSED, "XDP_SESSION_CLOSED", "closed" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpSessionState"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_output_type_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_OUTPUT_NONE, "XDP_OUTPUT_NONE", "none" },
{ XDP_OUTPUT_MONITOR, "XDP_OUTPUT_MONITOR", "monitor" },
{ XDP_OUTPUT_WINDOW, "XDP_OUTPUT_WINDOW", "window" },
{ XDP_OUTPUT_VIRTUAL, "XDP_OUTPUT_VIRTUAL", "virtual" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpOutputType"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_device_type_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_DEVICE_NONE, "XDP_DEVICE_NONE", "none" },
{ XDP_DEVICE_KEYBOARD, "XDP_DEVICE_KEYBOARD", "keyboard" },
{ XDP_DEVICE_POINTER, "XDP_DEVICE_POINTER", "pointer" },
{ XDP_DEVICE_TOUCHSCREEN, "XDP_DEVICE_TOUCHSCREEN", "touchscreen" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpDeviceType"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_screencast_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_SCREENCAST_FLAG_NONE, "XDP_SCREENCAST_FLAG_NONE", "none" },
{ XDP_SCREENCAST_FLAG_MULTIPLE, "XDP_SCREENCAST_FLAG_MULTIPLE", "multiple" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpScreencastFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_cursor_mode_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_CURSOR_MODE_HIDDEN, "XDP_CURSOR_MODE_HIDDEN", "hidden" },
{ XDP_CURSOR_MODE_EMBEDDED, "XDP_CURSOR_MODE_EMBEDDED", "embedded" },
{ XDP_CURSOR_MODE_METADATA, "XDP_CURSOR_MODE_METADATA", "metadata" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpCursorMode"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_persist_mode_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_PERSIST_MODE_NONE, "XDP_PERSIST_MODE_NONE", "none" },
{ XDP_PERSIST_MODE_TRANSIENT, "XDP_PERSIST_MODE_TRANSIENT", "transient" },
{ XDP_PERSIST_MODE_PERSISTENT, "XDP_PERSIST_MODE_PERSISTENT", "persistent" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpPersistMode"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_remote_desktop_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_REMOTE_DESKTOP_FLAG_NONE, "XDP_REMOTE_DESKTOP_FLAG_NONE", "none" },
{ XDP_REMOTE_DESKTOP_FLAG_MULTIPLE, "XDP_REMOTE_DESKTOP_FLAG_MULTIPLE", "multiple" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpRemoteDesktopFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_button_state_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_BUTTON_RELEASED, "XDP_BUTTON_RELEASED", "released" },
{ XDP_BUTTON_PRESSED, "XDP_BUTTON_PRESSED", "pressed" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpButtonState"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_discrete_axis_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_AXIS_HORIZONTAL_SCROLL, "XDP_AXIS_HORIZONTAL_SCROLL", "horizontal-scroll" },
{ XDP_AXIS_VERTICAL_SCROLL, "XDP_AXIS_VERTICAL_SCROLL", "vertical-scroll" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpDiscreteAxis"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_key_state_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_KEY_RELEASED, "XDP_KEY_RELEASED", "released" },
{ XDP_KEY_PRESSED, "XDP_KEY_PRESSED", "pressed" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpKeyState"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "screenshot.h" */
GType
xdp_screenshot_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_SCREENSHOT_FLAG_NONE, "XDP_SCREENSHOT_FLAG_NONE", "none" },
{ XDP_SCREENSHOT_FLAG_INTERACTIVE, "XDP_SCREENSHOT_FLAG_INTERACTIVE", "interactive" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpScreenshotFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "session.h" */
GType
xdp_session_type_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_SESSION_SCREENCAST, "XDP_SESSION_SCREENCAST", "screencast" },
{ XDP_SESSION_REMOTE_DESKTOP, "XDP_SESSION_REMOTE_DESKTOP", "remote-desktop" },
{ XDP_SESSION_INPUT_CAPTURE, "XDP_SESSION_INPUT_CAPTURE", "input-capture" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpSessionType"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "spawn.h" */
GType
xdp_spawn_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_SPAWN_FLAG_NONE, "XDP_SPAWN_FLAG_NONE", "none" },
{ XDP_SPAWN_FLAG_CLEARENV, "XDP_SPAWN_FLAG_CLEARENV", "clearenv" },
{ XDP_SPAWN_FLAG_LATEST, "XDP_SPAWN_FLAG_LATEST", "latest" },
{ XDP_SPAWN_FLAG_SANDBOX, "XDP_SPAWN_FLAG_SANDBOX", "sandbox" },
{ XDP_SPAWN_FLAG_NO_NETWORK, "XDP_SPAWN_FLAG_NO_NETWORK", "no-network" },
{ XDP_SPAWN_FLAG_WATCH, "XDP_SPAWN_FLAG_WATCH", "watch" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpSpawnFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "updates.h" */
GType
xdp_update_status_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_UPDATE_STATUS_RUNNING, "XDP_UPDATE_STATUS_RUNNING", "running" },
{ XDP_UPDATE_STATUS_EMPTY, "XDP_UPDATE_STATUS_EMPTY", "empty" },
{ XDP_UPDATE_STATUS_DONE, "XDP_UPDATE_STATUS_DONE", "done" },
{ XDP_UPDATE_STATUS_FAILED, "XDP_UPDATE_STATUS_FAILED", "failed" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpUpdateStatus"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_update_monitor_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_UPDATE_MONITOR_FLAG_NONE, "XDP_UPDATE_MONITOR_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpUpdateMonitorFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
xdp_update_install_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GEnumValue values[] = {
{ XDP_UPDATE_INSTALL_FLAG_NONE, "XDP_UPDATE_INSTALL_FLAG_NONE", "none" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_enum_register_static (g_intern_static_string ("XdpUpdateInstallFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "wallpaper.h" */
GType
xdp_wallpaper_flags_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const GFlagsValue values[] = {
{ XDP_WALLPAPER_FLAG_NONE, "XDP_WALLPAPER_FLAG_NONE", "none" },
{ XDP_WALLPAPER_FLAG_BACKGROUND, "XDP_WALLPAPER_FLAG_BACKGROUND", "background" },
{ XDP_WALLPAPER_FLAG_LOCKSCREEN, "XDP_WALLPAPER_FLAG_LOCKSCREEN", "lockscreen" },
{ XDP_WALLPAPER_FLAG_PREVIEW, "XDP_WALLPAPER_FLAG_PREVIEW", "preview" },
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("XdpWallpaperFlags"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* Generated data ends here */

View File

@@ -0,0 +1,90 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO;
using Flax.Build;
namespace Flax.Deps.Dependencies;
/// <summary>
/// libportal.
/// </summary>
/// <seealso cref="Flax.Deps.Dependency" />
class libportal : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{
var dstPath = Path.Combine(options.ThirdPartyFolder, "libportal");
var includePath = Path.Combine(dstPath, "include");
string root = options.IntermediateFolder;
var configs = new string[]
{
"-Dbackend-qt6=disabled",
"-Dbackend-qt5=disabled",
"-Dbackend-gtk4=disabled",
"-Dbackend-gtk3=disabled",
"-Dintrospection=false",
"-Dtests=false",
"-Ddocs=false",
"-Dvapi=false",
"--buildtype release",
"--default-library static",
};
CloneGitRepo(root, "https://github.com/flatpak/libportal");
GitFetch(root);
GitResetToCommit(root, "8f5dc8d192f6e31dafe69e35219e3b707bde71ce"); // 0.9.1
foreach (var platform in options.Platforms)
{
BuildStarted(platform);
switch (platform)
{
case TargetPlatform.Linux:
{
foreach (var architecture in new TargetArchitecture[] { TargetArchitecture.x64 /*, TargetArchitecture.ARM64*/ })
{
var buildDir = $"build_{architecture}";
Utilities.Run("meson", $"{buildDir} {string.Join(" ", configs)}", null, root, Utilities.RunOptions.DefaultTool);
Utilities.Run("ninja", $"-C {buildDir} ", null, root, Utilities.RunOptions.DefaultTool);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "libportal.a"), Path.Combine(depsFolder, "libportal.a"));
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "portal-enums.h"), Path.Combine(includePath, "portal-enums.h"));
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "portal-enums.c"), Path.Combine(dstPath, "portal-enums.c"));
}
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstPath, "LICENSE.txt"));
if (!Directory.Exists(includePath))
Directory.CreateDirectory(includePath);
if (!Directory.Exists(Path.Combine(includePath, "libportal")))
Directory.CreateDirectory(Path.Combine(includePath, "libportal"));
foreach (var file in Directory.GetFiles(Path.Combine(root, "libportal"), "*.h"))
Utilities.FileCopy(file, Path.Combine(includePath, "libportal", Path.GetFileName(file)));
break;
}
}
}
}
}

View File

@@ -126,7 +126,16 @@ namespace Flax.Build.Platforms
args.Add("-lXcursor");
args.Add("-lXinerama");
args.Add("-lXfixes");
args.Add("-lwayland-client");
if (EngineConfiguration.WithSDL(options))
{
// Link Wayland
args.Add("-lwayland-client");
// Link GLib for libportal
args.Add("-lglib-2.0");
args.Add("-lgio-2.0");
}
}
/// <inheritdoc />