Yet another try to fix missing X windows. Using xwininfo.
This commit is contained in:
parent
55f1ebedd9
commit
812998704d
|
@ -90,11 +90,11 @@ if __name__=="__main__":
|
||||||
table.gdk_handle = gtk.gdk.window_foreign_new(table.number)
|
table.gdk_handle = gtk.gdk.window_foreign_new(table.number)
|
||||||
|
|
||||||
print "table =", table
|
print "table =", table
|
||||||
print "game =", table.get_game()
|
# print "game =", table.get_game()
|
||||||
|
|
||||||
fake = fake_hud(table)
|
fake = fake_hud(table)
|
||||||
print "fake =", fake
|
print "fake =", fake
|
||||||
gobject.timeout_add(100, check_on_table, table, fake)
|
# gobject.timeout_add(100, check_on_table, table, fake)
|
||||||
print "calling main"
|
print "calling main"
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
|
|
|
@ -69,36 +69,42 @@ class Table(Table_Window):
|
||||||
for listing in os.popen('xwininfo -root -tree').readlines():
|
for listing in os.popen('xwininfo -root -tree').readlines():
|
||||||
if re.search(search_string, listing):
|
if re.search(search_string, listing):
|
||||||
print listing
|
print listing
|
||||||
mo = re.match('\s+([\dxabcdef]+)\s', listing)
|
mo = re.match('\s+([\dxabcdef]+) (.+):\s\(\"([a-zA-Z.]+)\".+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing)
|
||||||
window_number = int( mo.group(1), 0)
|
self.number = int( mo.group(1), 0)
|
||||||
|
self.width = int( mo.group(4) )
|
||||||
done_looping = False
|
self.height = int( mo.group(5) )
|
||||||
for outside in root.query_tree().children:
|
self.x = int( mo.group(6) )
|
||||||
for inside in outside.query_tree().children:
|
self.y = int( mo.group(7) )
|
||||||
if done_looping: break
|
self.title = re.sub('\"', '', mo.group(2))
|
||||||
if inside.id == window_number:
|
self.exe = "" # not used?
|
||||||
self.window = inside
|
self.hud = None
|
||||||
self.parent = outside
|
# done_looping = False
|
||||||
done_looping = True
|
# for outside in root.query_tree().children:
|
||||||
break
|
# for inside in outside.query_tree().children:
|
||||||
|
# if done_looping: break
|
||||||
|
# if inside.id == window_number:
|
||||||
|
# self.window = inside
|
||||||
|
# self.parent = outside
|
||||||
|
# done_looping = True
|
||||||
|
# break
|
||||||
|
|
||||||
if window_number is None:
|
if window_number is None:
|
||||||
print "Window %s not found. Skipping." % search_string
|
print "Window %s not found. Skipping." % search_string
|
||||||
return None
|
return None
|
||||||
|
|
||||||
my_geo = self.window.get_geometry()
|
# my_geo = self.window.get_geometry()
|
||||||
pa_geo = self.parent.get_geometry()
|
# pa_geo = self.parent.get_geometry()
|
||||||
|
#
|
||||||
|
# self.x = pa_geo.x + my_geo.x
|
||||||
|
# self.y = pa_geo.y + my_geo.y
|
||||||
|
# self.width = my_geo.width
|
||||||
|
# self.height = my_geo.height
|
||||||
|
# self.exe = self.window.get_wm_class()[0]
|
||||||
|
# self.title = self.window.get_wm_name()
|
||||||
|
# self.site = ""
|
||||||
|
# self.hud = None
|
||||||
|
|
||||||
self.x = pa_geo.x + my_geo.x
|
# window_string = str(self.window)
|
||||||
self.y = pa_geo.y + my_geo.y
|
|
||||||
self.width = my_geo.width
|
|
||||||
self.height = my_geo.height
|
|
||||||
self.exe = self.window.get_wm_class()[0]
|
|
||||||
self.title = self.window.get_wm_name()
|
|
||||||
self.site = ""
|
|
||||||
self.hud = None
|
|
||||||
|
|
||||||
window_string = str(self.window)
|
|
||||||
mo = re.match('Xlib\.display\.Window\(([\dxabcdef]+)', window_string)
|
mo = re.match('Xlib\.display\.Window\(([\dxabcdef]+)', window_string)
|
||||||
if not mo:
|
if not mo:
|
||||||
print "Not matched"
|
print "Not matched"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user