JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Don't swap_to_main if no window has focus or main has focus.
authorRyan McBride <mcbride@countersiege.com>
Wed, 14 Jan 2009 06:04:21 +0000 (06:04 +0000)
committerRyan McBride <mcbride@countersiege.com>
Wed, 14 Jan 2009 06:04:21 +0000 (06:04 +0000)
scrotwm.c

index 87cb946..d8b6519 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -371,7 +371,10 @@ swap_to_main(union arg *args)
        struct ws_win           *tmpwin = TAILQ_FIRST(&ws[current_ws].winlist);
 
        DNPRINTF(SWM_D_MISC, "swap_to_main: win: %lu\n",
-           ws[current_ws].focus->id);
+           ws[current_ws].focus ? ws[current_ws].focus->id : 0);
+
+       if (ws[current_ws].focus == NULL || ws[current_ws].focus == tmpwin)
+               return;
 
        TAILQ_REMOVE(&ws[current_ws].winlist, tmpwin, entry);
        TAILQ_INSERT_AFTER(&ws[current_ws].winlist, ws[current_ws].focus,