Re: [hackers] [tabbed][PATCH] focus(): clear XUrgencyHint from the container window

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 21 Jan 2025 20:27:53 +0100

On Tue, Jan 21, 2025 at 08:28:42PM +0300, Mikhail Pchelin wrote:
> On Tue, Jan 21, 2025 at 05:03:25PM +0000, NRK wrote:
> > > + if (clients[c]->urgent && (wmh = XGetWMHints(dpy, clients[c]->win)) &&
> > > + (win_wmh = XGetWMHints(dpy, win))) {
> >
> > This will leak if the first XGetWMHints succeeds but the 2nd one fails.
>
> Thank you for the review, updated version bellow.
>
> From 155a030ea55845e5ec81d08b3cf3f9f08fb876d1 Mon Sep 17 00:00:00 2001
> From: Mikhail Pchelin <misha_AT_FreeBSD.org>
> Date: Tue, 21 Jan 2025 19:01:13 +0300
> Subject: [PATCH] focus(): clear XUrgencyHint from the container window
>
> ---
> tabbed.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tabbed.c b/tabbed.c
> index e5664aa..aa45716 100644
> --- a/tabbed.c
> +++ b/tabbed.c
> _AT_@ -447,6 +447,7 @@ focus(int c)
> char buf[BUFSIZ] = "tabbed-"VERSION" ::";
> size_t i, n;
> XWMHints* wmh;
> + XWMHints* win_wmh;
>
> /* If c, sel and clients are -1, raise tabbed-win itself */
> if (nclients == 0) {
> _AT_@ -480,6 +481,17 @@ focus(int c)
> XSetWMHints(dpy, clients[c]->win, wmh);
> clients[c]->urgent = False;
> XFree(wmh);
> +
> + /*
> + * gnome-shell will not stop notifying us about urgency,
> + * if we clear only the client hint and don't clear the
> + * hint from the main container window
> + */
> + if ((win_wmh = XGetWMHints(dpy, win))) {
> + win_wmh->flags &= ~XUrgencyHint;
> + XSetWMHints(dpy, win, win_wmh);
> + XFree(win_wmh);
> + }
> }
>
> drawbar();
> --
> 2.45.2
>
>

Hi,

Thanks for the patch, at a glance it looks good.

Can anyone confirm this makes sense. I do not use gnome-shell myself.

Thank you,

-- 
Kind regards,
Hiltjo
Received on Tue Jan 21 2025 - 20:27:53 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 21 2025 - 20:36:38 CET