Permalink
Browse files

libxbmc: add ability to run without display

  • Loading branch information...
1 parent 3243266 commit fd91cc35816d3845c36b552f374daa35ea459de2 theuni committed Jun 6, 2012
Showing with 19 additions and 11 deletions.
  1. +10 −3 xbmc/Application.cpp
  2. +1 −1 xbmc/Application.h
  3. +3 −3 xbmc/XBApplicationEx.cpp
  4. +1 −1 xbmc/XBApplicationEx.h
  5. +1 −1 xbmc/guilib/IWindowManagerCallback.h
  6. +3 −2 xbmc/xbmc.cpp
View
@@ -2732,7 +2732,7 @@ void CApplication::UpdateLCD()
#endif
}
-void CApplication::FrameMove(bool processEvents)
+void CApplication::FrameMove(bool processEvents, bool processGUI)
{
MEASURE_FUNCTION;
@@ -2744,6 +2744,8 @@ void CApplication::FrameMove(bool processEvents)
// never set a frametime less than 2 fps to avoid problems when debuggin and on breaks
if( frameTime > 0.5 ) frameTime = 0.5;
+ if (processGUI)
+ {
g_graphicsContext.Lock();
// check if there are notifications to display
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
@@ -2755,6 +2757,8 @@ void CApplication::FrameMove(bool processEvents)
}
}
g_graphicsContext.Unlock();
+ CWinEvents::MessagePump();
+ }
UpdateLCD();
@@ -2764,18 +2768,21 @@ void CApplication::FrameMove(bool processEvents)
#endif
// process input actions
- CWinEvents::MessagePump();
ProcessHTTPApiButtons();
ProcessJsonRpcButtons();
ProcessRemote(frameTime);
ProcessGamepad(frameTime);
ProcessEventServer(frameTime);
ProcessPeripherals(frameTime);
- m_pInertialScrollingHandler->ProcessInertialScroll(frameTime);
+ if (processGUI)
+ m_pInertialScrollingHandler->ProcessInertialScroll(frameTime);
}
+ if (processGUI)
+ {
if (!m_bStop)
g_windowManager.Process(CTimeUtils::GetFrameTime());
g_windowManager.FrameMove();
+ }
}
bool CApplication::ProcessGamepad(float frameTime)
View
@@ -111,7 +111,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
CApplication(void);
virtual ~CApplication(void);
virtual bool Initialize();
- virtual void FrameMove(bool processEvents);
+ virtual void FrameMove(bool processEvents, bool processGUI = true);
virtual void Render();
virtual bool RenderNoPresent();
virtual void Preflight();
View
@@ -68,7 +68,7 @@ VOID CXBApplicationEx::Destroy()
}
/* Function that runs the application */
-INT CXBApplicationEx::Run()
+INT CXBApplicationEx::Run(bool renderGUI)
{
CLog::Log(LOGNOTICE, "Running the application..." );
@@ -117,7 +117,7 @@ INT CXBApplicationEx::Run()
try
{
#endif
- if (!m_bStop) FrameMove(true);
+ if (!m_bStop) FrameMove(true, renderGUI);
//reset exception count
frameMoveExceptionCount = 0;
@@ -142,7 +142,7 @@ INT CXBApplicationEx::Run()
try
{
#endif
- if (!m_bStop) Render();
+ if (renderGUI && !m_bStop) Render();
//reset exception count
renderExceptionCount = 0;
View
@@ -50,7 +50,7 @@ class CXBApplicationEx : public IWindowManagerCallback
public:
// Functions to create, run, and clean up the application
virtual bool Create();
- INT Run();
+ INT Run(bool renderGUI = true);
VOID Destroy();
private:
@@ -36,7 +36,7 @@ class IWindowManagerCallback
IWindowManagerCallback(void);
virtual ~IWindowManagerCallback(void);
- virtual void FrameMove(bool processEvents) = 0;
+ virtual void FrameMove(bool processEvents, bool processGUI = true) = 0;
virtual void Render() = 0;
virtual void Process() = 0;
};
View
@@ -56,6 +56,7 @@ int main(int argc, char* argv[])
XBMC::Context context;
int status = -1;
+ bool renderGUI = true;
//this can't be set from CAdvancedSettings::Initialize() because it will overwrite
//the loglevel set with the --debug flag
#ifdef _DEBUG
@@ -95,7 +96,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "ERROR: Unable to create application. Exiting\n");
return status;
}
- if (!g_application.CreateGUI())
+ if (renderGUI && !g_application.CreateGUI())
{
fprintf(stderr, "ERROR: Unable to create GUI. Exiting\n");
return status;
@@ -108,7 +109,7 @@ int main(int argc, char* argv[])
try
{
- status = g_application.Run();
+ status = g_application.Run(renderGUI);
}
catch(...)
{

0 comments on commit fd91cc3

Please sign in to comment.