input-capture: Add D-Bus method to clear barriers

This will be needed by the portal backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
Jonas Ådahl
2022-04-01 19:14:48 +02:00
committed by Carlos Garnacho
parent 1d1983edb5
commit 2a8c11d69b
4 changed files with 110 additions and 0 deletions

View File

@ -532,6 +532,27 @@ handle_add_barrier (MetaDBusInputCaptureSession *object,
return G_DBUS_METHOD_INVOCATION_HANDLED;
}
static gboolean
handle_clear_barriers (MetaDBusInputCaptureSession *object,
GDBusMethodInvocation *invocation)
{
MetaInputCaptureSession *session = META_INPUT_CAPTURE_SESSION (object);
if (!check_permission (session, invocation))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"Permission denied");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}
g_hash_table_remove_all (session->barriers);
meta_dbus_input_capture_session_complete_clear_barriers (object, invocation);
return G_DBUS_METHOD_INVOCATION_HANDLED;
}
static gboolean
handle_get_zones (MetaDBusInputCaptureSession *object,
GDBusMethodInvocation *invocation)
@ -749,6 +770,7 @@ static void
meta_input_capture_session_init_iface (MetaDBusInputCaptureSessionIface *iface)
{
iface->handle_add_barrier = handle_add_barrier;
iface->handle_clear_barriers = handle_clear_barriers;
iface->handle_enable = handle_enable;
iface->handle_disable = handle_disable;
iface->handle_release = handle_release;