From 149c8238e561d8495cd71df4f4549ec8be96e882 Mon Sep 17 00:00:00 2001 From: dpayne Date: Wed, 20 Sep 2017 20:48:40 -0700 Subject: [PATCH] 1. Updating readme to recommend rxvt-256color over xterm-256color. 2. Fixing issue where gradient=true was not being read correctly. --- Makefile | 24 +++++++++++++++++++----- README.md | 11 +++++++++-- TODO | 2 ++ src/Domain/VisConstants.h | 1 + src/Utils/ConfigurationUtils.cpp | 5 +++++ 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 4039d1b..078ca4f 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,8 @@ CXX_FLAGS += -D__extern_always_inline=inline TEST_CCACHE_CLANG=ccache clang++ TEST_CLANG=clang++ -ALL_WARNINGS=-Werror +ALL_WARNINGS=-Werror -Weverything -Wno-zero-as-null-pointer-constant -Wno-variadic-macros -Wno-format-nonliteral -Wno-global-constructors -Wno-exit-time-destructors -Wno-padded -Wno-reserved-id-macro -Wno-gnu-zero-variadic-macro-arguments -Wno-c++98-compat -Wno-documentation-unknown-command +ifdef VIS_COMPILE_WITH_WARNINGS # Only turn on extra warnings for clang since g++ does not support -Weverything ifeq ($(CXX),$(TEST_CLANG)) CXX_FLAGS += $(ALL_WARNINGS) @@ -55,6 +56,7 @@ ifeq ($(CXX),$(TEST_CCACHE_CLANG)) CXX_FLAGS += $(ALL_WARNINGS) endif endif +endif #perf tests should not have many warnings or error out on warning PERF_TEST_CXX_FLAGS = -std=c++14 @@ -110,12 +112,18 @@ LD_FLAGS += -fsanitize=$(SANITIZE) endif # Include Paths -INCLUDE_PATH = -I/usr/local/include -I$(DIR)/include -I$(DIR)/src -TEST_INCLUDE_PATH = -I/usr/include -PERF_TEST_INCLUDE_PATH = -I/usr/include # Lib Paths -LIB_PATH = -L/usr/local/lib +ifdef VIS_NCURSES_LIB_PATH + LIB_PATH = -L${VIS_NCURSES_LIB_PATH} -L/usr/local/lib + INCLUDE_PATH = -I${VIS_NCURSES_INCLUDE_PATH} -I$(DIR)/include -I$(DIR)/src +else + INCLUDE_PATH = -I/usr/local/include -I$(DIR)/include -I$(DIR)/src + LIB_PATH = -L/usr/local/lib +endif + +TEST_INCLUDE_PATH = ${INCLUDE_PATH} +PERF_TEST_INCLUDE_PATH = ${INCLUDE_PATH} # Libs LIBS = -lfftw3 -lm -lstdc++ @@ -128,6 +136,11 @@ LD_FLAGS += -D_ENABLE_PULSE LIBS += -lpulse -lpulse-simple endif +ifdef VIS_NCURSES_LIB_PATH + LIBS += -lncursesw -ldl + CXX_FLAGS += -DNCURSESW + LD_FLAGS += -DNCURSESW +else #if this box has an older version of ncurses ifneq ("$(wildcard /usr/include/ncursesw/ncurses.h)","") LIBS += -lncursesw @@ -142,6 +155,7 @@ else LIBS += -lncurses endif endif +endif #use jemalloc if available ifneq ("$(wildcard /usr/lib/libjemalloc.so)","") diff --git a/README.md b/README.md index eaa3a19..18958e1 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,11 @@ A C++ compiler that supports C++14 is also needed. On arch linux, the latest g++ In order to show the colors, you need a terminal with 256 color support.`rxvt-unicode` out of the box. -For xterm, the default `$TERM` setting needs to be changed to `xterm-256color`. To change this run +For xterm, the default `$TERM` setting needs to be changed to `rxvt-256color`. To change this run - export TERM=xterm-256color + export TERM=rxvt-256color + +Setting TERM to `xterm-256color` may also work but seems to cause issues with rendering of the visualizers in some terminals. ### Ubuntu @@ -605,6 +607,11 @@ Turn off overriding terminal colors. Due to the way terminal color schemes work, there is no portable way for ncurses to get the original color scheme. By default it overrides the user's terminal colors with the visualizer colors. It does this to get a smoother transition between gradients, however this overrides the user's terminal color scheme. +#### Tearing our corrupt output + +This is usually and issue with ncurses versions past versions 6.0+20170729. Try changing the TERM variable to rxvt with + + export TERM=rxvt-256color ### Mac OSX diff --git a/TODO b/TODO index e8ac58c..ce68081 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,7 @@ - use configure or something similar to check for libraries and which compiler to use and flags +- use 1000 color range for ColorDefinition, this is usueful for smoother gradients + - add more visualizers - add beat detection - add flashing squares diff --git a/src/Domain/VisConstants.h b/src/Domain/VisConstants.h index 24afaca..bfcd3c3 100644 --- a/src/Domain/VisConstants.h +++ b/src/Domain/VisConstants.h @@ -22,6 +22,7 @@ namespace VisConstants static const int16_t k_max_extended_color = 2 << 13; // 16384 static const int16_t k_default_max_color = 256; static const std::string k_disabled_gradient_color_config{"gradient=false"}; +static const std::string k_enabled_gradient_color_config{"gradient=true"}; // Various constants static const std::string k_default_locale{"en_US.UTF8"}; diff --git a/src/Utils/ConfigurationUtils.cpp b/src/Utils/ConfigurationUtils.cpp index e0cae69..cec0017 100644 --- a/src/Utils/ConfigurationUtils.cpp +++ b/src/Utils/ConfigurationUtils.cpp @@ -328,6 +328,11 @@ vis::ConfigurationUtils::read_colors(bool is_override_terminal_colors, { is_gradient_enabled = false; } + else if (lines.empty() && + line == VisConstants::k_enabled_gradient_color_config) + { + is_gradient_enabled = true; + } else { lines.push_back(line);