From 967e741b1696b2d43f9a742f4489be955cd97b92 Mon Sep 17 00:00:00 2001 From: SineStriker <55847490+SineStriker@users.noreply.github.com> Date: 周一, 24 2月 2025 02:59:04 +0800 Subject: [PATCH] Update --- src/core/contexts/abstractwindowcontext.cpp | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index f3a9c7f..beea180 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -231,27 +231,27 @@ removeEventFilter(m_windowHandle); } m_windowHandle = m_delegate->hostWindow(m_host); + if (m_windowHandle) { + m_windowHandle->installEventFilter(this); + } if (oldWinId != m_windowId) { winIdChanged(m_windowId, oldWinId); - } - if (m_windowHandle) { - m_windowHandle->installEventFilter(this); - - // Refresh window attributes - for (auto it = m_windowAttributesOrder.begin(); it != m_windowAttributesOrder.end();) { - if (!windowAttributeChanged(it->first, it->second, {})) { - m_windowAttributes.remove(it->first); - it = m_windowAttributesOrder.erase(it); - continue; + if (m_windowId) { + // Refresh window attributes + for (auto it = m_windowAttributesOrder.begin(); + it != m_windowAttributesOrder.end();) { + if (!windowAttributeChanged(it->first, it->second, {})) { + m_windowAttributes.remove(it->first); + it = m_windowAttributesOrder.erase(it); + continue; + } + ++it; } - ++it; } - } - // Send to shared dispatchers - if (oldWinId != m_windowId) { + // Send to shared dispatchers QEvent e(QEvent::WinIdChange); sharedDispatch(m_host, &e); } @@ -271,18 +271,18 @@ if (!attribute.isValid()) { return true; } - if (m_windowHandle && !windowAttributeChanged(key, attribute, {})) { + if (m_windowId && !windowAttributeChanged(key, attribute, {})) { return false; } - m_windowAttributes.insert(key, - m_windowAttributesOrder.insert(m_windowAttributesOrder.end(), - std::make_pair(key, attribute))); + m_windowAttributes.insert( + key, m_windowAttributesOrder.insert(m_windowAttributesOrder.end(), + std::make_pair(key, attribute))); return true; } auto &listIter = it.value(); auto &oldAttr = listIter->second; - if (m_windowHandle && !windowAttributeChanged(key, attribute, oldAttr)) { + if (m_windowId && !windowAttributeChanged(key, attribute, oldAttr)) { return false; } -- Gitblit v1.9.1