1
0
Fork 0

service-channel: Add client type for filechooser portal

Add a new service client type for a filechooser portal client, and
expose the x11_interop protocol to it.

This will be used to make Nautilus a file chooser portal implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3694>
This commit is contained in:
Georges Basile Stavracas Neto 2024-04-09 16:11:59 -03:00 committed by Marge Bot
parent 7937f78c7e
commit cdbe0a27a2
4 changed files with 12 additions and 5 deletions

View file

@ -8,6 +8,7 @@
<!-- <!--
ServiceClientTypes: ServiceClientTypes:
PORTAL_BACKEND: 1 PORTAL_BACKEND: 1
FILECHOOSER_PORTAL_BACKEND: 2
--> -->
<method name="OpenWaylandServiceConnection"> <method name="OpenWaylandServiceConnection">
<arg name="service_client_type" type="u" direction="in" /> <arg name="service_client_type" type="u" direction="in" />

View file

@ -98,6 +98,7 @@ verify_service_client_type (uint32_t service_client_type)
case META_SERVICE_CLIENT_TYPE_NONE: case META_SERVICE_CLIENT_TYPE_NONE:
return FALSE; return FALSE;
case META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND: case META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND:
case META_SERVICE_CLIENT_TYPE_FILECHOOSER_PORTAL_BACKEND:
return TRUE; return TRUE;
} }

View file

@ -30,6 +30,7 @@ typedef enum _MetaServiceClientType
{ {
META_SERVICE_CLIENT_TYPE_NONE, META_SERVICE_CLIENT_TYPE_NONE,
META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND, META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND,
META_SERVICE_CLIENT_TYPE_FILECHOOSER_PORTAL_BACKEND,
} MetaServiceClientType; } MetaServiceClientType;
#define META_TYPE_SERVICE_CHANNEL (meta_service_channel_get_type ()) #define META_TYPE_SERVICE_CHANNEL (meta_service_channel_get_type ())

View file

@ -101,13 +101,17 @@ x11_interop_filter (const struct wl_client *client,
service_client = service_client =
meta_service_channel_get_service_client (service_channel, meta_service_channel_get_service_client (service_channel,
META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND); META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND);
if (!service_client)
return META_WAYLAND_ACCESS_DENIED;
if (meta_wayland_client_matches (service_client, client)) if (service_client && meta_wayland_client_matches (service_client, client))
return META_WAYLAND_ACCESS_ALLOWED; return META_WAYLAND_ACCESS_ALLOWED;
else
return META_WAYLAND_ACCESS_DENIED; service_client =
meta_service_channel_get_service_client (service_channel,
META_SERVICE_CLIENT_TYPE_FILECHOOSER_PORTAL_BACKEND);
if (service_client && meta_wayland_client_matches (service_client, client))
return META_WAYLAND_ACCESS_ALLOWED;
return META_WAYLAND_ACCESS_DENIED;
} }
void void