void CGUIDialogContextMenu::PositionAtCurrentFocus() { CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow()); if (window) { const CGUIControl *focusedControl = window->GetFocusedControl(); if (focusedControl) { CPoint pos = focusedControl->GetRenderPosition() + CPoint(focusedControl->GetWidth() * 0.5f, focusedControl->GetHeight() * 0.5f) + window->GetRenderPosition(); SetPosition(m_coordX + pos.x - GetWidth() * 0.5f, m_coordY + pos.y - GetHeight() * 0.5f); return; } } // no control to center at, so just center the window CenterWindow(); }