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
anaconda authored and popcornmix committed Apr 3, 2020
1 parent 8c962b2 commit 78ee9ba
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
10 changes: 10 additions & 0 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4905,3 +4905,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const

return false;
}

bool CApplication::ScreenSaverDisablesAutoScrolling()
{
bool onBlackDimScreenSaver = IsInScreenSaver() &&
(m_screensaverIdInUse == "screensaver.xbmc.builtin.dim" ||
m_screensaverIdInUse == "screensaver.xbmc.builtin.black");
bool openingStreams = m_appPlayer.IsPlaying() && CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_BUSY);

return onBlackDimScreenSaver || openingStreams;
}
2 changes: 2 additions & 0 deletions xbmc/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ friend class CAppInboundProtocol;
*/
void UnregisterActionListener(IActionListener *listener);

bool ScreenSaverDisablesAutoScrolling();

std::unique_ptr<CServiceManager> m_ServiceManager;

/*!
Expand Down
3 changes: 2 additions & 1 deletion xbmc/guilib/GUIFadeLabelControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "GUIMessage.h"
#include "utils/Random.h"
#include "Application.h"

using namespace KODI::GUILIB;

Expand Down Expand Up @@ -98,7 +99,7 @@ void CGUIFadeLabelControl::Process(unsigned int currentTime, CDirtyRegionList &d
MarkDirtyRegion();
}

if (m_infoLabels.size() > 1 || !m_shortText)
if ((m_infoLabels.size() > 1 || !m_shortText) && !g_application.ScreenSaverDisablesAutoScrolling())
{ // have scrolling text
bool moveToNextLabel = false;
if (!m_scrollOut)
Expand Down
4 changes: 4 additions & 0 deletions xbmc/guilib/GUIFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* See LICENSES/README.md for more information.
*/

#include "Application.h"
#include "GUIFont.h"

#include "GUIFontTTF.h"
Expand Down Expand Up @@ -115,6 +116,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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#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 @@ -95,7 +97,7 @@ void CGUILabel::Render()
UTILS::Color 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* See LICENSES/README.md for more information.
*/

#include "Application.h"
#include "GUITextBox.h"

#include "GUIInfoManager.h"
Expand Down Expand Up @@ -129,7 +130,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 78ee9ba

Please sign in to comment.