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:
parent
7937f78c7e
commit
cdbe0a27a2
4 changed files with 12 additions and 5 deletions
|
@ -8,6 +8,7 @@
|
|||
<!--
|
||||
ServiceClientTypes:
|
||||
PORTAL_BACKEND: 1
|
||||
FILECHOOSER_PORTAL_BACKEND: 2
|
||||
-->
|
||||
<method name="OpenWaylandServiceConnection">
|
||||
<arg name="service_client_type" type="u" direction="in" />
|
||||
|
|
|
@ -98,6 +98,7 @@ verify_service_client_type (uint32_t service_client_type)
|
|||
case META_SERVICE_CLIENT_TYPE_NONE:
|
||||
return FALSE;
|
||||
case META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND:
|
||||
case META_SERVICE_CLIENT_TYPE_FILECHOOSER_PORTAL_BACKEND:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ typedef enum _MetaServiceClientType
|
|||
{
|
||||
META_SERVICE_CLIENT_TYPE_NONE,
|
||||
META_SERVICE_CLIENT_TYPE_PORTAL_BACKEND,
|
||||
META_SERVICE_CLIENT_TYPE_FILECHOOSER_PORTAL_BACKEND,
|
||||
} MetaServiceClientType;
|
||||
|
||||
#define META_TYPE_SERVICE_CHANNEL (meta_service_channel_get_type ())
|
||||
|
|
|
@ -101,13 +101,17 @@ x11_interop_filter (const struct wl_client *client,
|
|||
service_client =
|
||||
meta_service_channel_get_service_client (service_channel,
|
||||
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;
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue