commit 0832dee0473eb5e905049e0bba42164995d9e2e8
Author: Ricardo B. Ayres <[email protected]>
Date:   Tue Aug 10 20:28:59 2021 -0300

    [dwm][patch][tab] Fix rejected chunk in dwm.c
    
    The patch fails to apply because the getatomprop function prototype is
    different context from the previous old patch. I just applied the
    rejected chunk manually and generated the new diff.

diff --git a/dwm.suckless.org/patches/tab/dwm-tab-v2b-56a31dc.diff 
b/dwm.suckless.org/patches/tab/dwm-tab-v2b-20210810-7162335.diff
similarity index 77%
rename from dwm.suckless.org/patches/tab/dwm-tab-v2b-56a31dc.diff
rename to dwm.suckless.org/patches/tab/dwm-tab-v2b-20210810-7162335.diff
index ec8bba6c..d531d3fb 100644
--- a/dwm.suckless.org/patches/tab/dwm-tab-v2b-56a31dc.diff
+++ b/dwm.suckless.org/patches/tab/dwm-tab-v2b-20210810-7162335.diff
@@ -1,23 +1,34 @@
+From a10056f3bbda7337b87f1dcd4beaf4f688d5368b Mon Sep 17 00:00:00 2001
+From: "Ricardo B. Ayres" <[email protected]>
+Date: Tue, 10 Aug 2021 19:52:22 -0300
+Subject: [PATCH] fixing focuswin function prototype not being applied because
+ of new Atom function in context
+
+---
+ config.def.h |   9 +++
+ dwm.1        |  33 +++++---
+ dwm.c        | 209 ++++++++++++++++++++++++++++++++++++++++++++++++---
+ 3 files changed, 232 insertions(+), 19 deletions(-)
+
 diff --git a/config.def.h b/config.def.h
-index fd77a07..dd2442b 100644
+index a2ac963..931d7ae 100644
 --- a/config.def.h
 +++ b/config.def.h
-@@ -5,6 +5,14 @@ static const unsigned int borderpx  = 1;        /* border 
pixel of windows */
+@@ -5,6 +5,13 @@ static const unsigned int borderpx  = 1;        /* border 
pixel of windows */
  static const unsigned int snap      = 32;       /* snap pixel */
  static const int showbar            = 1;        /* 0 means no bar */
  static const int topbar             = 1;        /* 0 means bottom bar */
-+
-+/*   Display modes of the tab bar: never shown, always shown, shown only in */
-+/*   monocle mode in presence of several windows.                           */
-+/*   Modes after showtab_nmodes are disabled                                */
++/*  Display modes of the tab bar: never shown, always shown, shown only in  */
++/*  monocle mode in the presence of several windows.                        */
++/*  Modes after showtab_nmodes are disabled.                                */
 +enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, 
showtab_always};
-+static const int showtab            = showtab_auto; /* Default tab bar show 
mode */
-+static const int toptab             = False;    /* False means bottom tab bar 
*/
++static const int showtab                      = showtab_auto;        /* 
Default tab bar show mode */
++static const int toptab                               = False;               
/* False means bottom tab bar */
 +
  static const char *fonts[]          = { "monospace:size=10" };
  static const char dmenufont[]       = "monospace:size=10";
  static const char col_gray1[]       = "#222222";
-@@ -64,6 +72,7 @@ static Key keys[] = {
+@@ -65,6 +72,7 @@ static Key keys[] = {
        { MODKEY,                       XK_p,      spawn,          {.v = 
dmenucmd } },
        { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = 
termcmd } },
        { MODKEY,                       XK_b,      togglebar,      {0} },
@@ -25,7 +36,7 @@ index fd77a07..dd2442b 100644
        { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
        { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
        { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
-@@ -111,5 +120,6 @@ static Button buttons[] = {
+@@ -112,5 +120,6 @@ static Button buttons[] = {
        { ClkTagBar,            0,              Button3,        toggleview,     
{0} },
        { ClkTagBar,            MODKEY,         Button1,        tag,            
{0} },
        { ClkTagBar,            MODKEY,         Button3,        toggletag,      
{0} },
@@ -33,10 +44,10 @@ index fd77a07..dd2442b 100644
  };
  
 diff --git a/dwm.1 b/dwm.1
-index 6687011..9ff827c 100644
+index ddc8321..7752444 100644
 --- a/dwm.1
 +++ b/dwm.1
-@@ -19,14 +19,22 @@ layout applied.
+@@ -20,14 +20,22 @@ layout applied.
  Windows are grouped by tags. Each window can be tagged with one or multiple
  tags. Selecting certain tags displays all windows with these tags.
  .P
@@ -48,7 +59,7 @@ index 6687011..9ff827c 100644
 -color. The tags of the focused window are indicated with a filled square in 
the
 -top left corner.  The tags which are applied to one or more windows are
 -indicated with an empty square in the top left corner.
-+Each screen contains two small status bars. 
++Each screen contains two small status bars.
 +.P
 +One bar displays all available tags, the layout, the title of the focused
 +window, and the text read from the root window name property, if the screen is
@@ -57,7 +68,7 @@ index 6687011..9ff827c 100644
 +selected tags are indicated with a different color. The tags of the focused
 +window are indicated with a filled square in the top left corner.  The tags
 +which are applied to one or more windows are indicated with an empty square in
-+the top left corner. 
++the top left corner.
 +.P
 +Another bar contains a tab for each window of the current view and allows
 +navigation between windows, especially in the monocle mode. The different
@@ -67,7 +78,7 @@ index 6687011..9ff827c 100644
  .P
  dwm draws a small border around windows to indicate the focus state.
  .SH OPTIONS
-@@ -43,7 +51,8 @@ command.
+@@ -44,7 +52,8 @@ command.
  .TP
  .B Button1
  click on a tag label to display all windows with that tag, click on the layout
@@ -77,7 +88,7 @@ index 6687011..9ff827c 100644
  .TP
  .B Button3
  click on a tag label adds/removes all windows with that tag to/from the view.
-@@ -104,6 +113,12 @@ Increase master area size.
+@@ -110,6 +119,12 @@ Increase master area size.
  .B Mod1\-h
  Decrease master area size.
  .TP
@@ -91,10 +102,10 @@ index 6687011..9ff827c 100644
  Zooms/cycles focused window to/from master area (tiled layouts only).
  .TP
 diff --git a/dwm.c b/dwm.c
-index b2bc9bd..134a5b0 100644
+index 5e4d494..e3662ca 100644
 --- a/dwm.c
 +++ b/dwm.c
-@@ -65,7 +65,7 @@ enum { NetSupported, NetWMName, NetWMState,
+@@ -64,7 +64,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
         NetWMFullscreen, NetActiveWindow, NetWMWindowType,
         NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default 
atoms */
@@ -103,7 +114,7 @@ index b2bc9bd..134a5b0 100644
         ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
  
  typedef union {
-@@ -112,24 +112,32 @@ typedef struct {
+@@ -111,24 +111,32 @@ typedef struct {
        void (*arrange)(Monitor *);
  } Layout;
  
@@ -136,23 +147,15 @@ index b2bc9bd..134a5b0 100644
        const Layout *lt[2];
  };
  
-@@ -165,12 +173,15 @@ static void detachstack(Client *c);
- static Monitor *dirtomon(int dir);
- static void drawbar(Monitor *m);
- static void drawbars(void);
-+static void drawtab(Monitor *m);
-+static void drawtabs(void);
- static void enternotify(XEvent *e);
- static void expose(XEvent *e);
- static void focus(Client *c);
+@@ -169,6 +177,7 @@ static void focus(Client *c);
  static void focusin(XEvent *e);
  static void focusmon(const Arg *arg);
  static void focusstack(const Arg *arg);
 +static void focuswin(const Arg* arg);
+ static Atom getatomprop(Client *c, Atom prop);
  static int getrootptr(int *x, int *y);
  static long getstate(Window w);
- static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
-@@ -207,6 +218,7 @@ static void setup(void);
+@@ -207,6 +216,7 @@ static void seturgent(Client *c, int urg);
  static void showhide(Client *c);
  static void sigchld(int unused);
  static void spawn(const Arg *arg);
@@ -160,7 +163,7 @@ index b2bc9bd..134a5b0 100644
  static void tag(const Arg *arg);
  static void tagmon(const Arg *arg);
  static void tile(Monitor *);
-@@ -241,6 +253,7 @@ static char stext[256];
+@@ -241,6 +251,7 @@ static char stext[256];
  static int screen;
  static int sw, sh;           /* X display screen geometry width, height */
  static int bh, blw = 0;      /* bar geometry */
@@ -168,7 +171,7 @@ index b2bc9bd..134a5b0 100644
  static int lrpad;            /* sum of left and right padding for text */
  static int (*xerrorxlib)(Display *, XErrorEvent *);
  static unsigned int numlockmask = 0;
-@@ -393,8 +406,9 @@ arrange(Monitor *m)
+@@ -393,8 +404,9 @@ arrange(Monitor *m)
  }
  
  void
@@ -180,7 +183,7 @@ index b2bc9bd..134a5b0 100644
        strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
        if (m->lt[m->sellt]->arrange)
                m->lt[m->sellt]->arrange(m);
-@@ -444,14 +458,33 @@ buttonpress(XEvent *e)
+@@ -444,7 +456,24 @@ buttonpress(XEvent *e)
                        click = ClkStatusText;
                else
                        click = ClkWinTitle;
@@ -189,35 +192,36 @@ index b2bc9bd..134a5b0 100644
 +      if(ev->window == selmon->tabwin) {
 +              i = 0; x = 0;
 +              for(c = selmon->clients; c; c = c->next){
-+                if(!ISVISIBLE(c)) continue;
-+                x += selmon->tab_widths[i];
-+                if (ev->x > x)
-+                  ++i;
-+                else
-+                  break;
-+                if(i >= m->ntabs) break;
++                      if(!ISVISIBLE(c)) continue;
++                      x += selmon->tab_widths[i];
++                      if (ev->x > x)
++                              ++i;
++                      else
++                              break;
++                      if(i >= m->ntabs) break;
 +              }
 +              if(c) {
-+                click = ClkTabBar;
-+                arg.ui = i;
++                      click = ClkTabBar;
++                      arg.ui = i;
 +              }
 +      }
 +      else if((c = wintoclient(ev->window))) {
                focus(c);
-               click = ClkClientWin;
+               restack(selmon);
+               XAllowEvents(dpy, ReplayPointer, CurrentTime);
+@@ -452,8 +481,9 @@ buttonpress(XEvent *e)
        }
        for (i = 0; i < LENGTH(buttons); i++)
                if (click == buttons[i].click && buttons[i].func && 
buttons[i].button == ev->button
 -              && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
 -                      buttons[i].func(click == ClkTagBar && buttons[i].arg.i 
== 0 ? &arg : &buttons[i].arg);
 +              && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)){
-+                      buttons[i].func(((click == ClkTagBar || click == 
ClkTabBar)
-+                                 && buttons[i].arg.i == 0) ? &arg : 
&buttons[i].arg);
++                      buttons[i].func(((click == ClkTagBar || click == 
ClkTabBar) && buttons[i].arg.i == 0) ? &arg : &buttons[i].arg);
 +              }
  }
  
  void
-@@ -504,6 +537,8 @@ cleanupmon(Monitor *mon)
+@@ -507,6 +537,8 @@ cleanupmon(Monitor *mon)
        }
        XUnmapWindow(dpy, mon->barwin);
        XDestroyWindow(dpy, mon->barwin);
@@ -226,18 +230,7 @@ index b2bc9bd..134a5b0 100644
        free(mon);
  }
  
-@@ -576,7 +611,9 @@ configurenotify(XEvent *e)
-               if (updategeom() || dirty) {
-                       drw_resize(drw, sw, bh);
-                       updatebars();
--                      for (m = mons; m; m = m->next) {
-+                      //refreshing display of status bar. The tab bar is 
handled by the arrange()
-+                      //method, which is called below
-+                      for(m = mons; m; m = m->next){
-                               for (c = m->clients; c; c = c->next)
-                                       if (c->isfullscreen)
-                                               resizeclient(c, m->mx, m->my, 
m->mw, m->mh);
-@@ -650,7 +687,10 @@ createmon(void)
+@@ -638,7 +670,10 @@ createmon(void)
        m->mfact = mfact;
        m->nmaster = nmaster;
        m->showbar = showbar;
@@ -248,10 +241,11 @@ index b2bc9bd..134a5b0 100644
        m->lt[0] = &layouts[0];
        m->lt[1] = &layouts[1 % LENGTH(layouts)];
        strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
-@@ -765,6 +805,105 @@ drawbars(void)
+@@ -752,6 +787,105 @@ drawbars(void)
+               drawbar(m);
  }
  
- void
++void
 +drawtabs(void) {
 +      Monitor *m;
 +
@@ -330,8 +324,8 @@ index b2bc9bd..134a5b0 100644
 +        if(i >= m->ntabs) break;
 +        if(m->tab_widths[i] >  maxsize) m->tab_widths[i] = maxsize;
 +        w = m->tab_widths[i];
-+        drw_setscheme(drw, (c == m->sel) ? scheme[SchemeSel] : 
scheme[SchemeNorm]);
-+        drw_text(drw, x, 0, w, th, lrpad / 2, c->name, 0);
++        drw_setscheme(drw, scheme[(c == m->sel) ? SchemeSel : SchemeNorm]);
++        drw_text(drw, x, 0, w, th, 0, c->name, 0);
 +        x += w;
 +        ++i;
 +      }
@@ -340,21 +334,20 @@ index b2bc9bd..134a5b0 100644
 +
 +      /* cleans interspace between window names and current viewed tag label 
*/
 +      w = m->ww - view_info_w - x;
-+      drw_text(drw, x, 0, w, th, lrpad / 2, "", 0);
++      drw_text(drw, x, 0, w, th, 0, "", 0);
 +
 +      /* view info */
 +      x += w;
 +      w = view_info_w;
-+      drw_text(drw, x, 0, w, th, lrpad / 2, view_info, 0);
++      drw_text(drw, x, 0, w, th, 0, view_info, 0);
 +
 +      drw_map(drw, m->tabwin, 0, 0, m->ww, th);
 +}
 +
-+void
+ void
  enternotify(XEvent *e)
  {
-       Client *c;
-@@ -789,8 +928,10 @@ expose(XEvent *e)
+@@ -777,8 +911,10 @@ expose(XEvent *e)
        Monitor *m;
        XExposeEvent *ev = &e->xexpose;
  
@@ -366,15 +359,15 @@ index b2bc9bd..134a5b0 100644
  }
  
  void
-@@ -817,6 +958,7 @@ focus(Client *c)
+@@ -804,6 +940,7 @@ focus(Client *c)
        }
        selmon->sel = c;
        drawbars();
 +      drawtabs();
  }
  
- /* there are some broken focus acquiring clients */
-@@ -870,6 +1012,19 @@ focusstack(const Arg *arg)
+ /* there are some broken focus acquiring clients needing extra handling */
+@@ -856,6 +993,19 @@ focusstack(const Arg *arg)
        }
  }
  
@@ -394,7 +387,7 @@ index b2bc9bd..134a5b0 100644
  Atom
  getatomprop(Client *c, Atom prop)
  {
-@@ -1253,12 +1408,14 @@ propertynotify(XEvent *e)
+@@ -1234,12 +1384,14 @@ propertynotify(XEvent *e)
                case XA_WM_HINTS:
                        updatewmhints(c);
                        drawbars();
@@ -409,7 +402,7 @@ index b2bc9bd..134a5b0 100644
                }
                if (ev->atom == netatom[NetWMWindowType])
                        updatewindowtype(c);
-@@ -1372,6 +1529,7 @@ restack(Monitor *m)
+@@ -1353,6 +1505,7 @@ restack(Monitor *m)
        XWindowChanges wc;
  
        drawbar(m);
@@ -417,18 +410,19 @@ index b2bc9bd..134a5b0 100644
        if (!m->sel)
                return;
        if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
-@@ -1564,6 +1722,7 @@ setup(void)
-               die("no fonts could be loaded.
");
+@@ -1547,6 +1700,7 @@ setup(void)
+               die("no fonts could be loaded.");
        lrpad = drw->fonts->h;
        bh = drw->fonts->h + 2;
 +      th = bh;
        updategeom();
        /* init atoms */
-       wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
-@@ -1698,6 +1857,17 @@ togglebar(const Arg *arg)
+       utf8string = XInternAtom(dpy, "UTF8_STRING", False);
+@@ -1708,6 +1862,17 @@ togglebar(const Arg *arg)
+       arrange(selmon);
  }
  
- void
++void
 +tabmode(const Arg *arg)
 +{
 +      if(arg && arg->i >= 0)
@@ -439,22 +433,22 @@ index b2bc9bd..134a5b0 100644
 +}
 +
 +
-+void
+ void
  togglefloating(const Arg *arg)
  {
-       if (!selmon->sel)
-@@ -1808,20 +1978,44 @@ updatebars(void)
-                                         
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+@@ -1819,6 +1984,11 @@ updatebars(void)
+                               CWOverrideRedirect|CWBackPixmap|CWEventMask, 
&wa);
                XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
                XMapRaised(dpy, m->barwin);
 +              m->tabwin = XCreateWindow(dpy, root, m->wx, m->ty, m->ww, th, 
0, DefaultDepth(dpy, screen),
-+                                        CopyFromParent, DefaultVisual(dpy, 
screen),
-+                                        
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
++                                              CopyFromParent, 
DefaultVisual(dpy, screen),
++                                              
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
 +              XDefineCursor(dpy, m->tabwin, cursor[CurNormal]->cursor);
 +              XMapRaised(dpy, m->tabwin);
+               XSetClassHint(dpy, m->barwin, &ch);
        }
  }
- 
+@@ -1826,14 +1996,33 @@ updatebars(void)
  void
  updatebarpos(Monitor *m)
  {
@@ -474,12 +468,12 @@ index b2bc9bd..134a5b0 100644
                m->by = -bh;
 +      }
 +
-+      for(c = m->clients; c; c = c->next){
-+        if(ISVISIBLE(c)) ++nvis;
++      for(c = m->clients; c; c = c->next) {
++              if(ISVISIBLE(c)) ++nvis;
 +      }
 +
 +      if(m->showtab == showtab_always
-+         || ((m->showtab == showtab_auto) && (nvis > 1) && 
(m->lt[m->sellt]->arrange == monocle))){
++         || ((m->showtab == showtab_auto) && (nvis > 1) && 
(m->lt[m->sellt]->arrange == monocle))) {
 +              m->wh -= th;
 +              m->ty = m->toptab ? m->wy : m->wy + m->wh;
 +              if ( m->toptab )
@@ -490,7 +484,7 @@ index b2bc9bd..134a5b0 100644
  }
  
  void
-@@ -2062,7 +2256,7 @@ wintomon(Window w)
+@@ -2070,7 +2259,7 @@ wintomon(Window w)
        if (w == root && getrootptr(&x, &y))
                return recttomon(x, y, 1, 1);
        for (m = mons; m; m = m->next)
@@ -499,3 +493,6 @@ index b2bc9bd..134a5b0 100644
                        return m;
        if ((c = wintoclient(w)))
                return c->mon;
+-- 
+2.32.0
+
diff --git a/dwm.suckless.org/patches/tab/index.md 
b/dwm.suckless.org/patches/tab/index.md
index ca126799..225663ed 100644
--- a/dwm.suckless.org/patches/tab/index.md
+++ b/dwm.suckless.org/patches/tab/index.md
@@ -111,7 +111,7 @@ Download
 --------
 * Tab patch alone
   * For dwm 6.1: [dwm-6.1-tab-v2b.diff](dwm-6.1-tab-v2b.diff)
-  * For dwm from the git master branch: 
[dwm-tab-v2b-56a31dc.diff](dwm-tab-v2b-56a31dc.diff)
+  * For dwm from the git master branch: 
[dwm-tab-v2b-20210810-7162335.diff](dwm-tab-v2b-20210810-7162335.diff)
   * For dwm 6.2: [dwm-6.2-tab-v2b.diff](dwm-6.2-tab-v2b.diff)
 * Combined patch of tab and the [pertag](../pertag/) patch from Jan Christoph
   Ebersbach.
@@ -123,6 +123,7 @@ Download
 
 Change log
 ----------
+* Fixed the standalone tab patch not applying to the current git master.
 * **v2b** Fixed in the pertag-tab patch the support for per-tag default layout
   specification. No change in the tab only patch.
 * **v2a** Typo corrected in the man page. For the combined pertag-tab patch,


Reply via email to