Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 47c84053 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects/snaphelper] Do massive overhaul

Summary:
This patch fixes some of issues that the Snap Helper effect currently
has:

* If a window is being moved, there are visual artifacts (cause: missing
  addRepaint's);
* It uses addRepaintFull;
* For some reason, if a window goes deleted, it will be kept around as
  long as the Snap Helper effect needs it (visually, it doesn't look
  good).

Among other changes:
* Use variables to store color and width of grid lines;
* Use new connect syntax;
* Port to TimeLine;
* Fix coding style in some places.

Test Plan:
Tried the effect with different rendering backends, no longer see visual
artifacts when moving or resizing windows.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15695
parent c081f222
This diff is collapsed.
......@@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -22,38 +23,44 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_SNAPHELPER_H
#include <kwineffects.h>
#include <QTimeLine>
namespace KWin
{
class SnapHelperEffect
: public Effect
class SnapHelperEffect : public Effect
{
Q_OBJECT
public:
SnapHelperEffect();
~SnapHelperEffect();
~SnapHelperEffect() override;
virtual void reconfigure(ReconfigureFlags);
void reconfigure(ReconfigureFlags flags) override;
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
virtual bool isActive() const;
void postPaintScreen() override;
bool isActive() const override;
public Q_SLOTS:
void slotWindowClosed(KWin::EffectWindow *w);
void slotWindowStartUserMovedResized(KWin::EffectWindow *w);
void slotWindowFinishUserMovedResized(KWin::EffectWindow *w);
void slotWindowResized(KWin::EffectWindow *w, const QRect &r);
private Q_SLOTS:
void slotWindowClosed(EffectWindow *w);
void slotWindowStartUserMovedResized(EffectWindow *w);
void slotWindowFinishUserMovedResized(EffectWindow *w);
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
private:
bool m_active;
EffectWindow* m_window;
QTimeLine m_timeline;
//GC m_gc;
QRect m_geometry;
EffectWindow *m_window = nullptr;
struct Animation {
bool active = false;
TimeLine timeLine;
};
Animation m_animation;
};
} // namespace
} // namespace KWin
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment