sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-pertag-5.6.1.diff (5083B)


      1 --- dwm.c	2009-09-18 18:12:50.000000000 +0200
      2 +++ dwm.c.working	2009-09-18 18:14:04.000000000 +0200
      3 @@ -131,6 +131,25 @@
      4  	void            (*arrange) (Monitor *);
      5  }               Layout;
      6  
      7 +struct Monitor {
      8 +	float           mfact;
      9 +	int             num;
     10 +	int             by;	/* bar geometry */
     11 +	int             mx, my, mw, mh;	/* screen size */
     12 +	int             wx, wy, ww, wh;	/* window area  */
     13 +	unsigned int    seltags;
     14 +	unsigned int    sellt;
     15 +	unsigned int    tagset[2];
     16 +	Bool            showbar;
     17 +	Bool            topbar;
     18 +	Client         *clients;
     19 +	Client         *sel;
     20 +	Client         *stack;
     21 +	Monitor        *next;
     22 +	Window          barwin;
     23 +	const Layout   *lt[2];
     24 +};
     25 +
     26  typedef struct {
     27  	const char     *class;
     28  	const char     *instance;
     29 @@ -263,30 +282,6 @@
     30  /* configuration, allows nested code to access above variables */
     31  #include "config.h"
     32  
     33 -struct Monitor {
     34 -	float           mfact;
     35 -	int             num;
     36 -	int             by;	/* bar geometry */
     37 -	int             mx, my, mw, mh;	/* screen size */
     38 -	int             wx, wy, ww, wh;	/* window area  */
     39 -	unsigned int    seltags;
     40 -	unsigned int    sellt;
     41 -	unsigned int    tagset[2];
     42 -	Bool            showbar;
     43 -	Bool            topbar;
     44 -	Client         *clients;
     45 -	Client         *sel;
     46 -	Client         *stack;
     47 -	Monitor        *next;
     48 -	Window          barwin;
     49 -	const Layout   *lt[2];
     50 -	int             curtag;
     51 -	int             prevtag;
     52 -	const Layout   *lts[LENGTH(tags) + 1];
     53 -	double          mfacts[LENGTH(tags) + 1];
     54 -	Bool            showbars[LENGTH(tags) + 1];
     55 -};
     56 -
     57  /* compile-time check if all tags fit into an unsigned int bit array. */
     58  struct NumTags {
     59  	char            limitexceeded[LENGTH(tags) > 31 ? -1 : 1];
     60 @@ -1484,7 +1479,7 @@
     61  	if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
     62  		selmon->sellt ^= 1;
     63  	if (arg && arg->v)
     64 -		selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *) arg->v;
     65 +		selmon->lt[selmon->sellt] = (Layout *) arg->v;
     66  	if (selmon->sel)
     67  		arrange();
     68  	else
     69 @@ -1502,7 +1497,7 @@
     70  	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
     71  	if (f < 0.1 || f > 0.9)
     72  		return;
     73 -	selmon->mfact = selmon->mfacts[selmon->curtag] = f;
     74 +	selmon->mfact = f;
     75  	arrange();
     76  }
     77  
     78 @@ -1512,7 +1507,6 @@
     79  	unsigned int    i;
     80  	int             w;
     81  	XSetWindowAttributes wa;
     82 -	Monitor        *m;
     83  
     84  	/* clean up any zombies immediately */
     85  	sigchld(0);
     86 @@ -1547,31 +1541,11 @@
     87  	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
     88  	if (!dc.font.set)
     89  		XSetFont(dpy, dc.gc, dc.font.xfont->fid);
     90 -	/* init tags */
     91 -	for (m = mons; m; m = m->next)
     92 -		m->curtag = m->prevtag = 1;
     93 -	/* init mfacts */
     94 -	for (m = mons; m; m = m->next) {
     95 -		for (i = 0; i < LENGTH(tags) + 1; i++) {
     96 -			m->mfacts[i] = m->mfact;
     97 -		}
     98 -	}
     99 -	/* init layouts */
    100 -	for (m = mons; m; m = m->next) {
    101 -		for (i = 0; i < LENGTH(tags) + 1; i++) {
    102 -			m->lts[i] = &layouts[0];
    103 -		}
    104 -	}
    105  	/* init bars */
    106  	for (blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
    107  		w = TEXTW(layouts[i].symbol);
    108  		blw = MAX(blw, w);
    109  	}
    110 -	for (m = mons; m; m = m->next) {
    111 -		for (i = 0; i < LENGTH(tags) + 1; i++) {
    112 -			m->showbars[i] = m->showbar;
    113 -		}
    114 -	}
    115  	updatebars();
    116  	updatestatus();
    117  	/* EWMH support per view */
    118 @@ -1689,7 +1663,7 @@
    119  void
    120  togglebar(const Arg * arg)
    121  {
    122 -	selmon->showbar = selmon->showbars[selmon->curtag] = !selmon->showbar;
    123 +	selmon->showbar = !selmon->showbar;
    124  	updatebarpos(selmon);
    125  	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
    126  	arrange();
    127 @@ -1710,27 +1684,13 @@
    128  void
    129  toggletag(const Arg * arg)
    130  {
    131 -	unsigned int    i;
    132  	unsigned int    newtags;
    133  
    134  	if (!selmon->sel)
    135  		return;
    136  	newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
    137  	if (newtags) {
    138 -		if (newtags == ~0) {
    139 -			selmon->prevtag = selmon->curtag;
    140 -			selmon->curtag = 0;
    141 -		}
    142 -		if (!(newtags & 1 << (selmon->curtag - 1))) {
    143 -			selmon->prevtag = selmon->curtag;
    144 -			for (i = 0; !(newtags & 1 << i); i++);
    145 -			selmon->curtag = i + 1;
    146 -		}
    147  		selmon->sel->tags = newtags;
    148 -		selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
    149 -		selmon->mfact = selmon->mfacts[selmon->curtag];
    150 -		if (selmon->showbar != selmon->showbars[selmon->curtag])
    151 -			togglebar(NULL);
    152  		arrange();
    153  	}
    154  }
    155 @@ -1993,28 +1953,11 @@
    156  void
    157  view(const Arg * arg)
    158  {
    159 -	unsigned int    i;
    160  	if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
    161  		return;
    162  	selmon->seltags ^= 1;	/* toggle sel tagset */
    163 -	if (arg->ui & TAGMASK) {
    164 +	if (arg->ui & TAGMASK)
    165  		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
    166 -		selmon->prevtag = selmon->curtag;
    167 -		if (arg->ui == ~0)
    168 -			selmon->curtag = 0;
    169 -		else {
    170 -			for (i = 0; !(arg->ui & 1 << i); i++);
    171 -			selmon->curtag = i + 1;
    172 -		}
    173 -	} else {
    174 -		selmon->prevtag = selmon->curtag ^ selmon->prevtag;
    175 -		selmon->curtag ^= selmon->prevtag;
    176 -		selmon->prevtag = selmon->curtag ^ selmon->prevtag;
    177 -	}
    178 -	selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
    179 -	selmon->mfact = selmon->mfacts[selmon->curtag];
    180 -	if (selmon->showbar != selmon->showbars[selmon->curtag])
    181 -		togglebar(NULL);
    182  	arrange();
    183  }
    184