diff --git a/src/WallpaperEngine/Application/CWallpaperApplication.cpp b/src/WallpaperEngine/Application/CWallpaperApplication.cpp index bd08c10..b01d4dd 100644 --- a/src/WallpaperEngine/Application/CWallpaperApplication.cpp +++ b/src/WallpaperEngine/Application/CWallpaperApplication.cpp @@ -19,7 +19,8 @@ float g_TimeLast; float g_Daytime; namespace WallpaperEngine::Application { -CWallpaperApplication::CWallpaperApplication (CApplicationContext& context, WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext) : +CWallpaperApplication::CWallpaperApplication (CApplicationContext& context, + WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext) : m_context (context), m_defaultBackground (nullptr), browserContext (browserContext) { @@ -158,7 +159,7 @@ void CWallpaperApplication::setupContainer (CCombinedContainer& container, const void CWallpaperApplication::loadBackgrounds () { // load default background if specified - if (!this->m_context.settings.general.defaultBackground.empty()) { + if (!this->m_context.settings.general.defaultBackground.empty ()) { this->m_defaultBackground = this->loadBackground (this->m_context.settings.general.defaultBackground); } @@ -303,8 +304,8 @@ void CWallpaperApplication::show () { } // wallpapers are setup, free browsesr context if possible - if (!this->browserContext.isUsed()) { - this->browserContext.stop(); + if (!this->browserContext.isUsed ()) { + this->browserContext.stop (); } static time_t seconds; diff --git a/src/WallpaperEngine/Core/Wallpapers/CWeb.cpp b/src/WallpaperEngine/Core/Wallpapers/CWeb.cpp index ab857be..be38213 100644 --- a/src/WallpaperEngine/Core/Wallpapers/CWeb.cpp +++ b/src/WallpaperEngine/Core/Wallpapers/CWeb.cpp @@ -9,7 +9,6 @@ const std::string& CWeb::getFilename () { return this->m_filename; } -CWeb::CWeb (std::string filename, CProject& project) : CWallpaper (Type, project), m_filename (std::move (filename)) { -} +CWeb::CWeb (std::string filename, CProject& project) : CWallpaper (Type, project), m_filename (std::move (filename)) {} const std::string CWeb::Type = "web"; diff --git a/src/WallpaperEngine/Render/CWallpaper.cpp b/src/WallpaperEngine/Render/CWallpaper.cpp index 4032ba9..321c74c 100644 --- a/src/WallpaperEngine/Render/CWallpaper.cpp +++ b/src/WallpaperEngine/Render/CWallpaper.cpp @@ -287,7 +287,8 @@ CWallpaper* CWallpaper::fromWallpaper (Core::CWallpaper* wallpaper, CRenderConte if (wallpaper->is ()) return new WallpaperEngine::Render::CVideo (wallpaper->as (), context, audioContext, scalingMode); else if (wallpaper->is ()) - return new WallpaperEngine::Render::CWeb (wallpaper->as (), context, audioContext, browserContext, scalingMode); + return new WallpaperEngine::Render::CWeb (wallpaper->as (), context, audioContext, browserContext, + scalingMode); else sLog.exception ("Unsupported wallpaper type"); } \ No newline at end of file diff --git a/src/WallpaperEngine/Render/Wallpapers/CWeb.cpp b/src/WallpaperEngine/Render/Wallpapers/CWeb.cpp index fdfb1a0..c859f63 100644 --- a/src/WallpaperEngine/Render/Wallpapers/CWeb.cpp +++ b/src/WallpaperEngine/Render/Wallpapers/CWeb.cpp @@ -6,8 +6,7 @@ using namespace WallpaperEngine::Render; using namespace WallpaperEngine::WebBrowser; -CWeb::CWeb (Core::CWeb* web, CRenderContext& context, CAudioContext& audioContext, - CWebBrowserContext& browserContext, +CWeb::CWeb (Core::CWeb* web, CRenderContext& context, CAudioContext& audioContext, CWebBrowserContext& browserContext, const CWallpaperState::TextureUVsScaling& scalingMode) : CWallpaper (web, Type, context, audioContext, scalingMode), m_width (16), @@ -15,7 +14,7 @@ CWeb::CWeb (Core::CWeb* web, CRenderContext& context, CAudioContext& audioContex m_browserContext (browserContext), m_browser (), m_client () { - this->m_browserContext.markAsUsed(); + this->m_browserContext.markAsUsed (); // setup framebuffers this->setupFramebuffers (); @@ -56,8 +55,8 @@ void CWeb::setSize (int64_t width, int64_t height) { void CWeb::renderFrame (glm::ivec4 viewport) { // ensure the viewport matches the window size, and resize if needed - if (viewport.z != this->getWidth() || viewport.w != this->getHeight()) { - this->setSize(viewport.z, viewport.w); + if (viewport.z != this->getWidth () || viewport.w != this->getHeight ()) { + this->setSize (viewport.z, viewport.w); } // ensure the virtual mouse position is up to date diff --git a/src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.cpp b/src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.cpp index 111430e..61df7be 100644 --- a/src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.cpp +++ b/src/WallpaperEngine/WebBrowsesr/CWebBrowserContext.cpp @@ -6,52 +6,50 @@ using namespace WallpaperEngine::WebBrowser; -CWebBrowserContext::CWebBrowserContext (int argc, char** argv) : m_stopped(false) { +CWebBrowserContext::CWebBrowserContext (int argc, char** argv) : m_stopped (false) { // clone original argc/argv as they'll be modified by cef char** argv2 = new char*[argc]; - for(int i = 0; i < argc; i ++) { - argv2[i] = new char[strlen(argv[i]) + 1]; - strcpy(argv2[i], argv[i]); + for (int i = 0; i < argc; i++) { + argv2 [i] = new char [strlen (argv [i]) + 1]; + strcpy (argv2 [i], argv [i]); } - CefMainArgs args(argc, argv2); + CefMainArgs args (argc, argv2); - int exit_code = CefExecuteProcess(args, nullptr, nullptr);//Spawned processes will terminate here(see CefIninitilize below). Maybe implementing settings.browser_subprocess_path will allow it to work not in main function. - if (exit_code >= 0) - { + int exit_code = CefExecuteProcess ( + args, nullptr, nullptr); // Spawned processes will terminate here(see CefIninitilize below). Maybe implementing + // settings.browser_subprocess_path will allow it to work not in main function. + if (exit_code >= 0) { // Sub proccess has endend, so exit - exit(exit_code); - } - else if (exit_code == -1) - { + exit (exit_code); + } else if (exit_code == -1) { // If called for the browser process (identified by no "type" command-line value) // it will return immediately with a value of -1 } // Configurate Chromium CefSettings settings; - //CefString(&settings.locales_dir_path) = "OffScreenCEF/godot/locales"; - //CefString(&settings.resources_dir_path) = "OffScreenCEF/godot/"; - //CefString(&settings.framework_dir_path) = "OffScreenCEF/godot/"; - //CefString(&settings.cache_path) = "OffScreenCEF/godot/"; - // CefString(&settings.browser_subprocess_path) = "path/to/client" + // CefString(&settings.locales_dir_path) = "OffScreenCEF/godot/locales"; + // CefString(&settings.resources_dir_path) = "OffScreenCEF/godot/"; + // CefString(&settings.framework_dir_path) = "OffScreenCEF/godot/"; + // CefString(&settings.cache_path) = "OffScreenCEF/godot/"; + // CefString(&settings.browser_subprocess_path) = "path/to/client" settings.windowless_rendering_enabled = true; #if defined(CEF_NO_SANDBOX) settings.no_sandbox = true; #endif // spawns two new processess - bool result = CefInitialize(args, settings, nullptr, nullptr); + bool result = CefInitialize (args, settings, nullptr, nullptr); - if (!result) - { + if (!result) { sLog.exception ("CefInitialize: failed"); } } -CWebBrowserContext::~CWebBrowserContext() { - this->stop(); +CWebBrowserContext::~CWebBrowserContext () { + this->stop (); } void CWebBrowserContext::markAsUsed () { @@ -62,14 +60,14 @@ bool CWebBrowserContext::isUsed () { return this->m_inUse; } -void CWebBrowserContext::stop() { +void CWebBrowserContext::stop () { if (this->m_stopped) { return; } - sLog.out("Shutting down CEF"); + sLog.out ("Shutting down CEF"); this->m_stopped = true; - CefShutdown(); + CefShutdown (); } \ No newline at end of file