Re: [hackers] Re: [dwm][PATCH] buttonpress: fix status text click area mismatch

From: Ruben Gonzalez <neorubenx_AT_gmail.com>
Date: Sat, 14 Mar 2026 17:01:08 +0200

Perfect then, thank you!

On Sat, Mar 14, 2026 at 12:37 PM Hiltjo Posthuma <hiltjo_AT_codemadness.org> wrote:
>
> On Fri, Mar 13, 2026 at 05:36:30PM +0200, Ruben Gonzalez wrote:
> > Hello,
> >
> > I am resending the patch because it contained some incorrect indentation.
> >
> >
>
> No worries, I noticed it and fixed up the commit before pushing.
>
> Thanks again for the patches.
>
> > From 382e4a21c070760f6c5607da704f2384d71ca5c2 Mon Sep 17 00:00:00 2001
> > From: Ruben Gonzalez <gonzaru_AT_sdf.org>
> > Date: Fri, 13 Mar 2026 15:23:24 +0200
> > Subject: [PATCH] buttonpress: fix status text click area mismatch
> >
> > ---
> > dwm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/dwm.c b/dwm.c
> > index 6fe226f..ab3a84c 100644
> > --- a/dwm.c
> > +++ b/dwm.c
> > _AT_@ -440,7 +440,7 @@ buttonpress(XEvent *e)
> > arg.ui = 1 << i;
> > } else if (ev->x < x + TEXTW(selmon->ltsymbol))
> > click = ClkLtSymbol;
> > - else if (ev->x > selmon->ww - (int)TEXTW(stext))
> > + else if (ev->x > selmon->ww - (int)TEXTW(stext) + lrpad - 2)
> > click = ClkStatusText;
> > else
> > click = ClkWinTitle;
> > --
> > 2.43.0
> >
> > On Fri, Mar 13, 2026 at 4:04 PM Ruben Gonzalez <neorubenx_AT_gmail.com> wrote:
> > >
> > > The status bar in drawbar() calculates the text width as TEXTW(stext)
> > > - lrpad + 2. However, the click detection in buttonpress() used
> > > TEXTW(stext) without adjusting for that padding.
> > >
> > > This created an "extra" clickable area of some pixels to the left of
> > > the status text that would incorrectly trigger ClkStatusText actions
> > > instead of ClkWinTitle.
> > >
> > > Steps to reproduce:
> > > 1. Set a status text: xsetroot -name "HELLO"
> > > 2. Move the mouse to the empty space with some pixels close to the
> > > left of the word "HELLO" but in the title area.
> > > 3. Middle-click (or any binding for ClkStatusText).
> > > 4. You can see that the status bar action is triggered (default a
> > > terminal spawns), even though you clicked in the window title area.
> > >
> > > This fix ensures that the clickable area matches the visual text.
> > >
> > > 0001-buttonpress-fix-status-text-click-area-mismatch.patch
> > >
> > > From 382e4a21c070760f6c5607da704f2384d71ca5c2 Mon Sep 17 00:00:00 2001
> > > From: Ruben Gonzalez <gonzaru_AT_sdf.org>
> > > Date: Fri, 13 Mar 2026 15:23:24 +0200
> > > Subject: [PATCH] buttonpress: fix status text click area mismatch
> > >
> > > ---
> > > dwm.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/dwm.c b/dwm.c
> > > index 6fe226f..ab3a84c 100644
> > > --- a/dwm.c
> > > +++ b/dwm.c
> > > _AT_@ -440,7 +440,7 @@ buttonpress(XEvent *e)
> > > arg.ui = 1 << i;
> > > } else if (ev->x < x + TEXTW(selmon->ltsymbol))
> > > click = ClkLtSymbol;
> > > - else if (ev->x > selmon->ww - (int)TEXTW(stext))
> > > + else if (ev->x > selmon->ww - (int)TEXTW(stext) + lrpad - 2)
> > > click = ClkStatusText;
> > > else
> > > click = ClkWinTitle;
> > > --
> >
>
> --
> Kind regards,
> Hiltjo
>
Received on Sat Mar 14 2026 - 16:01:08 CET

This archive was generated by hypermail 2.3.0 : Sat Mar 14 2026 - 16:36:38 CET