dwm-meillo
changeset 99:a19556fe83b5
applied Sanders resize patch, fixed lower bug
author | arg@10ksloc.org |
---|---|
date | Wed, 19 Jul 2006 11:31:04 +0200 |
parents | f08394353588 |
children | bb3803fb560c |
files | client.c dwm.h event.c main.c tag.c |
diffstat | 5 files changed, 43 insertions(+), 19 deletions(-) [+] |
line diff
1.1 --- a/client.c Tue Jul 18 17:54:55 2006 +0200 1.2 +++ b/client.c Wed Jul 19 11:31:04 2006 +0200 1.3 @@ -267,7 +267,7 @@ 1.4 *sel->w = sw - 2 * sel->border; 1.5 *sel->h = sh - 2 * sel->border - bh; 1.6 higher(sel); 1.7 - resize(sel, False); 1.8 + resize(sel, False, TopLeft); 1.9 } 1.10 1.11 void 1.12 @@ -283,9 +283,11 @@ 1.13 } 1.14 1.15 void 1.16 -resize(Client *c, Bool inc) 1.17 +resize(Client *c, Bool inc, Corner sticky) 1.18 { 1.19 XConfigureEvent e; 1.20 + int right = *c->x + *c->w; 1.21 + int bottom = *c->y + *c->h; 1.22 1.23 if(inc) { 1.24 if(c->incw) 1.25 @@ -305,6 +307,10 @@ 1.26 *c->w = c->maxw; 1.27 if(c->maxh && *c->h > c->maxh) 1.28 *c->h = c->maxh; 1.29 + if(sticky == TopRight || sticky == BottomRight) 1.30 + *c->x = right - *c->w; 1.31 + if(sticky == BottomLeft || sticky == BottomRight) 1.32 + *c->y = bottom - *c->h; 1.33 resizetitle(c); 1.34 XSetWindowBorderWidth(dpy, c->win, 1); 1.35 XMoveResizeWindow(dpy, c->win, *c->x, *c->y, *c->w, *c->h);
2.1 --- a/dwm.h Tue Jul 18 17:54:55 2006 +0200 2.2 +++ b/dwm.h Wed Jul 19 11:31:04 2006 +0200 2.3 @@ -25,6 +25,7 @@ 2.4 /********** CUSTOMIZE **********/ 2.5 2.6 typedef union Arg Arg; 2.7 +typedef enum Corner Corner; 2.8 typedef struct DC DC; 2.9 typedef struct Client Client; 2.10 typedef struct Fnt Fnt; 2.11 @@ -43,6 +44,8 @@ 2.12 /* cursor */ 2.13 enum { CurNormal, CurResize, CurMove, CurLast }; 2.14 2.15 +enum Corner { TopLeft, TopRight, BottomLeft, BottomRight }; 2.16 + 2.17 struct Fnt { 2.18 int ascent; 2.19 int descent; 2.20 @@ -121,7 +124,7 @@ 2.21 extern void manage(Window w, XWindowAttributes *wa); 2.22 extern void maximize(Arg *arg); 2.23 extern void pop(Client *c); 2.24 -extern void resize(Client *c, Bool inc); 2.25 +extern void resize(Client *c, Bool inc, Corner sticky); 2.26 extern void setgeom(Client *c); 2.27 extern void setsize(Client *c); 2.28 extern void settitle(Client *c);
3.1 --- a/event.c Tue Jul 18 17:54:55 2006 +0200 3.2 +++ b/event.c Wed Jul 19 11:31:04 2006 +0200 3.3 @@ -79,7 +79,7 @@ 3.4 XSync(dpy, False); 3.5 *c->x = ocx + (ev.xmotion.x - x1); 3.6 *c->y = ocy + (ev.xmotion.y - y1); 3.7 - resize(c, False); 3.8 + resize(c, False, TopLeft); 3.9 break; 3.10 case ButtonRelease: 3.11 XUngrabPointer(dpy, CurrentTime); 3.12 @@ -93,6 +93,7 @@ 3.13 { 3.14 XEvent ev; 3.15 int ocx, ocy; 3.16 + Corner sticky; 3.17 3.18 ocx = *c->x; 3.19 ocy = *c->y; 3.20 @@ -113,7 +114,18 @@ 3.21 *c->h = abs(ocy - ev.xmotion.y); 3.22 *c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w; 3.23 *c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h; 3.24 - resize(c, True); 3.25 + if(ocx <= ev.xmotion.x) { 3.26 + if(ocy <= ev.xmotion.y) 3.27 + sticky = TopLeft; 3.28 + else 3.29 + sticky = BottomLeft; 3.30 + } else { 3.31 + if(ocy <= ev.xmotion.y) 3.32 + sticky = TopRight; 3.33 + else 3.34 + sticky = BottomRight; 3.35 + } 3.36 + resize(c, True, sticky); 3.37 break; 3.38 case ButtonRelease: 3.39 XUngrabPointer(dpy, CurrentTime); 3.40 @@ -153,24 +165,27 @@ 3.41 } 3.42 } 3.43 else if((c = getclient(ev->window))) { 3.44 - if(arrange == dotile && !c->isfloat) { 3.45 - if((ev->state & ControlMask) && (ev->button == Button1)) 3.46 - zoom(NULL); 3.47 - return; 3.48 - } 3.49 - /* floating windows */ 3.50 - higher(c); 3.51 switch(ev->button) { 3.52 default: 3.53 break; 3.54 case Button1: 3.55 - movemouse(c); 3.56 + if(arrange == dotile && !c->isfloat) { 3.57 + if((ev->state & ControlMask) && (ev->button == Button1)) 3.58 + zoom(NULL); 3.59 + } 3.60 + else { 3.61 + higher(c); 3.62 + movemouse(c); 3.63 + } 3.64 break; 3.65 case Button2: 3.66 lower(c); 3.67 break; 3.68 case Button3: 3.69 - resizemouse(c); 3.70 + if(arrange == dofloat || c->isfloat) { 3.71 + higher(c); 3.72 + resizemouse(c); 3.73 + } 3.74 break; 3.75 } 3.76 } 3.77 @@ -197,7 +212,7 @@ 3.78 if(ev->value_mask & CWBorderWidth) 3.79 c->border = 1; 3.80 gravitate(c, False); 3.81 - resize(c, True); 3.82 + resize(c, True, TopLeft); 3.83 } 3.84 3.85 wc.x = ev->x;
4.1 --- a/main.c Tue Jul 18 17:54:55 2006 +0200 4.2 +++ b/main.c Wed Jul 19 11:31:04 2006 +0200 4.3 @@ -24,7 +24,7 @@ 4.4 cleanup() 4.5 { 4.6 while(sel) { 4.7 - resize(sel, True); 4.8 + resize(sel, True, TopLeft); 4.9 unmanage(sel); 4.10 } 4.11 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
5.1 --- a/tag.c Tue Jul 18 17:54:55 2006 +0200 5.2 +++ b/tag.c Wed Jul 19 11:31:04 2006 +0200 5.3 @@ -45,7 +45,7 @@ 5.4 for(c = clients; c; c = c->next) { 5.5 setgeom(c); 5.6 if(c->tags[tsel]) { 5.7 - resize(c, True); 5.8 + resize(c, True, TopLeft); 5.9 } 5.10 else 5.11 ban(c); 5.12 @@ -81,7 +81,7 @@ 5.13 if(c->tags[tsel]) { 5.14 if(c->isfloat) { 5.15 higher(c); 5.16 - resize(c, True); 5.17 + resize(c, True, TopLeft); 5.18 continue; 5.19 } 5.20 if(n == 1) { 5.21 @@ -102,7 +102,7 @@ 5.22 *c->w = w - 2 * c->border; 5.23 *c->h = h - 2 * c->border; 5.24 } 5.25 - resize(c, False); 5.26 + resize(c, False, TopLeft); 5.27 i++; 5.28 } 5.29 else