Bug 631170 - mouse hover broken in Qt build r=romaxa a=npodb
authorFlorian Hanel <florian.haenel@heeen.de>
Thu, 03 Feb 2011 23:27:01 +0200
changeset 61879 344de3f6033f1b849a44568fd7ed2188d9e632ac
parent 61878 b22b865abf30f0381173a6c61092274ce9cdaa61
child 61907 ab87d34e89fa00423266c8177ee3eb1811e08f61
push idunknown
push userunknown
push dateunknown
reviewersromaxa, npodb
bugs631170
milestone2.0b12pre
Bug 631170 - mouse hover broken in Qt build r=romaxa a=npodb
widget/src/qt/mozqwidget.cpp
widget/src/qt/mozqwidget.h
widget/src/qt/nsWindow.cpp
widget/src/qt/nsWindow.h
--- a/widget/src/qt/mozqwidget.cpp
+++ b/widget/src/qt/mozqwidget.cpp
@@ -82,16 +82,17 @@ static QString gLastPreeditString;
 MozQWidget::MozQWidget(nsWindow* aReceiver, QGraphicsItem* aParent)
     : QGraphicsWidget(aParent),
       mReceiver(aReceiver)
 {
 #if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
      setFlag(QGraphicsItem::ItemAcceptsInputMethod);
      setAcceptTouchEvents(true);
 #endif
+     setAcceptHoverEvents(true);
 }
 
 MozQWidget::~MozQWidget()
 {
     if (mReceiver)
         mReceiver->QWidgetDestroyed();
 }
 
@@ -171,17 +172,17 @@ void MozQWidget::hoverEnterEvent(QGraphi
 
 void MozQWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent* aEvent)
 {
     mReceiver->OnLeaveNotifyEvent(aEvent);
 }
 
 void MozQWidget::hoverMoveEvent(QGraphicsSceneHoverEvent* aEvent)
 {
-    mReceiver->OnMoveEvent(aEvent);
+    mReceiver->OnMotionNotifyEvent(aEvent->pos(), aEvent->modifiers());
 }
 
 void MozQWidget::keyPressEvent(QKeyEvent* aEvent)
 {
 #if (MOZ_PLATFORM_MAEMO == 6)
     if (!gKeyboardOpen ||
        //those might get sended as KeyEvents, even in 'NormalMode'
        aEvent->key() == Qt::Key_Space ||
@@ -313,17 +314,17 @@ void MozQWidget::mouseDoubleClickEvent(Q
 {
     // Qt sends double click event, but not second press event.
     mReceiver->OnButtonPressEvent(aEvent);
     mReceiver->OnMouseDoubleClickEvent(aEvent);
 }
 
 void MozQWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* aEvent)
 {
-    mReceiver->OnMotionNotifyEvent(aEvent);
+    mReceiver->OnMotionNotifyEvent(aEvent->pos(), aEvent->modifiers());
 }
 
 void MozQWidget::mousePressEvent(QGraphicsSceneMouseEvent* aEvent)
 {
     mReceiver->OnButtonPressEvent(aEvent);
 }
 
 void MozQWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* aEvent)
--- a/widget/src/qt/mozqwidget.h
+++ b/widget/src/qt/mozqwidget.h
@@ -188,16 +188,17 @@ class MozQGraphicsView : public QGraphic
 
 public:
     MozQGraphicsView(MozQWidget* aTopLevel, QWidget * aParent = nsnull)
      : QGraphicsView (new QGraphicsScene(), aParent)
      , mEventHandler(this)
      , mTopLevelWidget(aTopLevel)
     {
         scene()->addItem(aTopLevel);
+        setMouseTracking(true);
     }
 
 protected:
 
     virtual bool event(QEvent* aEvent)
     {
         mEventHandler.handleEvent(aEvent, mTopLevelWidget);
         return QGraphicsView::event(aEvent);
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -1250,24 +1250,24 @@ if (mLastMultiTouchTime.isValid()) { \
         mLastMultiTouchTime = QTime(); \
    } \
 }
 #else
 define CHECK_MOUSE_BLOCKED {}
 #endif
 
 nsEventStatus
-nsWindow::OnMotionNotifyEvent(QGraphicsSceneMouseEvent *aEvent)
+nsWindow::OnMotionNotifyEvent(QPointF aPos,  Qt::KeyboardModifiers aModifiers)
 {
     UserActivity();
 
     CHECK_MOUSE_BLOCKED
 
-    mMoveEvent.pos = aEvent->pos();
-    mMoveEvent.modifiers = aEvent->modifiers();
+    mMoveEvent.pos = aPos;
+    mMoveEvent.modifiers = aModifiers;
     mMoveEvent.needDispatch = true;
     DispatchMotionToMainThread();
 
     return nsEventStatus_eIgnore;
 }
 
 void
 nsWindow::InitButtonEvent(nsMouseEvent &aMoveEvent,
--- a/widget/src/qt/nsWindow.h
+++ b/widget/src/qt/nsWindow.h
@@ -266,17 +266,17 @@ protected:
     friend class InterceptContainer;
     friend class MozQWidget;
 
     virtual nsEventStatus OnMoveEvent(QGraphicsSceneHoverEvent *);
     virtual nsEventStatus OnResizeEvent(QGraphicsSceneResizeEvent *);
     virtual nsEventStatus OnCloseEvent(QCloseEvent *);
     virtual nsEventStatus OnEnterNotifyEvent(QGraphicsSceneHoverEvent *);
     virtual nsEventStatus OnLeaveNotifyEvent(QGraphicsSceneHoverEvent *);
-    virtual nsEventStatus OnMotionNotifyEvent(QGraphicsSceneMouseEvent *);
+    virtual nsEventStatus OnMotionNotifyEvent(QPointF, Qt::KeyboardModifiers);
     virtual nsEventStatus OnButtonPressEvent(QGraphicsSceneMouseEvent *);
     virtual nsEventStatus OnButtonReleaseEvent(QGraphicsSceneMouseEvent *);
     virtual nsEventStatus OnMouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
     virtual nsEventStatus OnFocusInEvent(QEvent *);
     virtual nsEventStatus OnFocusOutEvent(QEvent *);
     virtual nsEventStatus OnKeyPressEvent(QKeyEvent *);
     virtual nsEventStatus OnKeyReleaseEvent(QKeyEvent *);
     virtual nsEventStatus OnScrollEvent(QGraphicsSceneWheelEvent *);