Client: Rename m_topmostPopup to clarify its goal

This is used when creating new grabbed popups to ensure they are only
created on the topmost grabbing popup as per the specification.

Non-grabbing popups don't have this restriction.

Change-Id: I8e2b8cd0f091688c847f81f2e5d33ce2f0df96a1
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
David Edmundson 2018-11-12 10:14:33 +00:00
parent 27d39e7b3a
commit 3684b83589
4 changed files with 10 additions and 10 deletions

View File

@ -172,14 +172,14 @@ QWaylandXdgSurfaceV6::Popup::~Popup()
if (m_grabbing) { if (m_grabbing) {
auto *shell = m_xdgSurface->m_shell; auto *shell = m_xdgSurface->m_shell;
Q_ASSERT(shell->m_topmostPopup == this); Q_ASSERT(shell->m_topmostGrabbingPopup == this);
shell->m_topmostPopup = m_parent->m_popup; shell->m_topmostGrabbingPopup = m_parent->m_popup;
} }
} }
void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) 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); zxdg_popup_v6::grab(seat->wl_seat(), serial);
m_grabbing = true; m_grabbing = true;
} }
@ -332,7 +332,7 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent)
void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
{ {
auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface()); auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface());
auto *top = m_shell->m_topmostPopup; auto *top = m_shell->m_topmostGrabbingPopup;
if (top && top->m_xdgSurface != parentXdgSurface) { if (top && top->m_xdgSurface != parentXdgSurface) {
qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off.";

View File

@ -156,7 +156,7 @@ public:
private: private:
void zxdg_shell_v6_ping(uint32_t serial) override; void zxdg_shell_v6_ping(uint32_t serial) override;
QWaylandXdgSurfaceV6::Popup *m_topmostPopup = nullptr; QWaylandXdgSurfaceV6::Popup *m_topmostGrabbingPopup = nullptr;
friend class QWaylandXdgSurfaceV6; friend class QWaylandXdgSurfaceV6;
}; };

View File

@ -200,14 +200,14 @@ QWaylandXdgSurface::Popup::~Popup()
if (m_grabbing) { if (m_grabbing) {
auto *shell = m_xdgSurface->m_shell; auto *shell = m_xdgSurface->m_shell;
Q_ASSERT(shell->m_topmostPopup == this); Q_ASSERT(shell->m_topmostGrabbingPopup == this);
shell->m_topmostPopup = m_parent->m_popup; shell->m_topmostGrabbingPopup = m_parent->m_popup;
} }
} }
void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) 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); xdg_popup::grab(seat->wl_seat(), serial);
m_grabbing = true; m_grabbing = true;
} }
@ -366,7 +366,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
{ {
auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface()); auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
auto *top = m_shell->m_topmostPopup; auto *top = m_shell->m_topmostGrabbingPopup;
if (top && top->m_xdgSurface != parentXdgSurface) { if (top && top->m_xdgSurface != parentXdgSurface) {
qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off.";

View File

@ -170,7 +170,7 @@ private:
QWaylandDisplay *m_display = nullptr; QWaylandDisplay *m_display = nullptr;
QScopedPointer<QWaylandXdgDecorationManagerV1> m_xdgDecorationManager; QScopedPointer<QWaylandXdgDecorationManagerV1> m_xdgDecorationManager;
QWaylandXdgSurface::Popup *m_topmostPopup = nullptr; QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr;
friend class QWaylandXdgSurface; friend class QWaylandXdgSurface;
}; };