Sine Striker
2023-12-19 f874811443991759df4231b5127788af059a0df9
Add raise hook
4个文件已修改
40 ■■■■ 已修改文件
README.md 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext.cpp 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/qtwindowcontext.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -10,6 +10,8 @@
+ Fix window 10 top border color in dark background
+ Fix `isFixedSize` code
+ Support customized system button area on Mac
+ Implement Mac window context hook
+ Support window attribute switching on Windows
## Supported Platforms
src/core/contexts/abstractwindowcontext.cpp
@@ -2,6 +2,7 @@
#include <QtGui/QPen>
#include <QtGui/QPainter>
#include <QtGui/QScreen>
#include "qwkglobal_p.h"
@@ -154,12 +155,17 @@
    void AbstractWindowContext::virtual_hook(int id, void *data) {
        switch (id) {
            case CentralizeHook: {
                // TODO: Qt
                QRect screenGeometry = m_windowHandle->screen()->geometry();
                int x = screenGeometry.width() / 2 - m_windowHandle->width() / 2;
                int y = screenGeometry.height() / 2 - m_windowHandle->height() / 2;
                m_windowHandle->setPosition(x, y);
                break;
            }
            case ShowSystemMenuHook: {
                // TODO: Qt
            case RaiseWindowHook: {
                if (m_windowHandle->windowStates() & Qt::WindowMinimized)
                    m_windowHandle->showNormal();
                m_windowHandle->raise();
                break;
            }
src/core/contexts/qtwindowcontext.cpp
@@ -244,12 +244,6 @@
    }
    void QtWindowContext::virtual_hook(int id, void *data) {
        switch (id) {
            case ShowSystemMenuHook:
                return;
            default:
                break;
        }
        AbstractWindowContext::virtual_hook(id, data);
    }
src/core/contexts/win32windowcontext.cpp
@@ -812,6 +812,26 @@
                return;
            }
            case RaiseWindowHook: {
                if (m_windowHandle->windowStates() & Qt::WindowMinimized)
                    m_windowHandle->showNormal();
                auto hWnd = reinterpret_cast<HWND>(windowId);
                // I have no idea what this does, but it works mostly
                // https://www.codeproject.com/Articles/1724/Some-handy-dialog-box-tricks-tips-and-workarounds
                ::AttachThreadInput(::GetWindowThreadProcessId(::GetForegroundWindow(), nullptr),
                                    ::GetCurrentThreadId(), TRUE);
                ::SetForegroundWindow(hWnd);
                ::SetFocus(hWnd);
                ::AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), nullptr),
                                    GetCurrentThreadId(), FALSE);
                return;
            }
            case ShowSystemMenuHook: {
                const auto &pos = *static_cast<const QPoint *>(data);
                auto hWnd = reinterpret_cast<HWND>(windowId);