visibilitymode property
doesn't do much, just disables struts
This commit is contained in:
parent
8592875eac
commit
63e0942ac2
|
@ -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();
|
||||
|
||||
|
|
|
@ -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<ConfigView> m_panelConfigView;
|
||||
ShellCorona *m_corona;
|
||||
QTimer *m_strutsTimer;
|
||||
VisibilityMode m_visibilityMode;
|
||||
|
||||
static const int STRUTSTIMERDELAY = 200;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user