diff options
author | Gerhard Roethlin <gerhard@disneyresearch.com> | 2012-09-19 11:16:12 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-24 10:58:06 (GMT) |
commit | 33ee8dff49fa89b83ce793974208304fd19dc367 (patch) | |
tree | 9d2dccd5188f7f8db24d34beec834c5202c05429 | |
parent | 94253f3472a13ac4eab3ccfbbba9d14165647f85 (diff) | |
download | Qt-33ee8dff49fa89b83ce793974208304fd19dc367.zip Qt-33ee8dff49fa89b83ce793974208304fd19dc367.tar.gz Qt-33ee8dff49fa89b83ce793974208304fd19dc367.tar.bz2 |
float->int error in OS X Mouse Event Handling
NSEvent for mouse events contain the mouse position in floating
point numbers. This value is truncated/floored for mouse clicks.
Qt instead rounds that value, so mouse move events can get positions
that are slightly off sometimes. This solves #QTBUG-27273.
Change-Id: I2d3f59a09f50cb83dc1ccf6de940b7d99087c9ee
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 99004bb..d3bb230 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1057,7 +1057,9 @@ QWidget *qt_mac_getTargetForMouseEvent( { Q_UNUSED(event); NSPoint nsglobalpoint = event ? [[event window] convertBaseToScreen:[event locationInWindow]] : [NSEvent mouseLocation]; - returnGlobalPoint = flipPoint(nsglobalpoint).toPoint(); + QPointF globalPointF = flipPoint(nsglobalpoint); + // Always truncate to convert to integer, same as Cocoa does for clicks + returnGlobalPoint = QPoint(globalPointF.x(), globalPointF.y()); QWidget *mouseGrabber = QWidget::mouseGrabber(); bool buttonDownNotBlockedByModal = qt_button_down && !QApplicationPrivate::isBlockedByModal(qt_button_down); QWidget *popup = QApplication::activePopupWidget(); |