[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace/Plasma/5.8] shell: Don't set PanelView visibilty when opening/closing config
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2016-11-22 10:29:28
Message-ID: E1c98KO-0001tt-0Z () code ! kde ! org
[Download RAW message or body]

Git commit 7248a71a959f2099a4c27533c5316345c1a11fa1 by David Edmundson.
Committed on 22/11/2016 at 10:29.
Pushed by davidedmundson into branch 'Plasma/5.8'.

Don't set PanelView visibilty when opening/closing config

Summary:
    Instead of making PanelViewConfig manipulate the visibiltyMode of
    PanelView, make PanelView force the view to be visible whilst the
config
    is open.

    This is cleaner as it doesn't alter the original config, and
resolves a
    bug that opening configure with an autohide panel would shift
contents
    about.

Test Plan:
With panel as autohide opened config
Moused away from panel, panel stayed visible

With panel as autohide, plugged in a USB pen - panel appeared - and
closed when I hid the dialog

Changed mode in panel config, panel didn't immediately change - but did
on close.
Tested with all modes.

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: mart, plasma-devel

Tags: #plasma
BUG: 372248

Differential Revision: https://phabricator.kde.org/D3408

M  +2    -15   shell/panelconfigview.cpp
M  +0    -1    shell/panelconfigview.h
M  +28   -9    shell/panelview.cpp

http://commits.kde.org/plasma-workspace/7248a71a959f2099a4c27533c5316345c1a11fa1

diff --git a/shell/panelconfigview.cpp b/shell/panelconfigview.cpp
index ac24764..98db1e8 100644
--- a/shell/panelconfigview.cpp
+++ b/shell/panelconfigview.cpp
@@ -49,8 +49,6 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, \
PanelView *pa  {
     connect(panelView, &QObject::destroyed, this, &QObject::deleteLater);
 
-    m_visibilityMode = panelView->visibilityMode();
-
     setScreen(panelView->screen());
 
     connect(panelView, SIGNAL(screenChanged(QScreen *)), &m_screenSyncTimer, \
SLOT(start())); @@ -83,9 +81,6 @@ \
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa  
 PanelConfigView::~PanelConfigView()
 {
-    if (m_panelView) {
-        m_panelView->setVisibilityMode(m_visibilityMode);
-    }
 }
 
 void PanelConfigView::init()
@@ -209,16 +204,12 @@ void PanelConfigView::showEvent(QShowEvent *ev)
         m_containment->setUserConfiguring(true);
     }
 
-    if (m_visibilityMode != PanelView::NormalPanel) {
-        m_panelView->setVisibilityMode(PanelView::WindowsGoBelow);
-    }
     PanelShadows::self()->addWindow(this, m_enabledBorders);
 }
 
 void PanelConfigView::hideEvent(QHideEvent *ev)
 {
     QQuickWindow::hideEvent(ev);
-    m_panelView->setVisibilityMode(m_visibilityMode);
 
     if (m_containment) {
         m_containment->setUserConfiguring(false);
@@ -280,17 +271,13 @@ bool PanelConfigView::event(QEvent *e)
 
 void PanelConfigView::setVisibilityMode(PanelView::VisibilityMode mode)
 {
-    if (m_visibilityMode == mode) {
-        return;
-    }
-
-    m_visibilityMode = mode;
+    m_panelView->setVisibilityMode(mode);
     emit visibilityModeChanged();
 }
 
 PanelView::VisibilityMode PanelConfigView::visibilityMode() const
 {
-    return m_visibilityMode;
+    return m_panelView->visibilityMode();
 }
 
 Plasma::FrameSvg::EnabledBorders PanelConfigView::enabledBorders() const
diff --git a/shell/panelconfigview.h b/shell/panelconfigview.h
index a32157f..4716bac 100644
--- a/shell/panelconfigview.h
+++ b/shell/panelconfigview.h
@@ -87,7 +87,6 @@ Q_SIGNALS:
 private:
     Plasma::Containment *m_containment;
     QPointer<PanelView> m_panelView;
-    PanelView::VisibilityMode m_visibilityMode;
     Plasma::FrameSvg::EnabledBorders m_enabledBorders = \
Plasma::FrameSvg::AllBorders;  Plasma::Theme m_theme;
     QTimer m_screenSyncTimer;
diff --git a/shell/panelview.cpp b/shell/panelview.cpp
index f3c3cd0..0530032 100644
--- a/shell/panelview.cpp
+++ b/shell/panelview.cpp
@@ -320,6 +320,7 @@ void PanelView::setVisibilityMode(PanelView::VisibilityMode mode)
     updateStruts();
 
     emit visibilityModeChanged();
+
     restoreAutoHide();
 }
 
@@ -562,13 +563,23 @@ void PanelView::showConfigurationInterface(Plasma::Applet \
*applet)  
 void PanelView::restoreAutoHide()
 {
-    setAutoHideEnabled(edgeActivated()
-        && (!containment() ||
-                (containment()->status() < Plasma::Types::RequiresAttentionStatus
-                 || containment()->status() == Plasma::Types::HiddenStatus)
-                )
-        && !geometry().contains(QCursor::pos(screenToFollow()))
-    );
+    bool autoHide = true;
+
+    if (!edgeActivated()) {
+        autoHide = false;
+    }
+    else if (geometry().contains(QCursor::pos(screenToFollow()))) {
+        autoHide = false;
+    }
+    else if (containment() && containment()->isUserConfiguring()) {
+        autoHide = false;
+    }
+    else if (containment() && containment()->status() >= \
Plasma::Types::NeedsAttentionStatus && +             containment()->status() != \
Plasma::Types::HiddenStatus) { +        autoHide = false;
+    }
+
+    setAutoHideEnabled(autoHide);
 }
 
 void PanelView::setAutoHideEnabled(bool enabled)
@@ -949,11 +960,10 @@ bool PanelView::canSetStrut() const
 
 void PanelView::updateStruts()
 {
-    if (!containment() || !m_screenToFollow) {
+    if (!containment() || containment()->isUserConfiguring() || !m_screenToFollow) {
         return;
     }
 
-
     NETExtendedStrut strut;
 
     if (m_visibilityMode == NormalPanel) {
@@ -1037,6 +1047,15 @@ void PanelView::themeChanged()
 void PanelView::containmentChanged()
 {
     restore();
+    connect(containment(), &Plasma::Containment::userConfiguringChanged, this, \
[this](bool configuring){ +        if (configuring) {
+            showTemporarily();
+        } else {
+            m_unhideTimer.start();
+            updateStruts();
+        }
+    });
+
     connect(containment(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), \
SLOT(statusChanged(Plasma::Types::ItemStatus)));  connect(containment(), \
                &Plasma::Applet::appletDeleted, this, [this] {
         //containment()->destroyed() is true only when the user deleted it


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic