Remove some mapping stuff and xsyncs.
struct layout {
void (*l_stack)(struct workspace *, struct swm_geometry *);
void (*l_config)(struct workspace *, int);
struct layout {
void (*l_stack)(struct workspace *, struct swm_geometry *);
void (*l_config)(struct workspace *, int);
+ u_int32_t flags;
+#define SWM_L_FOCUSPREV (1<<0)
+#define SWM_L_MAPONFOCUS (1<<1)
} layouts[] = {
/* stack, configure */
} layouts[] = {
/* stack, configure */
- { vertical_stack, vertical_config},
- { horizontal_stack, horizontal_config},
- { max_stack, NULL},
- { NULL, NULL},
+ { vertical_stack, vertical_config, 0},
+ { horizontal_stack, horizontal_config, 0},
+ { max_stack, NULL,
+ SWM_L_FOCUSPREV | SWM_L_MAPONFOCUS},
+ { NULL, NULL, 0},
};
#define SWM_H_SLICE (32)
};
#define SWM_H_SLICE (32)
XSetWindowBorder(display, win->id,
win->ws->r->s->c[SWM_S_COLOR_FOCUS].color);
grabbuttons(win, 1);
XSetWindowBorder(display, win->id,
win->ws->r->s->c[SWM_S_COLOR_FOCUS].color);
grabbuttons(win, 1);
+ if (win->ws->cur_layout->flags & SWM_L_MAPONFOCUS)
+ XMapRaised(display, win->id);
XSetInputFocus(display, win->id,
RevertToPointerRoot, CurrentTime);
XSync(display, False);
XSetInputFocus(display, win->id,
RevertToPointerRoot, CurrentTime);
XSync(display, False);
if (winfocus == winlostfocus || winfocus == NULL)
return;
if (winfocus == winlostfocus || winfocus == NULL)
return;
- XMapRaised(display, winfocus->id);
ignore_enter = 1;
stack();
focus_win(winfocus);
ignore_enter = 1;
stack();
focus_win(winfocus);
DNPRINTF(SWM_D_STACK, "max_stack: workspace: %d\n", ws->idx);
DNPRINTF(SWM_D_STACK, "max_stack: workspace: %d\n", ws->idx);
+ if (ws == NULL)
+ return;
+
winno = count_win(ws, 0);
if (winno == 0 && count_win(ws, 1) == 0)
return;
winno = count_win(ws, 0);
if (winno == 0 && count_win(ws, 1) == 0)
return;
/* put the last transient on top */
if (wintrans) {
stack_floater(wintrans, ws->r);
/* put the last transient on top */
if (wintrans) {
stack_floater(wintrans, ws->r);
- XMapRaised(display, wintrans->id);
focus_win(wintrans); /* override */
}
}
focus_win(wintrans); /* override */
}
}
if (win->transient)
winfocus = find_window(win->transient);
else if (ws->focus == win) {
if (win->transient)
winfocus = find_window(win->transient);
else if (ws->focus == win) {
- if (TAILQ_FIRST(wl) == win)
+ if ((ws->cur_layout->flags & SWM_L_FOCUSPREV) &&
+ ws->focus_prev)
+ winfocus = ws->focus_prev;
+ else if (TAILQ_FIRST(wl) == win)
winfocus = TAILQ_NEXT(win, entry);
else {
winfocus = TAILQ_NEXT(win, entry);
else {
- winfocus = TAILQ_PREV(ws->focus, ws_win_list, entry);
+ winfocus = TAILQ_PREV(ws->focus, ws_win_list,
+ entry);
if (winfocus == NULL)
winfocus = TAILQ_LAST(wl, ws_win_list);
}
if (winfocus == NULL)
winfocus = TAILQ_LAST(wl, ws_win_list);
}