t* dwm + patches URI git clone git://git.codevoid.de/dwm-sdk DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- tmaximize.c (1929B) --- 1 void maximize(int x, int y, int w, int h) 2 { 3 XEvent ev; 4 5 if(!selmon->sel || selmon->sel->isfixed) 6 return; 7 XRaiseWindow(dpy, selmon->sel->win); 8 if(!selmon->sel->ismax) { 9 if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating) 10 selmon->sel->wasfloating = True; 11 else { 12 togglefloating(NULL); 13 selmon->sel->wasfloating = False; 14 } 15 selmon->sel->oldx = selmon->sel->x; 16 selmon->sel->oldy = selmon->sel->y; 17 selmon->sel->oldw = selmon->sel->w; 18 selmon->sel->oldh = selmon->sel->h; 19 resize(selmon->sel, x, y, w, h, True); 20 selmon->sel->ismax = True; 21 } 22 else { 23 resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True); 24 if(!selmon->sel->wasfloating) 25 togglefloating(NULL); 26 selmon->sel->ismax = False; 27 } 28 drawbar(selmon); 29 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 30 } 31 32 void restore() 33 { 34 XEvent ev; 35 36 if(!selmon->sel || selmon->sel->isfixed) 37 return; 38 XRaiseWindow(dpy, selmon->sel->win); 39 if(selmon->sel->ismax) { 40 resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True); 41 if(!selmon->sel->wasfloating) 42 togglefloating(NULL); 43 selmon->sel->ismax = False; 44 } 45 XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); 46 drawbar(selmon); 47 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 48 } 49 50 void togglemaximize(const Arg *arg) 51 { 52 maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx); 53 if(!selmon->sel) 54 return; 55 if(selmon->sel->ismax) { 56 XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeNorm][ColBg].pixel); 57 } else { 58 XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); 59 } 60 }