Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,6 @@ size_t HeaderHeight;
size_t FooterHeight;
size_t FooterStartY;

void validateScreenSize()
{
using Global::MainHeight;

if (COLS < 30 || MainHeight < 5)
{
NC::destroyScreen();
std::cout << "Screen is too small to handle ncmpcpp correctly\n";
exit(1);
}
}

void initializeScreens()
{
myHelp = new Help;
Expand Down Expand Up @@ -221,8 +209,6 @@ void resizeScreen(bool reload_main_window)

MainHeight = std::max(LINES-(Config.design == Design::Alternative ? 7 : 4), 0);

validateScreenSize();

if (!Config.header_visibility)
MainHeight += 2;
if (!Config.statusbar_visibility)
Expand Down
9 changes: 6 additions & 3 deletions src/curses/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,16 @@ void Window::moveTo(size_t new_x, size_t new_y)

void Window::adjustDimensions(size_t width, size_t height)
{
// NOTE: when dimensions get small, integer overflow will cause calls to
// `Menu<T>::refresh()` to run for a very long time.

if (m_border)
{
width -= 2;
height -= 2;
width -= width >= 2 ? 2 : 0;
height -= height >= 2 ? 2 : 0;
}
if (!m_title.empty())
height -= 2;
height -= height >= 2 ? 2 : 0;
m_height = height;
m_width = width;
}
Expand Down