mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-05 21:55:24 +00:00
More cross-platform, cross-terminal-emulator resize compatibility fixes.
This commit is contained in:
parent
0951d87add
commit
5c7415bc45
@ -63,6 +63,7 @@ using namespace std::chrono;
|
|||||||
|
|
||||||
static OverlayStack overlays;
|
static OverlayStack overlays;
|
||||||
static bool disconnected = false;
|
static bool disconnected = false;
|
||||||
|
static bool resized = false;
|
||||||
|
|
||||||
static App* instance = nullptr;
|
static App* instance = nullptr;
|
||||||
|
|
||||||
@ -71,6 +72,11 @@ static void hangupHandler(int signal) {
|
|||||||
disconnected = true;
|
disconnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void resizedHandler(int signal) {
|
||||||
|
endwin(); /* required in *nix because? */
|
||||||
|
resized = true;
|
||||||
|
}
|
||||||
|
|
||||||
static std::string getEnvironmentVariable(const std::string& name) {
|
static std::string getEnvironmentVariable(const std::string& name) {
|
||||||
std::string result;
|
std::string result;
|
||||||
const char* value = std::getenv(name.c_str());
|
const char* value = std::getenv(name.c_str());
|
||||||
@ -249,6 +255,7 @@ App::App(const std::string& title) {
|
|||||||
#else
|
#else
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
std::signal(SIGHUP, hangupHandler);
|
std::signal(SIGHUP, hangupHandler);
|
||||||
|
std::signal(SIGWINCH, resizedHandler);
|
||||||
std::signal(SIGPIPE, SIG_IGN);
|
std::signal(SIGPIPE, SIG_IGN);
|
||||||
this->colorMode = Colors::Palette;
|
this->colorMode = Colors::Palette;
|
||||||
#endif
|
#endif
|
||||||
@ -501,7 +508,6 @@ void App::Run(ILayoutPtr layout) {
|
|||||||
this->state.keyHandler = nullptr;
|
this->state.keyHandler = nullptr;
|
||||||
int lastWidth = Screen::GetWidth();
|
int lastWidth = Screen::GetWidth();
|
||||||
int lastHeight = Screen::GetHeight();
|
int lastHeight = Screen::GetHeight();
|
||||||
bool resized = false;
|
|
||||||
|
|
||||||
this->ChangeLayout(layout);
|
this->ChangeLayout(layout);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user