qmsetup @ f1c009 | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/corewindowagent.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/handler/qtwindowcontext.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/handler/qtwindowcontext_p.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/handler/win32windowcontext.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
qmsetup
New file @@ -0,0 +1 @@ Subproject commit f1c00991ef5a360ec2148dd125a8bb7c4d8a16a1 src/core/corewindowagent.h
@@ -24,6 +24,7 @@ Close, NumSystemButton, }; Q_ENUM(SystemButton) public Q_SLOTS: void showSystemMenu(const QPoint &pos); src/core/handler/qtwindowcontext.cpp
@@ -2,6 +2,44 @@ namespace QWK { static constexpr const int kDefaultResizeBorderThickness = 8; static Qt::CursorShape calculateCursorShape(const QWindow *window, const QPoint &pos) { #ifdef Q_OS_MACOS Q_UNUSED(window); Q_UNUSED(pos); return Qt::ArrowCursor; #else Q_ASSERT(window); if (!window) { return Qt::ArrowCursor; } if (window->visibility() != QWindow::Windowed) { return Qt::ArrowCursor; } const int x = pos.x(); const int y = pos.y(); const int w = window->width(); const int h = window->height(); if (((x < kDefaultResizeBorderThickness) && (y < kDefaultResizeBorderThickness)) || ((x >= (w - kDefaultResizeBorderThickness)) && (y >= (h - kDefaultResizeBorderThickness)))) { return Qt::SizeFDiagCursor; } if (((x >= (w - kDefaultResizeBorderThickness)) && (y < kDefaultResizeBorderThickness)) || ((x < kDefaultResizeBorderThickness) && (y >= (h - kDefaultResizeBorderThickness)))) { return Qt::SizeBDiagCursor; } if ((x < kDefaultResizeBorderThickness) || (x >= (w - kDefaultResizeBorderThickness))) { return Qt::SizeHorCursor; } if ((y < kDefaultResizeBorderThickness) || (y >= (h - kDefaultResizeBorderThickness))) { return Qt::SizeVerCursor; } return Qt::ArrowCursor; #endif } QtWindowContext::QtWindowContext(QWindow *window, WindowItemDelegate *delegate) : AbstractWindowContext(window, delegate) { } @@ -9,4 +47,8 @@ QtWindowContext::~QtWindowContext() { } bool QtWindowContext::eventFilter(QObject *obj, QEvent *event) { return AbstractWindowContext::eventFilter(obj, event); } } src/core/handler/qtwindowcontext_p.h
@@ -10,6 +10,9 @@ public: QtWindowContext(QWindow *window, WindowItemDelegate *delegate); ~QtWindowContext(); protected: bool eventFilter(QObject *obj, QEvent *event) override; }; } src/core/handler/win32windowcontext.cpp
@@ -4,16 +4,45 @@ namespace QWK { static LRESULT CALLBACK QWKWindowsWndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { static LRESULT CALLBACK QWK_WindowsWndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { // Implement return 0; } Win32WindowContext::Win32WindowContext(QWindow *window, WindowItemDelegate *delegate) static bool hookWindowProc(QObject *window, WId windowId) { Q_ASSERT(windowId); if (!windowId) { return false; } const auto hwnd = reinterpret_cast<HWND>(windowId); if (!extraData->qtWindowProc) { ::SetLastError(ERROR_SUCCESS); const auto qtWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtrW(hwnd, GWLP_WNDPROC)); Q_ASSERT(qtWindowProc); if (!qtWindowProc) { WARNING << getSystemErrorMessage(kGetWindowLongPtrW); return false; } extraData->qtWindowProc = qtWindowProc; } if (!extraData->windowProcHooked) { ::SetLastError(ERROR_SUCCESS); if (::SetWindowLongPtrW(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(QWK_WindowsWndProc)) == 0) { WARNING << getSystemErrorMessage(kSetWindowLongPtrW); return false; } extraData->windowProcHooked = true; } return true; } Win32WindowContext::Win32WindowContext(QWindow *window, WindowItemDelegate *delegate) : AbstractWindowContext(window, delegate) { // Install windows hook // Install windows window hook } Win32WindowContext::~Win32WindowContext() {