bool CGUIWindowManager::IsWindowActive(int id, bool ignoreClosing /* = true */) const { /* 参数: 1、 返回: 1、 说明: 1、 */ // mask out multiple instances of the same window id &= WINDOW_ID_MASK; if ((GetActiveWindow() & WINDOW_ID_MASK) == id) return true; // run through the dialogs CSingleLock lock(g_graphicsContext); for (ciDialog it = m_activeDialogs.begin(); it != m_activeDialogs.end(); ++it) { CGUIWindow *window = *it; if ((window->GetID() & WINDOW_ID_MASK) == id && (!ignoreClosing || !window->IsAnimating(ANIM_TYPE_WINDOW_CLOSE))) return true; } return false; // window isn't active }
bool CGUIWindowManager::OnAction(const CAction &action) const { CSingleLock lock(g_graphicsContext); unsigned int topMost = m_activeDialogs.size(); while (topMost) { CGUIWindow *dialog = m_activeDialogs[--topMost]; lock.Leave(); if (dialog->IsModalDialog()) { // we have the topmost modal dialog if (!dialog->IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) { bool fallThrough = (dialog->GetID() == WINDOW_DIALOG_FULLSCREEN_INFO); if (dialog->OnAction(action)) return true; // dialog didn't want the action - we'd normally return false // but for some dialogs we want to drop the actions through if (fallThrough) break; return false; } return true; // do nothing with the action until the anim is finished } lock.Enter(); if (topMost > m_activeDialogs.size()) topMost = m_activeDialogs.size(); } lock.Leave(); CGUIWindow* window = GetWindow(GetActiveWindow()); if (window) return window->OnAction(action); return false; }
bool CGUIWindowManager::OnAction(const CAction &action) { if (g_powerManager.IsSuspended()) { g_powerManager.Resume(); return true; } // If the screen saver is active, it is on top of // existing dialogs. Pass the actions to the screen // saver and not to the dialogs if (!g_application.GetInSlideshowScreensaver()) { CSingleLock lock(g_graphicsContext); unsigned int topMost = m_activeDialogs.size(); while (topMost) { CGUIWindow *dialog = m_activeDialogs[--topMost]; lock.Leave(); if (dialog->IsModalDialog()) { // we have the topmost modal dialog if (!dialog->IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) { bool fallThrough = (dialog->GetID() == WINDOW_DIALOG_FULLSCREEN_INFO); if (dialog->OnAction(action)) return true; // dialog didn't want the action - we'd normally return false // but for some dialogs we want to drop the actions through if (fallThrough) break; return false; } return true; // do nothing with the action until the anim is finished } // music or video overlay are handled as a special case, as they're modeless, but we allow // clicking on them with the mouse. if (action.id == ACTION_MOUSE && (dialog->GetID() == WINDOW_VIDEO_OVERLAY || dialog->GetID() == WINDOW_MUSIC_OVERLAY)) { if (dialog->OnAction(action)) return true; } lock.Enter(); if (topMost > m_activeDialogs.size()) topMost = m_activeDialogs.size(); } lock.Leave(); } CGUIWindow* window = GetWindow(GetActiveWindow()); if (window) return window->OnAction(action); return false; }
bool CGUIWindowManager::OnAction(const CAction &action) { /* 参数: 1、 返回: 1、 说明: 1、 */ CSingleLock lock(g_graphicsContext); unsigned int topMost = m_activeDialogs.size(); while (topMost) { CGUIWindow *dialog = m_activeDialogs[--topMost]; lock.Leave(); if (dialog->IsModalDialog()) { // we have the topmost modal dialog if (!dialog->IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) { bool fallThrough = (dialog->GetID() == WINDOW_DIALOG_FULLSCREEN_INFO); if (dialog->OnAction(action)) return true; // dialog didn't want the action - we'd normally return false // but for some dialogs we want to drop the actions through if (fallThrough) break; return false; } return true; // do nothing with the action until the anim is finished } // music or video overlay are handled as a special case, as they're modeless, but we allow // clicking on them with the mouse. if (action.IsMouse() && (dialog->GetID() == WINDOW_DIALOG_VIDEO_OVERLAY || dialog->GetID() == WINDOW_DIALOG_MUSIC_OVERLAY)) { if (dialog->OnAction(action)) return true; } lock.Enter(); if (topMost > m_activeDialogs.size()) topMost = m_activeDialogs.size(); } lock.Leave(); CGUIWindow* window = GetWindow(GetActiveWindow()); if (window) return window->OnAction(action); return false; }
/// \brief Get the ID of the top most routed window /// \return id ID of the window or WINDOW_INVALID if no routed window available int CGUIWindowManager::GetTopMostModalDialogID(bool ignoreClosing /*= false*/) const { CSingleLock lock(g_graphicsContext); for (crDialog it = m_activeDialogs.rbegin(); it != m_activeDialogs.rend(); ++it) { CGUIWindow *dialog = *it; if (dialog->IsModalDialog() && (!ignoreClosing || !dialog->IsAnimating(ANIM_TYPE_WINDOW_CLOSE))) { // have a modal window return dialog->GetID(); } } return WINDOW_INVALID; }
bool CGUIWindowManager::HasModalDialog() const { CSingleLock lock(g_graphicsContext); for (ciDialog it = m_activeDialogs.begin(); it != m_activeDialogs.end(); ++it) { CGUIWindow *window = *it; if (window->IsModalDialog()) { // have a modal window if (!window->IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) return true; } } return false; }
bool CGUIWindowManager::IsWindowActive(const std::string &xmlFile, bool ignoreClosing /* = true */) const { CSingleLock lock(g_graphicsContext); CGUIWindow *window = GetWindow(GetActiveWindow()); if (window && StringUtils::EqualsNoCase(URIUtils::GetFileName(window->GetProperty("xmlfile").asString()), xmlFile)) return true; // run through the dialogs for (const auto& window : m_activeDialogs) { if (StringUtils::EqualsNoCase(URIUtils::GetFileName(window->GetProperty("xmlfile").asString()), xmlFile) && (!ignoreClosing || !window->IsAnimating(ANIM_TYPE_WINDOW_CLOSE))) return true; } return false; // window isn't active }
bool CGUIWindowManager::HasModalDialog() const { // If the screen saver is active, don't tell anyone that there // are any dialogs open, so the window will get the events and // not the dialogs if (g_application.GetInSlideshowScreensaver()) return false; CSingleLock lock(g_graphicsContext); for (ciDialog it = m_activeDialogs.begin(); it != m_activeDialogs.end(); ++it) { CGUIWindow *window = *it; if (window->IsModalDialog()) { // have a modal window if (!window->IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) return true; } } return false; }
bool CGUIWindowManager::IsColorBufferActive() { CGUIWindow* pWindow = GetWindow(GetActiveWindow()); if(!pWindow) return false; if(pWindow->HasDynamicContents()) return false; if(pWindow->IsAnimating()) return false; int mode3d = MODE_3D_NONE; #ifdef HAS_EMBEDDED mode3d = g_guiSettings.GetInt("videoscreen.mode3d"); #endif if(mode3d != MODE_3D_NONE) return false; // find the window with the lowest render order vector<CGUIWindow *> renderList = m_activeDialogs; stable_sort(renderList.begin(), renderList.end(), RenderOrderSortFunction); // iterate through all dialogs. If the dialog enable color buffer return true; for (iDialog it = renderList.begin(); it != renderList.end(); ++it) { if ((*it)->IsDialogRunning()) { if ((*it)->IsAnimating()) { return false; } else if((*it)->HasColorBufferActive()) return true; } } return false; }
bool CGUIWindowManager::IsWindowActive(const CStdString &xmlFile, bool ignoreClosing /* = true */) const { CSingleLock lock(g_graphicsContext); CGUIWindow *window = GetWindow(GetActiveWindow()); if (window && URIUtils::GetFileName(window->GetProperty("xmlfile").asString()).Equals(xmlFile)) return true; // run through the dialogs for (ciDialog it = m_activeDialogs.begin(); it != m_activeDialogs.end(); ++it) { CGUIWindow *window = *it; if (URIUtils::GetFileName(window->GetProperty("xmlfile").asString()).Equals(xmlFile) && (!ignoreClosing || !window->IsAnimating(ANIM_TYPE_WINDOW_CLOSE))) return true; } return false; // window isn't active }