summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2012-08-26 21:55:37 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-08-27 14:30:39 +0200
commitc5df6afaf32cd8506771fa5619cf3a1d004a7876 (patch)
tree6610e50d09f4b714e41223781004ef34f14d7e46
parentec187fe3673dafa395d433319f112090e3603523 (diff)
Fix mouse input in WaylandSurfaceItem.
Mouse input is fixed by passing global coordinates to the mouse events, now windows can be moved by a QML-based compositor. Also, all the mouse buttons are accepted. Change-Id: Ib4cdca047ffffcc2a89a23847c813d34387ca591 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
-rw-r--r--src/compositor/compositor_api/waylandsurfaceitem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compositor/compositor_api/waylandsurfaceitem.cpp b/src/compositor/compositor_api/waylandsurfaceitem.cpp
index 6a6d8c61..f081e46b 100644
--- a/src/compositor/compositor_api/waylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/waylandsurfaceitem.cpp
@@ -132,7 +132,11 @@ void WaylandSurfaceItem::init(WaylandSurface *surface)
setSmooth(true);
setFlag(ItemHasContents);
- setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
+ setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
+ Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
+ Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
+ Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
+ Qt::ExtraButton12 | Qt::ExtraButton13);
setAcceptHoverEvents(true);
connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped()));
@@ -192,7 +196,7 @@ void WaylandSurfaceItem::mousePressEvent(QMouseEvent *event)
WaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
if (inputDevice->mouseFocus() != m_surface)
inputDevice->setMouseFocus(m_surface, event->pos(), event->globalPos());
- inputDevice->sendMousePressEvent(event->button(), toSurface(event->pos()));
+ inputDevice->sendMousePressEvent(event->button(), toSurface(event->pos()), event->globalPos());
}
}
@@ -200,7 +204,7 @@ void WaylandSurfaceItem::mouseMoveEvent(QMouseEvent *event)
{
if (m_surface){
WaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
- inputDevice->sendMouseMoveEvent(m_surface, toSurface(event->pos()));
+ inputDevice->sendMouseMoveEvent(m_surface, toSurface(event->pos()), event->globalPos());
}
}
@@ -208,7 +212,7 @@ void WaylandSurfaceItem::mouseReleaseEvent(QMouseEvent *event)
{
if (m_surface){
WaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
- inputDevice->sendMouseReleaseEvent(event->button(), toSurface(event->pos()));
+ inputDevice->sendMouseReleaseEvent(event->button(), toSurface(event->pos()), event->globalPos());
}
}