Skip to content

Commit

Permalink
Disable autoscrolling while on screensaver and while opening streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
menakite authored and popcornmix committed Mar 31, 2015
1 parent 4177d5c commit 4430a9b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions xbmc/Application.cpp
Expand Up @@ -4936,3 +4936,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const

return false;
}

bool CApplication::ScreenSaverDisablesAutoScrolling()
{
bool onBlackDimScreenSaver = IsInScreenSaver() && m_screenSaver &&
(m_screenSaver->ID() == "screensaver.xbmc.builtin.black" ||
m_screenSaver->ID() == "screensaver.xbmc.builtin.dim");
bool openingStreams = m_pPlayer->IsPlaying() && g_windowManager.IsWindowActive(WINDOW_DIALOG_BUSY);

return onBlackDimScreenSaver || openingStreams;
}
2 changes: 2 additions & 0 deletions xbmc/Application.h
Expand Up @@ -389,6 +389,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
*/
void UnregisterActionListener(IActionListener *listener);

bool ScreenSaverDisablesAutoScrolling();

protected:
virtual bool OnSettingsSaving() const;

Expand Down
4 changes: 3 additions & 1 deletion xbmc/guilib/GUIFadeLabelControl.cpp
Expand Up @@ -20,6 +20,8 @@

#include "GUIFadeLabelControl.h"

#include "Application.h"

using namespace std;

CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
Expand Down Expand Up @@ -102,7 +104,7 @@ void CGUIFadeLabelControl::Process(unsigned int currentTime, CDirtyRegionList &d
m_lastLabel = m_currentLabel;
}

if (m_infoLabels.size() > 1 || !m_shortText)
if ((m_infoLabels.size() > 1 || !m_shortText) && !g_application.ScreenSaverDisablesAutoScrolling())
{ // have scrolling text
MarkDirtyRegion();

Expand Down
4 changes: 4 additions & 0 deletions xbmc/guilib/GUIFont.cpp
Expand Up @@ -22,6 +22,7 @@
#include "GUIFontTTF.h"
#include "GraphicContext.h"

#include "Application.h"
#include "threads/SingleLock.h"
#include "utils/TimeUtils.h"
#include "utils/MathUtils.h"
Expand Down Expand Up @@ -128,6 +129,9 @@ bool CGUIFont::UpdateScrollInfo(const vecText &text, CScrollInfo &scrollInfo)
// If the string is smaller than the viewport, then it may be plotted even
// more times than that.
//
if (g_application.ScreenSaverDisablesAutoScrolling())
return false;

if (scrollInfo.waitTime)
{
scrollInfo.waitTime--;
Expand Down
4 changes: 3 additions & 1 deletion xbmc/guilib/GUILabel.cpp
Expand Up @@ -21,6 +21,8 @@
#include "GUILabel.h"
#include <limits>

#include "Application.h"

CGUILabel::CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, CGUILabel::OVER_FLOW overflow)
: m_label(labelInfo)
, m_textLayout(labelInfo.font, overflow == OVER_FLOW_WRAP, height)
Expand Down Expand Up @@ -104,7 +106,7 @@ void CGUILabel::Render()
color_t color = GetColor();
bool renderSolid = (m_color == COLOR_DISABLED);
bool overFlows = (m_renderRect.Width() + 0.5f < m_textLayout.GetTextWidth()); // 0.5f to deal with floating point rounding issues
if (overFlows && m_scrolling && !renderSolid)
if (overFlows && m_scrolling && !renderSolid && !g_application.ScreenSaverDisablesAutoScrolling())
m_textLayout.RenderScrolling(m_renderRect.x1, m_renderRect.y1, m_label.angle, color, m_label.shadowColor, 0, m_renderRect.Width(), m_scrollInfo);
else
{
Expand Down
3 changes: 2 additions & 1 deletion xbmc/guilib/GUITextBox.cpp
Expand Up @@ -23,6 +23,7 @@
#include "utils/XBMCTinyXML.h"
#include "utils/MathUtils.h"
#include "utils/StringUtils.h"
#include "Application.h"

#include <algorithm>

Expand Down Expand Up @@ -134,7 +135,7 @@ void CGUITextBox::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio
// update our auto-scrolling as necessary
if (m_autoScrollTime && m_lines.size() > m_itemsPerPage)
{
if (!m_autoScrollCondition || m_autoScrollCondition->Get())
if ((!m_autoScrollCondition || m_autoScrollCondition->Get()) && !g_application.ScreenSaverDisablesAutoScrolling())
{
if (m_lastRenderTime)
m_autoScrollDelayTime += currentTime - m_lastRenderTime;
Expand Down

0 comments on commit 4430a9b

Please sign in to comment.