def get_property(self, prop): if prop == "xid": return self.client_window.xid elif prop == "depth": return self._depth elif prop == "title": return get_wm_name() or "xpra desktop" elif prop == "client-machine": return socket.gethostname() elif prop == "window-type": return ["NORMAL"] elif prop == "shadow": return True elif prop == "class-instance": return ("xpra-desktop", "Xpra-Desktop") elif prop == "icon": try: icon_name = get_wm_name() + ".png" icon = get_icon(icon_name) log("get_icon(%s)=%s", icon_name, icon) return icon except: log("failed to return window icon") return None else: return gobject.GObject.get_property(self, prop)
def get_window_frame_sizes(self): wfs = get_window_frame_sizes() if self.frame_request_window: v = self.get_frame_extents(self.frame_request_window) if v: try: wm_name = get_wm_name() except: wm_name = None try: if len(v)==8: framelog.warn("Warning: invalid frame extents value '%s'", v) if wm_name: framelog.warn(" this is probably a bug in '%s'", wm_name) v = v[4:] framelog.warn(" using '%s' instead", v) l, r, t, b = v wfs["frame"] = (l, r, t, b) wfs["offset"] = (l, t) except Exception as e: framelog.warn("Warning: invalid frame extents value '%s'", v) framelog.warn(" %s", e) framelog.warn(" this is probably a bug in '%s'", wm_name) framelog("get_window_frame_sizes()=%s", wfs) return wfs
def update_wm_name(self): try: wm_name = get_wm_name() #pylint: disable=assignment-from-none except Exception: wm_name = "" iconlog("update_wm_name() wm-name=%s", wm_name) return self._updateprop("wm-name", wm_name)
def get_window_frame_sizes(self): wfs = get_window_frame_sizes() if self.frame_request_window: v = self.get_frame_extents(self.frame_request_window) if v: try: wm_name = get_wm_name() except: wm_name = None try: if len(v) == 8: framelog.warn( "Warning: invalid frame extents value '%s'", v) if wm_name: framelog.warn(" this is probably a bug in '%s'", wm_name) v = v[4:] framelog.warn(" using '%s' instead", v) l, r, t, b = v wfs["frame"] = (l, r, t, b) wfs["offset"] = (l, t) except Exception as e: framelog.warn("Warning: invalid frame extents value '%s'", v) framelog.warn(" %s", e) framelog.warn(" this is probably a bug in '%s'", wm_name) framelog("get_window_frame_sizes()=%s", wfs) return wfs
def update_wm_name(self): wm_name = "" try: wm_name = get_wm_name() except: pass iconlog("update_wm_name() wm-name=%s", wm_name) return self._updateprop("wm-name", wm_name)
def update_icon(self): icon = None try: icon_name = (get_wm_name() or "").lower() + ".png" icon = get_icon(icon_name) iconlog("get_icon(%s)=%s", icon_name, icon) except: iconlog("failed to return window icon") return self._updateprop("icon", icon)
def __init__(self): log.info("Xpra %s client version %s %i-bit", self.client_toolkit(), full_version_str(), BITS) for c in UIXpraClient.__bases__: c.__init__(self) try: pinfo = get_platform_info() osinfo = "%s" % platform_name( sys.platform, pinfo.get("linux_distribution") or pinfo.get("sysrelease", "")) log.info(" running on %s", osinfo) except: log("platform name error:", exc_info=True) wm = get_wm_name() if wm: log.info(" window manager is '%s'", wm) self._ui_events = 0 self.title = "" self.session_name = u"" self.server_platform = "" self.server_session_name = None #features: self.opengl_enabled = False self.opengl_props = {} self.readonly = False self.xsettings_enabled = False self.server_start_new_commands = False #in WindowClient - should it be? #self.server_is_desktop = False self.server_sharing = False self.server_sharing_toggle = False self.server_lock = False self.server_lock_toggle = False self.server_window_filters = False self.client_supports_opengl = False self.client_supports_sharing = False self.client_lock = False #helpers and associated flags: self.client_extras = None self.keyboard_helper_class = KeyboardHelper self.keyboard_helper = None self.keyboard_grabbed = False self.pointer_grabbed = False self.kh_warning = False self.menu_helper = None #state: self._on_handshake = [] self._on_server_setting_changed = {}
def get_caps(self): caps = { "randr_notify": True, "show-desktop": True, } wm_name = get_wm_name() if wm_name: caps["wm_name"] = wm_name self._last_screen_settings = self.get_screen_settings() root_w, root_h, sss, ndesktops, desktop_names, u_root_w, u_root_h, _, _ = self._last_screen_settings if u_root_w and u_root_h: caps["desktop_size"] = self.cp(u_root_w, u_root_h) if ndesktops: caps["desktops"] = ndesktops caps["desktop.names"] = desktop_names ss = self.get_screen_sizes() self._current_screen_sizes = ss log.info(" desktop size is %sx%s with %s screen%s:", u_root_w, u_root_h, len(ss), engs(ss)) log_screen_sizes(u_root_w, u_root_h, ss) if self.xscale != 1 or self.yscale != 1: caps["screen_sizes.unscaled"] = ss caps["desktop_size.unscaled"] = u_root_w, u_root_h root_w, root_h = self.cp(u_root_w, u_root_h) if fequ(self.xscale, self.yscale): sinfo = "%i%%" % iround(self.xscale * 100) else: sinfo = "%i%% x %i%%" % (iround( self.xscale * 100), iround(self.yscale * 100)) log.info(" %sscaled by %s, virtual screen size: %ix%i", ["down", "up"][int(u_root_w > root_w or u_root_h > root_h)], sinfo, root_w, root_h) log_screen_sizes(root_w, root_h, sss) else: root_w, root_h = u_root_w, u_root_h sss = ss caps["screen_sizes"] = sss caps.update(self.get_screen_caps()) caps.update( flatten_dict({ "dpi": self.get_dpi_caps(), "screen-scaling": self.get_scaling_caps(), })) return caps
def get_caps(self) -> dict: caps = { "randr_notify": True, "show-desktop": True, "vrefresh": self.get_vrefresh(), } wm_name = get_wm_name() if wm_name: caps["wm_name"] = wm_name self._last_screen_settings = self.get_screen_settings() root_w, root_h, sss, ndesktops, desktop_names, u_root_w, u_root_h = self._last_screen_settings[: 7] if u_root_w and u_root_h: caps["desktop_size"] = self.cp(u_root_w, u_root_h) if ndesktops: caps["desktops"] = ndesktops caps["desktop.names"] = tuple(desktop_names) ss = self.get_screen_sizes() self._current_screen_sizes = ss log.info(" desktop size is %sx%s:", u_root_w, u_root_h) log_screen_sizes(u_root_w, u_root_h, ss) if self.xscale != 1 or self.yscale != 1: caps["screen_sizes.unscaled"] = ss caps["desktop_size.unscaled"] = u_root_w, u_root_h root_w, root_h = self.cp(u_root_w, u_root_h) if fequ(self.xscale, self.yscale): sinfo = "%i%%" % iround(self.xscale * 100) else: sinfo = "%i%% x %i%%" % (iround( self.xscale * 100), iround(self.yscale * 100)) scaled_up = u_root_w > root_w or u_root_h > root_h log.info(" %sscaled to %s, virtual screen size: %ix%i", "up" if scaled_up else "down", sinfo, root_w, root_h) log_screen_sizes(root_w, root_h, sss) else: root_w, root_h = u_root_w, u_root_h sss = ss caps["screen_sizes"] = sss caps.update(self.get_screen_caps()) caps.update( flatten_dict({ "dpi": self.get_dpi_caps(), "screen-scaling": self.get_scaling_caps(), })) return caps
def get_property(self, prop): if prop=="xid": return self.client_window.xid elif prop=="title": return get_wm_name() or "xpra desktop" elif prop=="client-machine": return socket.gethostname() elif prop=="window-type": return ["NORMAL"] elif prop=="shadow": return True elif prop=="class-instance": return ("xpra-desktop", "Xpra-Desktop") else: return gobject.GObject.get_property(self, prop)
def get_property(self, prop): if prop == "xid": return int(get_xwindow(self.client_window)) if prop == "depth": return self._depth if prop == "title": return get_wm_name() or "xpra desktop" if prop == "client-machine": return socket.gethostname() if prop == "window-type": return ["NORMAL"] if prop == "shadow": return True if prop == "class-instance": return ("xpra-desktop", "Xpra-Desktop") return gobject.GObject.get_property(self, prop)
def update_icon(self): icons = None try: icon_name = get_icon_filename((get_wm_name() or "").lower() + ".png") from PIL import Image img = Image.open(icon_name) iconlog("Image(%s)=%s", icon_name, img) if img: icon_data = load_binary_file(icon_name) assert icon_data w, h = img.size icon = (w, h, "png", icon_data) icons = (icon, ) except: iconlog("failed to return window icon", exc_info=True) return self._updateprop("icons", icons)
def update_icon(self): icons = None try: wm_name = get_wm_name() #pylint: disable=assignment-from-none if not wm_name: return icon_name = get_icon_filename(wm_name.lower()+".png") from PIL import Image img = Image.open(icon_name) iconlog("Image(%s)=%s", icon_name, img) if img: icon_data = load_binary_file(icon_name) assert icon_data w, h = img.size icon = (w, h, "png", icon_data) icons = (icon,) except Exception: iconlog("failed to return window icon", exc_info=True) return self._updateprop("icons", icons)
def guess_session_name(self, procs=None): log("guess_session_name(%s)", procs) self.session_name = get_wm_name() # pylint: disable=assignment-from-none log("get_wm_name()=%s", self.session_name)
def __init__(self): log.info("Xpra %s client version %s %i-bit", self.client_toolkit(), full_version_str(), BITS) #mmap_enabled belongs in the MmapClient mixin, #but it is used outside it, so make sure we define it: self.mmap_enabled = False #same for tray: self.tray = None for c in CLIENT_BASES: log("calling %s.__init__()", c) c.__init__(self) try: pinfo = get_platform_info() osinfo = "%s" % platform_name(sys.platform, pinfo.get("linux_distribution") or pinfo.get("sysrelease", "")) log.info(" running on %s", osinfo) except Exception: log("platform name error:", exc_info=True) wm = get_wm_name() #pylint: disable=assignment-from-none if wm: log.info(" window manager is '%s'", wm) self._ui_events = 0 self.title = "" self.session_name = u"" self.server_platform = "" self.server_session_name = None #features: self.opengl_enabled = False self.opengl_props = {} self.readonly = False self.xsettings_enabled = False self.server_start_new_commands = False self.server_xdg_menu = None self.start_new_commands = [] self.start_child_new_commands = [] #in WindowClient - should it be? #self.server_is_desktop = False self.server_sharing = False self.server_sharing_toggle = False self.server_lock = False self.server_lock_toggle = False self.server_window_filters = False self.server_keyboard = True self.server_toggle_keyboard_sync = False self.server_pointer = True self.client_supports_opengl = False self.client_supports_sharing = False self.client_lock = False #helpers and associated flags: self.client_extras = None self.keyboard_helper_class = KeyboardHelper self.keyboard_helper = None self.keyboard_grabbed = False self.keyboard_sync = False self.pointer_grabbed = False self.kh_warning = False self.menu_helper = None #state: self._on_handshake = [] self._on_server_setting_changed = {}
def guess_session_name(self, _procs=None): self.session_name = get_wm_name()