9uint64_t QWasmWindowTreeNode::s_nextActiveIndex = 0;
23 (QGuiApplication::focusWindow() &&
24 QGuiApplication::focusWindow() != window->window()))
30 std::map<uint64_t, QWasmWindow *> allWindows;
31 for (
const auto &w : window->platformScreen()->allWindows()) {
32 if (w->getActiveIndex() > 0)
33 allWindows.insert({w->getActiveIndex(), w});
37 if (window->getActiveIndex() > 0)
38 allWindows.insert({window->getActiveIndex(), window});
40 if (allWindows.size() >= 2) {
41 const auto lastIt = std::prev(allWindows.end());
42 const auto prevIt =
std::prev(lastIt);
43 const auto lastW = lastIt->second;
44 const auto prevW = prevIt->second;
47 prevW->requestActivateWindow();
53 QWasmWindowStack::PositionPreference positionPreference)
57 previousParent->m_childStack.removeWindow(window);
63 currentParent->m_childStack.pushWindow(window, positionPreference);
77 if (changeType == QWasmWindowTreeNodeChangeType::NodeInsertion && parent ==
this
78 && m_childStack.topWindow()
79 && m_childStack.topWindow()->window()) {
81 const auto flags = m_childStack.topWindow()->window()->flags();
82 const bool notToolOrPopup = ((flags & Qt::ToolTip) != Qt::ToolTip) && ((flags & Qt::Popup) != Qt::Popup);
83 const QVariant showWithoutActivating = m_childStack.topWindow()->window()->property(
"_q_showWithoutActivating");
84 if (!showWithoutActivating.isValid() || !showWithoutActivating.toBool()) {
86 m_childStack.topWindow()->requestActivateWindow();
100 QWasmWindowStack::PositionPreference positionPreference)
114 m_activeIndex = ++s_nextActiveIndex;
129 m_childStack.lower(asWasmWindow());
134 constexpr int zOrderForElementInFrontOfScreen = 3;
135 int z = zOrderForElementInFrontOfScreen;
136 std::for_each(m_childStack.rbegin(), m_childStack.rend(),
137 [
this, &z](QWasmWindow *window) { setWindowZOrder(window, z++); });
142 m_activeChild = activeChild;
144 auto it = m_childStack.begin();
145 if (it == m_childStack.end())
147 for (; it != m_childStack.end(); ++it)
148 (*it)->onActivationChanged(*it == m_activeChild);
virtual ~QWasmWindowTreeNode()
virtual void onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTreeNode *current, QWasmWindowStack::PositionPreference positionPreference)
virtual QWasmWindowTreeNode * parentNode()=0
virtual void onSubtreeChanged(QWasmWindowTreeNodeChangeType changeType, QWasmWindowTreeNode *parent, QWasmWindow *child)
virtual QWasmWindow * asWasmWindow()
virtual void setWindowZOrder(QWasmWindow *window, int z)
void onPositionPreferenceChanged(QWasmWindowStack::PositionPreference positionPreference)
friend class QWasmCompositor
void setZOrder(int order)
QWasmWindowTreeNodeChangeType