summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandwlshellintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/extensions/qwaylandwlshellintegration.cpp')
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index a1ef5f32a..1acc01dd7 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
QT_BEGIN_NAMESPACE
@@ -60,28 +60,39 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item)
connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed);
}
-void WlShellIntegration::handleStartMove(QWaylandInputDevice *inputDevice)
+void WlShellIntegration::handleStartMove(QWaylandSeat *seat)
{
grabberState = GrabberState::Move;
- moveState.inputDevice = inputDevice;
+ moveState.seat = seat;
moveState.initialized = false;
}
-void WlShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges)
+void WlShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges)
{
grabberState = GrabberState::Resize;
- resizeState.inputDevice = inputDevice;
+ resizeState.seat = seat;
resizeState.resizeEdges = edges;
float scaleFactor = m_item->view()->output()->scaleFactor();
resizeState.initialSize = m_shellSurface->surface()->size() / scaleFactor;
resizeState.initialized = false;
}
-void WlShellIntegration::handleSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent)
+void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent)
{
- Q_UNUSED(inputDevice);
+ Q_UNUSED(seat);
+
+ // Find the parent item on the same output
+ QWaylandQuickShellSurfaceItem *parentItem = nullptr;
+ Q_FOREACH (QWaylandView *view, parent->views()) {
+ if (view->output() == m_item->view()->output()) {
+ QWaylandQuickShellSurfaceItem *item = qobject_cast<QWaylandQuickShellSurfaceItem*>(view->renderObject());
+ if (item) {
+ parentItem = item;
+ break;
+ }
+ }
+ }
- QWaylandQuickShellSurfaceItem* parentItem = qobject_cast<QWaylandQuickShellSurfaceItem*>(parent->views().first()->renderObject());
if (parentItem) {
// Clear all the transforms for this ShellSurfaceItem. They are not
// applicable when the item becomes a child to a surface that has its
@@ -100,8 +111,8 @@ void WlShellIntegration::handleSetPopup(QWaylandInputDevice *inputDevice, QWayla
if (!popupShellSurfaces.contains(m_shellSurface)) {
popupShellSurfaces.append(m_shellSurface);
- QObject::connect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
}
@@ -109,8 +120,8 @@ void WlShellIntegration::handlePopupClosed()
{
handlePopupRemoved();
if (m_shellSurface)
- QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
void WlShellIntegration::handlePopupRemoved()
@@ -130,7 +141,7 @@ void WlShellIntegration::handleShellSurfaceDestroyed()
m_shellSurface = nullptr;
}
-void WlShellIntegration::handleSurfaceUnmapped()
+void WlShellIntegration::handleSurfaceHasContentChanged()
{
if (!m_shellSurface || !m_shellSurface->surface()->size().isEmpty())
return;
@@ -147,7 +158,7 @@ void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset)
bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
{
if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
if (!resizeState.initialized) {
resizeState.initialMousePos = event->windowPos();
resizeState.initialized = true;
@@ -158,7 +169,7 @@ bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges);
m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges);
} else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
QQuickItem *moveItem = m_item->moveItem();
if (!moveState.initialized) {
moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());