cleanup function no longer cleans up when in raw output mode

master
karlstav 8 years ago
parent 3bcfc4df38
commit 48b9eecff1
  1. 14
      cava.c
  2. 11
      config.c
  3. 4
      output/terminal_noncurses.c

@ -79,7 +79,7 @@
struct termios oldtio, newtio;
int rc;
int M = 2048;
int output_mode;
@ -90,10 +90,12 @@ int should_reload = 0;
// general: cleanup
void cleanup(void)
{
#ifdef NCURSES
cleanup_terminal_ncurses();
#endif
cleanup_terminal_noncurses();
if (output_mode == 1 || output_mode == 2 ) {
cleanup_terminal_ncurses();
}
else if (output_mode ==3 ) {
cleanup_terminal_noncurses();
}
}
// general: handle signals
@ -316,6 +318,8 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
//config: load
load_config(configPath, supportedInput, (void *)&p);
output_mode = p.om;
if (p.om != 4) {
// Check if we're running in a tty
inAtty = 0;

@ -212,6 +212,17 @@ if (!validate_color(p->bcolor, p->om)) {
exit(EXIT_FAILURE);
}
if (p->gradient) {
if (!validate_color(p->gradient_color_1, p->om)) {
fprintf(stderr, "The first gradient color is invalid. It must be HTML color of the form '#xxxxxx'.\n");
exit(EXIT_FAILURE);
}
if (!validate_color(p->gradient_color_2, p->om)) {
fprintf(stderr, "The second gradient color is invalid. It must be HTML color of the form '#xxxxxx'.\n");
exit(EXIT_FAILURE);
}
}
// In case color is not html format set bgcol and col to predefinedint values
p->col = 6;
if (strcmp(p->color, "black") == 0) p->col = 0;

@ -71,9 +71,9 @@ int init_terminal_noncurses(int col, int bgcol, int w, int h, int bw) {
printf("\033[1m"); //setting "bright" color mode, looks cooler... I think
if (bgcol != 0)
if (bgcol != 0) {
printf("\033[%dm", bgcol);
{
for (n = (h); n >= 0; n--) {
for (i = 0; i < w; i++) {

Loading…
Cancel
Save