pinosaur
/
dwm.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
floating clients get random (x,y) offsets now
[dwm.git]
/
client.c
diff --git
a/client.c
b/client.c
index
beb7e35
..
62d4afc
100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-192,6
+192,7
@@
lower(Client *c)
void
manage(Window w, XWindowAttributes *wa)
{
void
manage(Window w, XWindowAttributes *wa)
{
+ int diff;
Client *c;
XSetWindowAttributes twa;
Window trans;
Client *c;
XSetWindowAttributes twa;
Window trans;
@@
-205,6
+206,12
@@
manage(Window w, XWindowAttributes *wa)
c->bw = c->fw = c->tw = wa->width;
c->fh = c->th = wa->height;
c->bh = bh;
c->bw = c->fw = c->tw = wa->width;
c->fh = c->th = wa->height;
c->bh = bh;
+
+ diff = sw - c->fw;
+ c->fx = sx + (random() % diff ? diff : 1);
+ diff = sh - c->fh;
+ c->fy = sx + (random() % diff ? diff : 1);
+
c->border = 1;
c->proto = getproto(c->win);
setsize(c);
c->border = 1;
c->proto = getproto(c->win);
setsize(c);
@@
-267,7
+274,7
@@
maximize(Arg *arg)
*sel->w = sw - 2 * sel->border;
*sel->h = sh - 2 * sel->border - bh;
higher(sel);
*sel->w = sw - 2 * sel->border;
*sel->h = sh - 2 * sel->border - bh;
higher(sel);
- resize(sel, False);
+ resize(sel, False
, TopLeft
);
}
void
}
void
@@
-283,9
+290,11
@@
pop(Client *c)
}
void
}
void
-resize(Client *c, Bool inc)
+resize(Client *c, Bool inc
, Corner sticky
)
{
XConfigureEvent e;
{
XConfigureEvent e;
+ int right = *c->x + *c->w;
+ int bottom = *c->y + *c->h;
if(inc) {
if(c->incw)
if(inc) {
if(c->incw)
@@
-305,6
+314,10
@@
resize(Client *c, Bool inc)
*c->w = c->maxw;
if(c->maxh && *c->h > c->maxh)
*c->h = c->maxh;
*c->w = c->maxw;
if(c->maxh && *c->h > c->maxh)
*c->h = c->maxh;
+ if(sticky == TopRight || sticky == BottomRight)
+ *c->x = right - *c->w;
+ if(sticky == BottomLeft || sticky == BottomRight)
+ *c->y = bottom - *c->h;
resizetitle(c);
XSetWindowBorderWidth(dpy, c->win, 1);
XMoveResizeWindow(dpy, c->win, *c->x, *c->y, *c->w, *c->h);
resizetitle(c);
XSetWindowBorderWidth(dpy, c->win, 1);
XMoveResizeWindow(dpy, c->win, *c->x, *c->y, *c->w, *c->h);