Sine Striker
2023-12-21 c229915e9d4b2818155f3650869726fdcbe7e21d
Prepare to add mica
4个文件已修改
47 ■■■■ 已修改文件
README.md 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/cocoawindowcontext.mm 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/windowagentbase.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -7,6 +7,19 @@
Support as many system native features as possible without requiring additional dependencies.
<!-- ## Why using QWindowKit?
Here're why `QWindowKit` is better than `FramelessHelper`:
+ Full support of Windows 11 Snap Layout
+ Most of the redundant codes and architectural flaws are eliminated, and the binary size compiled by MSVC is about 1/9 of `FramelessHelper`
+ A critical issue that moving window forces the entire window to be repainted on Windows is fixed
+ Capable to cope with WinId mutation, and `QWebEngineView` is perfectly supported
+ Simpler APIs, more detailed documentation and comments
+ A lot of bugs are fixed
Feature requests are welcome. -->
## Supported Platforms
+ Microsoft Windows
src/core/contexts/cocoawindowcontext.mm
@@ -371,11 +371,6 @@
    void CocoaWindowContext::virtual_hook(int id, void *data) {
        switch (id) {
            case ShowSystemMenuHook: {
                // TODO: mac system menu
                return;
            }
            case SystemButtonAreaChangedHook: {
                // TODO: mac system button rect updated
                return;
src/core/contexts/win32windowcontext.cpp
@@ -914,13 +914,38 @@
                const auto &oldVar = *static_cast<const QVariant *>(args[2]);
                if (key == QStringLiteral("no-frame-shadow")) {
                    if (!windowId)
                        return;
                    if (newVar.toBool()) {
                        // TODO: set off
                    } else {
                        // TODO: set on
                    }
                }
                } else if (key == QStringLiteral("mica-material")) {
                    if (!windowId || !isWin11OrGreater())
                        return;
                    const auto hwnd = reinterpret_cast<HWND>(windowId);
                    if (newVar.toBool()) {
                        /*
                        // We need to extend the window frame into the whole client area to be able
                        // to see the blurred window background.
                        static constexpr const MARGINS margins = {-1, -1, -1, -1};
                        ::DwmExtendFrameIntoClientArea(hwnd, &margins);
                        // Use official DWM API to enable Mica/Mica Alt, available since Windows 11
                        // (10.0.22000).
                        const DWM_SYSTEMBACKDROP_TYPE blurType =
                            DWMSBT_MAINWINDOW; // This one is Mica, if you want to enable Mica Alt,
                                               // use DWMSBT_TABBEDWINDOW instead.
                        DynamicApis::instance().pDwmSetWindowAttribute(
                            hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &blurType, sizeof(blurType));
                        */
                    } else {
                        // TODO: set off
                    }
                }
                return;
            }
src/core/windowagentbase.h
@@ -32,7 +32,7 @@
        void setWindowAttribute(const QString &key, const QVariant &var);
    public Q_SLOTS:
        void showSystemMenu(const QPoint &pos);
        void showSystemMenu(const QPoint &pos); // Only available on Windows now
        void centralize();
        void raise();