1.1 --- a/desktop/windows.py Wed Jun 03 21:28:49 2009 +0200
1.2 +++ b/desktop/windows.py Sun Jun 07 16:19:31 2009 +0200
1.3 @@ -83,6 +83,7 @@
1.4 "A window on the desktop."
1.5
1.6 _name_pattern = re.compile(r':\s+\(.*?\)\s+[-0-9x+]+\s+[-0-9+]+$')
1.7 + _absent_names = "(has no name)", "(the root window) (has no name)"
1.8
1.9 def __init__(self, identifier):
1.10
1.11 @@ -120,7 +121,7 @@
1.12 if len(name) > 1 and name[0] == '"' and name[-1] == '"':
1.13 name = name[1:-1]
1.14
1.15 - if name == "(has no name)":
1.16 + if name in self._absent_names:
1.17 return handle, None
1.18 else:
1.19 return handle, name
1.20 @@ -213,14 +214,25 @@
1.21 d = _xwininfo(s)
1.22 return _get_int_properties(d, ["Absolute upper-left X", "Absolute upper-left Y"])
1.23
1.24 - def visible(self):
1.25 + def displayed(self):
1.26
1.27 - "Return whether the window is in some way visible."
1.28 + """
1.29 + Return whether the window is displayed in some way (but not necessarily
1.30 + visible on the current screen).
1.31 + """
1.32
1.33 s = self._get_command_output("stats")
1.34 d = _xwininfo(s)
1.35 return d["Map State"] != "IsUnviewable"
1.36
1.37 + def visible(self):
1.38 +
1.39 + "Return whether the window is displayed and visible."
1.40 +
1.41 + s = self._get_command_output("stats")
1.42 + d = _xwininfo(s)
1.43 + return d["Map State"] == "IsViewable"
1.44 +
1.45 def list(desktop=None):
1.46
1.47 """
1.48 @@ -230,7 +242,7 @@
1.49 """
1.50
1.51 root_window = root(desktop)
1.52 - window_list = [window for window in root_window.descendants() if window.visible()]
1.53 + window_list = [window for window in root_window.descendants() if window.displayed()]
1.54 window_list.insert(0, root_window)
1.55 return window_list
1.56