[hackers] Re: [st][PATCH] xclearwin clears the window

From: Christian Tenllado <ctenllado_AT_gmail.com>
Date: Wed, 06 May 2020 12:44:19 +0200

Ok, I see, I had myself problems reproducing it, sorry for that. This
problem apparently only happens on the following conditions:

- anysize patch applied (I had it applied)
- patch to handle new OSC codes (10,11, 12) applied, to independently
  change the background and foreground colors (I posted that patch days
  ago in the mailing list and yesterday or the day before on the sites repo).

I send you a patch that applies both patches on the tags/0.8.3 release
version, as well as the config.h file I used to reproduce the problem.

A commando to change the background to a color different from the one
defined in the config file that makes the problem appear is this:

echo -e "\033]11;#888888\007"

You will see a black line at the top of the terminal, different from the
background of the terminal.

A better approach might be to change also the border color when you
change the background color, if that makes sense. I just did not see
clearly how to do that. I have no experience with Xlib, but I can
explore that option a bit.

I see that this is a fix for a very specific setup, so mayby it is
better fuse it with the OSC patch I sent (if it is finally approved) or
with the anysize patch. Or just drop it, I will keep on using it for the
moment although I might try to remove the anysize patch to see if I do
not need this one also.

Apologise me for not having checked the effect of other patches I had
applied. I saw the TODO comment and thought that it was the general case
when the background color was changed.

Regards,

Christian.



Excerpts from Christian Tenllado's message of April 19, 2020 3:48 pm:
> When an OCS sequence was used to change the bg color, the borders where
> dirty. This simple patch just clears the window before the redraw of the
> terminal when the bg color has been changed. This is apparently enough
> and seams to be very smooth. There was a TODO comment for it on the st.c
> file, which I removed.
> ---
> st.c | 6 ++----
> win.h | 1 +
> x.c | 6 ++++++
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/st.c b/st.c
> index 3e48410..2efb4bd 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -1874,10 +1874,8 @@ strhandle(void)
> fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
> j, p ? p : "(null)");
> } else {
> - /*
> - * TODO if defaultbg color is changed, borders
> - * are dirty
> - */
> + if (j == defaultbg)
> + xclearwin();
> redraw();
> }
> return;
> diff --git a/win.h b/win.h
> index a6ef1b9..d7b4980 100644
> --- a/win.h
> +++ b/win.h
> _AT_@ -37,3 +37,4 @@ void xsetpointermotion(int);
> void xsetsel(char *);
> int xstartdraw(void);
> void xximspot(int, int);
> +void xclearwin(void);
> diff --git a/x.c b/x.c
> index 4cf6b21..afd35e0 100644
> --- a/x.c
> +++ b/x.c
> _AT_@ -825,6 +825,12 @@ xclear(int x1, int y1, int x2, int y2)
> x1, y1, x2-x1, y2-y1);
> }
>
> +void
> +xclearwin(void)
> +{
> + xclear(0, 0, win.w, win.h);
> +}
> +
> void
> xhints(void)
> {
> --
> 2.20.1
>
>

Received on Wed May 06 2020 - 12:44:19 CEST

This archive was generated by hypermail 2.3.0 : Wed May 06 2020 - 13:00:38 CEST