New window from id routine.

This commit is contained in:
Eratosthenes 2010-12-13 13:45:04 -05:00
parent 669fb58471
commit 6d8f1ca4f9

View File

@ -65,28 +65,35 @@ class Table(Table_Window):
if self.number is None: if self.number is None:
return None return None
(self.window, self.parent) = self.get_window_from_xid(self.number) (self.window, self.parent) = self.get_window_from_xid(self.number)
# def get_window_from_xid(self, id):
# for outside in root.query_tree().children:
# if outside.id == id:
# return (outside, outside.query_tree().parent)
# for inside in outside.query_tree().children:
# if inside.id == id: # GNOME, Xfce
# return (inside, inside.query_tree().parent)
# 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_window_from_xid(self, id): def get_window_from_xid(self, id):
for outside in root.query_tree().children: for top_level in root.query_tree().children:
if outside.id == id: if top_level.id == id:
return (outside, outside.query_tree().parent) return (top_level, None)
for inside in outside.query_tree().children: for w in treewalk(top_level):
if inside.id == id: # GNOME, Xfce if w.id == id:
return (inside, inside.query_tree().parent) return (w, top_level)
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()
if self.parent is None: if self.parent is None:
return {'x' : my_geo.x + pa_geo.x, return {'x' : my_geo.x,
'y' : my_geo.y + pa_geo.y, 'y' : my_geo.y,
'width' : my_geo.width, 'width' : my_geo.width,
'height' : my_geo.height 'height' : my_geo.height
} }
@ -116,3 +123,10 @@ 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)
def treewalk(parent):
for w in parent.query_tree().children:
for ww in treewalk(w):
yield ww
yield w