mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
floatpos: Adding m option to spawn floating clients where the mouse pointer is
This commit is contained in:
parent
82c3984b2d
commit
b714329d87
@ -29,6 +29,7 @@ setfloatpos(Client *c, const char *floatpos)
|
|||||||
return;
|
return;
|
||||||
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
|
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(sscanf(floatpos, "%d%c %d%c %d%c %d%c", &x, &xCh, &y, &yCh, &w, &wCh, &h, &hCh)) {
|
switch(sscanf(floatpos, "%d%c %d%c %d%c %d%c", &x, &xCh, &y, &yCh, &w, &wCh, &h, &hCh)) {
|
||||||
case 4:
|
case 4:
|
||||||
if (xCh == 'w' || xCh == 'W') {
|
if (xCh == 'w' || xCh == 'W') {
|
||||||
@ -41,12 +42,16 @@ setfloatpos(Client *c, const char *floatpos)
|
|||||||
h = y; hCh = yCh;
|
h = y; hCh = yCh;
|
||||||
x = 0; xCh = 'G';
|
x = 0; xCh = 'G';
|
||||||
y = 0; yCh = 'G';
|
y = 0; yCh = 'G';
|
||||||
|
} else if (xCh == 'm' || xCh == 'M') {
|
||||||
|
getrootptr(&x, &y);
|
||||||
} else {
|
} else {
|
||||||
w = 0; wCh = 0;
|
w = 0; wCh = 0;
|
||||||
h = 0; hCh = 0;
|
h = 0; hCh = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
if (xCh == 'm' || xCh == 'M')
|
||||||
|
getrootptr(&x, &y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -173,6 +178,8 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp,
|
|||||||
|
|
||||||
if (pCh == '%') // client mid-point position in relation to monitor window area size
|
if (pCh == '%') // client mid-point position in relation to monitor window area size
|
||||||
cp = min_p + max_s * MAX(MIN(pos, 100), 0) / 100 - (cs) / 2;
|
cp = min_p + max_s * MAX(MIN(pos, 100), 0) / 100 - (cs) / 2;
|
||||||
|
if (pCh == 'm' || pCh == 'M')
|
||||||
|
cp = pos - cs / 2;
|
||||||
|
|
||||||
if (!abs_p && cp < min_p)
|
if (!abs_p && cp < min_p)
|
||||||
cp = min_p;
|
cp = min_p;
|
||||||
|
Loading…
Reference in New Issue
Block a user