-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3592 move clipboard caps to a prefix
- Loading branch information
Showing
3 changed files
with
51 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2010-2021 Antoine Martin <[email protected]> | ||
# Copyright (C) 2010-2022 Antoine Martin <[email protected]> | ||
# Copyright (C) 2008, 2010 Nathaniel Smith <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
@@ -85,20 +85,22 @@ def get_info(self) -> dict: | |
def get_caps(self) -> dict: | ||
if not self.client_supports_clipboard: | ||
return {} | ||
caps = flatten_dict({ | ||
"clipboard" : { | ||
"" : True, | ||
"notifications" : True, | ||
"selections" : CLIPBOARDS, | ||
#buggy osx clipboards: | ||
"want_targets" : CLIPBOARD_WANT_TARGETS, | ||
#buggy osx and win32 clipboards: | ||
"greedy" : CLIPBOARD_GREEDY, | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"set_enabled" : True, #v4 servers no longer use or show this flag | ||
"contents-slice-fix" : True, #fixed in v2.4, removed check in v4.3 | ||
}, | ||
}) | ||
ccaps = { | ||
"" : True, | ||
"notifications" : True, | ||
"selections" : CLIPBOARDS, | ||
#buggy osx clipboards: | ||
"want_targets" : CLIPBOARD_WANT_TARGETS, | ||
#buggy osx and win32 clipboards: | ||
"greedy" : CLIPBOARD_GREEDY, | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"set_enabled" : True, #v4 servers no longer use or show this flag | ||
"contents-slice-fix" : True, #fixed in v2.4, removed check in v4.3 | ||
} | ||
#legacy flat format: | ||
caps = flatten_dict({"clipboard" : ccaps}) | ||
#v4.4 uses namespace: | ||
caps["clipboard"] = ccaps | ||
return caps | ||
|
||
def parse_server_capabilities(self, c : typedict) -> bool: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# This file is part of Xpra. | ||
# Copyright (C) 2010-2020 Antoine Martin <[email protected]> | ||
# Copyright (C) 2010-2022 Antoine Martin <[email protected]> | ||
# Copyright (C) 2008 Nathaniel Smith <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
@@ -72,22 +72,24 @@ def get_server_features(self, server_source=None) -> dict: | |
self._clipboard_helper, self._clipboard_client, server_source, clipboard) | ||
if not clipboard: | ||
return {} | ||
ccaps = { | ||
"notifications" : True, | ||
"selections" : self._clipboards, | ||
"enable-selections" : True, #client check removed in v4 | ||
"contents-slice-fix" : True, #fixed in v2.4, removed check in v4.3 | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"want_targets" : CLIPBOARD_WANT_TARGETS, | ||
"greedy" : CLIPBOARD_GREEDY, | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"set_enabled" : True, #v4 servers no longer use or show this flag | ||
"direction" : self.clipboard_direction, | ||
} | ||
f = { | ||
#duplicated in the sub-dict in v4.4: | ||
"clipboards" : self._clipboards, | ||
"clipboard-direction" : self.clipboard_direction, | ||
"clipboard" : { | ||
"" : True, | ||
"notifications" : True, | ||
"selections" : CLIPBOARDS, | ||
"enable-selections" : True, #client check removed in v4 | ||
"contents-slice-fix" : True, #fixed in v2.4, removed check in v4.3 | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"want_targets" : CLIPBOARD_WANT_TARGETS, | ||
"greedy" : CLIPBOARD_GREEDY, | ||
"preferred-targets" : CLIPBOARD_PREFERRED_TARGETS, | ||
"set_enabled" : True, #v4 servers no longer use or show this flag | ||
}, | ||
} | ||
"clipboard" : ccaps, | ||
} | ||
return f | ||
|
||
def init_clipboard(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# This file is part of Xpra. | ||
# Copyright (C) 2010-2020 Antoine Martin <[email protected]> | ||
# Copyright (C) 2010-2022 Antoine Martin <[email protected]> | ||
# Copyright (C) 2008 Nathaniel Smith <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
@@ -41,14 +41,25 @@ def cleanup(self): | |
self.cancel_clipboard_progress_timer() | ||
|
||
def parse_client_caps(self, c : typedict): | ||
self.clipboard_enabled = c.boolget("clipboard", False) | ||
self.clipboard_notifications = c.boolget("clipboard.notifications") | ||
ccaps = c.get("clipboard") | ||
if ccaps and isinstance(ccaps, dict): | ||
ccaps = typedict(ccaps) | ||
self.clipboard_enabled = True | ||
self.clipboard_notifications = ccaps.boolget("notifications") | ||
self.clipboard_greedy = ccaps.boolget("greedy") | ||
self.clipboard_want_targets = ccaps.boolget("want_targets") | ||
self.clipboard_selections = ccaps.strtupleget("selections", CLIPBOARDS) | ||
self.clipboard_preferred_targets = ccaps.strtupleget("preferred-targets", ()) | ||
else: | ||
#no namespace in v4.3 and earlier: | ||
self.clipboard_enabled = c.boolget("clipboard", False) | ||
self.clipboard_notifications = c.boolget("clipboard.notifications") | ||
self.clipboard_greedy = c.boolget("clipboard.greedy") | ||
self.clipboard_want_targets = c.boolget("clipboard.want_targets") | ||
self.clipboard_selections = c.strtupleget("clipboard.selections", CLIPBOARDS) | ||
self.clipboard_preferred_targets = c.strtupleget("clipboard.preferred-targets", ()) | ||
log("client clipboard: enabled=%s, notifications=%s", | ||
self.clipboard_enabled, self.clipboard_notifications) | ||
self.clipboard_greedy = c.boolget("clipboard.greedy") | ||
self.clipboard_want_targets = c.boolget("clipboard.want_targets") | ||
self.clipboard_selections = c.strtupleget("clipboard.selections", CLIPBOARDS) | ||
self.clipboard_preferred_targets = c.strtupleget("clipboard.preferred-targets", ()) | ||
log("client clipboard: greedy=%s, want_targets=%s, selections=%s", | ||
self.clipboard_greedy, self.clipboard_want_targets, self.clipboard_selections) | ||
|
||
|