From 63e0942ac2f0f8651e74599b64fcec8f5dc3126f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 9 Oct 2013 18:41:08 +0200 Subject: [PATCH] visibilitymode property doesn't do much, just disables struts --- src/shell/panelview.cpp | 34 ++++++++++++++++++++++++++++++++-- src/shell/panelview.h | 14 ++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 4fcca8ec3..e6d5b64ec 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -43,6 +43,7 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) m_minLength(0), m_alignment(Qt::AlignLeft), m_corona(corona), + m_visibilityMode(NormalPanel), m_strutsTimer(new QTimer(this)) { QSurfaceFormat format; @@ -257,6 +258,36 @@ void PanelView::setMinimumLength(int length) m_corona->requestApplicationConfigSync(); } +void PanelView::setVisibilityMode(PanelView::VisibilityMode mode) +{ + m_visibilityMode = mode; + + if (mode == LetWindowsCover) { + KWindowSystem::setState(winId(), NET::KeepBelow); + } else { + KWindowSystem::clearState(winId(), NET::KeepBelow); + } + //life is vastly simpler if we ensure we're visible now + show(); + + disconnect(containment(), SIGNAL(activate()), this, SLOT(unhide())); + if (!(mode == NormalPanel && mode == WindowsGoBelow)) { + connect(containment(), SIGNAL(activate()), this, SLOT(unhide())); + } + + config().writeEntry("panelVisibility", (int)mode); + + + updateStruts(); + + KWindowSystem::setOnAllDesktops(winId(), true); +} + +PanelView::VisibilityMode PanelView::visibilityMode() const +{ + return m_visibilityMode; +} + void PanelView::positionPanel() { if (!containment()) { @@ -461,8 +492,7 @@ void PanelView::updateStruts() NETExtendedStrut strut; - //TODO: visibility modes - if (true/*m_visibilityMode == NormalPanel*/) { + if (m_visibilityMode == NormalPanel) { const QRect thisScreen = corona()->screenGeometry(containment()->screen()); const QRect wholeScreen = screen()->availableVirtualGeometry(); diff --git a/src/shell/panelview.h b/src/shell/panelview.h index 668cebdb5..c98882c2e 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -36,8 +36,18 @@ class PanelView : public PlasmaQuickView Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength NOTIFY maximumLengthChanged) Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength NOTIFY minimumLengthChanged) Q_PROPERTY(QScreen *screen READ screen NOTIFY screenChanged) + Q_PROPERTY(VisibilityMode visibilityMode READ visibilityMode WRITE setVisibilityMode) public: + + enum VisibilityMode { + NormalPanel = 0, + AutoHide, + LetWindowsCover, + WindowsGoBelow + }; + Q_ENUMS(VisibilityMode) + explicit PanelView(ShellCorona *corona, QWindow *parent = 0); virtual ~PanelView(); @@ -61,6 +71,9 @@ public: int minimumLength() const; void setMinimumLength(int length); + VisibilityMode visibilityMode() const; + void setVisibilityMode(PanelView::VisibilityMode mode); + protected: void resizeEvent(QResizeEvent *ev); void showEvent(QShowEvent *event); @@ -94,6 +107,7 @@ private: QPointer m_panelConfigView; ShellCorona *m_corona; QTimer *m_strutsTimer; + VisibilityMode m_visibilityMode; static const int STRUTSTIMERDELAY = 200; };