diff options
11 files changed, 82 insertions, 51 deletions
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 0dd8d7af..43ccc0a9 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -195,6 +195,11 @@ private: void requestWaylandSync(); struct Listener { + Listener() = default; + Listener(RegistryListener incomingListener, + void* incomingData) + : listener(incomingListener), data(incomingData) + {} RegistryListener listener = nullptr; void *data = nullptr; }; diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 37c6fbe9..9d675ae2 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -451,10 +451,6 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); -#if QT_CONFIG(cursor) - window->window()->setCursor(window->window()->cursor()); -#endif - mFocus = window; mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -462,6 +458,11 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf mParent->mSerial = serial; mEnterSerial = serial; +#if QT_CONFIG(cursor) + // Depends on mEnterSerial being updated + window->window()->setCursor(window->window()->cursor()); +#endif + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { EnterEvent evt(mSurfacePos, mGlobalPos); diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index a5de3a90..77a9247a 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -884,17 +884,17 @@ void QWaylandQuickItem::handleSurfaceChanged() { Q_D(QWaylandQuickItem); if (d->oldSurface) { - disconnect(d->oldSurface, &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged); - disconnect(d->oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged); - disconnect(d->oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize); - disconnect(d->oldSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize); - disconnect(d->oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer); - disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update); - disconnect(d->oldSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded); - disconnect(d->oldSurface, &QWaylandSurface::subsurfacePlaceAbove, this, &QWaylandQuickItem::handlePlaceAbove); - disconnect(d->oldSurface, &QWaylandSurface::subsurfacePlaceBelow, this, &QWaylandQuickItem::handlePlaceBelow); + disconnect(d->oldSurface.data(), &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged); + disconnect(d->oldSurface.data(), &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged); + disconnect(d->oldSurface.data(), &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize); + disconnect(d->oldSurface.data(), &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize); + disconnect(d->oldSurface.data(), &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer); + disconnect(d->oldSurface.data(), &QWaylandSurface::redraw, this, &QQuickItem::update); + disconnect(d->oldSurface.data(), &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded); + disconnect(d->oldSurface.data(), &QWaylandSurface::subsurfacePlaceAbove, this, &QWaylandQuickItem::handlePlaceAbove); + disconnect(d->oldSurface.data(), &QWaylandSurface::subsurfacePlaceBelow, this, &QWaylandQuickItem::handlePlaceBelow); #if QT_CONFIG(draganddrop) - disconnect(d->oldSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted); + disconnect(d->oldSurface.data(), &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted); #endif #if QT_CONFIG(im) disconnect(d->oldSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod); diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp index f6b87fb9..b6398f06 100644 --- a/src/compositor/extensions/qwaylandivisurface.cpp +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -45,6 +45,7 @@ #endif #include <QtWaylandCompositor/QWaylandResource> +#include <QDebug> QT_BEGIN_NAMESPACE diff --git a/src/compositor/extensions/qwaylandxdgshell_p.h b/src/compositor/extensions/qwaylandxdgshell_p.h index 5ef8bde3..9d1140fb 100644 --- a/src/compositor/extensions/qwaylandxdgshell_p.h +++ b/src/compositor/extensions/qwaylandxdgshell_p.h @@ -136,6 +136,12 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelPrivate : public QObjectPri Q_DECLARE_PUBLIC(QWaylandXdgToplevel) public: struct ConfigureEvent { + ConfigureEvent() = default; + ConfigureEvent(const QVector<QWaylandXdgToplevel::State> + &incomingStates, + const QSize &incomingSize, uint incomingSerial) + : states(incomingStates), size(incomingSize), serial(incomingSerial) + { } QVector<QWaylandXdgToplevel::State> states; QSize size = {0, 0}; uint serial = 0; diff --git a/src/compositor/extensions/qwaylandxdgshellv6_p.h b/src/compositor/extensions/qwaylandxdgshellv6_p.h index e763f6ab..adc25cb7 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6_p.h +++ b/src/compositor/extensions/qwaylandxdgshellv6_p.h @@ -135,6 +135,12 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelV6Private : public QObjectP Q_DECLARE_PUBLIC(QWaylandXdgToplevelV6) public: struct ConfigureEvent { + ConfigureEvent() = default; + ConfigureEvent(const QVector<QWaylandXdgToplevelV6::State> + &incomingStates, + const QSize &incomingSize, uint incomingSerial) + : states(incomingStates), size(incomingSize), serial(incomingSerial) + { } QVector<QWaylandXdgToplevelV6::State> states; QSize size = {0, 0}; uint serial = 0; diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index c055cbb1..9e55e3e1 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -172,14 +172,14 @@ QWaylandXdgSurfaceV6::Popup::~Popup() if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostPopup == this); - shell->m_topmostPopup = m_parent->m_popup; + Q_ASSERT(shell->m_topmostGrabbingPopup == this); + shell->m_topmostGrabbingPopup = m_parent->m_popup; } } void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) { - m_xdgSurface->m_shell->m_topmostPopup = this; + m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; zxdg_popup_v6::grab(seat->wl_seat(), serial); m_grabbing = true; } @@ -199,8 +199,10 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + if (type == Qt::ToolTip && transientParent) { + setPopup(transientParent); + } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { + setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); } else { setToplevel(); if (transientParent) { @@ -304,19 +306,12 @@ void QWaylandXdgSurfaceV6::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; - if (grab && top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; - parentXdgSurface = top->m_xdgSurface; - parent = top->m_xdgSurface->m_window; - } - auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -332,8 +327,19 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) - m_popup->grab(device, serial); +} + +void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface()); + auto *top = m_shell->m_topmostGrabbingPopup; + + if (top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + parent = top->m_xdgSurface->m_window; + } + setPopup(parent); + m_popup->grab(device, serial); } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 874dba01..659aad04 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -131,7 +131,8 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); + void setPopup(QWaylandWindow *parent); + void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandXdgShellV6 *m_shell = nullptr; QWaylandWindow *m_window = nullptr; @@ -155,7 +156,7 @@ public: private: void zxdg_shell_v6_ping(uint32_t serial) override; - QWaylandXdgSurfaceV6::Popup *m_topmostPopup = nullptr; + QWaylandXdgSurfaceV6::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurfaceV6; }; diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 014b6bed..1310e340 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -200,14 +200,14 @@ QWaylandXdgSurface::Popup::~Popup() if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostPopup == this); - shell->m_topmostPopup = m_parent->m_popup; + Q_ASSERT(shell->m_topmostGrabbingPopup == this); + shell->m_topmostGrabbingPopup = m_parent->m_popup; } } void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) { - m_xdgSurface->m_shell->m_topmostPopup = this; + m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; xdg_popup::grab(seat->wl_seat(), serial); m_grabbing = true; } @@ -227,8 +227,10 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + if (type == Qt::ToolTip && transientParent) { + setPopup(transientParent); + } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { + setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); } else { setToplevel(); if (transientParent) { @@ -338,19 +340,12 @@ void QWaylandXdgSurface::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) +void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; - if (grab && top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; - parentXdgSurface = top->m_xdgSurface; - parent = top->m_xdgSurface->m_window; - } - auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -366,8 +361,19 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) - m_popup->grab(device, serial); +} + +void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface()); + auto *top = m_shell->m_topmostGrabbingPopup; + + if (top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + parent = top->m_xdgSurface->m_window; + } + setPopup(parent); + m_popup->grab(device, serial); } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 5e97a34b..741b83cf 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -138,7 +138,8 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); + void setPopup(QWaylandWindow *parent); + void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandXdgShell *m_shell = nullptr; QWaylandWindow *m_window = nullptr; @@ -169,7 +170,7 @@ private: QWaylandDisplay *m_display = nullptr; QScopedPointer<QWaylandXdgDecorationManagerV1> m_xdgDecorationManager; - QWaylandXdgSurface::Popup *m_topmostPopup = nullptr; + QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurface; }; diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp index f2e2d24d..57f3f1a9 100644 --- a/src/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/qtwaylandscanner/qtwaylandscanner.cpp @@ -126,7 +126,7 @@ private: bool Scanner::parseArguments(int argc, char **argv) { - QByteArray m_scannerName = argv[0]; + m_scannerName = argv[0]; if (argc <= 2 || !parseOption(argv[1])) return false; @@ -1200,8 +1200,6 @@ bool Scanner::process() for (int i = 0; i < e.arguments.size(); ++i) { printf("\n"); const WaylandArgument &a = e.arguments.at(i); - QByteArray cType = waylandToCType(a.type, a.interface); - QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); const char *argumentName = a.name.constData(); if (a.type == "string") printf(" QString::fromUtf8(%s)", argumentName); |