mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
* refs/heads/master: Fix a typo from r1.201; fixes window_grouptoggle binding. If a client does not set increment values, use 'moveamount' as a way to scale keyboard based resizes; extend kbfunc_amount(). Inline the only use of mousefunc_sweep_calc.
This commit is contained in:
commit
f9e9f76856
2
conf.c
2
conf.c
@ -483,7 +483,7 @@ static const struct {
|
||||
{ "window_hide", kbfunc_client_hide, CWM_CONTEXT_CLIENT, {0} },
|
||||
{ "window_move", mousefunc_client_move, CWM_CONTEXT_CLIENT, {0} },
|
||||
{ "window_resize", mousefunc_client_resize, CWM_CONTEXT_CLIENT, {0} },
|
||||
{ "window_grouptoggle", kbfunc_group_toggle, CWM_CONTEXT_CLIENT,
|
||||
{ "window_grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT,
|
||||
{.i = CWM_MOUSE} },
|
||||
{ "menu_group", mousefunc_menu_group, CWM_CONTEXT_SCREEN, {0} },
|
||||
{ "menu_unhide", mousefunc_menu_client, CWM_CONTEXT_SCREEN, {0} },
|
||||
|
16
kbfunc.c
16
kbfunc.c
@ -38,7 +38,7 @@
|
||||
|
||||
extern sig_atomic_t cwm_status;
|
||||
|
||||
static void kbfunc_amount(int, unsigned int *, unsigned int *);
|
||||
static void kbfunc_amount(int, int, unsigned int *, unsigned int *);
|
||||
|
||||
void
|
||||
kbfunc_client_lower(struct client_ctx *cc, union arg *arg)
|
||||
@ -54,12 +54,10 @@ kbfunc_client_raise(struct client_ctx *cc, union arg *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
kbfunc_amount(int flags, unsigned int *mx, unsigned int *my)
|
||||
kbfunc_amount(int flags, int amt, unsigned int *mx, unsigned int *my)
|
||||
{
|
||||
#define CWM_FACTOR 10
|
||||
int amt;
|
||||
|
||||
amt = Conf.mamount;
|
||||
if (flags & CWM_BIGAMOUNT)
|
||||
amt *= CWM_FACTOR;
|
||||
|
||||
@ -86,7 +84,7 @@ kbfunc_ptrmove(struct client_ctx *cc, union arg *arg)
|
||||
int x, y;
|
||||
unsigned int mx = 0, my = 0;
|
||||
|
||||
kbfunc_amount(arg->i, &mx, &my);
|
||||
kbfunc_amount(arg->i, Conf.mamount, &mx, &my);
|
||||
|
||||
xu_ptr_getpos(sc->rootwin, &x, &y);
|
||||
xu_ptr_setpos(sc->rootwin, x + mx, y + my);
|
||||
@ -103,7 +101,7 @@ kbfunc_client_move(struct client_ctx *cc, union arg *arg)
|
||||
if (cc->flags & CLIENT_FREEZE)
|
||||
return;
|
||||
|
||||
kbfunc_amount(arg->i, &mx, &my);
|
||||
kbfunc_amount(arg->i, Conf.mamount, &mx, &my);
|
||||
|
||||
cc->geom.x += mx;
|
||||
if (cc->geom.x + cc->geom.w < 0)
|
||||
@ -137,11 +135,15 @@ void
|
||||
kbfunc_client_resize(struct client_ctx *cc, union arg *arg)
|
||||
{
|
||||
unsigned int mx = 0, my = 0;
|
||||
int amt = 1;
|
||||
|
||||
if (cc->flags & CLIENT_FREEZE)
|
||||
return;
|
||||
|
||||
kbfunc_amount(arg->i, &mx, &my);
|
||||
if (!(cc->hint.flags & PResizeInc))
|
||||
amt = Conf.mamount;
|
||||
|
||||
kbfunc_amount(arg->i, amt, &mx, &my);
|
||||
|
||||
if ((cc->geom.w += mx * cc->hint.incw) < cc->hint.minw)
|
||||
cc->geom.w = cc->hint.minw;
|
||||
|
23
mousefunc.c
23
mousefunc.c
@ -32,21 +32,8 @@
|
||||
|
||||
#include "calmwm.h"
|
||||
|
||||
static void mousefunc_sweep_calc(struct client_ctx *, int, int, int, int);
|
||||
static void mousefunc_sweep_draw(struct client_ctx *);
|
||||
|
||||
static void
|
||||
mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
|
||||
{
|
||||
cc->geom.w = abs(x - mx) - cc->bwidth;
|
||||
cc->geom.h = abs(y - my) - cc->bwidth;
|
||||
|
||||
client_applysizehints(cc);
|
||||
|
||||
cc->geom.x = (x <= mx) ? x : x - cc->geom.w;
|
||||
cc->geom.y = (y <= my) ? y : y - cc->geom.h;
|
||||
}
|
||||
|
||||
static void
|
||||
mousefunc_sweep_draw(struct client_ctx *cc)
|
||||
{
|
||||
@ -94,8 +81,13 @@ mousefunc_client_resize(struct client_ctx *cc, union arg *arg)
|
||||
continue;
|
||||
ltime = ev.xmotion.time;
|
||||
|
||||
mousefunc_sweep_calc(cc, x, y,
|
||||
ev.xmotion.x_root, ev.xmotion.y_root);
|
||||
cc->geom.w = abs(x - ev.xmotion.x_root) - cc->bwidth;
|
||||
cc->geom.h = abs(y - ev.xmotion.y_root) - cc->bwidth;
|
||||
cc->geom.x = (x <= ev.xmotion.x_root) ?
|
||||
x : x - cc->geom.w;
|
||||
cc->geom.y = (y <= ev.xmotion.y_root) ?
|
||||
y : y - cc->geom.h;
|
||||
client_applysizehints(cc);
|
||||
client_resize(cc, 1);
|
||||
mousefunc_sweep_draw(cc);
|
||||
break;
|
||||
@ -158,7 +150,6 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg)
|
||||
cc->geom.y += client_snapcalc(cc->geom.y,
|
||||
cc->geom.y + cc->geom.h + (cc->bwidth * 2),
|
||||
area.y, area.y + area.h, sc->snapdist);
|
||||
|
||||
client_move(cc);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
|
Loading…
Reference in New Issue
Block a user