Skip to content

Commit

Permalink
#276 add control command and dbus interface for changing clipboard-di…
Browse files Browse the repository at this point in the history
…rection

git-svn-id: https://xpra.org/svn/Xpra/trunk@12711 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 30, 2016
1 parent 84523e0 commit 0d1efed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/xpra/server/dbus/dbus_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 9 additions & 0 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0d1efed

Please sign in to comment.