summaryrefslogtreecommitdiff
path: root/tizen/src/ui
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2016-01-25 20:46:46 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2016-01-27 16:36:42 +0900
commit8ceb9a92e47b1fba3bb0fd082429dddad7232c6b (patch)
tree2c94bd3fa92b476ae47455841dc595bf0c6003ef /tizen/src/ui
parentca41432d58ac753af9b11af688cd9d9ad183e5a4 (diff)
downloadqemu-8ceb9a92e47b1fba3bb0fd082429dddad7232c6b.tar.gz
qemu-8ceb9a92e47b1fba3bb0fd082429dddad7232c6b.tar.bz2
qemu-8ceb9a92e47b1fba3bb0fd082429dddad7232c6b.zip
mouse: synchronize mouse position between guest and host after moving
Change-Id: Ia42b64d1a89f678e9b21ed37c31a2da922c10a8f Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
Diffstat (limited to 'tizen/src/ui')
-rw-r--r--tizen/src/ui/displaybase.cpp16
-rw-r--r--tizen/src/ui/input/mousehelper.cpp34
-rw-r--r--tizen/src/ui/input/mousehelper.h11
3 files changed, 32 insertions, 29 deletions
diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp
index e57f6633cb..6db630a0c6 100644
--- a/tizen/src/ui/displaybase.cpp
+++ b/tizen/src/ui/displaybase.cpp
@@ -283,7 +283,7 @@ void DisplayBase::handleMousePress(QMouseEvent *event)
tsHelper->mousePressed(event, getGuestPos(event->pos()));
}
if (mouseHelper != NULL) {
- mouseHelper->mousePressed(event);
+ mouseHelper->mousePressed();
}
}
}
@@ -295,6 +295,10 @@ void DisplayBase::handleMouseRelease(QMouseEvent *event)
releaseWindow();
win->turnOffMovingMode();
+
+ if (mouseHelper != NULL) {
+ mouseHelper->mouseSync(getGuestPos(event->pos()));
+ }
return;
}
@@ -307,7 +311,7 @@ void DisplayBase::handleMouseRelease(QMouseEvent *event)
tsHelper->mouseReleased(event, getGuestPos(event->pos()));
}
if (mouseHelper != NULL) {
- mouseHelper->mouseReleased(event);
+ mouseHelper->mouseReleased();
}
}
}
@@ -369,12 +373,12 @@ void DisplayBase::handleMouseMove(QMouseEvent *event)
qDebug("drag out: auto release");
isDragging = false;
- mouseHelper->mouseReleased(event);
+ mouseHelper->mouseReleased();
return;
}
}
- mouseHelper->mouseMoved(event,
+ mouseHelper->mouseMoved(
event->pos(), getGuestPos(event->pos()));
}
}
@@ -383,7 +387,7 @@ void DisplayBase::handleMouseMove(QMouseEvent *event)
void DisplayBase::handleMouseEnter(QEvent *event)
{
if (mouseHelper != NULL) {
- mouseHelper->mouseEnter(event);
+ mouseHelper->mouseEnter();
}
}
@@ -391,7 +395,7 @@ void DisplayBase::handleMouseEnter(QEvent *event)
void DisplayBase::handleMouseLeave(QEvent *event)
{
if (mouseHelper != NULL) {
- mouseHelper->mouseLeave(event);
+ mouseHelper->mouseLeave();
}
}
diff --git a/tizen/src/ui/input/mousehelper.cpp b/tizen/src/ui/input/mousehelper.cpp
index 297fbd754c..61a22f90ad 100644
--- a/tizen/src/ui/input/mousehelper.cpp
+++ b/tizen/src/ui/input/mousehelper.cpp
@@ -58,22 +58,27 @@ void *MouseHelper::getParent()
return parent;
}
-void MouseHelper::mousePressed(QMouseEvent *event)
+void MouseHelper::mouseSync(QPoint guestPos)
{
- Q_UNUSED(event);
+ qDebug("sync");
- do_mouse_event(1, PS2_PRESS, 0, 0, 0, 0, 0);
+ /* absoluteness coordinates */
+ prevX = guestPos.x();
+ prevY = guestPos.y();
+ maru_tablet_event(INPUT_MOVE, prevX, prevY, 0, 0);
}
-void MouseHelper::mouseReleased(QMouseEvent *event)
+void MouseHelper::mousePressed()
{
- Q_UNUSED(event);
+ do_mouse_event(1, PS2_PRESS, 0, 0, 0, 0, 0);
+}
+void MouseHelper::mouseReleased()
+{
do_mouse_event(1, PS2_RELEASE, 0, 0, 0, 0, 0);
}
-void MouseHelper::mouseMoved(QMouseEvent *event,
- QPoint hostPos, QPoint guestPos)
+void MouseHelper::mouseMoved(QPoint hostPos, QPoint guestPos)
{
const int absX = guestPos.x();
const int absY = guestPos.y();
@@ -86,9 +91,7 @@ void MouseHelper::mouseMoved(QMouseEvent *event,
if (tv.tv_sec - lastMouseTime.tv_sec > CURSOR_RESET_TIME ||
mouseStatus != MOUSE_ENTERED)
{
- maru_tablet_event(INPUT_MOVE, absX, absY, 0, 0);
- prevX = absX;
- prevY = absY;
+ mouseSync(guestPos);
mouseStatus = MOUSE_ENTERED;
}
gettimeofday(&lastMouseTime, NULL);
@@ -98,29 +101,24 @@ void MouseHelper::mouseMoved(QMouseEvent *event,
prevY = qMin(resolution.height(), prevY);
prevY = qMax(0, prevY);
- /* relative positioning */
+ /* relative coordinates */
const int relX = absX - prevX;
const int relY = absY - prevY;
-
do_mouse_event(1, MOUSE_MOVE, hostPos.x(), hostPos.y(), relX, relY, 0);
prevX = absX;
prevY = absY;
}
-void MouseHelper::mouseEnter(QEvent *event)
+void MouseHelper::mouseEnter()
{
- Q_UNUSED(event);
-
if (mouseStatus == MOUSE_LEAVE) {
mouseStatus = MOUSE_ENTER;
}
}
-void MouseHelper::mouseLeave(QEvent *event)
+void MouseHelper::mouseLeave()
{
- Q_UNUSED(event);
-
mouseStatus = MOUSE_LEAVE;
}
diff --git a/tizen/src/ui/input/mousehelper.h b/tizen/src/ui/input/mousehelper.h
index 3bcb12729d..48bc3b9936 100644
--- a/tizen/src/ui/input/mousehelper.h
+++ b/tizen/src/ui/input/mousehelper.h
@@ -59,12 +59,13 @@ public:
void *getParent();
- void mousePressed(QMouseEvent *event);
- void mouseReleased(QMouseEvent *event);
- void mouseMoved(QMouseEvent *event, QPoint hostPos, QPoint guestPos);
+ void mouseSync(QPoint guestPos);
+ void mousePressed();
+ void mouseReleased();
+ void mouseMoved(QPoint hostPos, QPoint guestPos);
- void mouseEnter(QEvent *event);
- void mouseLeave(QEvent *event);
+ void mouseEnter();
+ void mouseLeave();
private:
void *parent;