rem: if (event.xkey.state & ControlMask && !wwin->flags.shaded) { ctrlmode=1; wUnselectWindows(scr); } else { ctrlmode=0; }
add: if (modes == (MOVABLE_BIT|RESIZABLE_BIT)) { if ((event.xkey.state & ControlMask) && !wwin->flags.shaded) { ctrlmode=1; wUnselectWindows(scr); } else { ctrlmode=0; } }
context: wKeyboardMoveResizeWindow(WWindow *wwin){    WScreen *scr = wwin->screen_ptr;    Window root = scr->root_win;    XEvent event;    int w = wwin->frame->core->width;    int h = wwin->frame->core->height;    int scr_width = wwin->screen_ptr->scr_width;    int scr_height = wwin->screen_ptr->scr_height;    int vert_border = wwin->frame->top_width + wwin->frame->bottom_width;    int src_x = wwin->frame_x;    int src_y = wwin->frame_y;    int done,off_x,off_y,ww,wh;    int kspeed = _KS;    Time lastTime = 0;    KeySym keysym=NoSymbol;    int moment=0;    KeyCode shiftl,shiftr,ctrll,ctrlmode;    shiftl = XKeysymToKeycode(dpy, XK_Shift_L);    shiftr = XKeysymToKeycode(dpy, XK_Shift_R);    ctrll = XKeysymToKeycode(dpy, XK_Control_L);    ctrlmode=done=off_x=off_y=0;    XSync(dpy, False);    wusleep(10000);    XGrabKeyboard(dpy, root, False, GrabModeAsync, GrabModeAsync, CurrentTime);    if (!wwin->flags.selected) {        wUnselectWindows(scr);    }    XGrabServer(dpy);    XGrabPointer(dpy, scr->root_win, True, PointerMotionMask                 |ButtonReleaseMask|ButtonPressMask, GrabModeAsync,                 GrabModeAsync, None, wCursor[WCUR_DEFAULT], CurrentTime);    if (wwin->flags.shaded || scr->selected_windows) {        if(scr->selected_windows)            drawFrames(wwin,scr->selected_windows,off_x,off_y);        else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);        if(!scr->selected_windows)            mapPositionDisplay(wwin, src_x, src_y, w, h);    } else {        drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);    }    ww=w;    wh=h;    while(1) {        /*         looper.ox=off_x;         looper.oy=off_y;         */        do {            WMMaskEvent(dpy, KeyPressMask | ButtonReleaseMask                        | ButtonPressMask | ExposureMask, &event);            if (event.type == Expose) {                WMHandleEvent(&event);            }        } while (event.type == Expose);        if (wwin->flags.shaded || scr->selected_windows) {            if(scr->selected_windows)                drawFrames(wwin,scr->selected_windows,off_x,off_y);            else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);            /*** I HATE EDGE RESISTANCE - ]d ***/        }        else {            drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);        }        if(ctrlmode)            showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);        XUngrabServer(dpy);        XSync(dpy, False);        switch (event.type) {        case KeyPress:            /* accelerate */            if (event.xkey.time - lastTime > 50) {                kspeed/=(1 + (event.xkey.time - lastTime)/100);            } else {                if (kspeed < 20) {                    kspeed++;                }            }            if (kspeed < _KS) kspeed = _KS;            lastTime = event.xkey.time;            if (event.xkey.state & ControlMask && !wwin->flags.shaded) {                ctrlmode=1;                wUnselectWindows(scr);            }            else {                ctrlmode=0;            }            if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) {                if (ctrlmode)                    cycleGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh, 0);                else                    cyclePositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);            }            else {                keysym = XLookupKeysym(&event.xkey, 0);                switch (keysym) {                case XK_Return:                    done=2;                    break;                case XK_Escape:                    done=1;                    break;                case XK_Up:#ifdef XK_KP_Up                case XK_KP_Up:#endif                case XK_k:                    if (ctrlmode){                        if (moment != UP)                            h = wh;                        h-=kspeed;                        moment = UP;                        if (h < 1) h = 1;                    }                    else off_y-=kspeed;                    break;                case XK_Down:#ifdef XK_KP_Down                case XK_KP_Down:#endif                case XK_j:                    if (ctrlmode){                        if (moment != DOWN)                            h = wh;                        h+=kspeed;                        moment = DOWN;                    }                    else off_y+=kspeed;                    break;                case XK_Left:#ifdef XK_KP_Left                case XK_KP_Left:#endif                case XK_h:                    if (ctrlmode) {                        if (moment != LEFT)                            w = ww;                        w-=kspeed;                        if (w < 1) w = 1;                        moment = LEFT;                    }                    else off_x-=kspeed;                    break;                case XK_Right:#ifdef XK_KP_Right                case XK_KP_Right:#endif                case XK_l:                    if (ctrlmode) {                        if (moment != RIGHT)                            w = ww;                        w+=kspeed;                        moment = RIGHT;                    }                    else off_x+=kspeed;                    break;                }                ww=w;wh=h;                wh-=vert_border;                wWindowConstrainSize(wwin, &ww, &wh);                wh+=vert_border;                if (wPreferences.ws_cycle){                    if (src_x + off_x + ww < 20){                        if(!scr->current_workspace) {                            wWorkspaceChange(scr, scr->workspace_count-1);                        }                        else wWorkspaceChange(scr, scr->current_workspace-1);                        off_x += scr_width;                    }                    else if (src_x + off_x + 20 > scr_width){                        if(scr->current_workspace == scr->workspace_count-1) {                            wWorkspaceChange(scr, 0);                        }                        else wWorkspaceChange(scr, scr->current_workspace+1);                        off_x -= scr_width;                    }                }                else {                    if (src_x + off_x + ww < 20)                        off_x = 20 - ww - src_x;                    else if (src_x + off_x + 20 > scr_width)                        off_x = scr_width - 20 - src_x;                }                if (src_y + off_y + wh < 20) {                    off_y = 20 - wh - src_y;                }                else if (src_y + off_y + 20 > scr_height) {                    off_y = scr_height - 20 - src_y;                }            }            break;        case ButtonPress:        case ButtonRelease:            done=1;            break;        case Expose:            WMHandleEvent(&event);            while (XCheckTypedEvent(dpy, Expose, &event)) {                WMHandleEvent(&event);            }            break;        default:            WMHandleEvent(&event);            break;        }        XGrabServer(dpy);        /*xxx*/        if (wwin->flags.shaded && !scr->selected_windows){            moveGeometryDisplayCentered(scr, src_x+off_x + w/2, src_y+off_y + h/2);        } else {            if (ctrlmode) {                WMUnmapWidget(scr->gview);                mapGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);            } else if(!scr->selected_windows) {                WMUnmapWidget(scr->gview);                mapPositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);            }        }        if (wwin->flags.shaded || scr->selected_windows) {            if (scr->selected_windows)                drawFrames(wwin,scr->selected_windows,off_x,off_y);            else                drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);        } else {            drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);        }        if (ctrlmode) {            showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);        } else if(!scr->selected_windows)            showPosition(wwin, src_x+off_x, src_y+off_y);        /**/        if (done) {            scr->keymove_tick=0;            /*             WMDeleteTimerWithClientData(&looper);             */            if (wwin->flags.shaded || scr->selected_windows) {                if(scr->selected_windows)                    drawFrames(wwin,scr->selected_windows,off_x,off_y);                else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);            }            else {                drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);            }            if (ctrlmode) {                showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);                WMUnmapWidget(scr->gview);            } else                WMUnmapWidget(scr->gview);            XUngrabKeyboard(dpy, CurrentTime);            XUngrabPointer(dpy, CurrentTime);            XUngrabServer(dpy);            if(done==2) {                if (wwin->flags.shaded || scr->selected_windows) {                    if (!scr->selected_windows) {                        wWindowMove(wwin, src_x+off_x, src_y+off_y);                        wWindowSynthConfigureNotify(wwin);                    } else {                        WMArrayIterator iter;                        WWindow *foo;                        doWindowMove(wwin, scr->selected_windows, off_x, off_y);                        WM_ITERATE_ARRAY(scr->selected_windows, foo, iter) {                            wWindowSynthConfigureNotify(foo);                        }                    }                } else {                    if (wwin->client.width != ww)                        wwin->flags.user_changed_width = 1;                    if (wwin->client.height != wh - vert_border)                        wwin->flags.user_changed_height = 1;                    wWindowConfigure(wwin, src_x+off_x, src_y+off_y,                                     ww, wh - vert_border);                    wWindowSynthConfigureNotify(wwin);                }                wWindowChangeWorkspace(wwin, scr->current_workspace);                wSetFocusTo(scr, wwin);            }            return 1;        }    }}