summaryrefslogtreecommitdiff
path: root/list.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-08-26 04:55:36 +0000
committersabetts <sabetts>2000-08-26 04:55:36 +0000
commit2a3c661689c276a3e441139f316689d6172a8ebb (patch)
tree380b956a60a4c0cf710034395159525c4aa5e0ea /list.c
parent592583e898157e6047412a398e33ed89b080e1d6 (diff)
downloadratpoison-2a3c661689c276a3e441139f316689d6172a8ebb.zip
fixed up some last_window() bugs where ratpoison was not properly switching to
the last accessed window.
Diffstat (limited to 'list.c')
-rw-r--r--list.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/list.c b/list.c
index 919aa5a..9b7e281 100644
--- a/list.c
+++ b/list.c
@@ -155,7 +155,16 @@ rp_window *
find_last_accessed_window ()
{
int last_access = 0;
- rp_window *cur, *most_recent = NULL;
+ rp_window *cur, *most_recent;
+
+ /* Find the first mapped window */
+ for (most_recent = rp_window_head; most_recent; most_recent=most_recent->next)
+ {
+ if (most_recent->state == STATE_MAPPED) break;
+ }
+
+ /* If there are no mapped windows, don't bother with the next part */
+ if (most_recent == NULL) return NULL;
for (cur=rp_window_head; cur; cur=cur->next)
{
@@ -164,7 +173,7 @@ find_last_accessed_window ()
&& cur->state == STATE_MAPPED)
{
most_recent = cur;
- last_access = most_recent->last_access;
+ last_access = cur->last_access;
}
}