Atom adelete;
Atom takefocus;
Atom a_wmname;
+Atom a_netwmname;
Atom a_utf8_string;
Atom a_string;
Atom a_swm_iconic;
struct ws_win *cur_focus = NULL;
struct ws_win_list *wl = NULL;
struct workspace *ws = NULL;
+ int all_iconics;
if (!(r && r->ws))
return;
return;
ws = r->ws;
wl = &ws->winlist;
+ if (TAILQ_EMPTY(wl))
+ return;
+ /* make sure there is at least one uniconified window */
+ all_iconics = 1;
+ TAILQ_FOREACH(winfocus, wl, entry)
+ if (winfocus->iconic == 0) {
+ all_iconics = 0;
+ break;
+ }
+ if (all_iconics)
+ return;
winlostfocus = cur_focus;
/* skip iconics */
if (winfocus && winfocus->iconic) {
- TAILQ_FOREACH_REVERSE(winfocus, wl, ws_win_list, entry)
+ while (winfocus != cur_focus) {
+ if (winfocus == NULL)
+ winfocus = TAILQ_LAST(wl, ws_win_list);
if (winfocus->iconic == 0)
break;
+ winfocus = TAILQ_PREV(winfocus, ws_win_list, entry);
+ }
}
break;
/* skip iconics */
if (winfocus && winfocus->iconic) {
- TAILQ_FOREACH(winfocus, wl, entry)
+ while (winfocus != cur_focus) {
+ if (winfocus == NULL)
+ winfocus = TAILQ_FIRST(wl);
if (winfocus->iconic == 0)
break;
+ winfocus = TAILQ_NEXT(winfocus, entry);
+ }
}
break;
unsigned char ws_idx_str[SWM_PROPLEN];
union arg a;
- if (r && r->ws)
+ if (r && r->ws && r->ws->focus)
win = r->ws->focus;
else
return;
unmap_window(win);
TAILQ_REMOVE(&ws->winlist, win, entry);
TAILQ_INSERT_TAIL(&nws->winlist, win, entry);
+ if (TAILQ_EMPTY(&ws->winlist))
+ r->ws->focus = NULL;
win->ws = nws;
/* Try to update the window's workspace property */
if (win->iconic == 0)
continue;
- name = get_win_name(display, win->id, a_wmname, a_string,
+ name = get_win_name(display, win->id, a_netwmname, a_utf8_string,
&len);
if (name == NULL)
continue;
TAILQ_FOREACH(win, &search_r->ws->winlist, entry) {
if (win->iconic == 0)
continue;
- name = get_win_name(display, win->id, a_wmname, a_string, &len);
+ name = get_win_name(display, win->id, a_netwmname, a_utf8_string, &len);
if (name == NULL)
continue;
if (asprintf(&s, "%s.%lu", name, win->id) == -1) {
if (wordlen == 0) {
warnx("%s: line %zd: no option found",
filename, lineno);
- return (1);
+ goto out;
}
optind = -1;
for (i = 0; i < LENGTH(configopt); i++) {
if (optind == -1) {
warnx("%s: line %zd: unknown option %.*s",
filename, lineno, wordlen, cp);
- return (1);
+ goto out;
}
if (keymapping && strcmp(opt->optname, "bind")) {
warnx("%s: line %zd: invalid option %.*s",
filename, lineno, wordlen, cp);
- return (1);
+ goto out;
}
cp += wordlen;
cp += strspn(cp, " \t\n"); /* eat whitespace */
if (wordlen == 0) {
warnx("%s: line %zd: syntax error",
filename, lineno);
- return (1);
+ goto out;
}
asprintf(&optsub, "%.*s", wordlen, cp);
}
DNPRINTF(SWM_D_CONF, "conf_load end\n");
return (0);
+
+out:
+ free(line);
+ fclose(config);
+
+ return (1);
}
void
adelete = XInternAtom(display, "WM_DELETE_WINDOW", False);
takefocus = XInternAtom(display, "WM_TAKE_FOCUS", False);
a_wmname = XInternAtom(display, "WM_NAME", False);
+ a_netwmname = XInternAtom(display, "_NET_WM_NAME", False);
a_utf8_string = XInternAtom(display, "UTF8_STRING", False);
a_string = XInternAtom(display, "STRING", False);
a_swm_iconic = XInternAtom(display, "_SWM_ICONIC", False);