sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

st-xclearwin-20200419-6ee7143.diff (1489B)


      1 From 6ee7143600e5ac6c7a26d2ee985ac2a3087a5570 Mon Sep 17 00:00:00 2001
      2 From: Christian Tenllado <ctenllado@gmail.com>
      3 Date: Sun, 19 Apr 2020 11:57:31 +0200
      4 Subject: [PATCH] xclearwin clears the window
      5 
      6 When an OCS sequence was used to change the bg color, the borders where
      7 dirty. This simple patch just clears the window before the redraw of the
      8 terminal when the bg color has been changed. This is apparently enough
      9 and seams to be very smooth. There was a TODO comment for it on the st.c
     10 file, which I removed.
     11 ---
     12  st.c  | 6 ++----
     13  win.h | 1 +
     14  x.c   | 6 ++++++
     15  3 files changed, 9 insertions(+), 4 deletions(-)
     16 
     17 diff --git a/st.c b/st.c
     18 index 3e48410..2efb4bd 100644
     19 --- a/st.c
     20 +++ b/st.c
     21 @@ -1874,10 +1874,8 @@ strhandle(void)
     22  				fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
     23  				        j, p ? p : "(null)");
     24  			} else {
     25 -				/*
     26 -				 * TODO if defaultbg color is changed, borders
     27 -				 * are dirty
     28 -				 */
     29 +				if (j == defaultbg)
     30 +					xclearwin();
     31  				redraw();
     32  			}
     33  			return;
     34 diff --git a/win.h b/win.h
     35 index a6ef1b9..d7b4980 100644
     36 --- a/win.h
     37 +++ b/win.h
     38 @@ -37,3 +37,4 @@ void xsetpointermotion(int);
     39  void xsetsel(char *);
     40  int xstartdraw(void);
     41  void xximspot(int, int);
     42 +void xclearwin(void);
     43 diff --git a/x.c b/x.c
     44 index 4cf6b21..afd35e0 100644
     45 --- a/x.c
     46 +++ b/x.c
     47 @@ -825,6 +825,12 @@ xclear(int x1, int y1, int x2, int y2)
     48  			x1, y1, x2-x1, y2-y1);
     49  }
     50  
     51 +void
     52 +xclearwin(void)
     53 +{
     54 +	xclear(0, 0, win.w, win.h);
     55 +}
     56 +
     57  void
     58  xhints(void)
     59  {
     60 -- 
     61 2.20.1
     62