dwm-maximize_vert_horz-6.0.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-maximize_vert_horz-6.0.diff (2385B) | |
--- | |
1 Author: Jan Christoph Ebersbach <[email protected]> | |
2 URL: http://dwm.suckless.org/patches/historical/moveresize | |
3 These patches provide helper functions for moving and resizing floating … | |
4 using keybindings. | |
5 | |
6 diff -r ec4baab78314 dwm.c | |
7 --- a/dwm.c Mon Dec 19 15:38:30 2011 +0100 | |
8 +++ b/dwm.c Fri Apr 06 08:23:23 2012 +0200 | |
9 @@ -90,7 +90,7 @@ | |
10 int basew, baseh, incw, inch, maxw, maxh, minw, minh; | |
11 int bw, oldbw; | |
12 unsigned int tags; | |
13 - Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isful… | |
14 + Bool ismax, wasfloating, isfixed, isfloating, isurgent, neverfo… | |
15 Client *next; | |
16 Client *snext; | |
17 Monitor *mon; | |
18 @@ -1151,6 +1151,8 @@ | |
19 updatewmhints(c); | |
20 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyCh… | |
21 grabbuttons(c, False); | |
22 + c->wasfloating = False; | |
23 + c->ismax = False; | |
24 if(!c->isfloating) | |
25 c->isfloating = c->oldstate = trans != None || c->isfix… | |
26 if(c->isfloating) | |
27 diff -r ec4baab78314 maximize.c | |
28 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
29 +++ b/maximize.c Fri Apr 06 08:23:23 2012 +0200 | |
30 @@ -0,0 +1,45 @@ | |
31 +void | |
32 +maximize(int x, int y, int w, int h) { | |
33 + XEvent ev; | |
34 + | |
35 + if(!selmon->sel || selmon->sel->isfixed) | |
36 + return; | |
37 + XRaiseWindow(dpy, selmon->sel->win); | |
38 + if(!selmon->sel->ismax) { | |
39 + if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->… | |
40 + selmon->sel->wasfloating = True; | |
41 + else { | |
42 + togglefloating(NULL); | |
43 + selmon->sel->wasfloating = False; | |
44 + } | |
45 + selmon->sel->oldx = selmon->sel->x; | |
46 + selmon->sel->oldy = selmon->sel->y; | |
47 + selmon->sel->oldw = selmon->sel->w; | |
48 + selmon->sel->oldh = selmon->sel->h; | |
49 + resize(selmon->sel, x, y, w, h, True); | |
50 + selmon->sel->ismax = True; | |
51 + } | |
52 + else { | |
53 + resize(selmon->sel, selmon->sel->oldx, selmon->sel->old… | |
54 + if(!selmon->sel->wasfloating) | |
55 + togglefloating(NULL); | |
56 + selmon->sel->ismax = False; | |
57 + } | |
58 + drawbar(selmon); | |
59 + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | |
60 +} | |
61 + | |
62 +void | |
63 +togglemaximize(const Arg *arg) { | |
64 + maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, sel… | |
65 +} | |
66 + | |
67 +void | |
68 +toggleverticalmax(const Arg *arg) { | |
69 + maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh… | |
70 +} | |
71 + | |
72 +void | |
73 +togglehorizontalmax(const Arg *arg) { | |
74 + maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx,… | |
75 +} |