[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Sat, 25 Sep 2010 22:08:14 +0000 (UTC)

changeset: 628:aa8dbca45724
tag: tip
user: William Light <wrl_AT_illest.net>
date: Sat Sep 25 15:00:49 2010 -0700
files: dwm.suckless.org/patches/dwm-5.8.2-pertag.diff dwm.suckless.org/patches/dwm-5.8.2-pertag_without_bar.diff dwm.suckless.org/patches/pertag.md
description:
fixed segfault with pertag when creating new monitors while dwm is running (i.e. with xrandr)

test case:
1) start dwm
2) plug in a second monitor and bring it up with xrandr, setting it RightOf the current screen
3) select the new monitor (modkey-,)
4) switch to a different tag


diff -r a33cf723d827 -r aa8dbca45724 dwm.suckless.org/patches/dwm-5.8.2-pertag.diff
--- a/dwm.suckless.org/patches/dwm-5.8.2-pertag.diff Sat Sep 18 11:18:13 2010 -0400
+++ b/dwm.suckless.org/patches/dwm-5.8.2-pertag.diff Sat Sep 25 15:00:49 2010 -0700
_AT_@ -1,7 +1,7 @@
-diff -r cb309a6cea4b dwm.c
---- a/dwm.c Wed Jun 02 18:24:24 2010 +0200
-+++ b/dwm.c Thu Jun 03 18:47:50 2010 +0200
-_AT_@ -121,26 +121,6 @@
+diff --git a/dwm.c b/dwm.c
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -122,26 +122,6 @@ typedef struct {
          void (*arrange)(Monitor *);
  } Layout;
  
_AT_@ -28,7 +28,7 @@
  typedef struct {
          const char *class;
          const char *instance;
-_AT_@ -275,6 +255,31 @@
+_AT_@ -278,6 +258,31 @@ static Window root;
  /* configuration, allows nested code to access above variables */
  #include "config.h"
  
_AT_@ -60,7 +60,31 @@
  /* compile-time check if all tags fit into an unsigned int bit array. */
  struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  
-_AT_@ -1467,7 +1472,7 @@
+_AT_@ -609,6 +614,7 @@ configurerequest(XEvent *e) {
+ Monitor *
+ createmon(void) {
+ Monitor *m;
++ unsigned int i;
+
+ if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
+_AT_@ -619,6 +625,15 @@ createmon(void) {
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++
++ /* pertag init */
++ m->curtag = m->prevtag = 1;
++ for(i=0; i < LENGTH(tags) + 1 ; i++) {
++ m->mfacts[i] = mfact;
++ m->lts[i] = &layouts[0];
++ m->showbars[i] = m->showbar;
++ }
++
+ return m;
+ }
+
+_AT_@ -1486,7 +1501,7 @@ setlayout(const Arg *arg) {
          if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
                  selmon->sellt ^= 1;
          if(arg && arg->v)
_AT_@ -69,7 +93,7 @@
          strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
          if(selmon->sel)
                  arrange(selmon);
-_AT_@ -1485,13 +1490,15 @@
+_AT_@ -1504,7 +1519,7 @@ setmfact(const Arg *arg) {
          f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
          if(f < 0.1 || f > 0.9)
                  return;
_AT_@ -78,43 +102,15 @@
          arrange(selmon);
  }
  
- void
- setup(void) {
- XSetWindowAttributes wa;
-+ Monitor *m;
-+ unsigned int i;
-
- /* clean up any zombies immediately */
- sigchld(0);
-_AT_@ -1527,7 +1534,27 @@
+_AT_@ -1547,7 +1562,6 @@ setup(void) {
          XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
          if(!dc.font.set)
                  XSetFont(dpy, dc.gc, dc.font.xfont->fid);
-+ /* init tags */
-+ for(m = mons; m; m = m->next)
-+ m->curtag = m->prevtag = 1;
-+ /* init mfacts */
-+ for(m = mons; m; m = m->next) {
-+ for(i=0; i < LENGTH(tags) + 1 ; i++) {
-+ m->mfacts[i] = m->mfact;
-+ }
-+ }
-+ /* init layouts */
-+ for(m = mons; m; m = m->next) {
-+ for(i=0; i < LENGTH(tags) + 1; i++) {
-+ m->lts[i] = &layouts[0];
-+ }
-+ }
- /* init bars */
-+ for(m = mons; m; m = m->next) {
-+ for(i=0; i < LENGTH(tags) + 1; i++) {
-+ m->showbars[i] = m->showbar;
-+ }
-+ }
+- /* init bars */
          updatebars();
          updatestatus();
          /* EWMH support per view */
-_AT_@ -1638,7 +1665,7 @@
+_AT_@ -1658,7 +1672,7 @@ tile(Monitor *m) {
  
  void
  togglebar(const Arg *arg) {
_AT_@ -123,7 +119,7 @@
          updatebarpos(selmon);
          XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
          arrange(selmon);
-_AT_@ -1658,12 +1685,27 @@
+_AT_@ -1678,12 +1692,27 @@ togglefloating(const Arg *arg) {
  void
  toggletag(const Arg *arg) {
          unsigned int newtags;
_AT_@ -151,7 +147,7 @@
                  arrange(selmon);
          }
  }
-_AT_@ -1930,11 +1972,29 @@
+_AT_@ -1950,11 +1979,29 @@ updatewmhints(Client *c) {
  
  void
  view(const Arg *arg) {
diff -r a33cf723d827 -r aa8dbca45724 dwm.suckless.org/patches/dwm-5.8.2-pertag_without_bar.diff
--- a/dwm.suckless.org/patches/dwm-5.8.2-pertag_without_bar.diff Sat Sep 18 11:18:13 2010 -0400
+++ b/dwm.suckless.org/patches/dwm-5.8.2-pertag_without_bar.diff Sat Sep 25 15:00:49 2010 -0700
_AT_@ -1,9 +1,7 @@
-diff -NU5 -r dwm-5.8.2/dwm.c dwm-5.8.2-pertag/dwm.c
---- dwm-5.8.2/dwm.c 2010-06-04 12:39:15.000000000 +0200
-+++ dwm-5.8.2-pertag/dwm.c 2010-06-15 17:59:56.000000000 +0200
-_AT_@ -120,30 +120,10 @@
- typedef struct {
- const char *symbol;
+diff --git a/dwm.c b/dwm.c
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -122,26 +122,6 @@ typedef struct {
          void (*arrange)(Monitor *);
  } Layout;
  
_AT_@ -30,11 +28,7 @@
  typedef struct {
          const char *class;
          const char *instance;
- const char *title;
- unsigned int tags;
-_AT_@ -276,10 +256,34 @@
- static Window root;
-
+_AT_@ -278,6 +258,30 @@ static Window root;
  /* configuration, allows nested code to access above variables */
  #include "config.h"
  
_AT_@ -65,11 +59,30 @@
  /* compile-time check if all tags fit into an unsigned int bit array. */
  struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  
- /* function implementations */
- void
-_AT_@ -1492,11 +1496,11 @@
- void
- setlayout(const Arg *arg) {
+_AT_@ -609,6 +613,7 @@ configurerequest(XEvent *e) {
+ Monitor *
+ createmon(void) {
+ Monitor *m;
++ unsigned int i;
+
+ if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
+_AT_@ -619,6 +624,14 @@ createmon(void) {
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++
++ /* pertag init */
++ m->curtag = m->prevtag = 1;
++ for(i=0; i < LENGTH(tags) + 1 ; i++) {
++ m->mfacts[i] = mfact;
++ m->lts[i] = &layouts[0];
++ }
++
+ return m;
+ }
+
+_AT_@ -1486,7 +1499,7 @@ setlayout(const Arg *arg) {
          if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
                  selmon->sellt ^= 1;
          if(arg && arg->v)
_AT_@ -78,11 +91,7 @@
          strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
          if(selmon->sel)
                  arrange(selmon);
- else
- drawbar(selmon);
-_AT_@ -1510,17 +1514,19 @@
- if(!arg || !selmon->lt[selmon->sellt]->arrange)
- return;
+_AT_@ -1504,7 +1517,7 @@ setmfact(const Arg *arg) {
          f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
          if(f < 0.1 || f > 0.9)
                  return;
_AT_@ -91,46 +100,15 @@
          arrange(selmon);
  }
  
- void
- setup(void) {
- XSetWindowAttributes wa;
-+ Monitor *m;
-+ unsigned int i;
-
- /* clean up any zombies immediately */
- sigchld(0);
-
- /* init screen */
-_AT_@ -1553,11 +1559,25 @@
- dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, NULL);
+_AT_@ -1547,7 +1560,6 @@ setup(void) {
          XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
          if(!dc.font.set)
                  XSetFont(dpy, dc.gc, dc.font.xfont->fid);
 - /* init bars */
-+ /* init tags */
-+ for(m = mons; m; m = m->next)
-+ m->curtag = m->prevtag = 1;
-+ /* init mfacts */
-+ for(m = mons; m; m = m->next) {
-+ for(i=0; i < LENGTH(tags) + 1 ; i++) {
-+ m->mfacts[i] = m->mfact;
-+ }
-+ }
-+ /* init layouts */
-+ for(m = mons; m; m = m->next) {
-+ for(i=0; i < LENGTH(tags) + 1; i++) {
-+ m->lts[i] = &layouts[0];
-+ }
-+ }
          updatebars();
          updatestatus();
          /* EWMH support per view */
- XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
- PropModeReplace, (unsigned char *) netatom, NetLast);
-_AT_@ -1684,16 +1704,29 @@
- }
-
+_AT_@ -1678,12 +1690,25 @@ togglefloating(const Arg *arg) {
  void
  toggletag(const Arg *arg) {
          unsigned int newtags;
_AT_@ -156,11 +134,7 @@
                  arrange(selmon);
          }
  }
-
- void
-_AT_@ -1957,15 +1990,31 @@
- }
- }
+_AT_@ -1950,11 +1975,27 @@ updatewmhints(Client *c) {
  
  void
  view(const Arg *arg) {
_AT_@ -189,5 +163,3 @@
          arrange(selmon);
  }
  
- Client *
- wintoclient(Window w) {
diff -r a33cf723d827 -r aa8dbca45724 dwm.suckless.org/patches/pertag.md
--- a/dwm.suckless.org/patches/pertag.md Sat Sep 18 11:18:13 2010 -0400
+++ b/dwm.suckless.org/patches/pertag.md Sat Sep 25 15:00:49 2010 -0700
_AT_@ -25,6 +25,7 @@
 * Updated by V4hn - `v4hn.de`
 * Updated by Jerome Andrieux - `<jerome at gcu dot info>`
 * Updated by Sidney Amani - `<seed at uffs dot org>`
+* Updated by William Light - `<wrl at illest dot net>`
 
 [1]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-pertag.diff
 [2]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-pertag_nmaster.diff
Received on Sun Sep 26 2010 - 00:08:14 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:29 CEST