From 7e1e691d0ae3c665ecb213ce7fd0e27d9838e5a9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 14 Apr 2010 09:44:50 +0200 Subject: Compile on Mac OS 10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Morten Sørvig --- src/plugins/mediaservices/qt7/qcvdisplaylink.h | 2 +- src/plugins/mediaservices/qt7/qt7ciimagevideobuffer.mm | 3 +++ src/plugins/mediaservices/qt7/qt7movierenderer.h | 2 +- src/plugins/mediaservices/qt7/qt7movievideowidget.h | 2 +- src/plugins/mediaservices/qt7/qt7movieviewoutput.mm | 3 +++ src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm | 3 +++ 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/mediaservices/qt7/qcvdisplaylink.h b/src/plugins/mediaservices/qt7/qcvdisplaylink.h index 5cd8f73..5a1180d 100644 --- a/src/plugins/mediaservices/qt7/qcvdisplaylink.h +++ b/src/plugins/mediaservices/qt7/qcvdisplaylink.h @@ -45,7 +45,7 @@ #include #include -#include +#include QT_BEGIN_HEADER diff --git a/src/plugins/mediaservices/qt7/qt7ciimagevideobuffer.mm b/src/plugins/mediaservices/qt7/qt7ciimagevideobuffer.mm index 3778b58..7c02f9f 100644 --- a/src/plugins/mediaservices/qt7/qt7ciimagevideobuffer.mm +++ b/src/plugins/mediaservices/qt7/qt7ciimagevideobuffer.mm @@ -41,6 +41,9 @@ #include "qt7ciimagevideobuffer.h" +#include +#include + QT7CIImageVideoBuffer::QT7CIImageVideoBuffer(CIImage *image) : QAbstractVideoBuffer(CoreImageHandle) , m_image(image) diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.h b/src/plugins/mediaservices/qt7/qt7movierenderer.h index c2dd177..5953b54 100644 --- a/src/plugins/mediaservices/qt7/qt7movierenderer.h +++ b/src/plugins/mediaservices/qt7/qt7movierenderer.h @@ -53,7 +53,7 @@ #include #include "qt7videooutputcontrol.h" -#include +#include #include diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h index 831a18d..3ff14f5 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h @@ -51,7 +51,7 @@ #include #include "qt7videooutputcontrol.h" -#include +#include #include diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm index 20f1a02..06299a3 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm @@ -48,6 +48,9 @@ #include "qt7playersession.h" #include +#include +#include + #define VIDEO_TRANSPARENT(m) -(void)m:(NSEvent *)e{[[self superview] m:e];} diff --git a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm index 33a6970..5af9809 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm @@ -55,6 +55,9 @@ #include #include +#include +#include + QT_BEGIN_NAMESPACE -- cgit v0.12 From d3e91e4124b96869b8c4e2c8492b4d4cec913ebc Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 13 Apr 2010 14:57:00 +0200 Subject: Cocoa: qwidget autotest fails on setToolTip The reason turns out to be that we: 1. Half-way fake mouse events from QCursor::setPos 2. Don't fake mouse move upon mouse enter unless traking is on The test failed when mouse trackin was on, so that we ended up faking the same mouse move event twize (in QCursor::setPos and mouseEnter). We now do a different implementation for setPos on cocoa (so that native events will be generated), and always fake a mouse move event from mouse enter to make tooltips (and other event filters) work Reviewed-by: MortenS --- src/gui/kernel/qcocoaview_mac.mm | 15 ++++++++------- src/gui/kernel/qcursor_mac.mm | 10 ++++++++++ tests/auto/qwidget/tst_qwidget.cpp | 3 --- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 9c5380b..dd12f65 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -673,13 +673,14 @@ static int qCocoaViewCount = 0; // Send mouse move and hover events as well: if (!qAppInstance()->activePopupWidget() || qAppInstance()->activePopupWidget() == qwidget->window()) { - if (qwidget->testAttribute(Qt::WA_MouseTracking)) { - NSEvent *mouseEvent = [NSEvent mouseEventWithType:NSMouseMoved - location:windowPoint modifierFlags:[event modifierFlags] timestamp:[event timestamp] - windowNumber:[event windowNumber] context:[event context] eventNumber:[event eventNumber] - clickCount:0 pressure:0]; - qt_mac_handleMouseEvent(self, mouseEvent, QEvent::MouseMove, Qt::NoButton); - } + // This mouse move event should be sendt, even when mouse + // tracking is switched off (to trigger tooltips): + NSEvent *mouseEvent = [NSEvent mouseEventWithType:NSMouseMoved + location:windowPoint modifierFlags:[event modifierFlags] timestamp:[event timestamp] + windowNumber:[event windowNumber] context:[event context] eventNumber:[event eventNumber] + clickCount:0 pressure:0]; + qt_mac_handleMouseEvent(self, mouseEvent, QEvent::MouseMove, Qt::NoButton); + if (qwidget->testAttribute(Qt::WA_Hover)) { QHoverEvent he(QEvent::HoverEnter, QPoint(viewPoint.x, viewPoint.y), QPoint(-1, -1)); QApplicationPrivate::instance()->notify_helper(qwidget, &he); diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm index 03e38b0..c3d6c54 100644 --- a/src/gui/kernel/qcursor_mac.mm +++ b/src/gui/kernel/qcursor_mac.mm @@ -224,6 +224,15 @@ QPoint QCursor::pos() void QCursor::setPos(int x, int y) { +#ifdef QT_MAC_USE_COCOA + CGPoint pos; + pos.x = x; + pos.y = y; + + CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0); + CGEventPost(kCGHIDEventTap, e); + CFRelease(e); +#else CGWarpMouseCursorPosition(CGPointMake(x, y)); /* I'm not too keen on doing this, but this makes it a lot easier, so I just @@ -240,6 +249,7 @@ void QCursor::setPos(int x, int y) QApplication::mouseButtons(), QApplication::keyboardModifiers()); qt_sendSpontaneousEvent(widget, &me); } +#endif } void QCursorData::initCursorFromBitmap() diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1b2944e..76e20b9 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -6056,9 +6056,6 @@ void tst_QWidget::setToolTip() #ifdef Q_OS_WINCE_WM QSKIP("Mouse over doesn't work on Windows mobile.", SkipAll); #endif -#ifdef QT_MAC_USE_COCOA - QSKIP("Temporarily disable the rest on cocoa due to QCursor::setPos problems.", SkipAll); -#endif for (int pass = 0; pass < 2; ++pass) { QWidget *popup = new QWidget(0, Qt::Popup); -- cgit v0.12