Skip to content

Commit

Permalink
force activate fullscreen window with CApplication::SwitchToFullScreen()
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaggi authored and popcornmix committed May 15, 2015
1 parent 68d9fea commit 6e84231
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions xbmc/Application.cpp
Expand Up @@ -3221,13 +3221,10 @@ PlayBackRet CApplication::PlayFile(const CFileItem& item, bool bRestart)
#ifdef HAS_VIDEO_PLAYBACK
else if( m_pPlayer->IsPlayingVideo() )
{
if (g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_VIDEO);

// if player didn't manange to switch to fullscreen by itself do it here
if( options.fullscreen && g_renderManager.IsStarted()
&& g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO )
SwitchToFullScreen();
if (options.fullscreen && g_renderManager.IsStarted() &&
g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO )
SwitchToFullScreen(true);
}
#endif
else
Expand Down Expand Up @@ -4664,7 +4661,7 @@ void CApplication::SeekPercentage(float percent)
}

// SwitchToFullScreen() returns true if a switch is made, else returns false
bool CApplication::SwitchToFullScreen()
bool CApplication::SwitchToFullScreen(bool force /* = false */)
{
// if playing from the video info window, close it first!
if (g_windowManager.HasModalDialog() && g_windowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_VIDEO_INFO)
Expand All @@ -4673,23 +4670,29 @@ bool CApplication::SwitchToFullScreen()
if (pDialog) pDialog->Close(true);
}

// don't switch if there is a dialog on screen or the slideshow is active
if (/*g_windowManager.HasModalDialog() ||*/ g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW)
// don't switch if the slideshow is active
if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW)
return false;

int windowID = WINDOW_INVALID;
// See if we're playing a video, and are in GUI mode
if ( m_pPlayer->IsPlayingVideo() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO)
{
// then switch to fullscreen mode
g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_VIDEO);
return true;
}
if (m_pPlayer->IsPlayingVideo() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO)
windowID = WINDOW_FULLSCREEN_VIDEO;

// special case for switching between GUI & visualisation mode. (only if we're playing an audio song)
if (m_pPlayer->IsPlayingAudio() && g_windowManager.GetActiveWindow() != WINDOW_VISUALISATION)
{ // then switch to visualisation
g_windowManager.ActivateWindow(WINDOW_VISUALISATION);
windowID = WINDOW_VISUALISATION;


if (windowID != WINDOW_INVALID)
{
if (force)
g_windowManager.ForceActivateWindow(windowID);
else
g_windowManager.ActivateWindow(windowID);
return true;
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion xbmc/Application.h
Expand Up @@ -365,7 +365,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs

float GetDimScreenSaverLevel() const;

bool SwitchToFullScreen();
bool SwitchToFullScreen(bool force = false);

CSplash* GetSplash() { return m_splash; }
void SetRenderGUI(bool renderGUI);
Expand Down

0 comments on commit 6e84231

Please sign in to comment.