rem: WWindow *tmp; tmp = wSwitchPanelHandleEvent(swpanel, &ev); if (tmp) { newFocused = tmp; wWindowFocus(newFocused, oldFocused); oldFocused = newFocused; }
add: WWindow *tmp; if (swpanel) { tmp = wSwitchPanelHandleEvent(swpanel, &ev); if (tmp) { newFocused = tmp; wWindowFocus(newFocused, oldFocused); oldFocused = newFocused; } }
context: StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next){    WScreen *scr = wScreenForRootWindow(event->xkey.root);    Bool done = False;    WWindow *newFocused;    WWindow *oldFocused;    int modifiers;    XModifierKeymap *keymap = NULL;    Bool hasModifier;    Bool somethingElse = False;    XEvent ev;#ifdef MOX_CYCLING    WSwitchPanel *swpanel = NULL;#endif    KeyCode leftKey, rightKey;    if (!wwin)        return;      leftKey = XKeysymToKeycode(dpy, XK_Left);    rightKey = XKeysymToKeycode(dpy, XK_Right);    if (next)        hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0);    else        hasModifier = (wKeyBindings[WKBD_FOCUSPREV].modifier != 0);    if (hasModifier) {        keymap = XGetModifierMapping(dpy);#ifdef DEBUG        printf("Grabbing keyboard\n");#endif        XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,                      CurrentTime);    }    scr->flags.doing_alt_tab = 1;#ifdef MOX_CYCLING    swpanel =  wInitSwitchPanel(scr, 0);    oldFocused = wwin;    newFocused = wSwitchPanelSelectNext(swpanel, next);  wWindowFocus(newFocused, oldFocused);  oldFocused = newFocused;#else /* !MOX_CYCLING */    if (next) {        if (wPreferences.windows_cycling)            newFocused = nextToFocusAfter(wwin);        else            newFocused = nextFocusWindow(wwin);    } else {        if (wPreferences.windows_cycling)            newFocused = nextToFocusBefore(wwin);        else            newFocused = prevFocusWindow(wwin);    }    if (wPreferences.circ_raise)        XRaiseWindow(dpy, newFocused->frame->core->window);    wWindowFocus(newFocused, scr->focused_window);    oldFocused = newFocused;#endif /* !MOX_CYCLING */    while (hasModifier && !done) {        WMMaskEvent(dpy, KeyPressMask|KeyReleaseMask|ExposureMask|PointerMotionMask, &ev);        if (ev.type != KeyRelease && ev.type != KeyPress) {            WMHandleEvent(&ev);            continue;        }        /* ignore CapsLock */        modifiers = ev.xkey.state & ValidModMask;        if (ev.type == KeyPress) {#ifdef DEBUG            printf("Got key press\n");#endif            if ((wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode                && wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers)                || ev.xkey.keycode == rightKey) {#ifdef MOX_CYCLING                newFocused = wSwitchPanelSelectNext(swpanel, False);                wWindowFocus(newFocused, oldFocused);                oldFocused = newFocused;#else /* !MOX_CYCLING */                newFocused = nextToFocusAfter(newFocused);                wWindowFocus(newFocused, oldFocused);                oldFocused = newFocused;                if (wPreferences.circ_raise) {                    /* restore order */                    CommitStacking(scr);                    XRaiseWindow(dpy, newFocused->frame->core->window);                }#endif /* !MOX_CYCLING */            } else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode                        && wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers)                       || ev.xkey.keycode == leftKey) {#ifdef MOX_CYCLING                newFocused = wSwitchPanelSelectNext(swpanel, True);                wWindowFocus(newFocused, oldFocused);                oldFocused = newFocused;#else /* !MOX_CYCLING */                newFocused = nextToFocusBefore(newFocused);                wWindowFocus(newFocused, oldFocused);                oldFocused = newFocused;                if (wPreferences.circ_raise) {                    /* restore order */                    CommitStacking(scr);                    XRaiseWindow(dpy, newFocused->frame->core->window);                }#endif /* !MOX_CYCLING */            } else if (ev.type == MotionNotify) {              WWindow *tmp;              tmp = wSwitchPanelHandleEvent(swpanel, &ev);              if (tmp) {                newFocused = tmp;                wWindowFocus(newFocused, oldFocused);                oldFocused = newFocused;              }            } else {#ifdef DEBUG                printf("Got something else\n");#endif                somethingElse = True;                done = True;            }        } else if (ev.type == KeyRelease) {            int i;#ifdef DEBUG            printf("Got key release\n");#endif            for (i = 0; i < 8 * keymap->max_keypermod; i++) {                if (keymap->modifiermap[i] == ev.xkey.keycode &&                    wKeyBindings[WKBD_FOCUSNEXT].modifier                    & 1<<(i/keymap->max_keypermod)) {                    done = True;                    break;                }            }        }    }    if (keymap)        XFreeModifiermap(keymap);    if (hasModifier) {#ifdef DEBUG        printf("Ungrabbing keyboard\n");#endif        XUngrabKeyboard(dpy, CurrentTime);    }    wSetFocusTo(scr, newFocused);#ifdef MOX_CYCLING    if (swpanel)        wSwitchPanelDestroy(swpanel);#endif    if (wPreferences.circ_raise) {        wRaiseFrame(newFocused->frame->core);        CommitStacking(scr);    }    scr->flags.doing_alt_tab = 0;    if (somethingElse) {        WMHandleEvent(&ev);    }}