summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-28 13:49:11 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-03-05 22:30:05 +0000
commit4eda22ea0db1fc571ae9f44a68825056e6245548 (patch)
tree74f426a3f7647c74bb27030c24b96ea7001f0d69
parent18da1dac20c7d27342e987586a16d125e39197c9 (diff)
macOS: Improve mouse logging
Change-Id: Icc81f73e728d9b3669afc37b0c1ef73588f24749 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview_dragging.mm17
-rw-r--r--src/plugins/platforms/cocoa/qnsview_mouse.mm26
3 files changed, 35 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index d86e935788..9c705616ba 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
Q_LOGGING_CATEGORY(lcQpaDrawing, "qt.qpa.drawing");
-Q_LOGGING_CATEGORY(lcQpaMouse, "qt.qpa.input.mouse");
+Q_LOGGING_CATEGORY(lcQpaMouse, "qt.qpa.input.mouse", QtCriticalMsg);
Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen");
//
diff --git a/src/plugins/platforms/cocoa/qnsview_dragging.mm b/src/plugins/platforms/cocoa/qnsview_dragging.mm
index 25be73b6ab..002cb3279e 100644
--- a/src/plugins/platforms/cocoa/qnsview_dragging.mm
+++ b/src/plugins/platforms/cocoa/qnsview_dragging.mm
@@ -177,17 +177,17 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender
{
- return [self handleDrag:sender];
+ return [self handleDrag:(QEvent::DragEnter) sender:sender];
}
- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender
{
QScopedValueRollback<bool> rollback(m_updatingDrag, true);
- return [self handleDrag:sender];
+ return [self handleDrag:(QEvent::DragMove) sender:sender];
}
// Sends drag update to Qt, return the action
-- (NSDragOperation)handleDrag:(id<NSDraggingInfo>)sender
+- (NSDragOperation)handleDrag:(QEvent::Type)dragType sender:(id<NSDraggingInfo>)sender
{
if (!m_platformWindow)
return NSDragOperationNone;
@@ -204,6 +204,11 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
const auto buttons = currentlyPressedMouseButtons();
const auto point = mapWindowCoordinates(m_platformWindow->window(), target, windowPoint);
+ if (dragType == QEvent::DragEnter)
+ qCDebug(lcQpaMouse) << dragType << self << "at" << windowPoint;
+ else
+ qCDebug(lcQpaMouse) << dragType << "at" << windowPoint << "with" << buttons;
+
QPlatformDragQtResponse response(false, Qt::IgnoreAction, QRect());
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
if (nativeDrag->currentDrag()) {
@@ -231,6 +236,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
QPoint windowPoint = QPointF::fromCGPoint([self convertPoint:sender.draggingLocation fromView:nil]).toPoint();
+ qCDebug(lcQpaMouse) << QEvent::DragLeave << self << "at" << windowPoint;
+
// Send 0 mime data to indicate drag exit
QWindowSystemInterface::handleDrag(target, nullptr,
mapWindowCoordinates(m_platformWindow->window(), target, windowPoint),
@@ -257,6 +264,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
const auto buttons = currentlyPressedMouseButtons();
const auto point = mapWindowCoordinates(m_platformWindow->window(), target, windowPoint);
+ qCDebug(lcQpaMouse) << QEvent::Drop << "at" << windowPoint << "with" << buttons;
+
if (nativeDrag->currentDrag()) {
// The drag was started from within the application
response = QWindowSystemInterface::handleDrop(target, nativeDrag->dragMimeData(),
@@ -285,6 +294,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation));
m_buttons = currentlyPressedMouseButtons();
+
+ qCDebug(lcQpaMouse) << "Drag session" << session << "ended, with" << m_buttons;
}
@end
diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm
index c9c87d9323..6e3cff2b48 100644
--- a/src/plugins/platforms/cocoa/qnsview_mouse.mm
+++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm
@@ -93,6 +93,7 @@
- (void)resetMouseButtons
{
+ qCDebug(lcQpaMouse) << "Reseting mouse buttons";
m_buttons = Qt::NoButton;
m_frameStrutButtons = Qt::NoButton;
}
@@ -145,6 +146,9 @@
QPoint qtScreenPoint = QCocoaScreen::mapFromNative(screenPoint).toPoint();
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);
}
@end
@@ -254,6 +258,11 @@
button = Qt::RightButton;
const auto eventType = cocoaEvent2QtMouseEvent(theEvent);
+ if (eventType == QEvent::MouseMove)
+ qCDebug(lcQpaMouse) << eventType << "at" << qtWindowPoint << "with" << buttons;
+ else
+ qCInfo(lcQpaMouse) << eventType << "of" << button << "at" << qtWindowPoint << "with" << buttons;
+
QWindowSystemInterface::handleMouseEvent(targetView->m_platformWindow->window(),
timestamp, qtWindowPoint, qtScreenPoint,
buttons, button, eventType, modifiers);
@@ -459,16 +468,16 @@
- (void)cursorUpdate:(NSEvent *)theEvent
{
- qCDebug(lcQpaMouse) << "Updating cursor for" << self << "to" << self.cursor;
-
// Note: We do not get this callback when moving from a subview that
// uses the legacy cursorRect API, so the cursor is reset to the arrow
// cursor. See rdar://34183708
- if (self.cursor)
+ if (self.cursor && self.cursor != NSCursor.currentCursor) {
+ qCInfo(lcQpaMouse) << "Updating cursor for" << self << "to" << self.cursor;
[self.cursor set];
- else
+ } else {
[super cursorUpdate:theEvent];
+ }
}
- (void)mouseMovedImpl:(NSEvent *)theEvent
@@ -523,6 +532,8 @@
QPointF screenPoint;
[self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
m_platformWindow->m_enterLeaveTargetWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
+
+ qCInfo(lcQpaMouse) << QEvent::Enter << self << "at" << windowPoint << "with" << currentlyPressedMouseButtons();
QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
@@ -541,6 +552,7 @@
if (!m_platformWindow->isContentView())
return;
+ qCInfo(lcQpaMouse) << QEvent::Leave << self;
QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_enterLeaveTargetWindow);
m_platformWindow->m_enterLeaveTargetWindow = 0;
}
@@ -639,8 +651,10 @@
// "isInverted": natural OS X scrolling, inverted from the Qt/other platform/Jens perspective.
bool isInverted = [theEvent isDirectionInvertedFromDevice];
- qCDebug(lcQpaMouse) << "scroll wheel @ window pos" << qt_windowPoint << "delta px" << pixelDelta
- << "angle" << angleDelta << "phase" << phase << (isInverted ? "inverted" : "");
+ qCInfo(lcQpaMouse).nospace() << phase << " at " << qt_windowPoint
+ << " pixelDelta=" << pixelDelta << " angleDelta=" << angleDelta
+ << (isInverted ? " inverted=true" : "");
+
QWindowSystemInterface::handleWheelEvent(m_platformWindow->window(), qt_timestamp, qt_windowPoint,
qt_screenPoint, pixelDelta, angleDelta, m_currentWheelModifiers, phase, source, isInverted);
}