SineStriker
2025-02-11 e9f790d3533ebaee1f782e91b6e13b2c6375c86a
AWC: fix window attribute handler
5个文件已修改
30 ■■■■ 已修改文件
src/core/contexts/abstractwindowcontext.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/cocoawindowcontext.mm 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/quick/quickwindowagent.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetwindowagent.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext.cpp
@@ -230,17 +230,20 @@
        if (m_windowHandle) {
            removeEventFilter(m_windowHandle);
        }
        auto oldWindowHandle = m_windowHandle.data();
        m_windowHandle = m_delegate->hostWindow(m_host);
        if (oldWinId != m_windowId) {
            winIdChanged(m_windowId, oldWinId);
        }
        if (m_windowHandle) {
            if (m_windowId) {
                // Installing twice has no side-effect.
            m_windowHandle->installEventFilter(this);
            // Refresh window attributes
            for (auto it = m_windowAttributesOrder.begin(); it != m_windowAttributesOrder.end();) {
                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);
@@ -251,7 +254,6 @@
        }
        // Send to shared dispatchers
        if (oldWinId != m_windowId) {
            QEvent e(QEvent::WinIdChange);
            sharedDispatch(m_host, &e);
        }
@@ -271,18 +273,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(),
            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;
        }
src/core/contexts/cocoawindowcontext.mm
@@ -708,6 +708,8 @@
                                                    const QVariant &oldAttribute) {
        Q_UNUSED(oldAttribute)
        Q_ASSERT(m_windowId);
        if (key == QStringLiteral("no-system-buttons")) {
            if (attribute.type() != QVariant::Bool)
                return false;
@@ -740,7 +742,6 @@
            }
            return ensureWindowProxy(m_windowId)->setBlurEffect(mode);
        }
        return false;
    }
src/core/contexts/win32windowcontext.cpp
@@ -916,9 +916,7 @@
        Q_UNUSED(oldAttribute)
        const auto hwnd = reinterpret_cast<HWND>(m_windowId);
        if (!hwnd) {
            return false;
        }
        Q_ASSERT(hwnd);
        const DynamicApis &apis = DynamicApis::instance();
        const auto &extendMargins = [this, &apis, hwnd]() {
src/quick/quickwindowagent.cpp
@@ -44,9 +44,6 @@
            return false;
        }
        // Make sure the native window handle is actually created before we apply
        // various hooks. But we don't need the actual window handle so just ignore it.
        std::ignore = window->winId();
        d->setup(window, new QuickItemDelegate());
        d->hostWindow = window;
src/widgets/widgetwindowagent.cpp
@@ -61,7 +61,7 @@
        w->setAttribute(Qt::WA_DontCreateNativeAncestors);
        // Make sure the native window handle is actually created before we apply
        // various hooks.
        w->setAttribute(Qt::WA_NativeWindow);
        w->setAttribute(Qt::WA_NativeWindow); // ### FIXME: Remove
        d->setup(w, new WidgetItemDelegate());
        d->hostWidget = w;