]> code.delx.au - spectrwm/commitdiff
If the master window already has focus when M-m is pressed, switch focus
authorRyan McBride <mcbride@countersiege.com>
Fri, 13 Feb 2009 00:47:21 +0000 (00:47 +0000)
committerRyan McBride <mcbride@countersiege.com>
Fri, 13 Feb 2009 00:47:21 +0000 (00:47 +0000)
back to the previously focused window, to match the behaviour of M-enter.

Pointed out by jacekm@.

scrotwm.c

index da457258877fc1abf38bfaa3f7da3f8cac75b1ef..634e08b27d142c7589a71681197c5831cab6a4b2 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -1288,6 +1288,10 @@ focus(struct swm_region *r, union arg *args)
 
        case SWM_ARG_ID_FOCUSMAIN:
                winfocus = TAILQ_FIRST(wl);
 
        case SWM_ARG_ID_FOCUSMAIN:
                winfocus = TAILQ_FIRST(wl);
+               if (winfocus == cur_focus)
+                       winfocus = cur_focus->ws->focus_prev;
+               if (winfocus == NULL)
+                       return;
                break;
 
        default:
                break;
 
        default: