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,
|
void *message,
|
||||||
base::NativeEventResult *result) {
|
base::NativeEventResult *result) {
|
||||||
NSEvent *e = static_cast<NSEvent*>(message);
|
NSEvent *e = static_cast<NSEvent*>(message);
|
||||||
return (e && [e type] == NSEventTypeLeftMouseDown)
|
return (e && [e type] == NSEventTypeLeftMouseDragged)
|
||||||
? _checkPerformDrag([e window])
|
? _checkPerformDrag([e window])
|
||||||
: false;
|
: false;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -399,6 +399,15 @@ void WindowHelper::init() {
|
||||||
size.width(),
|
size.width(),
|
||||||
size.height() - titleHeight);
|
size.height() - titleHeight);
|
||||||
}, _body->lifetime());
|
}, _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(
|
std::unique_ptr<BasicWindowHelper> CreateSpecialWindowHelper(
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,15 @@ void BasicWindowHelper::close() {
|
||||||
|
|
||||||
void BasicWindowHelper::setBodyTitleArea(
|
void BasicWindowHelper::setBodyTitleArea(
|
||||||
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
||||||
Expects(!_bodyTitleAreaTestMethod);
|
Expects(!_bodyTitleAreaTestMethod || testMethod);
|
||||||
|
|
||||||
if (!testMethod) {
|
if (!testMethod) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!_bodyTitleAreaTestMethod) {
|
||||||
|
setupBodyTitleAreaEvents();
|
||||||
|
}
|
||||||
_bodyTitleAreaTestMethod = std::move(testMethod);
|
_bodyTitleAreaTestMethod = std::move(testMethod);
|
||||||
setupBodyTitleAreaEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMargins BasicWindowHelper::nativeFrameMargins() const {
|
QMargins BasicWindowHelper::nativeFrameMargins() const {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue