diff --git a/ui/platform/mac/ui_window_mac.mm b/ui/platform/mac/ui_window_mac.mm index d0da109..9d0f12d 100644 --- a/ui/platform/mac/ui_window_mac.mm +++ b/ui/platform/mac/ui_window_mac.mm @@ -96,7 +96,7 @@ public: void *message, base::NativeEventResult *result) { NSEvent *e = static_cast(message); - return (e && [e type] == NSEventTypeLeftMouseDown) + return (e && [e type] == NSEventTypeLeftMouseDragged) ? _checkPerformDrag([e window]) : false; return false; @@ -399,6 +399,15 @@ void WindowHelper::init() { size.width(), size.height() - titleHeight); }, _body->lifetime()); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + setBodyTitleArea([=](QPoint widgetPoint) { + using Flag = Ui::WindowTitleHitTestFlag; + return (_body->y() > widgetPoint.y()) + ? (Flag::Move | Flag::Maximize) + : Flag::None; + }); +#endif // Qt >= 6.0.0 } std::unique_ptr CreateSpecialWindowHelper( diff --git a/ui/platform/ui_platform_window.cpp b/ui/platform/ui_platform_window.cpp index a9046dc..9bb8c50 100644 --- a/ui/platform/ui_platform_window.cpp +++ b/ui/platform/ui_platform_window.cpp @@ -81,13 +81,15 @@ void BasicWindowHelper::close() { void BasicWindowHelper::setBodyTitleArea( Fn testMethod) { - Expects(!_bodyTitleAreaTestMethod); + Expects(!_bodyTitleAreaTestMethod || testMethod); if (!testMethod) { return; } + if (!_bodyTitleAreaTestMethod) { + setupBodyTitleAreaEvents(); + } _bodyTitleAreaTestMethod = std::move(testMethod); - setupBodyTitleAreaEvents(); } QMargins BasicWindowHelper::nativeFrameMargins() const {