static int ActivateWindow(const std::vector<std::string>& params2) { std::vector<std::string> params(params2); // get the parameters std::string strWindow; if (params.size()) { strWindow = params[0]; params.erase(params.begin()); } // confirm the window destination is valid prior to switching int iWindow = CWindowTranslator::TranslateWindow(strWindow); if (iWindow != WINDOW_INVALID) { // compare the given directory param with the current active directory bool bIsSameStartFolder = true; if (!params.empty()) { CGUIWindow *activeWindow = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow()); if (activeWindow && activeWindow->IsMediaWindow()) bIsSameStartFolder = static_cast<CGUIMediaWindow*>(activeWindow)->IsSameStartFolder(params[0]); } // activate window only if window and path differ from the current active window if (iWindow != CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() || !bIsSameStartFolder) { g_application.WakeUpScreenSaverAndDPMS(); CServiceBroker::GetGUI()->GetWindowManager().ActivateWindow(iWindow, params, Replace); return 0; } } else { CLog::Log(LOGERROR, "Activate/ReplaceWindow called with invalid destination window: %s", strWindow.c_str()); return false; } return 1; }