Skip to content

Commit

Permalink
#1086 expose both global "icc" and per-display icc data
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@13820 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 22, 2016
1 parent 53a219e commit 40ef1b8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 46 deletions.
13 changes: 8 additions & 5 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from xpra.client.client_tray import ClientTray
from xpra.client.keyboard_helper import KeyboardHelper
from xpra.platform.features import MMAP_SUPPORTED, SYSTEM_TRAY_SUPPORTED, CLIPBOARD_WANT_TARGETS, CLIPBOARD_GREEDY, CLIPBOARDS, REINIT_WINDOWS
from xpra.platform.gui import (ready as gui_ready, get_vrefresh, get_antialias_info, get_icc_info, get_double_click_time, show_desktop, get_cursor_size,
from xpra.platform.gui import (ready as gui_ready, get_vrefresh, get_antialias_info, get_icc_info, get_display_icc_info, get_double_click_time, show_desktop, get_cursor_size,
get_double_click_distance, get_native_notifier_classes, get_native_tray_classes, get_native_system_tray_classes,
get_native_tray_menu_helper_classes, get_xdpi, get_ydpi, get_number_of_desktops, get_desktop_names, get_wm_name, ClientExtras)
from xpra.platform.paths import get_tray_icon_filename
Expand Down Expand Up @@ -1467,9 +1467,12 @@ def make_hello(self):
"rgb24zlib" : True,
"max-soft-expired" : MAX_SOFT_EXPIRED,
})
capabilities["antialias"] = get_antialias_info()
capabilities["icc"] = get_icc_info()
capabilities["cursor.size"] = int(2*get_cursor_size()/(self.xscale+self.yscale))
capabilities.update({
"antialias" : get_antialias_info(),
"icc" : get_icc_info(),
"display-icc" : get_display_icc_info(),
"cursor.size" : int(2*get_cursor_size()/(self.xscale+self.yscale)),
})
#generic rgb compression flags:
for x in compression.ALL_COMPRESSORS:
capabilities["encoding.rgb_%s" % x] = x in compression.get_enabled_compressors()
Expand Down Expand Up @@ -2939,7 +2942,7 @@ def free_mmap_area():
if len(packet)>10:
options = packet[10]
options = typedict(options)
paintlog("process_draw %s bytes for window %s using %s encoding with options=%s", len(data), wid, coding, options)
paintlog.warn("process_draw %s bytes for window %s using %s encoding with options=%s", len(data), wid, coding, options)
start = time.time()
def record_decode_time(success, message=""):
if success>0:
Expand Down
57 changes: 17 additions & 40 deletions src/xpra/platform/darwin/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,51 +126,27 @@ def get_window_frame_size(x, y, w, h):
"frame" : (0, 0, 22, 0),
}


def get_icc_info():
def get_display_icc_info():
info = {}
try:
from AppKit import NSScreen #@UnresolvedImport
except ImportError as e:
log("cannot get icc info without AppKit: %s", e)
return {}
ms = NSScreen.mainScreen()
info = do_get_screen_icc_info(ms)
screens = NSScreen.screens()
for i, screen in enumerate(screens):
si = do_get_screen_icc_info(screen)
if si:
info[i] = si
from Quartz import CoreGraphics as CG #@UnresolvedImport
err, active_displays, no = CG.CGGetActiveDisplayList(99, None, None)
if err==0 and no>0:
for i,adid in enumerate(active_displays):
info[i] = get_colorspace_info(CG.CGDisplayCopyColorSpace(adid))
except Exception as e:
log("failed to query colorspace for active displays: %s", e)
return info

def do_get_screen_icc_info(nsscreen):
def get_icc_info():
#maybe we shouldn't return anything if there's more than one display?
info = {}
try:
from AppKit import NSUnknownColorSpaceModel, NSGrayColorSpaceModel, NSRGBColorSpaceModel, NSCMYKColorSpaceModel, NSLABColorSpaceModel, NSDeviceNColorSpaceModel, NSIndexedColorSpaceModel, NSPatternColorSpaceModel #@UnresolvedImport
COLORSPACE_STR = {
NSUnknownColorSpaceModel : "unknown",
NSGrayColorSpaceModel : "gray",
NSRGBColorSpaceModel : "RGB",
NSCMYKColorSpaceModel : "CMYK",
NSLABColorSpaceModel : "LAB",
NSDeviceNColorSpaceModel : "DeviceN",
NSIndexedColorSpaceModel : "Indexed",
NSPatternColorSpaceModel : "Pattern",
}
try:
mscs = nsscreen.colorSpace()
except AttributeError as e:
#OSX 10.5.x and earlier don't have this attribute
return info
log("%s.colorSpace=%s", nsscreen, mscs)
info.update({
"colorspace" : COLORSPACE_STR.get(mscs.colorSpaceModel(), "unknown"),
"data" : str(mscs.ICCProfileData() or ""),
"name" : str(mscs.localizedName()),
"components" : mscs.numberOfColorComponents(),
})
from Quartz import CoreGraphics as CG #@UnresolvedImport
did = CG.CGMainDisplayID()
info = get_colorspace_info(CG.CGDisplayCopyColorSpace(did))
except Exception as e:
log.warn("Warning: cannot query ICC profiles:")
log.warn(" %s", e)
log("failed to query colorspace for main display: %s", e)
return info


Expand Down Expand Up @@ -273,12 +249,13 @@ def recttotuple(r):
)
info = _call_CG_conv(defs, did)
try:
from Quartz import CoreGraphics as CG #@UnresolvedImport
modes = CG.CGDisplayCopyAllDisplayModes(did, None)
info["modes"] = get_display_modes_info(modes)
except Exception as e:
log("failed to query display modes: %s", e)
return info

def get_displays_info():
from Quartz import CoreGraphics as CG #@UnresolvedImport
did = CG.CGMainDisplayID()
Expand Down
7 changes: 6 additions & 1 deletion src/xpra/platform/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def get_icon_size():
def get_antialias_info():
return {}

def get_display_icc_info():
#per display info
return {}

def get_icc_info():
from xpra.log import Logger
log = Logger("platform")
Expand Down Expand Up @@ -228,6 +232,7 @@ def fnames(l):
},
"antialias" : get_antialias_info(),
"icc" : get_icc_info(),
"display-icc" : get_display_icc_info(),
"window_frame" : get_window_frame_sizes(),
}

Expand All @@ -250,7 +255,7 @@ def fnames(l):
"get_native_notifier_classes",
"get_vrefresh", "get_workarea", "get_workareas",
"get_number_of_desktops", "get_desktop_names",
"get_antialias_info", "get_icc_info", "get_xdpi", "get_ydpi",
"get_antialias_info", "get_icc_info", "get_display_icc_info", "get_xdpi", "get_ydpi",
"get_icon_size",
"get_mouse_config",
"get_double_click_time", "get_double_click_distance",
Expand Down

0 comments on commit 40ef1b8

Please sign in to comment.