dwm

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

bar.c (844B)


      1 void
      2 barhover(XEvent *e, Bar *bar)
      3 {
      4 	const BarRule *br;
      5 	Monitor *m = bar->mon;
      6 	XMotionEvent *ev = &e->xmotion;
      7 	BarArg barg = { 0, 0, 0, 0 };
      8 	int r;
      9 
     10 	for (r = 0; r < LENGTH(barrules); r++) {
     11 		br = &barrules[r];
     12 		if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->hoverfunc == NULL)
     13 			continue;
     14 		if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->num)
     15 			continue;
     16 		if (bar->x[r] > ev->x || ev->x > bar->x[r] + bar->w[r])
     17 			continue;
     18 
     19 		barg.x = ev->x - bar->x[r];
     20 		barg.y = ev->y - bar->borderpx;
     21 		barg.w = bar->w[r];
     22 		barg.h = bar->bh - 2 * bar->borderpx;
     23 
     24 		br->hoverfunc(bar, &barg, ev);
     25 		break;
     26 	}
     27 }
     28 
     29 Bar *
     30 wintobar(Window win)
     31 {
     32 	Monitor *m;
     33 	Bar *bar;
     34 	for (m = mons; m; m = m->next)
     35 		for (bar = m->bar; bar; bar = bar->next)
     36 			if (bar->win == win)
     37 				return bar;
     38 	return NULL;
     39 }