示例#1
0
 def is_needed(cls, caps : typedict) -> bool:
     #the 'keyboard' and 'mouse' capability were only added in v4,
     #so we have to enable the mixin by default:
     return caps.boolget("keyboard", True) or caps.boolget("mouse", True) or caps.boolget("windows", False)
示例#2
0
 def is_needed(cls, caps: typedict) -> bool:
     return caps.boolget("notifications", False)
示例#3
0
 def parse_client_caps(self, c: typedict):
     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)
示例#4
0
 def is_needed(cls, caps: typedict) -> bool:
     return bool(caps.boolget("file-transfer") or caps.boolget("printing"))
示例#5
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
示例#6
0
 def parse_server_capabilities(self, caps : typedict) -> bool:
     self.parse_printing_capabilities(caps)
     self.parse_file_transfer_caps(caps)
     self.remote_request_file = caps.boolget("request-file", False)
     return True
示例#7
0
def caps_to_revision(caps: typedict) -> str:
    revision = caps.strget("revision")
    local_modifications = caps.intget("local_modifications")
    commit = caps.strget("commit")
    branch = caps.strget("branch")
    return make_revision_str(revision, local_modifications, branch, commit)
示例#8
0
def caps_to_version(caps: typedict) -> str:
    return caps.strget("version", "0") + "-" + caps_to_revision(caps)
示例#9
0
 def is_needed(cls, caps: typedict) -> bool:
     return caps.boolget("clipboard")
示例#10
0
 def is_needed(cls, caps: typedict) -> bool:
     return caps.boolget("shell", False)