aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero2013-07-20 21:52:40 +0200
committerRoberto E. Vargas Caballero2013-07-20 23:25:46 +0200
commit6837360b9616d03e0249359b21735345c273f44d (patch)
tree7abcdbc4ee4c8f9e91aa90fce9be43bfbdc7587d
parent2ad3e4da18bf4087e71c142f6f6e8de75694b4ab (diff)
downloadaur-6837360b9616d03e0249359b21735345c273f44d.tar.gz
Reload colors in reset
Colors definition can be changed using a OSC sequence, so we have to reload them if we want be sure all the colors are the correct. Could be desirable free the colors allocated due to rgb colors and inverse colors (XftColorAllocValues in xdraws), but it is impossible due we use the same structure for all of them.
-rw-r--r--st.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/st.c b/st.c
index 097244cc3b7a..362de23bfaf6 100644
--- a/st.c
+++ b/st.c
@@ -2428,6 +2428,7 @@ tputc(char *c, int len) {
treset();
term.esc = 0;
xresettitle();
+ xloadcols();
break;
case '=': /* DECPAM -- Application keypad */
term.mode |= MODE_APPKEYPAD;
@@ -2589,6 +2590,13 @@ void
xloadcols(void) {
int i, r, g, b;
XRenderColor color = { .alpha = 0xffff };
+ static bool loaded;
+ Colour *cp;
+
+ if(loaded) {
+ for (cp = dc.col; cp < dc.col + LEN(dc.col); ++cp)
+ XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
+ }
/* load colors [0-15] colors and [256-LEN(colorname)[ (config.h) */
for(i = 0; i < LEN(colorname); i++) {
@@ -2621,6 +2629,7 @@ xloadcols(void) {
die("Could not allocate color %d\n", i);
}
}
+ loaded = true;
}
int