def do_setup_xprops(self, *args): log("do_setup_xprops(%s)", args) ROOT_PROPS = [ "RESOURCE_MANAGER", "_NET_WORKAREA", "_NET_CURRENT_DESKTOP" ] try: self.init_x11_filter() from xpra.gtk_common.gtk_util import get_default_root_window from xpra.x11.xsettings import XSettingsWatcher from xpra.x11.xroot_props import XRootPropWatcher root = get_default_root_window() if self._xsettings_watcher is None: self._xsettings_watcher = XSettingsWatcher() self._xsettings_watcher.connect("xsettings-changed", self._handle_xsettings_changed) self._handle_xsettings_changed() if self._root_props_watcher is None: self._root_props_watcher = XRootPropWatcher(ROOT_PROPS, root) self._root_props_watcher.connect( "root-prop-changed", self._handle_root_prop_changed) #ensure we get the initial value: self._root_props_watcher.do_notify("RESOURCE_MANAGER") except ImportError as e: log("do_setup_xprops%s", args, exc_info=True) log.error( "Error: failed to load X11 properties/settings bindings:") log.error(" %s", e) log.error(" root window properties will not be propagated")
def test_watching(self): blob1 = "blob1" manager1 = XSettingsManager() manager1.set_blob_in_place(blob1) watcher = XSettingsWatcher() assert watcher.get_settings_blob() == blob1 blob2 = "blob2" manager2 = XSettingsManager() manager2.set_blob_in_place(blob2) assert_mainloop_emits(watcher, "xsettings-changed") assert watcher.get_settings_blob() == blob2 # It's likely that (due to how the GTK+ clipboard code works # underneath) all of the managers that we create within a single # process are actually using the same selection window, and thus the # previous tests could work right even if we only watch for # PropertyNotify *or* only watch for selection owner changes. # Test where the property change but no manager change message # is sent: blob3 = "blob3" manager2.set_blob_in_place(blob3) assert_mainloop_emits(watcher, "xsettings-changed") assert watcher.get_settings_blob() == blob3 # Test where the property does not change, but a manager change # message is sent: manager3 = XSettingsManager() manager3.set_blob_in_place(blob3) assert_mainloop_emits(watcher, "xsettings-changed") assert watcher.get_settings_blob() == blob3
def do_setup_xprops(self, *args): log("do_setup_xprops(%s)", args) if is_gtk3(): log("x11 root properties and XSETTINGS are not supported yet with GTK3" ) return ROOT_PROPS = [ "RESOURCE_MANAGER", "_NET_WORKAREA", "_NET_CURRENT_DESKTOP" ] try: from xpra.x11.xsettings import XSettingsWatcher from xpra.x11.xroot_props import XRootPropWatcher if self._xsettings_watcher is None: self._xsettings_watcher = XSettingsWatcher() self._xsettings_watcher.connect("xsettings-changed", self._handle_xsettings_changed) self._handle_xsettings_changed() if self._root_props_watcher is None: self._root_props_watcher = XRootPropWatcher(ROOT_PROPS) self._root_props_watcher.connect( "root-prop-changed", self._handle_root_prop_changed) #ensure we get the initial value: self._root_props_watcher.do_notify("RESOURCE_MANAGER") except ImportError as e: log.error( "failed to load X11 properties/settings bindings: %s - root window properties will not be propagated", e)
def setup_xprop_xsettings(client): log.debug("setup_xprop_xsettings(%s)", client) try: from xpra.x11.xsettings import XSettingsWatcher from xpra.x11.xroot_props import XRootPropWatcher self._xsettings_watcher = XSettingsWatcher() self._xsettings_watcher.connect("xsettings-changed", self._handle_xsettings_changed) self._handle_xsettings_changed() self._root_props_watcher = XRootPropWatcher( self.ROOT_PROPS.keys()) self._root_props_watcher.connect( "root-prop-changed", self._handle_root_prop_changed) self._root_props_watcher.notify_all() except ImportError, e: log.error( "failed to load X11 properties/settings bindings: %s - root window properties will not be propagated", e)
def do_setup_xprops(self, *args): log.debug("do_setup_xprops(%s)", args) ROOT_PROPS = ["RESOURCE_MANAGER", "_NET_WORKAREA"] try: from xpra.x11.xsettings import XSettingsWatcher from xpra.x11.xroot_props import XRootPropWatcher self._xsettings_watcher = XSettingsWatcher() self._xsettings_watcher.connect("xsettings-changed", self._handle_xsettings_changed) self._handle_xsettings_changed() self._root_props_watcher = XRootPropWatcher(ROOT_PROPS) self._root_props_watcher.connect("root-prop-changed", self._handle_root_prop_changed) #ensure we get the initial value: self._root_props_watcher.do_notify("RESOURCE_MANAGER") except ImportError, e: log.error( "failed to load X11 properties/settings bindings: %s - root window properties will not be propagated", e)
def test_basic_set_get(self): blob = "asdfwheeeee" manager = XSettingsManager() manager.set_blob_in_place(blob) watcher = XSettingsWatcher() assert watcher.get_settings_blob() == blob