summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRyohei Ikegami <iofg2100@gmail.com>2013-08-14 13:49:24 +0900
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-15 03:50:52 +0200
commit8e13a9792afcaf1be901ac00418b30372e818fde (patch)
treec4c74292112429171ca59c52e4ce13b05a24179b /src
parentfe3c34c2595cfbf466d899b5431ee1de03ce52a7 (diff)
Change QNSView convertFromEvent: arguemnts to QPointF
Change QNSView convertFromEvent: toWindowPoint: andScreenPoint: arguments from QPoint to QPointF. QWindowSystemInterface event handlers already use QPointF and QPointF is needed for tablet support (https://codereview.qt-project.org/#change,62740). Change-Id: I6e5b2f19777fe24ae34e9e85028772e4be0a94f6 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 285e4aeb9f..aaff86c450 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -488,7 +488,7 @@ static QTouchDevice *touchDevice = 0;
return YES;
}
-- (void)convertFromEvent:(NSEvent *)event toWindowPoint:(QPoint *)qtWindowPoint andScreenPoint:(QPoint *)qtScreenPoint
+- (void)convertFromEvent:(NSEvent *)event toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint
{
// Calculate the mouse position in the QWindow and Qt screen coordinate system,
// starting from coordinates in the NSWindow coordinate system.
@@ -511,19 +511,19 @@ static QTouchDevice *touchDevice = 0;
NSPoint nsWindowPoint = [event locationInWindow]; // NSWindow coordinates
NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates
- *qtWindowPoint = QPoint(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
+ *qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
NSWindow *window = [self window];
// Use convertRectToScreen if available (added in 10.7).
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([window respondsToSelector:@selector(convertRectToScreen:)]) {
NSRect screenRect = [window convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates
- *qtScreenPoint = QPoint(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates
+ *qtScreenPoint = QPointF(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates
} else
#endif
{
NSPoint screenPoint = [window convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)];
- *qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+ *qtScreenPoint = QPointF(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
}
}
@@ -534,7 +534,8 @@ static QTouchDevice *touchDevice = 0;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
- QPoint qtWindowPoint, qtScreenPoint;
+ QPointF qtWindowPoint;
+ QPointF qtScreenPoint;
[self convertFromEvent:theEvent toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
ulong timestamp = [theEvent timestamp] * 1000;
@@ -674,9 +675,10 @@ static QTouchDevice *touchDevice = 0;
if (m_window->flags() & Qt::WindowTransparentForInput)
return [super mouseMoved:theEvent];
- QPoint windowPoint, screenPoint;
+ QPointF windowPoint;
+ QPointF screenPoint;
[self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
- QWindow *childWindow = m_platformWindow->childWindowAt(windowPoint);
+ QWindow *childWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
// Top-level windows generate enter-leave events for sub-windows.
// Qt wants to know which window (if any) will be entered at the
@@ -707,9 +709,10 @@ static QTouchDevice *touchDevice = 0;
if (!m_platformWindow->m_nsWindow)
return;
- QPoint windowPoint, screenPoint;
+ QPointF windowPoint;
+ QPointF screenPoint;
[self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
- m_platformWindow->m_underMouseWindow = m_platformWindow->childWindowAt(windowPoint);
+ m_platformWindow->m_underMouseWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_underMouseWindow, windowPoint, screenPoint);
}
@@ -857,7 +860,8 @@ static QTouchDevice *touchDevice = 0;
}
#endif
- QPoint qt_windowPoint, qt_screenPoint;
+ QPointF qt_windowPoint;
+ QPointF qt_screenPoint;
[self convertFromEvent:theEvent toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint];
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;