[effects/slidingpopups] Fix coding style

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14825
This commit is contained in:
Vlad Zagorodniy 2018-08-14 13:10:04 +03:00
parent cca11405b0
commit 83c1548205
2 changed files with 30 additions and 27 deletions

View file

@ -39,9 +39,9 @@ SlidingPopupsEffect::SlidingPopupsEffect()
display->createSlideManager(this)->create();
}
mSlideLength = QFontMetrics(qApp->font()).height() * 8;
m_slideLength = QFontMetrics(qApp->font()).height() * 8;
mAtom = effects->announceSupportProperty("_KDE_SLIDE", this);
m_atom = effects->announceSupportProperty("_KDE_SLIDE", this);
connect(effects, &EffectsHandler::windowAdded, this, &SlidingPopupsEffect::slotWindowAdded);
connect(effects, &EffectsHandler::windowClosed, this, &SlidingPopupsEffect::slideOut);
connect(effects, &EffectsHandler::windowDeleted, this, &SlidingPopupsEffect::slotWindowDeleted);
@ -50,7 +50,7 @@ SlidingPopupsEffect::SlidingPopupsEffect()
connect(effects, &EffectsHandler::windowHidden, this, &SlidingPopupsEffect::slideOut);
connect(effects, &EffectsHandler::xcbConnectionChanged, this,
[this] {
mAtom = effects->announceSupportProperty(QByteArrayLiteral("_KDE_SLIDE"), this);
m_atom = effects->announceSupportProperty(QByteArrayLiteral("_KDE_SLIDE"), this);
}
);
reconfigure(ReconfigureAll);
@ -115,7 +115,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
}
const AnimationData &animData = m_animationsData[w];
const int slideLength = (animData.slideLength > 0) ? animData.slideLength : mSlideLength;
const int slideLength = (animData.slideLength > 0) ? animData.slideLength : m_slideLength;
const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), w->desktop());
int splitPoint = 0;
@ -182,8 +182,8 @@ void SlidingPopupsEffect::postPaintWindow(EffectWindow* w)
void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
{
//X11
if (mAtom != XCB_ATOM_NONE) {
slotPropertyNotify(w, mAtom);
if (m_atom != XCB_ATOM_NONE) {
slotPropertyNotify(w, m_atom);
}
//Wayland
@ -206,10 +206,11 @@ void SlidingPopupsEffect::slotWindowDeleted(EffectWindow* w)
void SlidingPopupsEffect::slotPropertyNotify(EffectWindow *w, long a)
{
if (!w || a != mAtom || mAtom == XCB_ATOM_NONE)
if (!w || a != m_atom || m_atom == XCB_ATOM_NONE) {
return;
}
QByteArray data = w->readProperty(mAtom, mAtom, 32);
QByteArray data = w->readProperty(m_atom, m_atom, 32);
if (data.length() < 1) {
// Property was removed, thus also remove the effect for window
@ -221,7 +222,7 @@ void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a)
return;
}
auto* d = reinterpret_cast< uint32_t* >(data.data());
const auto *d = reinterpret_cast<const uint32_t *>(data.data());
AnimationData &animData = m_animationsData[w];
animData.offset = d[0];
@ -245,16 +246,18 @@ void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a)
animData.slideLength = 0;
if (data.length() >= (int)(sizeof(uint32_t) * 3)) {
animData.slideInDuration = std::chrono::milliseconds(d[2]);
if (data.length() >= (int)(sizeof(uint32_t) * 4))
if (data.length() >= (int)(sizeof(uint32_t) * 4)) {
//custom fadein
animData.slideOutDuration = std::chrono::milliseconds(d[3]);
else
} else {
//custom fadeout
animData.slideOutDuration = std::chrono::milliseconds(d[2]);
}
//do we want an actual slide?
if (data.length() >= (int)(sizeof(uint32_t) * 5))
if (data.length() >= (int)(sizeof(uint32_t) * 5)) {
animData.slideLength = d[4];
}
} else {
animData.slideInDuration = m_slideInDuration;
animData.slideOutDuration = m_slideOutDuration;

View file

@ -27,12 +27,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
class SlidingPopupsEffect
: public Effect
class SlidingPopupsEffect : public Effect
{
Q_OBJECT
Q_PROPERTY(int slideInDuration READ slideInDuration)
Q_PROPERTY(int slideOutDuration READ slideOutDuration)
public:
SlidingPopupsEffect();
~SlidingPopupsEffect() override;
@ -66,9 +66,9 @@ private Q_SLOTS:
private:
void setupAnimData(EffectWindow *w);
long mAtom;
long m_atom;
int mSlideLength;
int m_slideLength;
std::chrono::milliseconds m_slideInDuration;
std::chrono::milliseconds m_slideOutDuration;