Skip to content

Commit

Permalink
Add mouse hover support in CardHostWindow
Browse files Browse the repository at this point in the history
Open-webOS-DCO-1.0-Signed-off-by: Jose Dapena Paz <[email protected]>

Change-Id: Ia4800f621bfb937bc92114455c8437bea70c6648
  • Loading branch information
Jose Dapena Paz committed Mar 5, 2013
1 parent 26abd04 commit 64c7b6f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Src/lunaui/cards/CardHostWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CardHostWindow::CardHostWindow(WindowType::Type type, HostWindowData* data, IpcC
m_prepareAddedToWm = true; // host windows don't get prepared
m_touchEventsEnabled = true;
setAcceptTouchEvents(true);
setAcceptHoverEvents(true);

int animationStrength = AS(cardTransitionCurve);
m_rotateEquation = AS_EASEOUT(animationStrength);
Expand Down Expand Up @@ -655,6 +656,24 @@ void CardHostWindow::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
event->accept();
}

void CardHostWindow::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
{
event->accept();

Event evt;
evt.type = Event::MouseHover;
QPointF oldPos = pos() + event->lastScenePos();
evt.mouseHoverOldX = oldPos.x();
evt.mouseHoverOldY = oldPos.y();
QPointF newPos = pos() + event->scenePos();
evt.mouseHoverX = newPos.x();
evt.mouseHoverY = newPos.y();
evt.time = Time::curSysTimeMs();
if (m_channel)
m_channel->sendAsyncMessage(new View_InputEvent(routingId(),
SysMgrEventWrapper(&evt)));
}

void CardHostWindow::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
event->accept();
Expand Down
1 change: 1 addition & 0 deletions Src/lunaui/cards/CardHostWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Q_OBJECT
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
virtual void refreshAdjustmentAngle();
virtual void onSetAppFixedOrientation(int orientation, bool isPortrait);
Expand Down

0 comments on commit 64c7b6f

Please sign in to comment.