1.1 --- a/desktop/windows.py Wed Oct 15 21:12:21 2008 +0000
1.2 +++ b/desktop/windows.py Wed Oct 15 21:12:37 2008 +0000
1.3 @@ -72,11 +72,17 @@
1.4 def __repr__(self):
1.5 return "Window(%r)" % self.identifier
1.6
1.7 + def _get_identifier(self):
1.8 + if self.identifier is None:
1.9 + return "-root"
1.10 + else:
1.11 + return "-id " + self.identifier
1.12 +
1.13 def children(self):
1.14
1.15 "Return a list of windows which are children of this window."
1.16
1.17 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -children" % self.identifier, shell=1)
1.18 + s = _readfrom(_get_x11_vars() + "xwininfo %s -children" % self._get_identifier(), shell=1)
1.19 handles = []
1.20 adding = 0
1.21 for line in s.split("\n"):
1.22 @@ -90,7 +96,7 @@
1.23
1.24 "Return the name of the window."
1.25
1.26 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
1.27 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
1.28 for line in s.split("\n"):
1.29 if line.startswith("xwininfo:"):
1.30
1.31 @@ -110,7 +116,7 @@
1.32
1.33 "Return a tuple containing the width and height of this window."
1.34
1.35 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
1.36 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
1.37 d = _xwininfo(s)
1.38 return _get_int_properties(d, ["Width", "Height"])
1.39
1.40 @@ -118,7 +124,7 @@
1.41
1.42 "Return a tuple containing the upper left co-ordinates of this window."
1.43
1.44 - s = _readfrom(_get_x11_vars() + "xwininfo -id %s -stats" % self.identifier, shell=1)
1.45 + s = _readfrom(_get_x11_vars() + "xwininfo %s -stats" % self._get_identifier(), shell=1)
1.46 d = _xwininfo(s)
1.47 return _get_int_properties(d, ["Absolute upper-left X", "Absolute upper-left Y"])
1.48
1.49 @@ -137,7 +143,10 @@
1.50 s = _readfrom(_get_x11_vars() + "xlsclients -a -l", shell=1)
1.51 prefix = "Window "
1.52 prefix_end = len(prefix)
1.53 - handles = []
1.54 +
1.55 + # Include the root window.
1.56 +
1.57 + handles = [None]
1.58
1.59 for line in s.split("\n"):
1.60 if line.startswith(prefix):