Introduction
Introduction Statistics Contact Development Disclaimer Help
tapplied Sanders all5.patch (thanks for your weekend session, Sander!) - dwm - …
git clone git://src.adamsgaard.dk/dwm
Log
Files
Refs
README
LICENSE
---
commit b233089815367983e07939b2aabb999fdc359f91
parent 201c56f6d36e7f895c465f534fdb90e3d9e4ca18
Author: Anselm R. Garbe <[email protected]>
Date: Mon, 22 Jan 2007 10:22:58 +0100
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Diffstat:
M client.c | 68 +++++++++++++++--------------…
M dwm.h | 6 +-----
M event.c | 50 +++++++++++++++--------------…
M main.c | 2 +-
M view.c | 8 ++++----
5 files changed, 63 insertions(+), 71 deletions(-)
---
diff --git a/client.c b/client.c
t@@ -79,19 +79,14 @@ configure(Client *c) {
void
focus(Client *c) {
- Client *old;
+ Client *old = sel;
if(!issel || (c && !isvisible(c)))
return;
- if(!sel)
- sel = c;
- else if(sel != c) {
- old = sel;
- sel = c;
- if(old) {
- grabbuttons(old, False);
- XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
- }
+
+ if(old && old != c) {
+ grabbuttons(old, False);
+ XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
}
if(c) {
detachstack(c);
t@@ -103,6 +98,7 @@ focus(Client *c) {
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ sel = c;
drawstatus();
}
t@@ -134,20 +130,27 @@ manage(Window w, XWindowAttributes *wa) {
c = emallocz(sizeof(Client));
c->tags = emallocz(ntags * sizeof(Bool));
c->win = w;
- c->border = 0;
c->x = wa->x;
c->y = wa->y;
c->w = wa->width;
c->h = wa->height;
- updatesizehints(c);
- if(c->x + c->w + 2 * BORDERPX > sw)
- c->x = sw - c->w - 2 * BORDERPX;
- if(c->x < sx)
+ if(c->w == sw && c->h == sh) {
+ c->border = 0;
c->x = sx;
- if(c->y + c->h + 2 * BORDERPX > sh)
- c->y = sh - c->h - 2 * BORDERPX;
- if(c->h != sh && c->y < bh)
- c->y = bh;
+ c->y = sy;
+ }
+ else {
+ c->border = BORDERPX;
+ if(c->x < wax)
+ c->x = wax;
+ if(c->y < way)
+ c->y = way;
+ if(c->x + c->w + 2 * c->border > wax + waw)
+ c->x = wax + waw - c->w - 2 * c->border;
+ if(c->y + c->h + 2 * c->border > way + wah)
+ c->y = way + wah - c->h - 2 * c->border;
+ }
+ updatesizehints(c);
c->proto = getproto(c->win);
XSelectInput(dpy, c->win,
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
t@@ -170,9 +173,7 @@ manage(Window w, XWindowAttributes *wa) {
}
void
-resize(Client *c, Bool sizehints, Corner sticky) {
- int bottom = c->y + c->h;
- int right = c->x + c->w;
+resize(Client *c, Bool sizehints) {
XWindowChanges wc;
if(sizehints) {
t@@ -189,27 +190,24 @@ resize(Client *c, Bool sizehints, Corner sticky) {
if(c->maxh && c->h > c->maxh)
c->h = c->maxh;
}
- if(sticky == TopRight || sticky == BotRight)
- c->x = right - c->w;
- if(sticky == BotLeft || sticky == BotRight)
- c->y = bottom - c->h;
+ if(c->w == sw && c->h == sh)
+ c->border = 0;
+ else
+ c->border = BORDERPX;
/* offscreen appearance fixes */
- if(c->x + c->w < sx)
+ if(c->x + c->w + 2 * c->border < sx)
c->x = sx;
- if(c->y + c->h < bh)
- c->y = bh;
+ if(c->y + c->h + 2 * c->border < sy)
+ c->y = sy;
if(c->x > sw)
- c->x = sw - c->w;
+ c->x = sw - c->w - 2 * c->border;
if(c->y > sh)
- c->y = sh - c->h;
+ c->y = sh - c->h - 2 * c->border;
wc.x = c->x;
wc.y = c->y;
wc.width = c->w;
wc.height = c->h;
- if(c->w == sw && c->h == sh)
- wc.border_width = 0;
- else
- wc.border_width = BORDERPX;
+ wc.border_width = c->border;
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorde…
configure(c);
XSync(dpy, False);
diff --git a/dwm.h b/dwm.h
t@@ -44,10 +44,6 @@ enum { WMProtocols, WMDelete, WMLast }; …
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
-typedef enum {
- TopLeft, TopRight, BotLeft, BotRight
-} Corner; /* window corners */
-
typedef union {
const char *cmd;
int i;
t@@ -110,7 +106,7 @@ extern void focus(Client *c); /* fo…
extern Client *getclient(Window w); /* return client of w */
extern void killclient(Arg *arg); /* kill c nicely */
extern void manage(Window w, XWindowAttributes *wa); /* manage new clie…
-extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
+extern void resize(Client *c, Bool sizehints); /* resize c*/
extern void updatesizehints(Client *c); /* update the size hint…
extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */
diff --git a/event.c b/event.c
t@@ -35,14 +35,16 @@ movemouse(Client *c) {
c->ismax = False;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
for(;;) {
- XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
+ XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirec…
switch (ev.type) {
case ButtonRelease:
- resize(c, True, TopLeft);
+ resize(c, True);
XUngrabPointer(dpy, CurrentTime);
return;
+ case ConfigureRequest:
case Expose:
- handler[Expose](&ev);
+ case MapRequest:
+ handler[ev.type](&ev);
break;
case MotionNotify:
XSync(dpy, False);
t@@ -50,13 +52,13 @@ movemouse(Client *c) {
c->y = ocy + (ev.xmotion.y - y1);
if(abs(wax + c->x) < SNAP)
c->x = wax;
- else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
- c->x = wax + waw - c->w - 2 * BORDERPX;
+ else if(abs((wax + waw) - (c->x + c->w + 2 * c->border…
+ c->x = wax + waw - c->w - 2 * c->border;
if(abs(way - c->y) < SNAP)
c->y = way;
- else if(abs((way + wah) - (c->y + c->h)) < SNAP)
- c->y = way + wah - c->h - 2 * BORDERPX;
- resize(c, False, TopLeft);
+ else if(abs((way + wah) - (c->y + c->h + 2 * c->border…
+ c->y = way + wah - c->h - 2 * c->border;
+ resize(c, False);
break;
}
}
t@@ -66,7 +68,6 @@ static void
resizemouse(Client *c) {
int ocx, ocy;
int nw, nh;
- Corner sticky;
XEvent ev;
ocx = c->x;
t@@ -75,30 +76,26 @@ resizemouse(Client *c) {
None, cursor[CurResize], CurrentTime) != GrabSuccess)
return;
c->ismax = False;
- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h…
for(;;) {
- XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
+ XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirec…
switch(ev.type) {
case ButtonRelease:
- resize(c, True, TopLeft);
+ resize(c, True);
XUngrabPointer(dpy, CurrentTime);
return;
+ case ConfigureRequest:
case Expose:
- handler[Expose](&ev);
+ case MapRequest:
+ handler[ev.type](&ev);
break;
case MotionNotify:
XSync(dpy, False);
- if((nw = abs(ocx - ev.xmotion.x)))
- c->w = nw;
- if((nh = abs(ocy - ev.xmotion.y)))
- c->h = nh;
- c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
- c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
- if(ocx <= ev.xmotion.x)
- sticky = (ocy <= ev.xmotion.y) ? TopLeft : Bot…
- else
- sticky = (ocy <= ev.xmotion.y) ? TopRight : Bo…
- resize(c, True, sticky);
+ nw = ev.xmotion.x - ocx - 2 * c->border + 1;
+ c->w = nw > 0 ? nw : 1;
+ nh = ev.xmotion.y - ocy - 2 * c->border + 1;
+ c->h = nh > 0 ? nh : 1;
+ resize(c, True);
break;
}
}
t@@ -194,7 +191,7 @@ configurerequest(XEvent *e) {
configure(c);
XSync(dpy, False);
if(c->isfloat) {
- resize(c, False, TopLeft);
+ resize(c, False);
if(!isvisible(c))
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
t@@ -234,7 +231,8 @@ enternotify(XEvent *e) {
focus(c);
else if(ev->window == root) {
issel = True;
- focus(sel);
+ for(c = stack; c && !isvisible(c); c = c->snext);
+ focus(c);
}
}
diff --git a/main.c b/main.c
t@@ -41,7 +41,7 @@ static void
cleanup(void) {
close(STDIN_FILENO);
while(stack) {
- resize(stack, True, TopLeft);
+ resize(stack, True);
unmanage(stack);
}
if(dc.font.set)
diff --git a/view.c b/view.c
t@@ -31,7 +31,7 @@ togglemax(Client *c) {
c->w = c->rw;
c->h = c->rh;
}
- resize(c, True, TopLeft);
+ resize(c, True);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
t@@ -56,7 +56,7 @@ dofloat(void) {
for(c = clients; c; c = c->next) {
if(isvisible(c)) {
- resize(c, True, TopLeft);
+ resize(c, True);
}
else
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
t@@ -84,7 +84,7 @@ dotile(void) {
for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) {
if(c->isfloat) {
- resize(c, True, TopLeft);
+ resize(c, True);
continue;
}
c->ismax = False;
t@@ -105,7 +105,7 @@ dotile(void) {
else /* fallback if th < bh */
c->h = wah - 2 * BORDERPX;
}
- resize(c, False, TopLeft);
+ resize(c, False);
i++;
}
else
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.