Fixed table dectection on Ubuntu/KDE.
This commit is contained in:
parent
6bfb7df105
commit
f329d85ca7
|
@ -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
|
||||||
|
|
||||||
|
@ -105,4 +115,4 @@ class Table(Table_Window):
|
||||||
|
|
||||||
# This is the gdkhandle for the HUD window
|
# This is the gdkhandle for the HUD window
|
||||||
gdkwindow = gtk.gdk.window_foreign_new(window.window.xid)
|
gdkwindow = gtk.gdk.window_foreign_new(window.window.xid)
|
||||||
gdkwindow.set_transient_for(self.gdkhandle)
|
gdkwindow.set_transient_for(self.gdkhandle)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user