2017-06-21 02:23:44 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2015-2017 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-08-07 05:50:23 -04:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2017-06-21 02:23:44 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "backends/meta-remote-desktop-session.h"
|
|
|
|
|
2020-11-04 09:03:16 -05:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <gio/gunixfdlist.h>
|
|
|
|
#include <gio/gunixoutputstream.h>
|
|
|
|
#include <glib-unix.h>
|
2017-06-21 02:23:44 -04:00
|
|
|
#include <linux/input.h>
|
2018-01-29 01:28:07 -05:00
|
|
|
#include <stdlib.h>
|
2020-11-04 09:03:16 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
#include "backends/meta-dbus-session-watcher.h"
|
2022-03-11 03:39:07 -05:00
|
|
|
#include "backends/meta-dbus-session-manager.h"
|
2021-08-16 19:09:59 -04:00
|
|
|
#include "backends/meta-eis.h"
|
2023-08-30 15:37:44 -04:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2017-06-21 02:23:44 -04:00
|
|
|
#include "backends/meta-screen-cast-session.h"
|
2018-07-20 10:37:37 -04:00
|
|
|
#include "backends/meta-remote-access-controller-private.h"
|
2017-06-21 02:23:44 -04:00
|
|
|
#include "backends/x11/meta-backend-x11.h"
|
|
|
|
#include "cogl/cogl.h"
|
2020-11-04 04:27:40 -05:00
|
|
|
#include "core/display-private.h"
|
2020-11-04 09:03:16 -05:00
|
|
|
#include "core/meta-selection-private.h"
|
2020-11-04 10:09:42 -05:00
|
|
|
#include "core/meta-selection-source-remote.h"
|
2017-06-21 02:23:44 -04:00
|
|
|
#include "meta/meta-backend.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
#include "meta-dbus-remote-desktop.h"
|
|
|
|
|
|
|
|
#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/org/gnome/Mutter/RemoteDesktop/Session"
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
#define TRANSFER_REQUEST_CLEANUP_TIMEOUT_MS (s2ms (15))
|
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
N_PROPS
|
|
|
|
};
|
|
|
|
|
2020-12-15 04:34:43 -05:00
|
|
|
typedef enum _MetaRemoteDesktopNotifyAxisFlags
|
2018-01-29 01:40:28 -05:00
|
|
|
{
|
2020-12-15 04:34:43 -05:00
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_NONE = 0,
|
2018-01-29 01:40:28 -05:00
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH = 1 << 0,
|
2020-12-15 04:34:43 -05:00
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_WHEEL = 1 << 1,
|
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_FINGER = 1 << 2,
|
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_CONTINUOUS = 1 << 3,
|
2018-01-29 01:40:28 -05:00
|
|
|
} MetaRemoteDesktopNotifyAxisFlags;
|
|
|
|
|
2020-11-04 09:03:16 -05:00
|
|
|
typedef struct _SelectionReadData
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session;
|
|
|
|
GOutputStream *stream;
|
|
|
|
GCancellable *cancellable;
|
|
|
|
} SelectionReadData;
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
struct _MetaRemoteDesktopSession
|
|
|
|
{
|
|
|
|
MetaDBusRemoteDesktopSessionSkeleton parent;
|
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
MetaDbusSessionManager *session_manager;
|
2021-03-24 03:35:07 -04:00
|
|
|
|
2020-11-04 04:27:40 -05:00
|
|
|
GDBusConnection *connection;
|
2017-08-25 03:19:53 -04:00
|
|
|
char *peer_name;
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
char *session_id;
|
|
|
|
char *object_path;
|
|
|
|
|
|
|
|
MetaScreenCastSession *screen_cast_session;
|
|
|
|
gulong screen_cast_session_closed_handler_id;
|
2020-05-16 04:44:04 -04:00
|
|
|
guint started : 1;
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2023-08-28 11:01:03 -04:00
|
|
|
MetaEis *eis;
|
2017-06-21 02:23:44 -04:00
|
|
|
ClutterVirtualInputDevice *virtual_pointer;
|
|
|
|
ClutterVirtualInputDevice *virtual_keyboard;
|
2018-01-29 01:44:03 -05:00
|
|
|
ClutterVirtualInputDevice *virtual_touchscreen;
|
2018-07-20 10:37:37 -04:00
|
|
|
|
|
|
|
MetaRemoteDesktopSessionHandle *handle;
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
gboolean is_clipboard_enabled;
|
2020-11-04 04:27:40 -05:00
|
|
|
gulong owner_changed_handler_id;
|
2020-11-04 09:03:16 -05:00
|
|
|
SelectionReadData *read_data;
|
2020-11-04 04:27:40 -05:00
|
|
|
unsigned int transfer_serial;
|
2020-11-04 10:09:42 -05:00
|
|
|
MetaSelectionSourceRemote *current_source;
|
|
|
|
GHashTable *transfer_requests;
|
|
|
|
guint transfer_request_timeout_id;
|
2023-08-29 14:31:30 -04:00
|
|
|
|
|
|
|
GHashTable *mapping_ids;
|
2023-08-30 15:37:44 -04:00
|
|
|
|
|
|
|
gulong monitors_changed_handler_id;
|
2017-06-21 02:23:44 -04:00
|
|
|
};
|
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
static void initable_init_iface (GInitableIface *iface);
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface);
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface);
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (MetaRemoteDesktopSession,
|
|
|
|
meta_remote_desktop_session,
|
|
|
|
META_DBUS_TYPE_REMOTE_DESKTOP_SESSION_SKELETON,
|
2022-03-11 03:39:07 -05:00
|
|
|
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
|
|
|
initable_init_iface)
|
2017-06-21 02:23:44 -04:00
|
|
|
G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_REMOTE_DESKTOP_SESSION,
|
|
|
|
meta_remote_desktop_session_init_iface)
|
|
|
|
G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION,
|
|
|
|
meta_dbus_session_init_iface))
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
struct _MetaRemoteDesktopSessionHandle
|
|
|
|
{
|
|
|
|
MetaRemoteAccessHandle parent;
|
|
|
|
|
|
|
|
MetaRemoteDesktopSession *session;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (MetaRemoteDesktopSessionHandle,
|
|
|
|
meta_remote_desktop_session_handle,
|
|
|
|
META_TYPE_REMOTE_ACCESS_HANDLE)
|
|
|
|
|
2023-08-30 15:37:44 -04:00
|
|
|
struct _MetaLogicalMonitorViewport
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define META_TYPE_LOGICAL_MONITOR_VIEWPORT (meta_logical_monitor_viewport_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (MetaLogicalMonitorViewport, meta_logical_monitor_viewport,
|
|
|
|
META, LOGICAL_MONITOR_VIEWPORT,
|
|
|
|
GObject)
|
|
|
|
|
|
|
|
static void meta_eis_viewport_init_iface (MetaEisViewportInterface *iface);
|
|
|
|
|
|
|
|
G_DEFINE_FINAL_TYPE_WITH_CODE (MetaLogicalMonitorViewport,
|
|
|
|
meta_logical_monitor_viewport,
|
|
|
|
G_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (META_TYPE_EIS_VIEWPORT,
|
|
|
|
meta_eis_viewport_init_iface))
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
static MetaRemoteDesktopSessionHandle *
|
|
|
|
meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session);
|
|
|
|
|
2023-08-30 15:37:44 -04:00
|
|
|
static gboolean
|
|
|
|
meta_logical_monitor_viewport_is_standalone (MetaEisViewport *viewport)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
meta_logical_monitor_viewport_get_mapping_id (MetaEisViewport *viewport)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_logical_monitor_viewport_get_position (MetaEisViewport *viewport,
|
|
|
|
int *out_x,
|
|
|
|
int *out_y)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorViewport *logical_monitor_viewport =
|
|
|
|
META_LOGICAL_MONITOR_VIEWPORT (viewport);
|
|
|
|
MtkRectangle layout;
|
|
|
|
|
|
|
|
layout = meta_logical_monitor_get_layout (logical_monitor_viewport->logical_monitor);
|
|
|
|
*out_x = layout.x;
|
|
|
|
*out_y = layout.y;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_logical_monitor_viewport_get_size (MetaEisViewport *viewport,
|
|
|
|
int *out_width,
|
|
|
|
int *out_height)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorViewport *logical_monitor_viewport =
|
|
|
|
META_LOGICAL_MONITOR_VIEWPORT (viewport);
|
|
|
|
MtkRectangle layout;
|
|
|
|
|
|
|
|
layout = meta_logical_monitor_get_layout (logical_monitor_viewport->logical_monitor);
|
|
|
|
*out_width = layout.width;
|
|
|
|
*out_height = layout.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
static double
|
|
|
|
meta_logical_monitor_viewport_get_physical_scale (MetaEisViewport *viewport)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorViewport *logical_monitor_viewport =
|
|
|
|
META_LOGICAL_MONITOR_VIEWPORT (viewport);
|
|
|
|
|
|
|
|
return meta_logical_monitor_get_scale (logical_monitor_viewport->logical_monitor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_logical_monitor_viewport_transform_coordinate (MetaEisViewport *viewport,
|
|
|
|
double x,
|
|
|
|
double y,
|
|
|
|
double *out_x,
|
|
|
|
double *out_y)
|
|
|
|
{
|
|
|
|
*out_x = x;
|
|
|
|
*out_y = y;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_eis_viewport_init_iface (MetaEisViewportInterface *eis_viewport_iface)
|
|
|
|
{
|
|
|
|
eis_viewport_iface->is_standalone = meta_logical_monitor_viewport_is_standalone;
|
|
|
|
eis_viewport_iface->get_mapping_id = meta_logical_monitor_viewport_get_mapping_id;
|
|
|
|
eis_viewport_iface->get_position = meta_logical_monitor_viewport_get_position;
|
|
|
|
eis_viewport_iface->get_size = meta_logical_monitor_viewport_get_size;
|
|
|
|
eis_viewport_iface->get_physical_scale = meta_logical_monitor_viewport_get_physical_scale;
|
|
|
|
eis_viewport_iface->transform_coordinate = meta_logical_monitor_viewport_transform_coordinate;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_logical_monitor_viewport_class_init (MetaLogicalMonitorViewportClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_logical_monitor_viewport_init (MetaLogicalMonitorViewport *logical_monitor_viewport)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaLogicalMonitorViewport *
|
|
|
|
meta_logical_monitor_viewport_new (MetaLogicalMonitor *logical_monitor)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorViewport *logical_monitor_viewport;
|
|
|
|
|
|
|
|
logical_monitor_viewport = g_object_new (META_TYPE_LOGICAL_MONITOR_VIEWPORT,
|
|
|
|
NULL);
|
|
|
|
logical_monitor_viewport->logical_monitor = logical_monitor;
|
|
|
|
|
|
|
|
return logical_monitor_viewport;
|
|
|
|
}
|
|
|
|
|
2022-05-27 13:35:01 -04:00
|
|
|
static MetaDisplay *
|
|
|
|
display_from_session (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2022-03-11 03:39:07 -05:00
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaContext *context = meta_backend_get_context (backend);
|
|
|
|
|
|
|
|
return meta_context_get_display (context);
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static gboolean
|
|
|
|
meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2021-03-24 03:35:07 -04:00
|
|
|
return !!session->started;
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
static void
|
|
|
|
init_remote_access_handle (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2022-03-11 03:39:07 -05:00
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
2018-07-20 10:37:37 -04:00
|
|
|
MetaRemoteAccessController *remote_access_controller;
|
|
|
|
MetaRemoteAccessHandle *remote_access_handle;
|
|
|
|
|
|
|
|
session->handle = meta_remote_desktop_session_handle_new (session);
|
|
|
|
|
|
|
|
remote_access_controller = meta_backend_get_remote_access_controller (backend);
|
|
|
|
remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
|
meta_remote_access_controller_notify_new_handle (remote_access_controller,
|
|
|
|
remote_access_handle);
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
static void
|
|
|
|
ensure_virtual_device (MetaRemoteDesktopSession *session,
|
|
|
|
ClutterInputDeviceType device_type)
|
|
|
|
{
|
2022-03-11 03:39:07 -05:00
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
2021-03-24 03:35:07 -04:00
|
|
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
|
|
|
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
2021-05-07 09:01:44 -04:00
|
|
|
ClutterVirtualInputDevice **virtual_device_ptr = NULL;
|
2021-03-24 03:35:07 -04:00
|
|
|
|
|
|
|
switch (device_type)
|
|
|
|
{
|
|
|
|
case CLUTTER_POINTER_DEVICE:
|
2021-05-07 09:01:44 -04:00
|
|
|
virtual_device_ptr = &session->virtual_pointer;
|
2021-03-24 03:35:07 -04:00
|
|
|
break;
|
|
|
|
case CLUTTER_KEYBOARD_DEVICE:
|
2021-05-07 09:01:44 -04:00
|
|
|
virtual_device_ptr = &session->virtual_keyboard;
|
2021-03-24 03:35:07 -04:00
|
|
|
break;
|
|
|
|
case CLUTTER_TOUCHSCREEN_DEVICE:
|
2021-05-07 09:01:44 -04:00
|
|
|
virtual_device_ptr = &session->virtual_touchscreen;
|
2021-03-24 03:35:07 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
2021-05-07 09:01:44 -04:00
|
|
|
|
|
|
|
g_assert (virtual_device_ptr);
|
|
|
|
|
|
|
|
if (*virtual_device_ptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
*virtual_device_ptr = clutter_seat_create_virtual_device (seat, device_type);
|
2021-03-24 03:35:07 -04:00
|
|
|
}
|
|
|
|
|
2023-09-04 05:46:43 -04:00
|
|
|
static void
|
|
|
|
on_stream_is_configured (MetaScreenCastStream *stream,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (stream,
|
|
|
|
on_stream_is_configured,
|
|
|
|
session);
|
|
|
|
|
|
|
|
g_return_if_fail (meta_screen_cast_stream_is_configured (stream));
|
|
|
|
|
|
|
|
meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream));
|
|
|
|
}
|
|
|
|
|
2023-08-28 17:13:16 -04:00
|
|
|
static void
|
|
|
|
on_stream_added (MetaScreenCastSession *screen_cast_session,
|
|
|
|
MetaScreenCastStream *stream,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2023-09-04 05:46:43 -04:00
|
|
|
if (meta_screen_cast_stream_is_configured (stream))
|
|
|
|
{
|
|
|
|
meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_signal_connect (stream, "notify::is-configured",
|
|
|
|
G_CALLBACK (on_stream_is_configured), session);
|
|
|
|
}
|
2023-08-28 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_stream_removed (MetaScreenCastSession *screen_cast_session,
|
|
|
|
MetaScreenCastStream *stream,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2023-09-04 05:46:43 -04:00
|
|
|
if (g_signal_handlers_disconnect_by_func (stream,
|
|
|
|
on_stream_is_configured,
|
|
|
|
session) == 0)
|
|
|
|
meta_eis_remove_viewport (session->eis, META_EIS_VIEWPORT (stream));
|
2023-08-28 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2023-08-30 15:37:44 -04:00
|
|
|
static void
|
|
|
|
add_logical_monitor_viewports (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
GList *logical_monitors;
|
|
|
|
GList *l;
|
|
|
|
GList *viewports = NULL;
|
|
|
|
|
|
|
|
logical_monitors =
|
|
|
|
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
|
|
|
for (l = logical_monitors; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
|
|
|
MetaLogicalMonitorViewport *logical_monitor_viewport;
|
|
|
|
|
|
|
|
logical_monitor_viewport =
|
|
|
|
meta_logical_monitor_viewport_new (logical_monitor);
|
|
|
|
viewports = g_list_append (viewports, logical_monitor_viewport);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_eis_remove_all_viewports (session->eis);
|
|
|
|
meta_eis_take_viewports (session->eis, viewports);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_monitors_changed (MetaMonitorManager *monitor_manager,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
add_logical_monitor_viewports (session);
|
|
|
|
}
|
|
|
|
|
2023-08-28 17:13:16 -04:00
|
|
|
static void
|
|
|
|
initialize_viewports (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
if (session->screen_cast_session)
|
|
|
|
{
|
|
|
|
GList *streams;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
streams =
|
|
|
|
meta_screen_cast_session_peek_streams (session->screen_cast_session);
|
|
|
|
for (l = streams; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (l->data);
|
|
|
|
|
|
|
|
meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_connect (session->screen_cast_session,
|
|
|
|
"stream-added",
|
|
|
|
G_CALLBACK (on_stream_added),
|
|
|
|
session);
|
|
|
|
g_signal_connect (session->screen_cast_session,
|
|
|
|
"stream-removed",
|
|
|
|
G_CALLBACK (on_stream_removed),
|
|
|
|
session);
|
|
|
|
}
|
2023-08-30 15:37:44 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
|
|
|
|
add_logical_monitor_viewports (session);
|
|
|
|
session->monitors_changed_handler_id =
|
|
|
|
g_signal_connect (monitor_manager, "monitors-changed",
|
|
|
|
G_CALLBACK (on_monitors_changed), session);
|
|
|
|
}
|
2023-08-28 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static gboolean
|
|
|
|
meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|
|
|
GError **error)
|
|
|
|
{
|
2020-05-16 04:44:04 -04:00
|
|
|
g_assert (!session->started);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
if (session->screen_cast_session)
|
|
|
|
{
|
|
|
|
if (!meta_screen_cast_session_start (session->screen_cast_session, error))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2023-08-28 17:13:16 -04:00
|
|
|
if (session->eis)
|
|
|
|
initialize_viewports (session);
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
init_remote_access_handle (session);
|
2020-05-16 04:44:04 -04:00
|
|
|
session->started = TRUE;
|
2018-07-20 10:37:37 -04:00
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-03-10 18:35:14 -05:00
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_close (MetaDbusSession *dbus_session)
|
2017-06-21 02:23:44 -04:00
|
|
|
{
|
2022-03-10 18:35:14 -05:00
|
|
|
MetaRemoteDesktopSession *session =
|
|
|
|
META_REMOTE_DESKTOP_SESSION (dbus_session);
|
2017-06-21 02:23:44 -04:00
|
|
|
MetaDBusRemoteDesktopSession *skeleton =
|
|
|
|
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
2023-08-30 15:37:44 -04:00
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2020-05-16 04:44:04 -04:00
|
|
|
session->started = FALSE;
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
if (session->screen_cast_session)
|
|
|
|
{
|
2022-03-10 18:35:14 -05:00
|
|
|
MetaDbusSession *screen_cast_session =
|
|
|
|
META_DBUS_SESSION (session->screen_cast_session);
|
|
|
|
|
2019-11-15 19:25:52 -05:00
|
|
|
g_clear_signal_handler (&session->screen_cast_session_closed_handler_id,
|
|
|
|
session->screen_cast_session);
|
2022-03-10 18:35:14 -05:00
|
|
|
meta_dbus_session_close (screen_cast_session);
|
2017-06-21 02:23:44 -04:00
|
|
|
session->screen_cast_session = NULL;
|
|
|
|
}
|
|
|
|
|
2023-08-30 15:37:44 -04:00
|
|
|
g_clear_signal_handler (&session->monitors_changed_handler_id,
|
|
|
|
monitor_manager);
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
g_clear_object (&session->virtual_pointer);
|
|
|
|
g_clear_object (&session->virtual_keyboard);
|
2018-11-19 05:49:41 -05:00
|
|
|
g_clear_object (&session->virtual_touchscreen);
|
2023-08-28 11:01:03 -04:00
|
|
|
g_clear_object (&session->eis);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
meta_dbus_session_notify_closed (META_DBUS_SESSION (session));
|
|
|
|
meta_dbus_remote_desktop_session_emit_closed (skeleton);
|
|
|
|
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (session));
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
if (session->handle)
|
|
|
|
{
|
|
|
|
MetaRemoteAccessHandle *remote_access_handle =
|
|
|
|
META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
|
|
|
|
|
meta_remote_access_handle_notify_stopped (remote_access_handle);
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
g_object_unref (session);
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2022-03-11 03:39:07 -05:00
|
|
|
meta_remote_desktop_session_get_object_path (MetaRemoteDesktopSession *session)
|
2017-06-21 02:23:44 -04:00
|
|
|
{
|
2022-03-11 03:39:07 -05:00
|
|
|
return session->object_path;
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_screen_cast_session_closed (MetaScreenCastSession *screen_cast_session,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
session->screen_cast_session = NULL;
|
2022-03-10 18:35:14 -05:00
|
|
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *session,
|
|
|
|
MetaScreenCastSession *screen_cast_session,
|
|
|
|
GError **error)
|
|
|
|
{
|
2023-08-28 17:13:16 -04:00
|
|
|
if (session->started)
|
|
|
|
{
|
|
|
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
|
"Remote desktop session already started");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
if (session->screen_cast_session)
|
|
|
|
{
|
|
|
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
|
"Remote desktop session already have an associated "
|
|
|
|
"screen cast session");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
session->screen_cast_session = screen_cast_session;
|
|
|
|
session->screen_cast_session_closed_handler_id =
|
|
|
|
g_signal_connect (screen_cast_session, "session-closed",
|
|
|
|
G_CALLBACK (on_screen_cast_session_closed),
|
|
|
|
session);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2023-08-29 14:31:30 -04:00
|
|
|
const char *
|
|
|
|
meta_remote_desktop_session_acquire_mapping_id (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
char *mapping_id;
|
|
|
|
|
|
|
|
mapping_id = g_uuid_string_random ();
|
|
|
|
if (g_hash_table_contains (session->mapping_ids, mapping_id))
|
|
|
|
{
|
|
|
|
g_free (mapping_id);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_add (session->mapping_ids, mapping_id);
|
|
|
|
return mapping_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-12 07:09:45 -04:00
|
|
|
void
|
|
|
|
meta_remote_desktop_session_release_mapping_id (MetaRemoteDesktopSession *session,
|
|
|
|
const char *mapping_id)
|
|
|
|
{
|
|
|
|
g_hash_table_remove (session->mapping_ids, mapping_id);
|
|
|
|
}
|
|
|
|
|
2017-08-25 03:19:53 -04:00
|
|
|
static gboolean
|
|
|
|
check_permission (MetaRemoteDesktopSession *session,
|
|
|
|
GDBusMethodInvocation *invocation)
|
|
|
|
{
|
|
|
|
return g_strcmp0 (session->peer_name,
|
|
|
|
g_dbus_method_invocation_get_sender (invocation)) == 0;
|
|
|
|
}
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
static gboolean
|
|
|
|
meta_remote_desktop_session_check_can_notify (MetaRemoteDesktopSession *session,
|
|
|
|
GDBusMethodInvocation *invocation)
|
|
|
|
{
|
|
|
|
if (!session->started)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Session not started");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!check_permission (session, invocation))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_ACCESS_DENIED,
|
|
|
|
"Permission denied");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static gboolean
|
|
|
|
handle_start (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
GError *error = NULL;
|
|
|
|
|
2020-05-16 04:44:04 -04:00
|
|
|
if (session->started)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Already started");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-08-25 03:19:53 -04:00
|
|
|
if (!check_permission (session, invocation))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_ACCESS_DENIED,
|
|
|
|
"Permission denied");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
if (!meta_remote_desktop_session_start (session, &error))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed to start remote desktop: %s",
|
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
|
2022-03-10 18:35:14 -05:00
|
|
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_start (skeleton, invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_stop (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
|
2020-05-16 04:44:04 -04:00
|
|
|
if (!session->started)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Session not started");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-08-25 03:19:53 -04:00
|
|
|
if (!check_permission (session, invocation))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_ACCESS_DENIED,
|
|
|
|
"Permission denied");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-03-10 18:35:14 -05:00
|
|
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_stop (skeleton, invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:38:13 -05:00
|
|
|
static gboolean
|
|
|
|
handle_notify_keyboard_keycode (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
unsigned int keycode,
|
|
|
|
gboolean pressed)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
ClutterKeyState state;
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:38:13 -05:00
|
|
|
|
|
|
|
if (pressed)
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
ensure_virtual_device (session, CLUTTER_KEYBOARD_DEVICE);
|
|
|
|
state = CLUTTER_KEY_STATE_PRESSED;
|
|
|
|
}
|
2018-01-29 01:38:13 -05:00
|
|
|
else
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
if (!session->virtual_keyboard)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid key event");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
state = CLUTTER_KEY_STATE_RELEASED;
|
|
|
|
}
|
2018-01-29 01:38:13 -05:00
|
|
|
|
|
|
|
clutter_virtual_input_device_notify_key (session->virtual_keyboard,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
keycode,
|
|
|
|
state);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_keyboard_keycode (skeleton,
|
|
|
|
invocation);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static gboolean
|
|
|
|
handle_notify_keyboard_keysym (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
unsigned int keysym,
|
|
|
|
gboolean pressed)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
ClutterKeyState state;
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2017-08-25 03:19:53 -04:00
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
if (pressed)
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
ensure_virtual_device (session, CLUTTER_KEYBOARD_DEVICE);
|
|
|
|
state = CLUTTER_KEY_STATE_PRESSED;
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
else
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
if (!session->virtual_keyboard)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid key event");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
state = CLUTTER_KEY_STATE_RELEASED;
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
clutter_virtual_input_device_notify_keyval (session->virtual_keyboard,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
keysym,
|
|
|
|
state);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_keyboard_keysym (skeleton,
|
|
|
|
invocation);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_notify_pointer_button (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
int button_code,
|
|
|
|
gboolean pressed)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
uint32_t button;
|
|
|
|
ClutterButtonState state;
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2017-08-25 03:19:53 -04:00
|
|
|
|
2023-10-11 09:30:35 -04:00
|
|
|
button = meta_evdev_button_to_clutter (button_code);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
if (pressed)
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
ensure_virtual_device (session, CLUTTER_POINTER_DEVICE);
|
|
|
|
state = CLUTTER_BUTTON_STATE_PRESSED;
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
else
|
2021-03-24 03:35:07 -04:00
|
|
|
{
|
|
|
|
if (!session->virtual_pointer)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid button event");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
state = CLUTTER_BUTTON_STATE_RELEASED;
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
clutter_virtual_input_device_notify_button (session->virtual_pointer,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
button,
|
|
|
|
state);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_pointer_button (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-12-15 04:34:43 -05:00
|
|
|
static gboolean
|
|
|
|
clutter_scroll_source_from_axis_flags (MetaRemoteDesktopNotifyAxisFlags axis_flags,
|
|
|
|
ClutterScrollSource *scroll_source)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopNotifyAxisFlags scroll_mask;
|
|
|
|
|
|
|
|
scroll_mask = META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_WHEEL |
|
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_FINGER |
|
|
|
|
META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_CONTINUOUS;
|
|
|
|
|
|
|
|
switch (axis_flags & scroll_mask)
|
|
|
|
{
|
|
|
|
case META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_WHEEL:
|
|
|
|
*scroll_source = CLUTTER_SCROLL_SOURCE_WHEEL;
|
|
|
|
return TRUE;
|
|
|
|
case META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_NONE:
|
|
|
|
case META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_FINGER:
|
|
|
|
*scroll_source = CLUTTER_SCROLL_SOURCE_FINGER;
|
|
|
|
return TRUE;
|
|
|
|
case META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_SOURCE_CONTINUOUS:
|
|
|
|
*scroll_source = CLUTTER_SCROLL_SOURCE_CONTINUOUS;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:40:28 -05:00
|
|
|
static gboolean
|
|
|
|
handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
double dx,
|
|
|
|
double dy,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
ClutterScrollFinishFlags finish_flags = CLUTTER_SCROLL_FINISHED_NONE;
|
2020-12-15 04:34:43 -05:00
|
|
|
ClutterScrollSource scroll_source;
|
2018-01-29 01:40:28 -05:00
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:40:28 -05:00
|
|
|
|
2020-12-15 04:34:43 -05:00
|
|
|
if (!clutter_scroll_source_from_axis_flags (flags, &scroll_source))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid scroll source");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:40:28 -05:00
|
|
|
if (flags & META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH)
|
|
|
|
{
|
|
|
|
finish_flags |= (CLUTTER_SCROLL_FINISHED_HORIZONTAL |
|
|
|
|
CLUTTER_SCROLL_FINISHED_VERTICAL);
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
ensure_virtual_device (session, CLUTTER_POINTER_DEVICE);
|
|
|
|
|
2018-01-29 01:40:28 -05:00
|
|
|
clutter_virtual_input_device_notify_scroll_continuous (session->virtual_pointer,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
dx, dy,
|
2020-12-15 04:34:43 -05:00
|
|
|
scroll_source,
|
2018-01-29 01:40:28 -05:00
|
|
|
finish_flags);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_pointer_axis (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static ClutterScrollDirection
|
|
|
|
discrete_steps_to_scroll_direction (unsigned int axis,
|
|
|
|
int steps)
|
|
|
|
{
|
|
|
|
if (axis == 0 && steps < 0)
|
|
|
|
return CLUTTER_SCROLL_UP;
|
|
|
|
if (axis == 0 && steps > 0)
|
|
|
|
return CLUTTER_SCROLL_DOWN;
|
|
|
|
if (axis == 1 && steps < 0)
|
|
|
|
return CLUTTER_SCROLL_LEFT;
|
|
|
|
if (axis == 1 && steps > 0)
|
|
|
|
return CLUTTER_SCROLL_RIGHT;
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
2019-01-24 18:47:44 -05:00
|
|
|
return 0;
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
unsigned int axis,
|
|
|
|
int steps)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
ClutterScrollDirection direction;
|
2018-01-29 01:28:07 -05:00
|
|
|
int step_count;
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2017-08-25 03:19:53 -04:00
|
|
|
|
2018-01-29 01:26:47 -05:00
|
|
|
if (axis > 1)
|
2017-06-21 02:23:44 -04:00
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid axis value");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (steps == 0)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid axis steps value");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
ensure_virtual_device (session, CLUTTER_POINTER_DEVICE);
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
/*
|
|
|
|
* We don't have the actual scroll source, but only know they should be
|
|
|
|
* considered as discrete steps. The device that produces such scroll events
|
|
|
|
* is the scroll wheel, so pretend that is the scroll source.
|
|
|
|
*/
|
|
|
|
direction = discrete_steps_to_scroll_direction (axis, steps);
|
2018-01-29 01:28:07 -05:00
|
|
|
|
|
|
|
for (step_count = 0; step_count < abs (steps); step_count++)
|
|
|
|
clutter_virtual_input_device_notify_discrete_scroll (session->virtual_pointer,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
direction,
|
|
|
|
CLUTTER_SCROLL_SOURCE_WHEEL);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:40:57 -05:00
|
|
|
static gboolean
|
|
|
|
handle_notify_pointer_motion_relative (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
double dx,
|
|
|
|
double dy)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:40:57 -05:00
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
ensure_virtual_device (session, CLUTTER_POINTER_DEVICE);
|
|
|
|
|
2018-01-29 01:40:57 -05:00
|
|
|
clutter_virtual_input_device_notify_relative_motion (session->virtual_pointer,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
dx, dy);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static gboolean
|
|
|
|
handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
const char *stream_path,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2018-01-29 01:42:48 -05:00
|
|
|
MetaScreenCastStream *stream;
|
|
|
|
double abs_x, abs_y;
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:42:48 -05:00
|
|
|
|
2020-06-29 09:01:55 -04:00
|
|
|
|
|
|
|
if (!session->screen_cast_session)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"No screen cast active");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:42:48 -05:00
|
|
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
|
|
|
stream_path);
|
|
|
|
if (!stream)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Unknown stream");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
ensure_virtual_device (session, CLUTTER_POINTER_DEVICE);
|
|
|
|
|
2021-01-30 17:52:00 -05:00
|
|
|
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
|
|
|
{
|
|
|
|
clutter_virtual_input_device_notify_absolute_motion (session->virtual_pointer,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
abs_x, abs_y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Dropping early absolute pointer motion (%f, %f)", x, y);
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:44:03 -05:00
|
|
|
static gboolean
|
|
|
|
handle_notify_touch_down (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
const char *stream_path,
|
|
|
|
unsigned int slot,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
MetaScreenCastStream *stream;
|
|
|
|
double abs_x, abs_y;
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:44:03 -05:00
|
|
|
|
2020-10-22 05:18:34 -04:00
|
|
|
if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Touch slot out of range");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-06-29 09:01:55 -04:00
|
|
|
if (!session->screen_cast_session)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"No screen cast active");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:44:03 -05:00
|
|
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
|
|
|
stream_path);
|
|
|
|
if (!stream)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Unknown stream");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
ensure_virtual_device (session, CLUTTER_TOUCHSCREEN_DEVICE);
|
|
|
|
|
2021-01-30 17:52:00 -05:00
|
|
|
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
|
|
|
{
|
|
|
|
clutter_virtual_input_device_notify_touch_down (session->virtual_touchscreen,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
slot,
|
|
|
|
abs_x, abs_y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Dropping early touch down (%f, %f)", x, y);
|
|
|
|
}
|
2018-01-29 01:44:03 -05:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_touch_down (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
const char *stream_path,
|
|
|
|
unsigned int slot,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
MetaScreenCastStream *stream;
|
|
|
|
double abs_x, abs_y;
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:44:03 -05:00
|
|
|
|
2020-06-29 09:01:55 -04:00
|
|
|
|
2020-10-22 05:18:34 -04:00
|
|
|
if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Touch slot out of range");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-06-29 09:01:55 -04:00
|
|
|
if (!session->screen_cast_session)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"No screen cast active");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:44:03 -05:00
|
|
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
|
|
|
stream_path);
|
|
|
|
if (!stream)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Unknown stream");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
if (!session->virtual_touchscreen)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid touch point");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-01-30 17:52:00 -05:00
|
|
|
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
|
|
|
{
|
|
|
|
clutter_virtual_input_device_notify_touch_motion (session->virtual_touchscreen,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
slot,
|
|
|
|
abs_x, abs_y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Dropping early touch motion (%f, %f)", x, y);
|
|
|
|
}
|
2018-01-29 01:44:03 -05:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_touch_motion (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
2020-10-22 05:18:34 -04:00
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
unsigned int slot)
|
2018-01-29 01:44:03 -05:00
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
|
2020-05-16 04:46:57 -04:00
|
|
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
|
|
|
return TRUE;
|
2018-01-29 01:44:03 -05:00
|
|
|
|
2020-10-22 05:18:34 -04:00
|
|
|
if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Touch slot out of range");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-24 03:35:07 -04:00
|
|
|
if (!session->virtual_touchscreen)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid touch point");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-01-29 01:44:03 -05:00
|
|
|
clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
|
|
|
|
CLUTTER_CURRENT_TIME,
|
|
|
|
slot);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_notify_touch_up (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
static MetaSelectionSourceRemote *
|
|
|
|
create_remote_desktop_source (MetaRemoteDesktopSession *session,
|
|
|
|
GVariant *mime_types_variant,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
GVariantIter iter;
|
|
|
|
char *mime_type;
|
|
|
|
GList *mime_types = NULL;
|
|
|
|
|
|
|
|
g_variant_iter_init (&iter, mime_types_variant);
|
|
|
|
if (g_variant_iter_n_children (&iter) == 0)
|
|
|
|
{
|
|
|
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
|
|
|
"No mime types in mime types list");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (g_variant_iter_next (&iter, "s", &mime_type))
|
|
|
|
mime_types = g_list_prepend (mime_types, mime_type);
|
|
|
|
|
|
|
|
mime_types = g_list_reverse (mime_types);
|
|
|
|
|
|
|
|
return meta_selection_source_remote_new (session, mime_types);
|
|
|
|
}
|
|
|
|
|
2020-11-04 04:27:40 -05:00
|
|
|
static const char *
|
|
|
|
mime_types_to_string (char **formats,
|
|
|
|
char *buf,
|
|
|
|
int buf_len)
|
|
|
|
{
|
|
|
|
g_autofree char *mime_types_string = NULL;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!formats)
|
|
|
|
return "N\\A";
|
|
|
|
|
|
|
|
mime_types_string = g_strjoinv (",", formats);
|
|
|
|
len = strlen (mime_types_string);
|
|
|
|
strncpy (buf, mime_types_string, buf_len - 1);
|
|
|
|
if (len >= buf_len - 1)
|
|
|
|
buf[buf_len - 2] = '*';
|
|
|
|
buf[buf_len - 1] = '\0';
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
static gboolean
|
|
|
|
is_own_source (MetaRemoteDesktopSession *session,
|
|
|
|
MetaSelectionSource *source)
|
|
|
|
{
|
|
|
|
return source && source == META_SELECTION_SOURCE (session->current_source);
|
|
|
|
}
|
|
|
|
|
2020-11-04 04:27:40 -05:00
|
|
|
static GVariant *
|
2020-11-04 10:09:42 -05:00
|
|
|
generate_owner_changed_variant (char **mime_types_array,
|
|
|
|
gboolean is_own_source)
|
2020-11-04 04:27:40 -05:00
|
|
|
{
|
|
|
|
GVariantBuilder builder;
|
|
|
|
|
|
|
|
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
|
|
|
if (mime_types_array)
|
|
|
|
{
|
|
|
|
g_variant_builder_add (&builder, "{sv}", "mime-types",
|
|
|
|
g_variant_new ("(^as)", mime_types_array));
|
2020-11-04 10:09:42 -05:00
|
|
|
g_variant_builder_add (&builder, "{sv}", "session-is-owner",
|
|
|
|
g_variant_new_boolean (is_own_source));
|
2020-11-04 04:27:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return g_variant_builder_end (&builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-11-19 08:29:05 -05:00
|
|
|
emit_owner_changed (MetaRemoteDesktopSession *session,
|
|
|
|
MetaSelectionSource *owner)
|
2020-11-04 04:27:40 -05:00
|
|
|
{
|
|
|
|
char log_buf[255];
|
|
|
|
g_autofree char **mime_types_array = NULL;
|
|
|
|
GList *l;
|
|
|
|
int i;
|
|
|
|
GVariant *options_variant;
|
|
|
|
const char *object_path;
|
|
|
|
|
|
|
|
if (owner)
|
|
|
|
{
|
|
|
|
GList *mime_types;
|
|
|
|
|
2020-11-19 08:29:05 -05:00
|
|
|
mime_types = meta_selection_source_get_mimetypes (owner);
|
2020-11-04 04:27:40 -05:00
|
|
|
mime_types_array = g_new0 (char *, g_list_length (mime_types) + 1);
|
|
|
|
for (l = meta_selection_source_get_mimetypes (owner), i = 0;
|
|
|
|
l;
|
|
|
|
l = l->next, i++)
|
|
|
|
mime_types_array[i] = l->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
2020-11-04 10:09:42 -05:00
|
|
|
"Clipboard owner changed, owner: %p (%s, is own? %s), mime types: [%s], "
|
2020-11-04 04:27:40 -05:00
|
|
|
"notifying %s",
|
|
|
|
owner,
|
|
|
|
owner ? g_type_name_from_instance ((GTypeInstance *) owner)
|
|
|
|
: "NULL",
|
2020-11-04 10:09:42 -05:00
|
|
|
is_own_source (session, owner) ? "yes" : "no",
|
2020-11-04 04:27:40 -05:00
|
|
|
mime_types_to_string (mime_types_array, log_buf,
|
|
|
|
G_N_ELEMENTS (log_buf)),
|
|
|
|
session->peer_name);
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
options_variant =
|
|
|
|
generate_owner_changed_variant (mime_types_array,
|
|
|
|
is_own_source (session, owner));
|
2020-11-04 04:27:40 -05:00
|
|
|
|
|
|
|
object_path = g_dbus_interface_skeleton_get_object_path (
|
|
|
|
G_DBUS_INTERFACE_SKELETON (session));
|
|
|
|
g_dbus_connection_emit_signal (session->connection,
|
|
|
|
NULL,
|
|
|
|
object_path,
|
|
|
|
"org.gnome.Mutter.RemoteDesktop.Session",
|
|
|
|
"SelectionOwnerChanged",
|
|
|
|
g_variant_new ("(@a{sv})", options_variant),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2020-11-19 08:29:05 -05:00
|
|
|
static void
|
|
|
|
on_selection_owner_changed (MetaSelection *selection,
|
|
|
|
MetaSelectionType selection_type,
|
|
|
|
MetaSelectionSource *owner,
|
|
|
|
MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
if (selection_type != META_SELECTION_CLIPBOARD)
|
|
|
|
return;
|
|
|
|
|
|
|
|
emit_owner_changed (session, owner);
|
|
|
|
}
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
static gboolean
|
|
|
|
handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
GVariant *arg_options)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2020-11-04 10:09:42 -05:00
|
|
|
GVariant *mime_types_variant;
|
|
|
|
g_autoptr (GError) error = NULL;
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 04:27:40 -05:00
|
|
|
MetaSelection *selection = meta_display_get_selection (display);
|
2020-11-19 08:29:05 -05:00
|
|
|
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Enable clipboard for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
if (session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Already enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
mime_types_variant = g_variant_lookup_value (arg_options,
|
|
|
|
"mime-types",
|
|
|
|
G_VARIANT_TYPE_STRING_ARRAY);
|
|
|
|
if (mime_types_variant)
|
|
|
|
{
|
|
|
|
source_remote = create_remote_desktop_source (session,
|
|
|
|
mime_types_variant,
|
|
|
|
&error);
|
|
|
|
if (!source_remote)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid mime type list: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-11-19 08:29:05 -05:00
|
|
|
}
|
2020-11-04 10:09:42 -05:00
|
|
|
|
2020-11-19 08:29:05 -05:00
|
|
|
if (source_remote)
|
|
|
|
{
|
2020-11-04 10:09:42 -05:00
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Setting remote desktop clipboard source: %p from %s",
|
|
|
|
source_remote, session->peer_name);
|
|
|
|
|
|
|
|
g_set_object (&session->current_source, source_remote);
|
|
|
|
meta_selection_set_owner (selection,
|
|
|
|
META_SELECTION_CLIPBOARD,
|
|
|
|
META_SELECTION_SOURCE (source_remote));
|
|
|
|
}
|
2020-11-19 08:29:05 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaSelectionSource *owner;
|
|
|
|
|
|
|
|
owner = meta_selection_get_current_owner (selection,
|
|
|
|
META_SELECTION_CLIPBOARD);
|
|
|
|
|
|
|
|
if (owner)
|
|
|
|
emit_owner_changed (session, owner);
|
|
|
|
}
|
2020-11-04 10:09:42 -05:00
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
session->is_clipboard_enabled = TRUE;
|
2020-11-04 04:27:40 -05:00
|
|
|
session->owner_changed_handler_id =
|
|
|
|
g_signal_connect (selection, "owner-changed",
|
|
|
|
G_CALLBACK (on_selection_owner_changed),
|
|
|
|
session);
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_enable_clipboard (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
static gboolean
|
|
|
|
cancel_transfer_request (gpointer key,
|
|
|
|
gpointer value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GTask *task = G_TASK (value);
|
|
|
|
MetaRemoteDesktopSession *session = user_data;
|
|
|
|
|
|
|
|
meta_selection_source_remote_cancel_transfer (session->current_source,
|
|
|
|
task);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_cancel_transfer_requests (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
g_return_if_fail (session->current_source);
|
|
|
|
|
|
|
|
g_hash_table_foreach_remove (session->transfer_requests,
|
|
|
|
cancel_transfer_request,
|
|
|
|
session);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2023-08-09 19:44:52 -04:00
|
|
|
transfer_request_cleanup_timeout (gpointer user_data)
|
2020-11-04 10:09:42 -05:00
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = user_data;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Cancel unanswered SelectionTransfer requests for %s, "
|
|
|
|
"waited for %.02f seconds already",
|
|
|
|
session->peer_name,
|
|
|
|
TRANSFER_REQUEST_CLEANUP_TIMEOUT_MS / 1000.0);
|
|
|
|
|
|
|
|
meta_remote_desktop_session_cancel_transfer_requests (session);
|
|
|
|
|
|
|
|
session->transfer_request_timeout_id = 0;
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reset_current_selection_source (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 10:09:42 -05:00
|
|
|
MetaSelection *selection = meta_display_get_selection (display);
|
|
|
|
|
|
|
|
if (!session->current_source)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_selection_unset_owner (selection,
|
|
|
|
META_SELECTION_CLIPBOARD,
|
|
|
|
META_SELECTION_SOURCE (session->current_source));
|
|
|
|
meta_remote_desktop_session_cancel_transfer_requests (session);
|
|
|
|
g_clear_handle_id (&session->transfer_request_timeout_id, g_source_remove);
|
|
|
|
g_clear_object (&session->current_source);
|
|
|
|
}
|
|
|
|
|
2020-11-04 09:03:16 -05:00
|
|
|
static void
|
|
|
|
cancel_selection_read (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
if (!session->read_data)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_cancellable_cancel (session->read_data->cancellable);
|
|
|
|
session->read_data->session = NULL;
|
|
|
|
session->read_data = NULL;
|
|
|
|
}
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
static gboolean
|
|
|
|
handle_disable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 04:27:40 -05:00
|
|
|
MetaSelection *selection = meta_display_get_selection (display);
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Disable clipboard for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
if (!session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Was not enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 04:27:40 -05:00
|
|
|
g_clear_signal_handler (&session->owner_changed_handler_id, selection);
|
2020-11-04 10:09:42 -05:00
|
|
|
reset_current_selection_source (session);
|
2020-11-04 09:03:16 -05:00
|
|
|
cancel_selection_read (session);
|
2020-11-04 04:27:40 -05:00
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
meta_dbus_remote_desktop_session_complete_disable_clipboard (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_set_selection (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
GVariant *arg_options)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2020-11-04 10:09:42 -05:00
|
|
|
g_autoptr (GVariant) mime_types_variant = NULL;
|
|
|
|
g_autoptr (GError) error = NULL;
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
if (!session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Clipboard not enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
if (session->current_source)
|
|
|
|
{
|
|
|
|
meta_remote_desktop_session_cancel_transfer_requests (session);
|
|
|
|
g_clear_handle_id (&session->transfer_request_timeout_id,
|
|
|
|
g_source_remove);
|
|
|
|
}
|
|
|
|
|
|
|
|
mime_types_variant = g_variant_lookup_value (arg_options,
|
|
|
|
"mime-types",
|
|
|
|
G_VARIANT_TYPE_STRING_ARRAY);
|
|
|
|
if (mime_types_variant)
|
|
|
|
{
|
|
|
|
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 10:09:42 -05:00
|
|
|
|
|
|
|
source_remote = create_remote_desktop_source (session,
|
|
|
|
mime_types_variant,
|
|
|
|
&error);
|
|
|
|
if (!source_remote)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Invalid format list: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Set selection for %s to %p",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation),
|
|
|
|
source_remote);
|
|
|
|
|
|
|
|
g_set_object (&session->current_source, source_remote);
|
|
|
|
meta_selection_set_owner (meta_display_get_selection (display),
|
|
|
|
META_SELECTION_CLIPBOARD,
|
|
|
|
META_SELECTION_SOURCE (source_remote));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Unset selection for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
reset_current_selection_source (session);
|
|
|
|
}
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
meta_dbus_remote_desktop_session_complete_set_selection (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
static void
|
|
|
|
reset_transfer_cleanup_timeout (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
g_clear_handle_id (&session->transfer_request_timeout_id, g_source_remove);
|
|
|
|
session->transfer_request_timeout_id =
|
|
|
|
g_timeout_add (TRANSFER_REQUEST_CLEANUP_TIMEOUT_MS,
|
2023-08-09 19:44:52 -04:00
|
|
|
transfer_request_cleanup_timeout,
|
2020-11-04 10:09:42 -05:00
|
|
|
session);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_remote_desktop_session_request_transfer (MetaRemoteDesktopSession *session,
|
|
|
|
const char *mime_type,
|
|
|
|
GTask *task)
|
|
|
|
{
|
|
|
|
const char *object_path;
|
|
|
|
|
|
|
|
session->transfer_serial++;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Emit SelectionTransfer ('%s', %u) for %s",
|
|
|
|
mime_type,
|
|
|
|
session->transfer_serial,
|
|
|
|
session->peer_name);
|
|
|
|
|
|
|
|
g_hash_table_insert (session->transfer_requests,
|
|
|
|
GUINT_TO_POINTER (session->transfer_serial),
|
|
|
|
task);
|
|
|
|
reset_transfer_cleanup_timeout (session);
|
|
|
|
|
|
|
|
object_path = g_dbus_interface_skeleton_get_object_path (
|
|
|
|
G_DBUS_INTERFACE_SKELETON (session));
|
|
|
|
g_dbus_connection_emit_signal (session->connection,
|
|
|
|
NULL,
|
|
|
|
object_path,
|
|
|
|
"org.gnome.Mutter.RemoteDesktop.Session",
|
|
|
|
"SelectionTransfer",
|
|
|
|
g_variant_new ("(su)",
|
|
|
|
mime_type,
|
|
|
|
session->transfer_serial),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
static gboolean
|
|
|
|
handle_selection_write (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
2020-11-04 10:09:42 -05:00
|
|
|
GUnixFDList *fd_list_in,
|
2020-10-13 11:38:42 -04:00
|
|
|
unsigned int serial)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2020-11-04 10:09:42 -05:00
|
|
|
g_autoptr (GError) error = NULL;
|
|
|
|
int pipe_fds[2];
|
|
|
|
g_autoptr (GUnixFDList) fd_list = NULL;
|
|
|
|
int fd_idx;
|
|
|
|
GVariant *fd_variant;
|
|
|
|
GTask *task;
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Write selection for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
if (!session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Clipboard not enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
if (!session->current_source)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"No current selection owned");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_hash_table_steal_extended (session->transfer_requests,
|
|
|
|
GUINT_TO_POINTER (serial),
|
|
|
|
NULL,
|
|
|
|
(gpointer *) &task))
|
2020-11-04 04:27:40 -05:00
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
2020-11-04 10:09:42 -05:00
|
|
|
"Transfer serial %u doesn't match "
|
|
|
|
"any transfer request",
|
|
|
|
serial);
|
2020-11-04 04:27:40 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
if (!g_unix_open_pipe (pipe_fds, FD_CLOEXEC, &error))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed open pipe: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_unix_set_fd_nonblocking (pipe_fds[0], TRUE, &error))
|
|
|
|
{
|
|
|
|
close (pipe_fds[0]);
|
|
|
|
close (pipe_fds[1]);
|
|
|
|
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed to make pipe non-blocking: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd_list = g_unix_fd_list_new ();
|
|
|
|
|
|
|
|
fd_idx = g_unix_fd_list_append (fd_list, pipe_fds[1], NULL);
|
|
|
|
close (pipe_fds[1]);
|
|
|
|
fd_variant = g_variant_new_handle (fd_idx);
|
|
|
|
|
|
|
|
meta_selection_source_remote_complete_transfer (session->current_source,
|
|
|
|
pipe_fds[0],
|
|
|
|
task);
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
meta_dbus_remote_desktop_session_complete_selection_write (skeleton,
|
|
|
|
invocation,
|
2020-11-04 10:09:42 -05:00
|
|
|
fd_list,
|
|
|
|
fd_variant);
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_selection_write_done (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
unsigned int arg_serial,
|
|
|
|
gboolean arg_success)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Write selection done for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
if (!session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Clipboard not enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_selection_write_done (skeleton,
|
|
|
|
invocation);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-05-25 05:07:40 -04:00
|
|
|
static gboolean
|
|
|
|
is_pipe_broken (int fd)
|
|
|
|
{
|
|
|
|
GPollFD poll_fd = {0};
|
|
|
|
int poll_ret;
|
|
|
|
int errsv;
|
|
|
|
|
|
|
|
poll_fd.fd = fd;
|
|
|
|
poll_fd.events = G_IO_OUT;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
poll_ret = g_poll (&poll_fd, 1, 0);
|
|
|
|
errsv = errno;
|
|
|
|
}
|
|
|
|
while (poll_ret == -1 && errsv == EINTR);
|
|
|
|
|
|
|
|
if (poll_ret < 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return !!(poll_fd.revents & G_IO_ERR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
has_pending_read_operation (SelectionReadData *read_data)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if (!read_data)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
fd = g_unix_output_stream_get_fd (G_UNIX_OUTPUT_STREAM (read_data->stream));
|
|
|
|
if (is_pipe_broken (fd))
|
|
|
|
{
|
|
|
|
cancel_selection_read (read_data->session);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 09:03:16 -05:00
|
|
|
static void
|
|
|
|
transfer_cb (MetaSelection *selection,
|
|
|
|
GAsyncResult *res,
|
|
|
|
SelectionReadData *read_data)
|
|
|
|
{
|
|
|
|
g_autoptr (GError) error = NULL;
|
|
|
|
|
|
|
|
if (!meta_selection_transfer_finish (selection, res, &error))
|
|
|
|
{
|
|
|
|
g_warning ("Could not fetch selection data "
|
|
|
|
"for remote desktop session: %s",
|
|
|
|
error->message);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_data->session)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP, "Finished selection transfer for %s",
|
|
|
|
read_data->session->peer_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_output_stream_close (read_data->stream, NULL, NULL);
|
|
|
|
g_clear_object (&read_data->stream);
|
|
|
|
g_clear_object (&read_data->cancellable);
|
|
|
|
|
|
|
|
if (read_data->session)
|
|
|
|
read_data->session->read_data = NULL;
|
|
|
|
|
|
|
|
g_free (read_data);
|
|
|
|
}
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
static gboolean
|
|
|
|
handle_selection_read (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
2020-11-04 09:03:16 -05:00
|
|
|
GUnixFDList *fd_list_in,
|
2020-10-13 11:38:42 -04:00
|
|
|
const char *mime_type)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 09:03:16 -05:00
|
|
|
MetaSelection *selection = meta_display_get_selection (display);
|
|
|
|
MetaSelectionSource *source;
|
|
|
|
g_autoptr (GError) error = NULL;
|
|
|
|
int pipe_fds[2];
|
|
|
|
g_autoptr (GUnixFDList) fd_list = NULL;
|
|
|
|
int fd_idx;
|
|
|
|
GVariant *fd_variant;
|
|
|
|
SelectionReadData *read_data;
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
|
|
|
"Read selection for %s",
|
|
|
|
g_dbus_method_invocation_get_sender (invocation));
|
|
|
|
|
|
|
|
if (!session->is_clipboard_enabled)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Clipboard not enabled");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 09:03:16 -05:00
|
|
|
source = meta_selection_get_current_owner (selection,
|
|
|
|
META_SELECTION_CLIPBOARD);
|
|
|
|
if (!source)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FILE_NOT_FOUND,
|
|
|
|
"No selection owner available");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:09:42 -05:00
|
|
|
if (is_own_source (session, source))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Tried to read own selection");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-05-25 05:07:40 -04:00
|
|
|
if (has_pending_read_operation (session->read_data))
|
2020-11-04 09:03:16 -05:00
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_LIMITS_EXCEEDED,
|
|
|
|
"Tried to read in parallel");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_unix_open_pipe (pipe_fds, FD_CLOEXEC, &error))
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed open pipe: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_unix_set_fd_nonblocking (pipe_fds[0], TRUE, &error))
|
|
|
|
{
|
|
|
|
close (pipe_fds[0]);
|
|
|
|
close (pipe_fds[1]);
|
|
|
|
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed to make pipe non-blocking: %s",
|
|
|
|
error->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd_list = g_unix_fd_list_new ();
|
|
|
|
|
|
|
|
fd_idx = g_unix_fd_list_append (fd_list, pipe_fds[0], NULL);
|
|
|
|
close (pipe_fds[0]);
|
|
|
|
fd_variant = g_variant_new_handle (fd_idx);
|
|
|
|
|
|
|
|
session->read_data = read_data = g_new0 (SelectionReadData, 1);
|
|
|
|
read_data->session = session;
|
|
|
|
read_data->stream = g_unix_output_stream_new (pipe_fds[1], TRUE);
|
|
|
|
read_data->cancellable = g_cancellable_new ();
|
|
|
|
meta_selection_transfer_async (selection,
|
|
|
|
META_SELECTION_CLIPBOARD,
|
|
|
|
mime_type,
|
|
|
|
-1,
|
|
|
|
read_data->stream,
|
|
|
|
read_data->cancellable,
|
|
|
|
(GAsyncReadyCallback) transfer_cb,
|
|
|
|
read_data);
|
|
|
|
|
2020-10-13 11:38:42 -04:00
|
|
|
meta_dbus_remote_desktop_session_complete_selection_read (skeleton,
|
|
|
|
invocation,
|
2020-11-04 09:03:16 -05:00
|
|
|
fd_list,
|
|
|
|
fd_variant);
|
2020-10-13 11:38:42 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2023-08-28 11:21:35 -04:00
|
|
|
static MetaEisDeviceTypes
|
|
|
|
device_types_to_eis_device_types (MetaRemoteDesktopDeviceTypes device_types)
|
|
|
|
{
|
|
|
|
MetaEisDeviceTypes eis_device_types = META_EIS_DEVICE_TYPE_NONE;
|
|
|
|
|
|
|
|
if (device_types & META_REMOTE_DESKTOP_DEVICE_TYPE_KEYBOARD)
|
|
|
|
eis_device_types |= META_EIS_DEVICE_TYPE_KEYBOARD;
|
|
|
|
if (device_types & META_REMOTE_DESKTOP_DEVICE_TYPE_POINTER)
|
|
|
|
eis_device_types |= META_EIS_DEVICE_TYPE_POINTER;
|
|
|
|
if (device_types & META_REMOTE_DESKTOP_DEVICE_TYPE_TOUCHSCREEN)
|
|
|
|
eis_device_types |= META_EIS_DEVICE_TYPE_TOUCHSCREEN;
|
|
|
|
|
|
|
|
return eis_device_types;
|
|
|
|
}
|
|
|
|
|
2022-09-28 11:54:02 -04:00
|
|
|
static gboolean
|
|
|
|
handle_connect_to_eis (MetaDBusRemoteDesktopSession *skeleton,
|
|
|
|
GDBusMethodInvocation *invocation,
|
|
|
|
GUnixFDList *fd_list_in,
|
|
|
|
GVariant *arg_options)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
|
|
|
g_autoptr (GUnixFDList) fd_list = NULL;
|
|
|
|
int fd_idx;
|
|
|
|
GVariant *fd_variant;
|
|
|
|
int fd;
|
|
|
|
|
2023-08-28 11:01:03 -04:00
|
|
|
if (!session->eis)
|
2023-08-28 11:21:35 -04:00
|
|
|
{
|
2023-12-07 10:12:15 -05:00
|
|
|
MetaRemoteDesktopDeviceTypes device_types = META_REMOTE_DESKTOP_DEVICE_TYPE_NONE;
|
2023-08-28 11:21:35 -04:00
|
|
|
MetaEisDeviceTypes eis_device_types;
|
2023-12-07 10:12:15 -05:00
|
|
|
GVariant *v;
|
2023-08-28 11:21:35 -04:00
|
|
|
|
2023-12-07 10:12:15 -05:00
|
|
|
v = g_variant_lookup_value (arg_options, "device-types", G_VARIANT_TYPE_UINT32);
|
|
|
|
if (v)
|
2023-08-28 11:21:35 -04:00
|
|
|
{
|
2023-12-07 10:12:15 -05:00
|
|
|
device_types = g_variant_get_uint32 (v);
|
2023-08-28 11:21:35 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
device_types = (META_REMOTE_DESKTOP_DEVICE_TYPE_KEYBOARD |
|
|
|
|
META_REMOTE_DESKTOP_DEVICE_TYPE_POINTER |
|
|
|
|
META_REMOTE_DESKTOP_DEVICE_TYPE_TOUCHSCREEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
eis_device_types = device_types_to_eis_device_types (device_types);
|
|
|
|
session->eis = meta_eis_new (backend, eis_device_types);
|
2023-08-28 17:13:16 -04:00
|
|
|
|
|
|
|
if (session->started)
|
|
|
|
initialize_viewports (session);
|
2023-08-28 11:21:35 -04:00
|
|
|
}
|
2022-09-28 11:54:02 -04:00
|
|
|
|
2023-08-28 11:01:03 -04:00
|
|
|
fd = meta_eis_add_client_get_fd (session->eis);
|
2022-09-28 11:54:02 -04:00
|
|
|
if (fd < 0)
|
|
|
|
{
|
|
|
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
|
|
G_DBUS_ERROR_FAILED,
|
|
|
|
"Failed to create socket: %s",
|
|
|
|
g_strerror (-fd));
|
|
|
|
return G_DBUS_METHOD_INVOCATION_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd_list = g_unix_fd_list_new ();
|
|
|
|
fd_idx = g_unix_fd_list_append (fd_list, fd, NULL);
|
|
|
|
close (fd);
|
|
|
|
fd_variant = g_variant_new_handle (fd_idx);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_complete_connect_to_eis (skeleton,
|
|
|
|
invocation,
|
|
|
|
fd_list,
|
|
|
|
fd_variant);
|
|
|
|
|
|
|
|
return G_DBUS_METHOD_INVOCATION_HANDLED;
|
|
|
|
}
|
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
static gboolean
|
|
|
|
meta_remote_desktop_session_initable_init (GInitable *initable,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (initable);
|
|
|
|
MetaBackend *backend =
|
|
|
|
meta_dbus_session_manager_get_backend (session->session_manager);
|
|
|
|
ClutterSeat *seat = meta_backend_get_default_seat (backend);
|
|
|
|
ClutterKeymap *keymap = clutter_seat_get_keymap (seat);
|
|
|
|
GDBusInterfaceSkeleton *interface_skeleton = G_DBUS_INTERFACE_SKELETON (session);
|
|
|
|
MetaDBusRemoteDesktopSession *skeleton =
|
|
|
|
META_DBUS_REMOTE_DESKTOP_SESSION (interface_skeleton);
|
|
|
|
|
|
|
|
meta_dbus_remote_desktop_session_set_session_id (skeleton, session->session_id);
|
|
|
|
|
|
|
|
session->connection =
|
|
|
|
meta_dbus_session_manager_get_connection (session->session_manager);
|
|
|
|
if (!g_dbus_interface_skeleton_export (interface_skeleton,
|
|
|
|
session->connection,
|
|
|
|
session->object_path,
|
|
|
|
error))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_object_bind_property (keymap, "caps-lock-state",
|
|
|
|
session, "caps-lock-state",
|
|
|
|
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
|
|
|
g_object_bind_property (keymap, "num-lock-state",
|
|
|
|
session, "num-lock-state",
|
|
|
|
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
|
|
|
|
2023-08-29 14:31:30 -04:00
|
|
|
session->mapping_ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
initable_init_iface (GInitableIface *iface)
|
|
|
|
{
|
|
|
|
iface->init = meta_remote_desktop_session_initable_init;
|
|
|
|
}
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface)
|
|
|
|
{
|
|
|
|
iface->handle_start = handle_start;
|
|
|
|
iface->handle_stop = handle_stop;
|
2018-01-29 01:38:13 -05:00
|
|
|
iface->handle_notify_keyboard_keycode = handle_notify_keyboard_keycode;
|
2017-06-21 02:23:44 -04:00
|
|
|
iface->handle_notify_keyboard_keysym = handle_notify_keyboard_keysym;
|
|
|
|
iface->handle_notify_pointer_button = handle_notify_pointer_button;
|
2018-01-29 01:40:28 -05:00
|
|
|
iface->handle_notify_pointer_axis = handle_notify_pointer_axis;
|
2017-06-21 02:23:44 -04:00
|
|
|
iface->handle_notify_pointer_axis_discrete = handle_notify_pointer_axis_discrete;
|
2018-01-29 01:40:57 -05:00
|
|
|
iface->handle_notify_pointer_motion_relative = handle_notify_pointer_motion_relative;
|
2017-06-21 02:23:44 -04:00
|
|
|
iface->handle_notify_pointer_motion_absolute = handle_notify_pointer_motion_absolute;
|
2018-01-29 01:44:03 -05:00
|
|
|
iface->handle_notify_touch_down = handle_notify_touch_down;
|
|
|
|
iface->handle_notify_touch_motion = handle_notify_touch_motion;
|
|
|
|
iface->handle_notify_touch_up = handle_notify_touch_up;
|
2020-10-13 11:38:42 -04:00
|
|
|
iface->handle_enable_clipboard = handle_enable_clipboard;
|
|
|
|
iface->handle_disable_clipboard = handle_disable_clipboard;
|
|
|
|
iface->handle_set_selection = handle_set_selection;
|
|
|
|
iface->handle_selection_write = handle_selection_write;
|
|
|
|
iface->handle_selection_write_done = handle_selection_write_done;
|
|
|
|
iface->handle_selection_read = handle_selection_read;
|
2022-09-28 11:54:02 -04:00
|
|
|
iface->handle_connect_to_eis = handle_connect_to_eis;
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
|
|
|
{
|
2022-03-10 18:35:14 -05:00
|
|
|
iface->close = meta_remote_desktop_session_close;
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (object);
|
2022-05-27 13:35:01 -04:00
|
|
|
MetaDisplay *display = display_from_session (session);
|
2020-11-04 04:27:40 -05:00
|
|
|
MetaSelection *selection = meta_display_get_selection (display);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
g_assert (!meta_remote_desktop_session_is_running (session));
|
|
|
|
|
2020-11-04 04:27:40 -05:00
|
|
|
g_clear_signal_handler (&session->owner_changed_handler_id, selection);
|
2020-11-04 10:09:42 -05:00
|
|
|
reset_current_selection_source (session);
|
2020-11-04 09:03:16 -05:00
|
|
|
cancel_selection_read (session);
|
2020-11-04 10:09:42 -05:00
|
|
|
g_hash_table_unref (session->transfer_requests);
|
2020-11-04 04:27:40 -05:00
|
|
|
|
2023-08-29 14:31:30 -04:00
|
|
|
g_clear_pointer (&session->mapping_ids, g_hash_table_unref);
|
|
|
|
|
2018-07-20 10:37:37 -04:00
|
|
|
g_clear_object (&session->handle);
|
2017-08-25 03:19:53 -04:00
|
|
|
g_free (session->peer_name);
|
2017-06-21 02:23:44 -04:00
|
|
|
g_free (session->session_id);
|
|
|
|
g_free (session->object_path);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (meta_remote_desktop_session_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-03-11 03:39:07 -05:00
|
|
|
meta_remote_desktop_session_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2017-06-21 02:23:44 -04:00
|
|
|
{
|
2022-03-11 03:39:07 -05:00
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (object);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
switch (prop_id)
|
|
|
|
{
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_SESSION_MANAGER:
|
2022-03-11 03:39:07 -05:00
|
|
|
session->session_manager = g_value_get_object (value);
|
|
|
|
break;
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_PEER_NAME:
|
2022-03-11 03:39:07 -05:00
|
|
|
session->peer_name = g_value_dup_string (value);
|
|
|
|
break;
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_ID:
|
2022-03-11 03:39:07 -05:00
|
|
|
session->session_id = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2022-03-11 03:39:07 -05:00
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_SESSION_MANAGER:
|
2022-03-11 03:39:07 -05:00
|
|
|
g_value_set_object (value, session->session_manager);
|
|
|
|
break;
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_PEER_NAME:
|
2022-03-11 03:39:07 -05:00
|
|
|
g_value_set_string (value, session->peer_name);
|
|
|
|
break;
|
2023-02-23 10:34:51 -05:00
|
|
|
case N_PROPS + META_DBUS_SESSION_PROP_ID:
|
2022-03-11 03:39:07 -05:00
|
|
|
g_value_set_string (value, session->session_id);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_init (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
static unsigned int global_session_number = 0;
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
session->object_path =
|
|
|
|
g_strdup_printf (META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/u%u",
|
|
|
|
++global_session_number);
|
2020-11-04 10:09:42 -05:00
|
|
|
|
|
|
|
session->transfer_requests = g_hash_table_new (NULL, NULL);
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_class_init (MetaRemoteDesktopSessionClass *klass)
|
|
|
|
{
|
|
|
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = meta_remote_desktop_session_finalize;
|
2022-03-11 03:39:07 -05:00
|
|
|
object_class->set_property = meta_remote_desktop_session_set_property;
|
|
|
|
object_class->get_property = meta_remote_desktop_session_get_property;
|
|
|
|
|
2023-02-23 10:34:51 -05:00
|
|
|
meta_dbus_session_install_properties (object_class, N_PROPS);
|
2017-06-21 02:23:44 -04:00
|
|
|
}
|
2018-07-20 10:37:37 -04:00
|
|
|
|
|
|
|
static MetaRemoteDesktopSessionHandle *
|
|
|
|
meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSessionHandle *handle;
|
|
|
|
|
|
|
|
handle = g_object_new (META_TYPE_REMOTE_DESKTOP_SESSION_HANDLE, NULL);
|
|
|
|
handle->session = session;
|
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_handle_stop (MetaRemoteAccessHandle *handle)
|
|
|
|
{
|
|
|
|
MetaRemoteDesktopSession *session;
|
|
|
|
|
|
|
|
session = META_REMOTE_DESKTOP_SESSION_HANDLE (handle)->session;
|
|
|
|
if (!session)
|
|
|
|
return;
|
|
|
|
|
2022-03-10 18:35:14 -05:00
|
|
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
2018-07-20 10:37:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_handle_init (MetaRemoteDesktopSessionHandle *handle)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_remote_desktop_session_handle_class_init (MetaRemoteDesktopSessionHandleClass *klass)
|
|
|
|
{
|
|
|
|
MetaRemoteAccessHandleClass *remote_access_handle_class =
|
|
|
|
META_REMOTE_ACCESS_HANDLE_CLASS (klass);
|
|
|
|
|
|
|
|
remote_access_handle_class->stop = meta_remote_desktop_session_handle_stop;
|
|
|
|
}
|