Bug 631170 - mouse hover broken in Qt build r=romaxa a=npodb

This commit is contained in:
Florian Hanel 2011-02-03 23:27:01 +02:00
parent b7fac673c5
commit c1825cc564
4 changed files with 8 additions and 6 deletions

View File

@ -87,6 +87,7 @@ MozQWidget::MozQWidget(nsWindow* aReceiver, QGraphicsItem* aParent)
setFlag(QGraphicsItem::ItemAcceptsInputMethod);
setAcceptTouchEvents(true);
#endif
setAcceptHoverEvents(true);
}
MozQWidget::~MozQWidget()
@ -176,7 +177,7 @@ void MozQWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent* aEvent)
void MozQWidget::hoverMoveEvent(QGraphicsSceneHoverEvent* aEvent)
{
mReceiver->OnMoveEvent(aEvent);
mReceiver->OnMotionNotifyEvent(aEvent->pos(), aEvent->modifiers());
}
void MozQWidget::keyPressEvent(QKeyEvent* aEvent)
@ -318,7 +319,7 @@ void MozQWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* aEvent)
void MozQWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* aEvent)
{
mReceiver->OnMotionNotifyEvent(aEvent);
mReceiver->OnMotionNotifyEvent(aEvent->pos(), aEvent->modifiers());
}
void MozQWidget::mousePressEvent(QGraphicsSceneMouseEvent* aEvent)

View File

@ -193,6 +193,7 @@ public:
, mTopLevelWidget(aTopLevel)
{
scene()->addItem(aTopLevel);
setMouseTracking(true);
}
protected:

View File

@ -1255,14 +1255,14 @@ 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();

View File

@ -271,7 +271,7 @@ protected:
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 *);