Fixed table dectection on Ubuntu/KDE.

This commit is contained in:
Eratosthenes 2010-12-05 12:52:02 -05:00
parent 6bfb7df105
commit f329d85ca7

View File

@ -66,27 +66,37 @@ class Table(Table_Window):
if self.number is None: if self.number is None:
return None return None
self.window = self.get_window_from_xid(self.number) (self.window, self.parent) = self.get_window_from_xid(self.number)
self.parent = self.window.query_tree().parent
def get_window_from_xid(self, id): def get_window_from_xid(self, id):
for outside in root.query_tree().children: for outside in root.query_tree().children:
if outside.id == id: if outside.id == id:
return outside return (outside, outside.query_tree().parent)
for inside in outside.query_tree().children: for inside in outside.query_tree().children:
if inside.id == id: if inside.id == id: # GNOME, Xfce
return inside return (inside, inside.query_tree().parent)
return None for wayinside in inside.query_tree().children:
if wayinside.id == id: # KDE
parent = wayinside.query_tree().parent
return (wayinside, parent.query_tree().parent)
return (None, None)
def get_geometry(self): def get_geometry(self):
try: try:
my_geo = self.window.get_geometry() my_geo = self.window.get_geometry()
pa_geo = self.parent.get_geometry() if self.parent is None:
return {'x' : my_geo.x + pa_geo.x, return {'x' : my_geo.x + pa_geo.x,
'y' : my_geo.y + pa_geo.y, 'y' : my_geo.y + pa_geo.y,
'width' : my_geo.width, 'width' : my_geo.width,
'height' : my_geo.height 'height' : my_geo.height
} }
else:
pa_geo = self.parent.get_geometry()
return {'x' : my_geo.x + pa_geo.x,
'y' : my_geo.y + pa_geo.y,
'width' : my_geo.width,
'height' : my_geo.height
}
except: except:
return None return None