Fix RpWindow drag-by-title on macOS with Qt 6.2.
This commit is contained in:
parent
9e4ffb81a5
commit
7b4114d907
2 changed files with 14 additions and 3 deletions
|
|
@ -96,7 +96,7 @@ public:
|
|||
void *message,
|
||||
base::NativeEventResult *result) {
|
||||
NSEvent *e = static_cast<NSEvent*>(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<BasicWindowHelper> CreateSpecialWindowHelper(
|
||||
|
|
|
|||
|
|
@ -81,13 +81,15 @@ void BasicWindowHelper::close() {
|
|||
|
||||
void BasicWindowHelper::setBodyTitleArea(
|
||||
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
||||
Expects(!_bodyTitleAreaTestMethod);
|
||||
Expects(!_bodyTitleAreaTestMethod || testMethod);
|
||||
|
||||
if (!testMethod) {
|
||||
return;
|
||||
}
|
||||
if (!_bodyTitleAreaTestMethod) {
|
||||
setupBodyTitleAreaEvents();
|
||||
}
|
||||
_bodyTitleAreaTestMethod = std::move(testMethod);
|
||||
setupBodyTitleAreaEvents();
|
||||
}
|
||||
|
||||
QMargins BasicWindowHelper::nativeFrameMargins() const {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue