Cocoa: Handle the event passed into the global monitor correctly
When the global monitor was used it did not get the right position for the mouse event and as a result it caused context menus to appear and disappear instantly when right clicking over a non active window. This ensures that the events are sent correctly with the right position and button information. Task-number: QTBUG-45015 Change-Id: I9b17a725e656c716c4e22117b4513e64c357b266 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>bb10
parent
5ce567c536
commit
50ce5a6830
|
|
@ -680,8 +680,10 @@ void QCocoaWindow::setVisible(bool visible)
|
|||
&& [m_nsWindow isKindOfClass:[NSPanel class]]) {
|
||||
[(NSPanel *)m_nsWindow setWorksWhenModal:YES];
|
||||
if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) {
|
||||
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDown handler:^(NSEvent *) {
|
||||
QWindowSystemInterface::handleMouseEvent(window(), QPointF(-1, -1), QPointF(window()->framePosition() - QPointF(1, 1)), Qt::LeftButton);
|
||||
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) {
|
||||
QPointF localPoint = qt_mac_flipPoint([NSEvent mouseLocation]);
|
||||
QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint,
|
||||
cocoaButton2QtButton([e buttonNumber]));
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue