dwm

Kris's build of dwm
git clone git clone https://git.krisyotam.com/krisyotam/dwm.git
Log | Files | Refs | README | LICENSE

maximize.c (1705B)


      1 void
      2 maximize(int x, int y, int w, int h)
      3 {
      4 	XEvent ev;
      5 
      6 	if (!selmon->sel || selmon->sel->isfixed)
      7 		return;
      8 	XRaiseWindow(dpy, selmon->sel->win);
      9 	if (!selmon->sel->ismax) {
     10 		if (!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
     11 			selmon->sel->wasfloating = True;
     12 		else {
     13 			togglefloating(NULL);
     14 			selmon->sel->wasfloating = False;
     15 		}
     16 		selmon->sel->oldx = selmon->sel->x;
     17 		selmon->sel->oldy = selmon->sel->y;
     18 		selmon->sel->oldw = selmon->sel->w;
     19 		selmon->sel->oldh = selmon->sel->h;
     20 		resize(selmon->sel, x, y, w, h, True);
     21 		selmon->sel->ismax = True;
     22 	}
     23 	else {
     24 		resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True);
     25 		if (!selmon->sel->wasfloating)
     26 			togglefloating(NULL);
     27 		selmon->sel->ismax = False;
     28 	}
     29 	drawbar(selmon);
     30 	while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
     31 }
     32 
     33 #if SETBORDERPX_PATCH
     34 void
     35 togglemax(const Arg *arg)
     36 {
     37 	maximize(selmon->wx, selmon->wy, selmon->ww - 2 * selmon->borderpx, selmon->wh - 2 * selmon->borderpx);
     38 }
     39 
     40 void
     41 toggleverticalmax(const Arg *arg)
     42 {
     43 	maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * selmon->borderpx);
     44 }
     45 
     46 void
     47 togglehorizontalmax(const Arg *arg)
     48 {
     49 	maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * selmon->borderpx, selmon->sel->h);
     50 }
     51 #else
     52 void
     53 togglemax(const Arg *arg)
     54 {
     55 	maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx);
     56 }
     57 
     58 void
     59 toggleverticalmax(const Arg *arg)
     60 {
     61 	maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx);
     62 }
     63 
     64 void
     65 togglehorizontalmax(const Arg *arg)
     66 {
     67 	maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h);
     68 }
     69 #endif // SETBORDERPX_PATCH
     70