Exemplo n.º 1
0
    def parse_client_caps(self, c: typedict):
        #general features:
        self.info_namespace = c.boolget("info-namespace")
        self.share = c.boolget("share")
        self.lock = c.boolget("lock")
        self.control_commands = c.strtupleget("control_commands")
        self.xdg_menu = c.boolget("xdg-menu", True)
        self.xdg_menu_update = c.boolget("xdg-menu-update")
        bandwidth_limit = c.intget("bandwidth-limit", 0)
        server_bandwidth_limit = self.server_bandwidth_limit
        if self.server_bandwidth_limit is None:
            server_bandwidth_limit = self.get_socket_bandwidth_limit(
            ) or bandwidth_limit
        self.bandwidth_limit = min(server_bandwidth_limit, bandwidth_limit)
        if self.bandwidth_detection:
            self.bandwidth_detection = c.boolget("bandwidth-detection", True)
        self.client_connection_data = c.dictget("connection-data", {})
        ccd = typedict(self.client_connection_data)
        self.adapter_type = ccd.strget("adapter-type", "")
        self.jitter = ccd.intget("jitter", 0)
        bandwidthlog(
            "server bandwidth-limit=%s, client bandwidth-limit=%s, value=%s, detection=%s",
            server_bandwidth_limit, bandwidth_limit, self.bandwidth_limit,
            self.bandwidth_detection)

        if getattr(self, "mmap_size", 0) > 0:
            log("mmap enabled, ignoring bandwidth-limit")
            self.bandwidth_limit = 0
Exemplo n.º 2
0
 def parse_client_caps(self, c: typedict):
     self.uuid = c.strget("uuid")
     self.session_id = c.strget("session-id")
     self.machine_id = c.strget("machine_id")
     self.hostname = c.strget("hostname")
     self.username = c.strget("username")
     self.name = c.strget("name")
     self.argv = c.strtupleget("argv")
     self.sharing = c.boolget("share")
     self.client_type = c.strget("client_type", "PyGTK")
     self.client_platform = c.strget("platform")
     self.client_machine = c.strget("platform.machine")
     self.client_processor = c.strget("platform.processor")
     self.client_release = c.strget("platform.sysrelease")
     self.client_linux_distribution = c.strtupleget(
         "platform.linux_distribution")
     self.client_version = c.strget("version")
     self.client_revision = c.strget("build.revision")
     self.client_bits = c.intget("python.bits")
     self.client_proxy = c.boolget("proxy")
     self.client_wm_name = c.strget("wm_name")
     self.client_session_type = c.strget("session-type")
     self.client_session_type_full = c.strget("session-type.full", "")
     self.client_setting_change = c.boolget("setting-change")
     self.client_opengl = typedict(c.dictget("opengl") or {})
     self.proxy_hostname = c.strget("proxy.hostname")
     self.proxy_platform = c.strget("proxy.platform")
     self.proxy_release = c.strget("proxy.platform.sysrelease")
     self.proxy_version = c.strget("proxy.version")
     self.proxy_version = c.strget("proxy.build.version",
                                   self.proxy_version)
     log("client uuid %s", self.uuid)
Exemplo n.º 3
0
 def parse_client_caps(self, c: typedict):
     self.randr_notify = c.boolget("randr_notify")
     self.desktop_size = c.intpair("desktop_size")
     if self.desktop_size is not None:
         w, h = self.desktop_size
         if w <= 0 or h <= 0 or w >= 32768 or h >= 32768:
             log.warn("ignoring invalid desktop dimensions: %sx%s", w, h)
             self.desktop_size = None
     self.desktop_mode_size = c.intpair("desktop_mode_size")
     self.desktop_size_unscaled = c.intpair("desktop_size.unscaled")
     self.screen_resize_bigger = c.boolget("screen-resize-bigger", True)
     self.set_screen_sizes(c.tupleget("screen_sizes"))
     self.set_desktops(c.intget("desktops", 1),
                       c.strtupleget("desktop.names"))
     self.show_desktop_allowed = c.boolget("show-desktop")
     self.icc = c.dictget("icc", {})
     self.display_icc = c.dictget("display-icc", {})
     self.opengl_props = c.dictget("opengl", {})
Exemplo n.º 4
0
 def parse_server_capabilities(self, c : typedict) -> bool:
     self.server_display = c.strget("display")
     self.server_desktop_size = c.intpair("desktop_size")
     log("server desktop size=%s", self.server_desktop_size)
     self.server_max_desktop_size = c.intpair("max_desktop_size", (2**15, 2**15))
     self.server_actual_desktop_size = c.intpair("actual_desktop_size")
     log("server actual desktop size=%s", self.server_actual_desktop_size)
     self.server_randr = c.boolget("resize_screen")
     log("server has randr: %s", self.server_randr)
     self.server_opengl = c.dictget("opengl")
     return True
Exemplo n.º 5
0
 def process_ui_capabilities(self, caps : typedict):
     for c in CLIENT_BASES:
         if c!=XpraClientBase:
             c.process_ui_capabilities(self, caps)
     #keyboard:
     if self.keyboard_helper:
         modifier_keycodes = caps.dictget("modifier_keycodes", {})
         if modifier_keycodes:
             self.keyboard_helper.set_modifier_mappings(modifier_keycodes)
     self.key_repeat_delay, self.key_repeat_interval = caps.intpair("key_repeat", (-1,-1))
     self.handshake_complete()
Exemplo n.º 6
0
 def parse_server_capabilities(self, c: typedict) -> bool:
     try:
         from xpra import clipboard
         assert clipboard
     except ImportError:
         log.warn("Warning: clipboard module is missing")
         self.clipboard_enabled = False
         return True
     self.server_clipboard = c.boolget("clipboard")
     self.server_clipboard_loop_uuids = c.dictget("clipboard.loop-uuids",
                                                  {})
     self.server_clipboard_direction = c.strget("clipboard-direction",
                                                "both")
     if self.server_clipboard_direction != self.client_clipboard_direction and self.server_clipboard_direction != "both":
         if self.client_clipboard_direction == "disabled":
             pass
         elif self.server_clipboard_direction == "disabled":
             log.warn(
                 "Warning: server clipboard synchronization is currently disabled"
             )
             self.client_clipboard_direction = "disabled"
         elif self.client_clipboard_direction == "both":
             log.warn(
                 "Warning: server only supports '%s' clipboard transfers",
                 self.server_clipboard_direction)
             self.client_clipboard_direction = self.server_clipboard_direction
         else:
             log.warn("Warning: incompatible clipboard direction settings")
             log.warn(" server setting: %s, client setting: %s",
                      self.server_clipboard_direction,
                      self.client_clipboard_direction)
     try:
         from xpra.clipboard.clipboard_core import ALL_CLIPBOARDS
     except ImportError:
         ALL_CLIPBOARDS = []
     self.server_clipboards = c.strtupleget("clipboards", ALL_CLIPBOARDS)
     log("server clipboard: supported=%s, direction=%s",
         self.server_clipboard, self.server_clipboard_direction)
     log("client clipboard: supported=%s, direction=%s",
         self.client_supports_clipboard, self.client_clipboard_direction)
     self.clipboard_enabled = self.client_supports_clipboard and self.server_clipboard
     log("parse_clipboard_caps() clipboard enabled=%s",
         self.clipboard_enabled)
     self.server_clipboard_contents_slice_fix = c.boolget(
         "clipboard.contents-slice-fix")
     self.server_clipboard_preferred_targets = c.strtupleget(
         "clipboard.preferred-targets", ())
     if not self.server_clipboard_contents_slice_fix:
         log.info("server clipboard does not include contents slice fix")
     return True
Exemplo n.º 7
0
    def parse_client_caps(self, c: typedict):
        #general features:
        self.info_namespace = c.boolget("info-namespace")
        self.send_notifications = c.boolget("notifications")
        self.send_notifications_actions = c.boolget("notifications.actions")
        log("notifications=%s, actions=%s", self.send_notifications,
            self.send_notifications_actions)
        self.share = c.boolget("share")
        self.lock = c.boolget("lock")
        self.control_commands = c.strtupleget("control_commands")
        self.xdg_menu_update = c.boolget("xdg-menu-update")
        bandwidth_limit = c.intget("bandwidth-limit", 0)
        server_bandwidth_limit = self.server_bandwidth_limit
        if self.server_bandwidth_limit is None:
            server_bandwidth_limit = self.get_socket_bandwidth_limit(
            ) or bandwidth_limit
        self.bandwidth_limit = min(server_bandwidth_limit, bandwidth_limit)
        if self.bandwidth_detection:
            self.bandwidth_detection = c.boolget("bandwidth-detection", True)
        self.client_connection_data = c.dictget("connection-data", {})
        self.jitter = typedict(self.client_connection_data).intget("jitter", 0)
        bandwidthlog(
            "server bandwidth-limit=%s, client bandwidth-limit=%s, value=%s, detection=%s",
            server_bandwidth_limit, bandwidth_limit, self.bandwidth_limit,
            self.bandwidth_detection)

        if getattr(self, "mmap_size", 0) > 0:
            log("mmap enabled, ignoring bandwidth-limit")
            self.bandwidth_limit = 0
        #adjust max packet size if file transfers are enabled:
        #TODO: belongs in mixin:
        file_transfer = getattr(self, "file_transfer", None)
        if file_transfer:
            self.protocol.max_packet_size = max(
                self.protocol.max_packet_size,
                self.file_size_limit * 1024 * 1024)
Exemplo n.º 8
0
    def parse_server_capabilities(self, c: typedict) -> bool:
        for cb in CLIENT_BASES:
            if not cb.parse_server_capabilities(self, c):
                log.info("failed to parse server capabilities in %s", cb)
                return False
        self.server_session_name = strtobytes(c.rawget("session_name",
                                                       b"")).decode("utf-8")
        set_name("Xpra", self.session_name or self.server_session_name
                 or "Xpra")
        self.server_platform = c.strget("platform")
        self.server_sharing = c.boolget("sharing")
        self.server_sharing_toggle = c.boolget("sharing-toggle")
        self.server_lock = c.boolget("lock")
        self.server_lock_toggle = c.boolget("lock-toggle")
        self.server_keyboard = c.boolget("keyboard", True)
        self.server_pointer = c.boolget("pointer", True)
        self.server_start_new_commands = c.boolget("start-new-commands")
        if self.server_start_new_commands:
            self.server_xdg_menu = c.dictget("xdg-menu", None)
        if self.start_new_commands or self.start_child_new_commands:
            if self.server_start_new_commands:
                self.after_handshake(self.send_start_new_commands)
            else:
                log.warn("Warning: cannot start new commands")
                log.warn(" the feature is currently disabled on the server")
        self.server_commands_info = c.boolget("server-commands-info")
        self.server_commands_signals = c.strtupleget("server-commands-signals")
        self.server_readonly = c.boolget("readonly")
        if self.server_readonly and not self.readonly:
            log.info("server is read only")
            self.readonly = True
        if not self.server_keyboard and self.keyboard_helper:
            #swallow packets:
            def nosend(*_args):
                pass

            self.keyboard_helper.send = nosend

        i = platform_name(
            self._remote_platform,
            c.strtupleget("platform.linux_distribution")
            or c.strget("platform.release", ""))
        r = self._remote_version
        if self._remote_revision:
            r += "-r%s" % self._remote_revision
        mode = c.strget("server.mode", "server")
        bits = c.intget("python.bits", 32)
        log.info("Xpra %s server version %s %i-bit", mode, std(r), bits)
        if i:
            log.info(" running on %s", std(i))
        if c.boolget("desktop") or c.boolget("shadow"):
            v = c.intpair("actual_desktop_size")
            if v:
                w, h = v
                ss = c.tupleget("screen_sizes")
                if ss:
                    log.info(" remote desktop size is %sx%s with %s screen%s:",
                             w, h, len(ss), engs(ss))
                    log_screen_sizes(w, h, ss)
                else:
                    log.info(" remote desktop size is %sx%s", w, h)
        if c.boolget("proxy"):
            proxy_hostname = c.strget("proxy.hostname")
            proxy_platform = c.strget("proxy.platform")
            proxy_release = c.strget("proxy.platform.release")
            proxy_version = c.strget("proxy.version")
            proxy_version = c.strget("proxy.build.version", proxy_version)
            proxy_distro = c.strget("proxy.linux_distribution")
            msg = "via: %s proxy version %s" % (platform_name(
                proxy_platform, proxy_distro
                or proxy_release), std(proxy_version or "unknown"))
            if proxy_hostname:
                msg += " on '%s'" % std(proxy_hostname)
            log.info(msg)
        return True