Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I6cc70da737d07a87e2b396e35f64adfeffc565bd
This commit is contained in:
commit
e4c13a174a
@ -181,14 +181,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;
|
||||||
}
|
}
|
||||||
@ -208,8 +208,10 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur
|
|||||||
Qt::WindowType type = window->window()->type();
|
Qt::WindowType type = window->window()->type();
|
||||||
auto *transientParent = window->transientParent();
|
auto *transientParent = window->transientParent();
|
||||||
|
|
||||||
if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) {
|
if (type == Qt::ToolTip && transientParent) {
|
||||||
setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup);
|
setPopup(transientParent);
|
||||||
|
} else if (type == Qt::Popup && transientParent && display->lastInputDevice()) {
|
||||||
|
setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial());
|
||||||
} else {
|
} else {
|
||||||
setToplevel();
|
setToplevel();
|
||||||
if (transientParent) {
|
if (transientParent) {
|
||||||
@ -307,19 +309,12 @@ void QWaylandXdgSurfaceV6::setToplevel()
|
|||||||
m_toplevel = new Toplevel(this);
|
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);
|
Q_ASSERT(!m_toplevel && !m_popup);
|
||||||
|
|
||||||
auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface());
|
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());
|
auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner());
|
||||||
// set_popup expects a position relative to the parent
|
// set_popup expects a position relative to the parent
|
||||||
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
||||||
@ -335,7 +330,18 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice
|
|||||||
m_popup = new Popup(this, parentXdgSurface, positioner);
|
m_popup = new Popup(this, parentXdgSurface, positioner);
|
||||||
positioner->destroy();
|
positioner->destroy();
|
||||||
delete positioner;
|
delete positioner;
|
||||||
if (grab)
|
}
|
||||||
|
|
||||||
|
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);
|
m_popup->grab(device, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setToplevel();
|
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;
|
QWaylandXdgShellV6 *m_shell = nullptr;
|
||||||
QWaylandWindow *m_window = nullptr;
|
QWaylandWindow *m_window = nullptr;
|
||||||
@ -155,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;
|
||||||
};
|
};
|
||||||
|
@ -209,14 +209,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;
|
||||||
}
|
}
|
||||||
@ -236,8 +236,10 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s
|
|||||||
Qt::WindowType type = window->window()->type();
|
Qt::WindowType type = window->window()->type();
|
||||||
auto *transientParent = window->transientParent();
|
auto *transientParent = window->transientParent();
|
||||||
|
|
||||||
if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) {
|
if (type == Qt::ToolTip && transientParent) {
|
||||||
setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup);
|
setPopup(transientParent);
|
||||||
|
} else if (type == Qt::Popup && transientParent && display->lastInputDevice()) {
|
||||||
|
setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial());
|
||||||
} else {
|
} else {
|
||||||
setToplevel();
|
setToplevel();
|
||||||
if (transientParent) {
|
if (transientParent) {
|
||||||
@ -341,19 +343,12 @@ void QWaylandXdgSurface::setToplevel()
|
|||||||
m_toplevel = new Toplevel(this);
|
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);
|
Q_ASSERT(!m_toplevel && !m_popup);
|
||||||
|
|
||||||
auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
|
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());
|
auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner());
|
||||||
// set_popup expects a position relative to the parent
|
// set_popup expects a position relative to the parent
|
||||||
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
|
||||||
@ -369,7 +364,18 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d
|
|||||||
m_popup = new Popup(this, parentXdgSurface, positioner);
|
m_popup = new Popup(this, parentXdgSurface, positioner);
|
||||||
positioner->destroy();
|
positioner->destroy();
|
||||||
delete positioner;
|
delete positioner;
|
||||||
if (grab)
|
}
|
||||||
|
|
||||||
|
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);
|
m_popup->grab(device, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setToplevel();
|
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;
|
QWaylandXdgShell *m_shell = nullptr;
|
||||||
QWaylandWindow *m_window = nullptr;
|
QWaylandWindow *m_window = nullptr;
|
||||||
@ -169,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;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user