Skip to content

Commit

Permalink
#489: better debug logging of dbus source objects, add GetAllWindowFi…
Browse files Browse the repository at this point in the history
…lters and also expose the filters via xpra info

git-svn-id: https://xpra.org/svn/Xpra/trunk@10787 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 10, 2015
1 parent 0a91bd9 commit 0269d2d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/xpra/server/dbus/dbus_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@ def __init__(self, source=None, extra=""):
self.source = source
session_bus = init_session_bus()
name = BUS_NAME
path = PATH + str(sequence.increase())
self.path = PATH + str(sequence.increase())
if extra:
name += extra
bus_name = dbus.service.BusName(name, session_bus)
dbus.service.Object.__init__(self, bus_name, path)
dbus.service.Object.__init__(self, bus_name, self.path)
self.log("(%s)", source)
self._properties = {"bell" : ("send_bell", ni),
"cursors" : ("send_cursors", ni),
"notifications" : ("send_notifications", ni),
}

def __str__(self):
return "DBUS_Source(%s:%s)" % (BUS_NAME, self.path)


def cleanup(self):
try:
log("calling %s", self.remove_from_connection)
Expand Down Expand Up @@ -109,6 +113,10 @@ def ResetWindowFilters(self):
def AddWindowFilter(self, object_name, property_name, operator, value):
self.source.add_window_filter(ns(object_name), ns(property_name), ns(operator), n(value))

@dbus.service.method(INTERFACE, out_signature='as')
def GetAllWindowFilters(self):
return [str(x) for x in self.source.get_all_window_filters()]


@dbus.service.method(INTERFACE, in_signature='')
def SetDefaultKeymap(self):
Expand Down
9 changes: 9 additions & 0 deletions src/xpra/server/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,12 @@ def up(prefix, d):
"delta" : AV_SYNC_DELTA})
if self.window_frame_sizes:
up("window.frame-sizes", self.window_frame_sizes)
if self.window_filters:
i = 0
for uuid, f in self.window_filters:
if uuid==self.uuid:
info["window-filter[%i]" % i] = str(f)
i += 1
info.update(self.get_sound_info())
info.update(self.get_features_info())
info.update(self.get_screen_info())
Expand Down Expand Up @@ -1733,6 +1739,9 @@ def window_metadata(self, wid, window, prop):
def reset_window_filters(self):
self.window_filters = [(uuid, f) for uuid, f in self.window_filters if uuid!=self.uuid]

def get_all_window_filters(self):
return [f for uuid, f in self.window_filters if uuid==self.uuid]

def get_window_filter(self, object_name, property_name, operator, value):
if object_name!="window":
raise ValueError("invalid object name")
Expand Down

0 comments on commit 0269d2d

Please sign in to comment.