Commit e2f7db1f authored by Tinu Weber's avatar Tinu Weber

Fix monitor focus stepping

* If the scratchpad is active on a monitor, apply workspace_focus on
* Use list_find_index instead of manually trying to determine indexes.
parent b047345d
......@@ -1504,15 +1504,17 @@ steplayout(union arg arg)
stepmon(union arg arg)
struct monitor *m, *srcmon, *dstmon;
struct monitor *srcmon, *dstmon;
unsigned int srcpos, dstpos;
/* find index of source monitor */
srcmon = seat->selmon;
LIST_FOR (seat->monitors, srcpos, m)
if (m == srcmon)
if (!srcmon) {
warn("Seat does not focus any monitor");
srcpos = list_find_index(seat->monitors, srcmon, NULL);
assert(srcpos < seat->monitors->size);
/* find destination monitor */
......@@ -91,17 +91,15 @@ monitor_focus(struct monitor *mon, bool focus)
if (mon->focused == focus)
if (focus && !mon->seat)
die("Attempt to focus unattached monitor");
mon->focused = focus;
if (mon->selws)
if (mon->scratchpad)
workspace_focus(mon->scratchpad, focus);
else if (mon->selws)
workspace_focus(mon->selws, focus);
else if (focus)
XSetInputFocus(x11.dpy, x11.root, RevertToPointerRoot,
statusbar_focus(mon->bar, focus);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment