refactor: move shadows handling to View::Effects

pull/3/head
Michail Vourlakos 6 years ago
parent f13e83ffb7
commit 3e9071f5f5

@ -23,7 +23,6 @@
#include "dockconfigview.h"
#include "dockmenumanager.h"
#include "effects.h"
#include "panelshadows_p.h"
#include "positioner.h"
#include "visibilitymanager.h"
#include "../dockcorona.h"
@ -47,7 +46,6 @@
#include <KAuthorized>
#include <KLocalizedContext>
#include <KLocalizedString>
#include <KWindowEffects>
#include <KWindowSystem>
#include <KActivities/Consumer>
@ -559,12 +557,6 @@ void DockView::setBehaveAsPlasmaPanel(bool behavior)
m_behaveAsPlasmaPanel = behavior;
if (m_behaveAsPlasmaPanel && m_effects->drawShadows()) {
PanelShadows::self()->addWindow(this, m_effects->enabledBorders());
} else {
PanelShadows::self()->removeWindow(this);
}
emit behaveAsPlasmaPanelChanged();
}
@ -988,10 +980,7 @@ bool DockView::event(QEvent *e)
if (m_shellSurface) {
m_positioner->syncGeometry();
if (m_effects->drawShadows()) {
PanelShadows::self()->addWindow(this, m_effects->enabledBorders());
}
m_effects->updateShadows();
}
break;
@ -1001,7 +990,7 @@ bool DockView::event(QEvent *e)
delete m_shellSurface;
m_shellSurface = nullptr;
qDebug() << "WAYLAND dock window surface was deleted...";
PanelShadows::self()->removeWindow(this);
m_effects->clearShadows();
}
break;

@ -55,6 +55,7 @@ void Effects::init()
connect(m_view, &Latte::DockView::alignmentChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::DockView::behaveAsPlasmaPanelChanged, this, &Effects::updateEffects);
connect(m_view, &Latte::DockView::behaveAsPlasmaPanelChanged, this, &Effects::updateShadows);
connect(this, SIGNAL(innerShadowChanged()), m_view->corona(), SIGNAL(availableScreenRectChanged()));
}
@ -238,6 +239,20 @@ void Effects::setMask(QRect area)
emit maskChanged();
}
void Effects::clearShadows()
{
PanelShadows::self()->removeWindow(m_view);
}
void Effects::updateShadows()
{
if (m_view->behaveAsPlasmaPanel() && drawShadows()) {
PanelShadows::self()->addWindow(m_view, enabledBorders());
} else {
PanelShadows::self()->removeWindow(m_view);
}
}
void Effects::updateEffects()
{
//! Don't apply any effect before the wayland surface is created under wayland

@ -85,6 +85,8 @@ public:
Plasma::FrameSvg::EnabledBorders enabledBorders() const;
public slots:
void clearShadows();
void updateShadows();
void updateEffects();
void updateEnabledBorders();

Loading…
Cancel
Save