Skip to content

Commit

Permalink
#1086 detect icc profile using X11 root window property
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@13824 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 22, 2016
1 parent 7351c75 commit 59e87e0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
26 changes: 26 additions & 0 deletions src/xpra/client/gtk_base/gtk_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,32 @@ def get_image(self, icon_name, size=None):
return None


def get_icc_info(self):
try:
from xpra.x11.gtk_x11.prop import prop_get
except ImportError:
pass
else:
root = self.get_root_window()
data = prop_get(root, "_ICC_PROFILE", ["u32"], ignore_errors=True)
screenlog("_ICC_PROFILE=%s", data)
if data:
#repack the data as a binary string:
#(prop_get gives us an array of Integers..)
import struct
bin_data = "".join(struct.pack("=I", x) for x in data)
import binascii
v = prop_get(root, "_ICC_PROFILE_IN_X_VERSION", "latin1", ignore_errors=True)
screenlog("get_icc_info() found _ICC_PROFILE_IN_X_VERSION=%s, _ICC_PROFILE=%s", v, binascii.hexlify(bin_data))
return {
"source" : "_ICC_PROFILE",
"data" : bin_data,
}
return UIXpraClient.get_icc_info(self)
#def get_display_icc_info(self):
#TODO


def request_frame_extents(self, window):
from xpra.x11.gtk_x11.send_wm import send_wm_request_frame_extents
from xpra.gtk_common.error import xsync
Expand Down
10 changes: 8 additions & 2 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,8 +1469,8 @@ def make_hello(self):
})
capabilities.update({
"antialias" : get_antialias_info(),
"icc" : get_icc_info(),
"display-icc" : get_display_icc_info(),
"icc" : self.get_icc_info(),
"display-icc" : self.get_display_icc_info(),
"cursor.size" : int(2*get_cursor_size()/(self.xscale+self.yscale)),
})
#generic rgb compression flags:
Expand Down Expand Up @@ -1574,6 +1574,12 @@ def make_hello(self):
def has_transparency(self):
return False

def get_icc_info(self):
return get_icc_info()

def get_display_icc_info(self):
return get_display_icc_info()


def server_ok(self):
return self._server_ok
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/platform/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def get_icc_info():
if ENV_ICC_DATA:
import binascii
return {
"name" : "environment-override",
"data" : binascii.unhexlify(ENV_ICC_DATA),
"source" : "environment-override",
"data" : binascii.unhexlify(ENV_ICC_DATA),
}
info = {}
try:
Expand Down

0 comments on commit 59e87e0

Please sign in to comment.