summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <[email protected]>2025-08-19 14:33:26 +0200
committerAllan Sandfeld Jensen <[email protected]>2025-08-20 13:44:46 +0200
commite13f11bba728d28e557e26cbf442e16fa4a2378d (patch)
tree543462df0a419f2f749e6f1c708aeea5e4af0048 /src/plugins
parent1c26d20b3f87a3b59eb6eb12a00c17d35df736f1 (diff)
Handle top-level Tool windowsHEADdev
Undo most Qt::Tool and Qt::Popup overlap, and keep just basic logic of dealing with transientsParents and positioning. Amends 4eba0b5305a585e4454e1935bd93b8e1b3b71681 Pick-to: 6.10 Fixes: QTBUG-139250 Change-Id: I0ea4275740f41b54f0604fced86ec828919c3ae7 Reviewed-by: David Edmundson <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp7
-rw-r--r--src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp2
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp18
3 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index c96ac2855b4..03d8d330578 100644
--- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -333,7 +333,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s
if (type == Qt::ToolTip)
setPopup(transientParent);
- else if (type == Qt::Popup || type == Qt::Tool)
+ else if (type == Qt::Popup)
setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial());
else
setToplevel();
@@ -599,10 +599,11 @@ bool QWaylandXdgSurface::requestActivate()
bool QWaylandXdgSurface::requestActivateOnShow()
{
- const Qt::WindowFlags flags = m_window->window()->flags();
- if (flags.testFlag(Qt::Popup))
+ const Qt::WindowType type = m_window->window()->type();
+ if (type == Qt::ToolTip || type == Qt::Popup || type == Qt::SplashScreen)
return false;
+ const Qt::WindowFlags flags = m_window->window()->flags();
if (flags & Qt::WindowDoesNotAcceptFocus)
return false;
diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
index 47fdf0e1ffc..90a5965bba6 100644
--- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
+++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
@@ -55,7 +55,7 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi
return new QWaylandShellSurface(window);
}
- if ((type == Qt::Popup || type == Qt::Tool) && (!transientParent || !display->lastInputDevice())) {
+ if (type == Qt::Popup && (!transientParent || !display->lastInputDevice())) {
qCWarning(lcQpaWayland) << "Failed to create grabbing popup. Ensure popup " << window->window() << "has a transientParent set and that parent window has received input.";
QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::AsynchronousDelivery>(window->window());
return new QWaylandShellSurface(window);
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index ba98e579e39..cc32eb4d1e9 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -121,7 +121,7 @@ void QWaylandWindow::initWindow()
Q_ASSERT(mShellIntegration);
mTransientParent = guessTransientParent();
if (mTransientParent) {
- if (window()->type() == Qt::Popup || window()->type() == Qt::Tool) {
+ if (window()->type() == Qt::Popup) {
if (mTopPopup && mTopPopup != mTransientParent) {
qCWarning(lcQpaWayland) << "Creating a popup with a parent," << mTransientParent->window()
<< "which does not match the current topmost grabbing popup,"
@@ -346,9 +346,7 @@ void QWaylandWindow::resetSurfaceRole()
closeChildPopups();
if (mTopPopup == this)
- mTopPopup = mTransientParent &&
- (mTransientParent->window()->type() == Qt::Popup || mTransientParent->window()->type() == Qt::Tool)
- ? mTransientParent : nullptr;
+ mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr;
if (mTransientParent)
mTransientParent->removeChildPopup(this);
mTransientParent = nullptr;
@@ -479,7 +477,8 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
void QWaylandWindow::setGeometry(const QRect &r)
{
auto rect = r;
- if (fixedToplevelPositions && !QPlatformWindow::parent() && !window()->flags().testFlag(Qt::Popup)) {
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
+ && window()->type() != Qt::ToolTip && window()->type() != Qt::Tool) {
rect.moveTo(screen()->geometry().topLeft());
}
setGeometry_helper(rect);
@@ -1219,12 +1218,12 @@ QWaylandWindow *QWaylandWindow::guessTransientParent() const
if (auto transientParent = closestShellSurfaceWindow(window()->transientParent()))
return transientParent;
- if (window()->type() == Qt::Popup || window()->type() == Qt::Tool) {
+ if (window()->type() == Qt::Popup) {
if (mTopPopup)
return mTopPopup;
}
- if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup || window()->type() == Qt::Tool) {
+ if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) {
if (auto lastInputWindow = display()->lastInputWindow())
return closestShellSurfaceWindow(lastInputWindow->window());
}
@@ -1499,7 +1498,8 @@ void QWaylandWindow::handleScreensChanged()
QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(window(), newScreen->QPlatformScreen::screen());
- if (fixedToplevelPositions && !QPlatformWindow::parent() && !window()->flags().testFlag(Qt::Popup)
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
+ && window()->type() != Qt::ToolTip && window()->type() != Qt::Tool
&& geometry().topLeft() != newScreen->geometry().topLeft()) {
auto geometry = this->geometry();
geometry.moveTo(newScreen->geometry().topLeft());
@@ -1649,7 +1649,7 @@ qreal QWaylandWindow::devicePixelRatio() const
bool QWaylandWindow::setMouseGrabEnabled(bool grab)
{
- if (window()->type() != Qt::Popup && window()->type() != Qt::Tool) {
+ if (window()->type() != Qt::Popup) {
qWarning("This plugin supports grabbing the mouse only for popup windows");
return false;
}