Commit 2d8b4e1d authored by David Edmundson's avatar David Edmundson

Don't autohide panel if a child window is open

Summary:
This is meant as a more generic fix for the autohide panels, actually
looking to see what transient windows we have open.

The problem with the current fixes (D6555) being posted is that we
potentially get attentionStatus in a corrupt status as we cache the
value but it might change externally whilst that window is open.

Also saves duplicating code in a bunch of places.

Test Plan:
Set autohide
Opened a context menu in task manager didn't autohide, till I closed it
Closing menu whilst keeping mouse in the panel doesn't auto hide it
until we move out after.
Hovering over TM tooltip keeps autohide from closing (another fix)

BUG: 352459
BUG: 347855
BUG: 351823

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6577
parent 930e8f96
......@@ -30,6 +30,7 @@
#include <QScreen>
#include <QQmlEngine>
#include <QQmlContext>
#include <QGuiApplication>
#include <QTimer>
#include <kactioncollection.h>
......@@ -613,6 +614,7 @@ void PanelView::showConfigurationInterface(Plasma::Applet *applet)
void PanelView::restoreAutoHide()
{
bool autoHide = true;
disconnect(m_transientWindowVisibleWatcher);
if (!edgeActivated()) {
autoHide = false;
......@@ -626,6 +628,14 @@ void PanelView::restoreAutoHide()
else if (containment() && containment()->status() >= Plasma::Types::NeedsAttentionStatus &&
containment()->status() != Plasma::Types::HiddenStatus) {
autoHide = false;
} else {
for(QWindow *window: qApp->topLevelWindows()) {
if (window->transientParent() == this && window->isVisible()) {
m_transientWindowVisibleWatcher = connect(window, &QWindow::visibleChanged, this, &PanelView::restoreAutoHide);
autoHide = false;
break; //if multiple are open, we will re-evaluate this expression after the first closes
}
}
}
setAutoHideEnabled(autoHide);
......
......@@ -236,6 +236,7 @@ private:
KWayland::Client::PlasmaShellSurface *m_shellSurface;
QPointer<QScreen> m_lastScreen;
QPointer<QScreen> m_screenToFollow;
QMetaObject::Connection m_transientWindowVisibleWatcher;
static const int STRUTSTIMERDELAY = 200;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment