Index: src/actions.c =================================================================== RCS file: /cvsroot/wm/src/actions.c,v retrieving revision 1.69 diff -u -r1.69 actions.c --- wmaker/src/actions.c 22 Oct 2004 23:39:11 -0000 1.69 +++ wmaker/src/actions.c 4 Jan 2005 10:32:18 -0000 @@ -175,15 +175,30 @@ /* if this is not the focused window focus it */ if (focused!=wwin) { /* change the focus window list order */ - if (wwin->prev) - wwin->prev->next = wwin->next; - - if (wwin->next) - wwin->next->prev = wwin->prev; - - wwin->prev = focused; - focused->next = wwin; - wwin->next = NULL; + if (wPreferences.windows_cycling ) { + /* swap wwin and focused */ + if (wwin->prev) + wwin->prev->next = wwin->next; + + if (wwin->next) + wwin->next->prev = wwin->prev; + + wwin->prev = focused; + focused->next = wwin; + wwin->next = NULL; + } else { + /* reorder the linked list without changing windows order */ + WWindow * last = wwin, *first = focused; + while (last->prev) last = last->prev; + while (first->next) first = first->next; + + last->prev = first; + first->next = last; + + if (wwin->next) + wwin->next->prev = NULL; + wwin->next = NULL; + } scr->focused_window = wwin; if (oapp && oapp != napp) { Index: src/defaults.c =================================================================== RCS file: /cvsroot/wm/src/defaults.c,v retrieving revision 1.95 diff -u -r1.95 defaults.c --- wmaker/src/defaults.c 27 Oct 2004 02:54:32 -0000 1.95 +++ wmaker/src/defaults.c 4 Jan 2005 10:32:22 -0000 @@ -407,6 +407,9 @@ {"RaiseDelay", "0", NULL, &wPreferences.raise_delay, getInt, NULL }, + {"WindozeCycling", "YES", NULL, + &wPreferences.windows_cycling,getBool, NULL + }, {"CirculateRaise", "NO", NULL, &wPreferences.circ_raise, getBool, NULL }, Index: src/workspace.c =================================================================== RCS file: /cvsroot/wm/src/workspace.c,v retrieving revision 1.52 diff -u -r1.52 workspace.c --- wmaker/src/workspace.c 26 Oct 2004 03:03:02 -0000 1.52 +++ wmaker/src/workspace.c 4 Jan 2005 10:32:23 -0000 @@ -575,13 +575,45 @@ if (scr->focused_window->flags.mapped && !foc) { foc = scr->focused_window; } + + if (!wPreferences.windows_cycling) { + /* Reorder window list. All windows in the current + workspace are moved at the end of the list */ + WWindow * current_ws = NULL, *other_ws = NULL; + WWindow * tmp = scr->focused_window; //foc; + while (tmp->next) tmp = tmp->next; + + while (tmp) { + if (tmp->prev) tmp->prev->next = tmp->next; + if (tmp->next) tmp->next->prev = tmp->prev; + + if (tmp->frame->workspace == workspace) { + tmp->next = current_ws; + if (current_ws) current_ws->prev = tmp; + current_ws = tmp; + } else { + tmp->next = other_ws; + if (other_ws) other_ws->prev = tmp; + other_ws = tmp; + } + tmp = tmp->prev; + } + if (current_ws && other_ws) { + other_ws->prev = NULL; + + while (other_ws->next) other_ws = other_ws->next; + + current_ws->prev = other_ws; + other_ws->next = current_ws; + } + } + if (wPreferences.focus_mode == WKF_CLICK) { wSetFocusTo(scr, foc); } else { unsigned int mask; int foo; Window bar, win; - WWindow *tmp; tmp = NULL; if (XQueryPointer(dpy, scr->root_win, &bar, &win,