macOS: Move off deprecated handleFrameStrutMouseEvent API

Change-Id: Id95c096700a8bfa733d8620064c2a37eb19cc3db
Fixes: QTBUG-72741
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-05-06 13:46:55 +02:00
parent 490ee4c5e6
commit a3d6a04949

View File

@ -147,9 +147,34 @@
ulong timestamp = [theEvent timestamp] * 1000;
auto eventType = cocoaEvent2QtMouseEvent(theEvent);
qCInfo(lcQpaMouse) << "Frame-strut" << eventType << "at" << qtWindowPoint << "with" << m_frameStrutButtons << "in" << self.window;
QWindowSystemInterface::handleFrameStrutMouseEvent(m_platformWindow->window(), timestamp, qtWindowPoint, qtScreenPoint, m_frameStrutButtons);
const auto button = cocoaButton2QtButton(theEvent);
auto eventType = [&]() {
switch (theEvent.type) {
case NSEventTypeLeftMouseDown:
case NSEventTypeRightMouseDown:
case NSEventTypeOtherMouseDown:
return QEvent::NonClientAreaMouseButtonPress;
case NSEventTypeLeftMouseUp:
case NSEventTypeRightMouseUp:
case NSEventTypeOtherMouseUp:
return QEvent::NonClientAreaMouseButtonRelease;
case NSEventTypeLeftMouseDragged:
case NSEventTypeRightMouseDragged:
case NSEventTypeOtherMouseDragged:
return QEvent::NonClientAreaMouseMove;
default:
break;
}
return QEvent::None;
}();
qCInfo(lcQpaMouse) << eventType << "at" << qtWindowPoint << "with" << m_frameStrutButtons << "in" << self.window;
QWindowSystemInterface::handleFrameStrutMouseEvent(m_platformWindow->window(),
timestamp, qtWindowPoint, qtScreenPoint, m_frameStrutButtons, button, eventType);
}
@end