hintboxext: fix for too long lines

text offset was calculated wrong if lines too long to fit on the
screen were present, leading to all sorts of graphics corruptions
(e.g. visible with the simple test.sh script from tuxbox wiki)
This commit is contained in:
Stefan Seyfried
2012-07-18 21:01:34 +02:00
parent d9d451dfb5
commit b04ab099b2

View File

@@ -191,6 +191,13 @@ void CHintBoxExt::init(const neutrino_locale_t Caption, const int Width, const c
if (nw > m_width) if (nw > m_width)
m_width = nw; m_width = nw;
/* if the output does not fit, make sure we at least
* stay inside the screen... */
m_width = w_max(m_width ,SHADOW_OFFSET);
if (maxLineWidth + scrollWidth > m_width)
maxLineWidth = m_width - scrollWidth;
textStartX = (m_width - scrollWidth - maxLineWidth) / 2; textStartX = (m_width - scrollWidth - maxLineWidth) / 2;
m_window = NULL; m_window = NULL;