Note that previous value of 'focus_cursor' is still valid.
.It Ic focus_mode
Window focus behavior with respect to the mouse cursor. Possible values:
.Pp
.It Ic focus_mode
Window focus behavior with respect to the mouse cursor. Possible values:
.Pp
-.Bl -tag -width "follow_cursor" -offset indent -compact
+.Bl -tag -width "default" -offset indent -compact
.It Cm default
Set window focus on border crossings caused by cursor motion and
window interaction.
.It Cm default
Set window focus on border crossings caused by cursor motion and
window interaction.
Set window focus on all cursor border crossings, including workspace switches
and changes to layout.
.It Cm manual
Set window focus on all cursor border crossings, including workspace switches
and changes to layout.
.It Cm manual
TAILQ_FOREACH(win, &old_ws->winlist, entry)
unmap_window(win);
TAILQ_FOREACH(win, &old_ws->winlist, entry)
unmap_window(win);
- new_ws->focus_pending = get_region_focus(new_ws->r);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ new_ws->focus_pending = get_region_focus(new_ws->r);
- if (new_ws->focus_pending) {
+ if (new_ws->focus_pending && focus_mode != SWM_FOCUS_FOLLOW) {
/* if workspaces were swapped, then don't wait to set focus */
if (old_ws->r)
focus_win(new_ws->focus_pending);
/* if workspaces were swapped, then don't wait to set focus */
if (old_ws->r)
focus_win(new_ws->focus_pending);
{
int wsid = args->id;
struct ws_win *win = NULL, *parent;
{
int wsid = args->id;
struct ws_win *win = NULL, *parent;
- struct workspace *ws, *nws;
+ struct workspace *ws, *nws, *pws;
char ws_idx_str[SWM_PROPLEN];
if (wsid >= workspace_limit)
char ws_idx_str[SWM_PROPLEN];
if (wsid >= workspace_limit)
/* Update the window's workspace property: _SWM_WS */
if (snprintf(ws_idx_str, SWM_PROPLEN, "%d", nws->idx) < SWM_PROPLEN) {
/* Update the window's workspace property: _SWM_WS */
if (snprintf(ws_idx_str, SWM_PROPLEN, "%d", nws->idx) < SWM_PROPLEN) {
- ws->focus_pending = get_focus_prev(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ ws->focus_pending = get_focus_prev(win);
/* Move the parent if this is a transient window. */
if (win->transient) {
parent = find_window(win->transient);
if (parent) {
/* Move the parent if this is a transient window. */
if (win->transient) {
parent = find_window(win->transient);
if (parent) {
/* Set new focus in parent's ws if needed. */
/* Set new focus in parent's ws if needed. */
- if (parent->ws->focus == parent) {
- parent->ws->focus_pending =
- get_focus_prev(parent);
+ if (pws->focus == parent) {
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ pws->focus_pending =
+ get_focus_prev(parent);
+
- parent->ws->focus =
- parent->ws->focus_pending;
- parent->ws->focus_pending = NULL;
+
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ pws->focus = pws->focus_pending;
+
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ pws->focus_pending = NULL;
}
/* Don't unmap parent if new ws is visible */
}
/* Don't unmap parent if new ws is visible */
/* Restack and set new focus. */
stack();
/* Restack and set new focus. */
stack();
- focus_win(ws->focus_pending);
- ws->focus_pending = NULL;
+
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ focus_win(ws->focus_pending);
+ ws->focus_pending = NULL;
+ }
case SWM_S_FOCUS_MODE:
if (!strcmp(value, "default"))
focus_mode = SWM_FOCUS_DEFAULT;
case SWM_S_FOCUS_MODE:
if (!strcmp(value, "default"))
focus_mode = SWM_FOCUS_DEFAULT;
- else if (!strcmp(value, "follow_cursor"))
+ else if (!strcmp(value, "follow") ||
+ !strcmp(value, "follow_cursor"))
focus_mode = SWM_FOCUS_FOLLOW;
else if (!strcmp(value, "manual"))
focus_mode = SWM_FOCUS_MANUAL;
focus_mode = SWM_FOCUS_FOLLOW;
else if (!strcmp(value, "manual"))
focus_mode = SWM_FOCUS_MANUAL;
- /* If we were focused, make sure we focus on something else. */
- if (win == win->ws->focus)
- win->ws->focus_pending = get_focus_prev(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ /* If we were focused, make sure we focus on something else. */
+ if (win == win->ws->focus)
+ win->ws->focus_pending = get_focus_prev(win);
+ }
unmanage_window(win);
stack();
unmanage_window(win);
stack();
- if (win->ws->focus_pending) {
- focus_win(win->ws->focus_pending);
- win->ws->focus_pending = NULL;
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ if (win->ws->focus_pending) {
+ focus_win(win->ws->focus_pending);
+ win->ws->focus_pending = NULL;
+ }
win->mapped = 1;
set_win_state(win, XCB_ICCCM_WM_STATE_NORMAL);
win->mapped = 1;
set_win_state(win, XCB_ICCCM_WM_STATE_NORMAL);
- if (win->ws->focus_pending == win) {
- focus_win(win);
- win->ws->focus_pending = NULL;
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ if (win->ws->focus_pending == win) {
+ focus_win(win);
+ win->ws->focus_pending = NULL;
+ }
stack();
/* The new window should get focus. */
stack();
/* The new window should get focus. */
- win->ws->focus_pending = get_focus_magic(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ win->ws->focus_pending = get_focus_magic(win);
/* Ignore EnterNotify to handle the mapnotify without interference. */
if (focus_mode == SWM_FOCUS_DEFAULT)
/* Ignore EnterNotify to handle the mapnotify without interference. */
if (focus_mode == SWM_FOCUS_DEFAULT)
if (e->atom == a_swm_iconic) {
if (e->state == XCB_PROPERTY_NEW_VALUE) {
if (e->atom == a_swm_iconic) {
if (e->state == XCB_PROPERTY_NEW_VALUE) {
- win->ws->focus_pending = get_focus_prev(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ win->ws->focus_pending = get_focus_prev(win);
+
unfocus_win(win);
unmap_window(win);
if (win->ws->r) {
stack();
unfocus_win(win);
unmap_window(win);
if (win->ws->r) {
stack();
- focus_win(win->ws->focus_pending);
- win->ws->focus_pending = NULL;
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ focus_win(win->ws->focus_pending);
+ win->ws->focus_pending = NULL;
+ }
focus_flush();
}
} else if (e->state == XCB_PROPERTY_DELETE) {
/* The window is no longer iconic, restack ws. */
focus_flush();
}
} else if (e->state == XCB_PROPERTY_DELETE) {
/* The window is no longer iconic, restack ws. */
- win->ws->focus_pending = get_focus_magic(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ win->ws->focus_pending = get_focus_magic(win);
+
stack();
/* Flush EnterNotify for mapnotify, if needed. */
stack();
/* Flush EnterNotify for mapnotify, if needed. */
} else if (e->atom == a_state) {
/* State just changed, make sure it gets focused if mapped. */
if (e->state == XCB_PROPERTY_NEW_VALUE) {
} else if (e->atom == a_state) {
/* State just changed, make sure it gets focused if mapped. */
if (e->state == XCB_PROPERTY_NEW_VALUE) {
- if (win->mapped && win->ws->focus_pending == win) {
- win->ws->focus_pending = NULL;
- focus_win(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ if (win->mapped &&
+ win->ws->focus_pending == win) {
+ focus_win(win->ws->focus_pending);
+ win->ws->focus_pending = NULL;
+ }
}
}
} else if (e->atom == XCB_ATOM_WM_CLASS ||
}
}
} else if (e->atom == XCB_ATOM_WM_CLASS ||
if (getstate(e->window) == XCB_ICCCM_WM_STATE_NORMAL) {
/* If we were focused, make sure we focus on something else. */
if (win == win->ws->focus)
if (getstate(e->window) == XCB_ICCCM_WM_STATE_NORMAL) {
/* If we were focused, make sure we focus on something else. */
if (win == win->ws->focus)
- win->ws->focus_pending = get_focus_prev(win);
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ win->ws->focus_pending = get_focus_prev(win);
win->mapped = 0;
set_win_state(win, XCB_ICCCM_WM_STATE_ICONIC);
win->mapped = 0;
set_win_state(win, XCB_ICCCM_WM_STATE_ICONIC);
unmanage_window(win);
stack();
unmanage_window(win);
stack();
- if (win->ws->focus_pending) {
- focus_win(win->ws->focus_pending);
- win->ws->focus_pending = NULL;
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ if (win->ws->focus_pending) {
+ focus_win(win->ws->focus_pending);
+ win->ws->focus_pending = NULL;
+ }