mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Add KEY_CONTROL_WINDOW_WEIGHT to keyboard move window code and bugs fixes.
This commit is contained in:
@@ -1118,8 +1118,6 @@ updateWindowPosition(WWindow *wwin, MoveData *data, Bool doResistance,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
typedef struct _looper {
|
||||
WWindow *wwin;
|
||||
@@ -1152,7 +1150,8 @@ _keyloop(_looper *lpr){
|
||||
}
|
||||
|
||||
#endif
|
||||
#define _KS 20
|
||||
|
||||
#define _KS KEY_CONTROL_WINDOW_WEIGHT
|
||||
|
||||
int
|
||||
wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
@@ -1168,9 +1167,10 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
int src_x = wwin->frame_x;
|
||||
int src_y = wwin->frame_y;
|
||||
int done,off_x,off_y,ww,wh;
|
||||
int kspeed = 1;
|
||||
int kspeed = _KS;
|
||||
Time lastTime = 0;
|
||||
KeySym keysym=NoSymbol;
|
||||
int moment=0;
|
||||
KeyCode shiftl,shiftr,ctrll,ctrlmode;
|
||||
|
||||
/*
|
||||
@@ -1236,11 +1236,13 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
case KeyPress:
|
||||
/* accelerate */
|
||||
if (event.xkey.time - lastTime > 50) {
|
||||
kspeed = 1;
|
||||
kspeed/=(1 + (event.xkey.time - lastTime)/100);
|
||||
} else {
|
||||
if (kspeed < 20)
|
||||
if (kspeed < 20) {
|
||||
kspeed++;
|
||||
}
|
||||
}
|
||||
if (kspeed < _KS) kspeed = _KS;
|
||||
lastTime = event.xkey.time;
|
||||
|
||||
if (event.xkey.state & ControlMask && !wwin->flags.shaded) {
|
||||
@@ -1257,6 +1259,7 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
cyclePositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||
}
|
||||
else {
|
||||
|
||||
keysym = XLookupKeysym(&event.xkey, 0);
|
||||
switch (keysym) {
|
||||
case XK_Return:
|
||||
@@ -1269,7 +1272,11 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
case XK_KP_Up:
|
||||
case XK_k:
|
||||
if (ctrlmode){
|
||||
if (moment != UP)
|
||||
h = wh;
|
||||
h-=kspeed;
|
||||
moment = UP;
|
||||
if (h < 1) h = 1;
|
||||
}
|
||||
else off_y-=kspeed;
|
||||
break;
|
||||
@@ -1277,7 +1284,10 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
case XK_KP_Down:
|
||||
case XK_j:
|
||||
if (ctrlmode){
|
||||
if (moment != DOWN)
|
||||
h = wh;
|
||||
h+=kspeed;
|
||||
moment = DOWN;
|
||||
}
|
||||
else off_y+=kspeed;
|
||||
break;
|
||||
@@ -1285,7 +1295,11 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
case XK_KP_Left:
|
||||
case XK_h:
|
||||
if (ctrlmode) {
|
||||
if (moment != LEFT)
|
||||
w = ww;
|
||||
w-=kspeed;
|
||||
if (w < 1) w = 1;
|
||||
moment = LEFT;
|
||||
}
|
||||
else off_x-=kspeed;
|
||||
break;
|
||||
@@ -1293,18 +1307,22 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
case XK_KP_Right:
|
||||
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 + wwin->frame->core->width < 20){
|
||||
if (src_x + off_x + ww < 20){
|
||||
if(!scr->current_workspace) {
|
||||
wWorkspaceChange(scr, scr->workspace_count-1);
|
||||
}
|
||||
@@ -1320,17 +1338,18 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (src_x + off_x + wwin->frame->core->width < 20)
|
||||
off_x = 20 - wwin->frame->core->width - src_x;
|
||||
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 + wwin->frame->core->height < 20)
|
||||
off_y = 20 - wwin->frame->core->height - src_y;
|
||||
else if (src_y + off_y + 20 > scr_height)
|
||||
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:
|
||||
|
||||
@@ -475,6 +475,7 @@
|
||||
|
||||
#define MOVE_THRESHOLD 5 /* how many pixels to move before dragging windows
|
||||
* and other objects */
|
||||
#define KEY_CONTROL_WINDOW_WEIGHT 1
|
||||
|
||||
#define HRESIZE_THRESHOLD 3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user