try: from wimpiggy.prop import set_xsettings_format set_xsettings_format(use_tuple=capabilities.get("xsettings-tuple", False)) except Exception, e: if os.name=="posix" and not sys.platform.startswith("darwin"): log.error("failed to set xsettings format: %s", e) self.server_supports_bell = capabilities.get("bell", True) #added in 0.5, default to True! self.bell_enabled = self.server_supports_bell and self.client_supports_bell self.server_supports_clipboard = capabilities.get("clipboard", False) self.clipboard_enabled = self.client_supports_clipboard and self.server_supports_clipboard self.mmap_enabled = self.supports_mmap and self.mmap_file and capabilities.get("mmap_enabled") self.server_auto_refresh_delay = capabilities.get("auto_refresh_delay", 0)/1000 self.change_quality = capabilities.get("change-quality", False) self.xsettings_tuple = capabilities.get("xsettings-tuple", False) if self.mmap_enabled: log.info("mmap is enabled using %sBytes area in %s", std_unit(self.mmap_size), self.mmap_file) #the server will have a handle on the mmap file by now, safe to delete: self.clean_mmap() self.send_deflate_level() self.server_start_time = capabilities.get("start_time", -1) self.server_platform = capabilities.get("platform") self.toggle_cursors_bell_notify = capabilities.get("toggle_cursors_bell_notify", False) self.toggle_keyboard_sync = capabilities.get("toggle_keyboard_sync", False) modifier_keycodes = capabilities.get("modifier_keycodes") if modifier_keycodes: self._client_extras.set_modifier_mappings(modifier_keycodes) #ui may want to know this is now set: self.emit("clipboard-toggled") self.key_repeat_delay, self.key_repeat_interval = capabilities.get("key_repeat", (-1,-1)) self.emit("handshake-complete")
if os.name == "posix" and not sys.platform.startswith("darwin"): log.error("failed to set xsettings format: %s", e) self.server_supports_bell = capabilities.get( "bell", True) #added in 0.5, default to True! self.bell_enabled = self.server_supports_bell and self.client_supports_bell self.server_supports_clipboard = capabilities.get("clipboard", False) self.clipboard_enabled = self.client_supports_clipboard and self.server_supports_clipboard self.mmap_enabled = self.supports_mmap and self.mmap_file and capabilities.get( "mmap_enabled") self.server_auto_refresh_delay = capabilities.get( "auto_refresh_delay", 0) / 1000 self.change_quality = capabilities.get("change-quality", False) self.xsettings_tuple = capabilities.get("xsettings-tuple", False) if self.mmap_enabled: log.info("mmap is enabled using %sBytes area in %s", std_unit(self.mmap_size), self.mmap_file) #the server will have a handle on the mmap file by now, safe to delete: self.clean_mmap() self.send_deflate_level() self.server_start_time = capabilities.get("start_time", -1) self.server_platform = capabilities.get("platform") self.toggle_cursors_bell_notify = capabilities.get( "toggle_cursors_bell_notify", False) self.toggle_keyboard_sync = capabilities.get("toggle_keyboard_sync", False) modifier_keycodes = capabilities.get("modifier_keycodes") if modifier_keycodes: self._client_extras.set_modifier_mappings(modifier_keycodes) #ui may want to know this is now set: self.emit("clipboard-toggled")
def parse_hello(self, capabilities): #batch options: self.default_batch_config = DamageBatchConfig() self.default_batch_config.always = bool( capabilities.get("batch.always", False)) self.default_batch_config.min_delay = min( 1000, max( 1, capabilities.get("batch.min_delay", DamageBatchConfig.MIN_DELAY))) self.default_batch_config.max_delay = min( 15000, max( 1, capabilities.get("batch.max_delay", DamageBatchConfig.MAX_DELAY))) self.default_batch_config.delay = min( 1000, max(1, capabilities.get("batch.delay", DamageBatchConfig.START_DELAY))) #client uuid: self.uuid = capabilities.get("uuid", "") self.client_type = capabilities.get("client_type", "PyGTK") self.client_platform = capabilities.get("platform", "") self.client_version = capabilities.get("version", None) #general features: self.send_windows = capabilities.get("windows", True) self.server_window_resize = capabilities.get("server-window-resize", False) self.send_cursors = self.send_windows and capabilities.get( "cursors", False) self.send_bell = capabilities.get("bell", False) self.send_notifications = capabilities.get("notifications", False) self.randr_notify = capabilities.get("randr_notify", False) self.clipboard_enabled = capabilities.get("clipboard", True) self.share = capabilities.get("share", False) self.desktop_size = capabilities.get("desktop_size") self.uses_swscale = capabilities.get("uses_swscale", True) #encodings: self.encoding_client_options = capabilities.get( "encoding_client_options", False) self.supports_rgb24zlib = capabilities.get("rgb24zlib", False) self.encodings = capabilities.get("encodings", []) self.set_encoding(capabilities.get("encoding", None), None) q = self.default_quality if "jpeg" in capabilities: #pre 0.7 versions q = capabilities["jpeg"] if "quality" in capabilities: #0.7 onwards: q = capabilities["quality"] if q >= 0: self.default_damage_options["quality"] = q self.png_window_icons = "png" in self.encodings and "png" in ENCODINGS self.auto_refresh_delay = int(capabilities.get("auto_refresh_delay", 0)) / 1000.0 #keyboard: self.keyboard_config = KeyboardConfig() self.keyboard_config.enabled = self.send_windows and bool( capabilities.get("keyboard", True)) self.assign_keymap_options(capabilities) self.keyboard_config.xkbmap_layout = capabilities.get("xkbmap_layout") self.keyboard_config.xkbmap_variant = capabilities.get( "xkbmap_variant") #mmap: if self.send_windows: #we don't need mmap if not sending pixels mmap_file = capabilities.get("mmap_file") mmap_token = capabilities.get("mmap_token") log("client supplied mmap_file=%s, mmap supported=%s", mmap_file, self.supports_mmap) if self.supports_mmap and mmap_file and os.path.exists(mmap_file): self.init_mmap(mmap_file, mmap_token) log("cursors=%s, bell=%s, notifications=%s", self.send_cursors, self.send_bell, self.send_notifications) log.info("%s client version %s with uuid %s", self.client_type, self.client_version, self.uuid) if self.send_windows: if self.mmap_size > 0: log.info("mmap is enabled using %sBytes area in %s", std_unit(self.mmap_size), mmap_file) else: log.info("using %s as primary encoding", self.encoding) else: log.info("windows forwarding is disabled")