From 0d1efed9516172f771cf933fad52444f54e7fc9b Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 30 May 2016 09:15:08 +0000 Subject: [PATCH] #276 add control command and dbus interface for changing clipboard-direction git-svn-id: https://xpra.org/svn/Xpra/trunk@12711 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/server/dbus/dbus_server.py | 5 +++++ src/xpra/server/server_base.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/xpra/server/dbus/dbus_server.py b/src/xpra/server/dbus/dbus_server.py index fb2b5c064e..76696c67e8 100755 --- a/src/xpra/server/dbus/dbus_server.py +++ b/src/xpra/server/dbus/dbus_server.py @@ -189,6 +189,11 @@ def ListWindows(self): return d + @dbus.service.method(INTERFACE, in_signature='s') + def SetClipboardDirection(self, direction): + self.server.control_command_clipboard_direction(direction) + + @dbus.service.method(INTERFACE, in_signature='ii') def MoveWindowToWorkspace(self, wid, workspace): self.server.control_command_workspace(ni(wid), ni(workspace)) diff --git a/src/xpra/server/server_base.py b/src/xpra/server/server_base.py index b3ec6b2c8d..d80d080ed3 100644 --- a/src/xpra/server/server_base.py +++ b/src/xpra/server/server_base.py @@ -732,6 +732,7 @@ def parse_boolean_value(v): ArgsControlCommand("send-file", "sends the file to the client(s)", min_args=3), ArgsControlCommand("compression", "sets the packet compressor", min_args=1, max_args=1), ArgsControlCommand("encoder", "sets the packet encoder", min_args=1, max_args=1), + ArgsControlCommand("clipboard-direction", "restrict clipboard transfers", min_args=1, max_args=1), #session and clients: ArgsControlCommand("client", "forwards a control command to the client(s)", min_args=1), ArgsControlCommand("name", "set the session name", min_args=1, max_args=1), @@ -1598,6 +1599,14 @@ def control_command_encoding(self, encoding, *args): ws.refresh(window, {}) return "set encoding to %s%s for windows %s" % (encoding, ["", " (strict)"][int(strict or 0)], wids) + def control_command_clipboard_direction(self, direction, *args): + ch = self._clipboard_helper + assert self.supports_clipboard and ch + assert direction in ("to-server", "to-client", "both", "disabled") + self.clipboard_direction = direction + can_send = direction in ("to-server", "both") + can_receive = direction in ("to-client", "both") + self.client.clipboard_helper.set_direction(can_send, can_receive) def _control_video_subregions_from_wid(self, wid): if wid not in self._id_to_window: