Sine Striker
2023-12-19 245ddfa1f01b4c9fa10337246b8045755e5bcce5
Change back to qScopeGuard
2个文件已修改
41 ■■■■ 已修改文件
README.md 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -21,9 +21,9 @@
### Windows 10 (And 7, Vista)
![image](./docs/images/win10.png)
### MacOS & Linux
### macOS & Linux
|              MacOS              |       Linux (Ubuntu 20.04)        |
|              macOS              |       Linux (Ubuntu 20.04)        |
|:-------------------------------:|:---------------------------------:|
| ![image](./docs/images/mac.png) | ![image](./docs/images/linux.png) |
src/core/contexts/win32windowcontext.cpp
@@ -480,21 +480,10 @@
        // so we use this small technique to pretend the foreground window is ours.
        ::AttachThreadInput(windowThreadProcessId, currentThreadId, TRUE);
        struct Cleaner {
            Cleaner(DWORD idAttach, DWORD idAttachTo)
                : m_idAttach(idAttach), m_idAttachTo(idAttachTo) {
            }
            ~Cleaner() {
                ::AttachThreadInput(m_idAttach, m_idAttachTo, FALSE);
            }
        private:
            DWORD m_idAttach;
            DWORD m_idAttachTo;
            Q_DISABLE_COPY(Cleaner)
        };
        [[maybe_unused]] Cleaner cleaner{windowThreadProcessId, currentThreadId};
        [[maybe_unused]] const auto &cleaner =
            qScopeGuard([windowThreadProcessId, currentThreadId]() {
                ::AttachThreadInput(windowThreadProcessId, currentThreadId, FALSE); //
            });
        ::BringWindowToTop(hwnd);
        // Activate the window too. This will force us to the virtual desktop this
@@ -1450,21 +1439,9 @@
                // Terminal does, however, later I found that if we choose a proper
                // color, our homemade top border can almost have exactly the same
                // appearance with the system's one.
                struct HitTestRecorder {
                    HitTestRecorder(Win32WindowContext *ctx, LRESULT *result)
                        : ctx(ctx), result(result) {
                    }
                    ~HitTestRecorder() {
                        ctx->lastHitTestResult = getHitWindowPart(int(*result));
                    }
                private:
                    Win32WindowContext *ctx;
                    LRESULT *result;
                    Q_DISABLE_COPY(HitTestRecorder)
                };
                [[maybe_unused]] HitTestRecorder hitTestRecorder{this, result};
                [[maybe_unused]] const auto &hitTestRecorder = qScopeGuard([this, result]() {
                    lastHitTestResult = getHitWindowPart(int(*result)); //
                });
                POINT nativeGlobalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
                POINT nativeLocalPos = nativeGlobalPos;