wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

ewmh.c (990B)


      1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include "dat.h"
      5 #include <limits.h>
      6 #include <string.h>
      7 #include "fns.h"
      8 
      9 enum {
     10 	Left, Right, Top, Bottom,
     11 	LeftMin, LeftMax,
     12 	RightMin, RightMax,
     13 	TopMin, TopMax,
     14 	BottomMin, BottomMax,
     15 	Last
     16 };
     17 
     18 void
     19 ewmh_setstrut(Window *w, Rectangle struts[4]) {
     20 	long strut[Last];
     21 	int i;
     22 
     23 	strut[LeftMin] = struts[Left].min.y;
     24 	strut[Left] = struts[Left].max.x;
     25 	strut[LeftMax] = struts[Left].max.y;
     26 
     27 	strut[RightMin] = struts[Right].min.y;
     28 	strut[Right] = -struts[Right].min.x;
     29 	strut[RightMax] = struts[Right].max.y;
     30 
     31 	strut[TopMin] = struts[Top].min.x;
     32 	strut[Top] = struts[Top].max.y;
     33 	strut[TopMax] = struts[Top].max.x;
     34 
     35 	strut[BottomMin] = struts[Bottom].min.x;
     36 	strut[Bottom] = -struts[Bottom].min.y;
     37 	strut[BottomMax] = struts[Bottom].max.x;
     38 
     39 	for(i=0; i<Last; i++)
     40 		if(strut[i] < 0)
     41 			strut[i] = 0;
     42 
     43 	changeprop_long(w, Net("WM_STRUT_PARTIAL"), "CARDINAL", strut, nelem(strut));
     44 }
     45