tapplied Sanders resize patch, fixed lower bug - dwm - [fork] customized build … | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c53980cddcee8afd13ea793134ed3ddf5dbef0e3 | |
parent 95e56ffc0d91f55dcb138b25b6788378971485a5 | |
Author: [email protected] <unknown> | |
Date: Wed, 19 Jul 2006 11:31:04 +0200 | |
applied Sanders resize patch, fixed lower bug | |
Diffstat: | |
M client.c | 10 ++++++++-- | |
M dwm.h | 5 ++++- | |
M event.c | 39 +++++++++++++++++++++--------… | |
M main.c | 2 +- | |
M tag.c | 6 +++--- | |
5 files changed, 43 insertions(+), 19 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -267,7 +267,7 @@ maximize(Arg *arg) | |
*sel->w = sw - 2 * sel->border; | |
*sel->h = sh - 2 * sel->border - bh; | |
higher(sel); | |
- resize(sel, False); | |
+ resize(sel, False, TopLeft); | |
} | |
void | |
t@@ -283,9 +283,11 @@ pop(Client *c) | |
} | |
void | |
-resize(Client *c, Bool inc) | |
+resize(Client *c, Bool inc, Corner sticky) | |
{ | |
XConfigureEvent e; | |
+ int right = *c->x + *c->w; | |
+ int bottom = *c->y + *c->h; | |
if(inc) { | |
if(c->incw) | |
t@@ -305,6 +307,10 @@ resize(Client *c, Bool inc) | |
*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); | |
diff --git a/dwm.h b/dwm.h | |
t@@ -25,6 +25,7 @@ enum { Tscratch, Tdev, Twww, Twork, TLast }; | |
/********** CUSTOMIZE **********/ | |
typedef union Arg Arg; | |
+typedef enum Corner Corner; | |
typedef struct DC DC; | |
typedef struct Client Client; | |
typedef struct Fnt Fnt; | |
t@@ -43,6 +44,8 @@ enum { WMProtocols, WMDelete, WMLast }; | |
/* cursor */ | |
enum { CurNormal, CurResize, CurMove, CurLast }; | |
+enum Corner { TopLeft, TopRight, BottomLeft, BottomRight }; | |
+ | |
struct Fnt { | |
int ascent; | |
int descent; | |
t@@ -121,7 +124,7 @@ extern void lower(Client *c); | |
extern void manage(Window w, XWindowAttributes *wa); | |
extern void maximize(Arg *arg); | |
extern void pop(Client *c); | |
-extern void resize(Client *c, Bool inc); | |
+extern void resize(Client *c, Bool inc, Corner sticky); | |
extern void setgeom(Client *c); | |
extern void setsize(Client *c); | |
extern void settitle(Client *c); | |
diff --git a/event.c b/event.c | |
t@@ -79,7 +79,7 @@ movemouse(Client *c) | |
XSync(dpy, False); | |
*c->x = ocx + (ev.xmotion.x - x1); | |
*c->y = ocy + (ev.xmotion.y - y1); | |
- resize(c, False); | |
+ resize(c, False, TopLeft); | |
break; | |
case ButtonRelease: | |
XUngrabPointer(dpy, CurrentTime); | |
t@@ -93,6 +93,7 @@ resizemouse(Client *c) | |
{ | |
XEvent ev; | |
int ocx, ocy; | |
+ Corner sticky; | |
ocx = *c->x; | |
ocy = *c->y; | |
t@@ -113,7 +114,18 @@ resizemouse(Client *c) | |
*c->h = abs(ocy - ev.xmotion.y); | |
*c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w; | |
*c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h; | |
- resize(c, True); | |
+ if(ocx <= ev.xmotion.x) { | |
+ if(ocy <= ev.xmotion.y) | |
+ sticky = TopLeft; | |
+ else | |
+ sticky = BottomLeft; | |
+ } else { | |
+ if(ocy <= ev.xmotion.y) | |
+ sticky = TopRight; | |
+ else | |
+ sticky = BottomRight; | |
+ } | |
+ resize(c, True, sticky); | |
break; | |
case ButtonRelease: | |
XUngrabPointer(dpy, CurrentTime); | |
t@@ -153,24 +165,27 @@ buttonpress(XEvent *e) | |
} | |
} | |
else if((c = getclient(ev->window))) { | |
- if(arrange == dotile && !c->isfloat) { | |
- if((ev->state & ControlMask) && (ev->button == Button1… | |
- zoom(NULL); | |
- return; | |
- } | |
- /* floating windows */ | |
- higher(c); | |
switch(ev->button) { | |
default: | |
break; | |
case Button1: | |
- movemouse(c); | |
+ if(arrange == dotile && !c->isfloat) { | |
+ if((ev->state & ControlMask) && (ev->button ==… | |
+ zoom(NULL); | |
+ } | |
+ else { | |
+ higher(c); | |
+ movemouse(c); | |
+ } | |
break; | |
case Button2: | |
lower(c); | |
break; | |
case Button3: | |
- resizemouse(c); | |
+ if(arrange == dofloat || c->isfloat) { | |
+ higher(c); | |
+ resizemouse(c); | |
+ } | |
break; | |
} | |
} | |
t@@ -197,7 +212,7 @@ configurerequest(XEvent *e) | |
if(ev->value_mask & CWBorderWidth) | |
c->border = 1; | |
gravitate(c, False); | |
- resize(c, True); | |
+ resize(c, True, TopLeft); | |
} | |
wc.x = ev->x; | |
diff --git a/main.c b/main.c | |
t@@ -24,7 +24,7 @@ static void | |
cleanup() | |
{ | |
while(sel) { | |
- resize(sel, True); | |
+ resize(sel, True, TopLeft); | |
unmanage(sel); | |
} | |
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | |
diff --git a/tag.c b/tag.c | |
t@@ -45,7 +45,7 @@ dofloat(Arg *arg) | |
for(c = clients; c; c = c->next) { | |
setgeom(c); | |
if(c->tags[tsel]) { | |
- resize(c, True); | |
+ resize(c, True, TopLeft); | |
} | |
else | |
ban(c); | |
t@@ -81,7 +81,7 @@ dotile(Arg *arg) | |
if(c->tags[tsel]) { | |
if(c->isfloat) { | |
higher(c); | |
- resize(c, True); | |
+ resize(c, True, TopLeft); | |
continue; | |
} | |
if(n == 1) { | |
t@@ -102,7 +102,7 @@ dotile(Arg *arg) | |
*c->w = w - 2 * c->border; | |
*c->h = h - 2 * c->border; | |
} | |
- resize(c, False); | |
+ resize(c, False, TopLeft); | |
i++; | |
} | |
else |