Add some const &

Summary:
Won't make things go much faster since everything that was
being passed by value is refcounted but still const & is a bit faster
than refcounting

For shared pointers instead of adding const & we move them into the
destination variable saving some cpu usage but at the same time making
clear the pointer is being stored by not being const &

Reviewers: zzag

Reviewed By: zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25022
This commit is contained in:
Albert Astals Cid 2019-10-29 23:04:15 +01:00
parent 92197242ce
commit e144748c7a
76 changed files with 112 additions and 112 deletions

View file

@ -124,7 +124,7 @@ public:
return 0;
}
void doneOpenGLContextCurrent() override {}
void drawWindow(KWin::EffectWindow *, int, QRegion, KWin::WindowPaintData &) override {}
void drawWindow(KWin::EffectWindow *, int, const QRegion &, KWin::WindowPaintData &) override {}
KWin::EffectFrame *effectFrame(KWin::EffectFrameStyle, bool, const QPoint &, Qt::Alignment) const override {
return nullptr;
}
@ -173,9 +173,9 @@ public:
bool optionRollOverDesktops() const override {
return false;
}
void paintEffectFrame(KWin::EffectFrame *, QRegion, double, double) override {}
void paintScreen(int, QRegion, KWin::ScreenPaintData &) override {}
void paintWindow(KWin::EffectWindow *, int, QRegion, KWin::WindowPaintData &) override {}
void paintEffectFrame(KWin::EffectFrame *, const QRegion &, double, double) override {}
void paintScreen(int, const QRegion &, KWin::ScreenPaintData &) override {}
void paintWindow(KWin::EffectWindow *, int, const QRegion &, KWin::WindowPaintData &) override {}
void postPaintScreen() override {}
void postPaintWindow(KWin::EffectWindow *) override {}
void prePaintScreen(KWin::ScreenPrePaintData &, int) override {}

View file

@ -397,7 +397,7 @@ void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData& data, int time)
// no special final code
}
void EffectsHandlerImpl::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void EffectsHandlerImpl::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
if (m_currentPaintScreenIterator != m_activeEffects.constEnd()) {
(*m_currentPaintScreenIterator++)->paintScreen(mask, region, data);
@ -440,7 +440,7 @@ void EffectsHandlerImpl::prePaintWindow(EffectWindow* w, WindowPrePaintData& dat
// no special final code
}
void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data)
{
if (m_currentPaintWindowIterator != m_activeEffects.constEnd()) {
(*m_currentPaintWindowIterator++)->paintWindow(w, mask, region, data);
@ -449,7 +449,7 @@ void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region,
m_scene->finalPaintWindow(static_cast<EffectWindowImpl*>(w), mask, region, data);
}
void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity)
{
if (m_currentPaintEffectFrameIterator != m_activeEffects.constEnd()) {
(*m_currentPaintEffectFrameIterator++)->paintEffectFrame(frame, region, opacity, frameOpacity);
@ -477,7 +477,7 @@ Effect *EffectsHandlerImpl::provides(Effect::Feature ef)
return nullptr;
}
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data)
{
if (m_currentDrawWindowIterator != m_activeEffects.constEnd()) {
(*m_currentDrawWindowIterator++)->drawWindow(w, mask, region, data);
@ -2280,7 +2280,7 @@ void EffectFrameImpl::plasmaThemeChanged()
free();
}
void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity)
void EffectFrameImpl::render(const QRegion &region, double opacity, double frameOpacity)
{
if (m_geometry.isEmpty()) {
return; // Nothing to display

View file

@ -74,20 +74,20 @@ public:
EffectsHandlerImpl(Compositor *compositor, Scene *scene);
~EffectsHandlerImpl() override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
/**
* Special hook to perform a paintScreen but just with the windows on @p desktop.
*/
void paintDesktop(int desktop, int mask, QRegion region, ScreenPaintData& data);
void postPaintScreen() override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;
void paintWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) override;
void postPaintWindow(EffectWindow* w) override;
void paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity) override;
void paintEffectFrame(EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity) override;
Effect *provides(Effect::Feature ef);
void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;
void drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) override;
void buildQuads(EffectWindow* w, WindowQuadList& quadList) override;
@ -541,7 +541,7 @@ public:
~EffectFrameImpl() override;
void free() override;
void render(QRegion region = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0) override;
void render(const QRegion &region = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0) override;
Qt::Alignment alignment() const override;
void setAlignment(Qt::Alignment alignment) override;
const QFont& font() const override;

View file

@ -431,7 +431,7 @@ bool ContrastEffect::shouldContrast(const EffectWindow *w, int mask, const Windo
return true;
}
void ContrastEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
void ContrastEffect::drawWindow(EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data)
{
const QRect screen = GLRenderTarget::virtualScreenGeometry();
if (shouldContrast(w, mask, data)) {
@ -467,7 +467,7 @@ void ContrastEffect::drawWindow(EffectWindow *w, int mask, QRegion region, Windo
effects->drawWindow(w, mask, region, data);
}
void ContrastEffect::paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity)
void ContrastEffect::paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity)
{
//FIXME: this is a no-op for now, it should figure out the right contrast, intensity, saturation
effects->paintEffectFrame(frame, region, opacity, frameOpacity);

View file

@ -55,8 +55,8 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity) override;
void drawWindow(EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override;

View file

@ -580,7 +580,7 @@ bool BlurEffect::shouldBlur(const EffectWindow *w, int mask, const WindowPaintDa
return true;
}
void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
void BlurEffect::drawWindow(EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data)
{
const QRect screen = GLRenderTarget::virtualScreenGeometry();
if (shouldBlur(w, mask, data)) {
@ -616,7 +616,7 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
effects->drawWindow(w, mask, region, data);
}
void BlurEffect::paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity)
void BlurEffect::paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity)
{
const QRect screen = effects->virtualScreenGeometry();
bool valid = m_renderTargetsValid && m_shader && m_shader->isValid();

View file

@ -58,8 +58,8 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override;
void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity) override;
void drawWindow(EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
void paintEffectFrame(EffectFrame *frame, const QRegion &region, double opacity, double frameOpacity) override;
bool provides(Feature feature) override;

View file

@ -61,7 +61,7 @@ ColorPickerEffect::ColorPickerEffect()
ColorPickerEffect::~ColorPickerEffect() = default;
void ColorPickerEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void ColorPickerEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
m_cachedOutputGeometry = data.outputGeometry();
effects->paintScreen(mask, region, data);

View file

@ -37,7 +37,7 @@ class ColorPickerEffect : public Effect, protected QDBusContext
public:
ColorPickerEffect();
~ColorPickerEffect() override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -129,7 +129,7 @@ void CoverSwitchEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void CoverSwitchEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);

View file

@ -54,7 +54,7 @@ public:
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
void windowInputMouseEvent(QEvent *e) override;

View file

@ -397,7 +397,7 @@ void CubeEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void CubeEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
if (activated) {
QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop());

View file

@ -59,7 +59,7 @@ public:
~CubeEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;

View file

@ -87,7 +87,7 @@ void CubeSlideEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void CubeSlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void CubeSlideEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
if (isActive()) {
glEnable(GL_CULL_FACE);

View file

@ -43,7 +43,7 @@ public:
~CubeSlideEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;

View file

@ -181,7 +181,7 @@ void DesktopGridEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void DesktopGridEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void DesktopGridEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
if (timeline.currentValue() == 0 && !isUsingPresentWindows()) {
effects->paintScreen(mask, region, data);

View file

@ -70,7 +70,7 @@ public:
~DesktopGridEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;

View file

@ -120,7 +120,7 @@ void FlipSwitchEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void FlipSwitchEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);
if (m_active) {

View file

@ -47,7 +47,7 @@ public:
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;

View file

@ -82,7 +82,7 @@ bool InvertEffect::loadData()
return true;
}
void InvertEffect::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
void InvertEffect::drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data)
{
// Load if we haven't already
if (m_valid && !m_inited)
@ -103,7 +103,7 @@ void InvertEffect::drawWindow(EffectWindow* w, int mask, QRegion region, WindowP
}
}
void InvertEffect::paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
void InvertEffect::paintEffectFrame(KWin::EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity)
{
if (m_valid && m_allWindows) {
frame->setShader(m_shader);

View file

@ -40,8 +40,8 @@ public:
InvertEffect();
~InvertEffect() override;
void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;
void paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity) override;
void drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) override;
void paintEffectFrame(KWin::EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity) override;
bool isActive() const override;
bool provides(Feature) override;

View file

@ -225,7 +225,7 @@ void LookingGlassEffect::slotMouseChanged(const QPoint& pos, const QPoint& old,
}
}
void LookingGlassEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void LookingGlassEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
// Call the next effect.
effects->paintScreen(mask, region, data);

View file

@ -46,7 +46,7 @@ public:
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
bool isActive() const override;
static bool supported();

View file

@ -138,7 +138,7 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time)
data.paint |= magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH);
}
void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void MagnifierEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data); // paint normal screen
if (zoom != 1.0) {

View file

@ -42,7 +42,7 @@ public:
~MagnifierEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
bool isActive() const override;
static bool supported();

View file

@ -111,7 +111,7 @@ void MouseClickEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void MouseClickEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void MouseClickEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);

View file

@ -104,7 +104,7 @@ public:
~MouseClickEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -111,7 +111,7 @@ void MouseMarkEffect::addRect(const QPoint &p1, const QPoint &p2, xcb_rectangle_
}
#endif
void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void MouseMarkEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data); // paint normal screen
if (marks.isEmpty() && drawing.isEmpty())

View file

@ -40,7 +40,7 @@ public:
MouseMarkEffect();
~MouseMarkEffect() override;
void reconfigure(ReconfigureFlags) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
bool isActive() const override;
// for properties

View file

@ -218,7 +218,7 @@ void PresentWindowsEffect::prePaintScreen(ScreenPrePaintData &data, int time)
effects->prePaintScreen(data, time);
}
void PresentWindowsEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void PresentWindowsEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
effects->paintScreen(mask, region, data);

View file

@ -98,7 +98,7 @@ public:
// Screen painting
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
// Window painting

View file

@ -89,7 +89,7 @@ void ScreenEdgeEffect::prePaintScreen(ScreenPrePaintData &data, int time)
}
}
void ScreenEdgeEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void ScreenEdgeEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
effects->paintScreen(mask, region, data);
for (QHash<ElectricBorder, Glow*>::iterator it = m_borders.begin();

View file

@ -37,7 +37,7 @@ public:
ScreenEdgeEffect();
~ScreenEdgeEffect() override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
bool isActive() const override;
int requestedEffectChainPosition() const override {

View file

@ -156,7 +156,7 @@ static xcb_pixmap_t xpixmapFromImage(const QImage &image)
return pixmap;
}
void ScreenShotEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void ScreenShotEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
m_cachedOutputGeometry = data.outputGeometry();
effects->paintScreen(mask, region, data);

View file

@ -44,7 +44,7 @@ public:
ScreenShotEffect();
~ScreenShotEffect() override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -151,7 +151,7 @@ void ShowFpsEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Windo
paint_size[ paints_pos ] += winsize;
}
void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void ShowFpsEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);
int fps = 0;

View file

@ -46,7 +46,7 @@ public:
ShowFpsEffect();
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override;
void postPaintScreen() override;
enum { INSIDE_GRAPH, NOWHERE, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT }; // fps text position

View file

@ -58,7 +58,7 @@ ShowPaintEffect::ShowPaintEffect()
connect(toggleAction, &QAction::triggered, this, &ShowPaintEffect::toggle);
}
void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void ShowPaintEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
m_painted = QRegion();
effects->paintScreen(mask, region, data);

View file

@ -33,7 +33,7 @@ class ShowPaintEffect : public Effect
public:
ShowPaintEffect();
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
bool isActive() const override;

View file

@ -128,7 +128,7 @@ inline QRegion buildClipRegion(const QPoint &pos, int w, int h)
return r;
}
void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void SlideEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
const bool wrap = effects->optionRollOverDesktops();
const int w = workspaceWidth();

View file

@ -45,7 +45,7 @@ public:
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;

View file

@ -105,7 +105,7 @@ void SnapHelperEffect::prePaintScreen(ScreenPrePaintData &data, int time)
effects->prePaintScreen(data, time);
}
void SnapHelperEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void SnapHelperEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
effects->paintScreen(mask, region, data);

View file

@ -38,7 +38,7 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -169,7 +169,7 @@ void StartupFeedbackEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void StartupFeedbackEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void StartupFeedbackEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);
if (m_active) {

View file

@ -40,7 +40,7 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -60,7 +60,7 @@ void ThumbnailAsideEffect::reconfigure(ReconfigureFlags)
arrange();
}
void ThumbnailAsideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void ThumbnailAsideEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
painted = QRegion();
effects->paintScreen(mask, region, data);

View file

@ -46,7 +46,7 @@ class ThumbnailAsideEffect
public:
ThumbnailAsideEffect();
void reconfigure(ReconfigureFlags) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
// for properties

View file

@ -127,7 +127,7 @@ void TouchPointsEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void TouchPointsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void TouchPointsEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);

View file

@ -39,7 +39,7 @@ public:
TouchPointsEffect();
~TouchPointsEffect() override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
bool isActive() const override;
bool touchDown(qint32 id, const QPointF &pos, quint32 time) override;

View file

@ -115,7 +115,7 @@ void TrackMouseEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void TrackMouseEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data); // paint normal screen

View file

@ -41,7 +41,7 @@ public:
TrackMouseEffect();
~TrackMouseEffect() override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
void reconfigure(ReconfigureFlags) override;
bool isActive() const override;

View file

@ -92,7 +92,7 @@ void WindowGeometry::reconfigure(ReconfigureFlags)
iHandleResizes = WindowGeometryConfiguration::resize();
}
void WindowGeometry::paintScreen(int mask, QRegion region, ScreenPaintData &data)
void WindowGeometry::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
effects->paintScreen(mask, region, data);
if (iAmActivated && iAmActive) {

View file

@ -39,7 +39,7 @@ public:
return ef == Effect::GeometryTip;
}
void reconfigure(ReconfigureFlags) override;
void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData &data) override;
bool isActive() const override;
int requestedEffectChainPosition() const override {

View file

@ -271,7 +271,7 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void ZoomEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
if (zoom != 1.0) {
data *= QVector2D(zoom, zoom);

View file

@ -49,7 +49,7 @@ public:
~ZoomEffect() override;
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override;
void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) override;
void postPaintScreen() override;
bool isActive() const override;
// for properties

View file

@ -138,7 +138,7 @@ void PreviewButtonItem::paint(QPainter *painter)
painter->fillRect(size, m_color);
}
void PreviewButtonItem::setColor(const QColor color)
void PreviewButtonItem::setColor(const QColor &color)
{
m_color = color;
m_color.setAlpha(127);

View file

@ -59,7 +59,7 @@ public:
void setType(int type);
const QColor &color() const { return m_color; }
void setColor(const QColor color);
void setColor(const QColor &color);
Q_SIGNALS:
void bridgeChanged();

View file

@ -315,7 +315,7 @@ int RulesWidget::comboToDesktop(int val) const
}
#ifdef KWIN_BUILD_ACTIVITIES
int RulesWidget::activityToCombo(QString d) const
int RulesWidget::activityToCombo(const QString &d) const
{
// TODO: ivan - do a multiselection list
for (int i = 0; i < activity->count(); i++) {

View file

@ -107,7 +107,7 @@ private:
int desktopToCombo(int d) const;
int comboToDesktop(int val) const;
#ifdef KWIN_BUILD_ACTIVITIES
int activityToCombo(QString d) const;
int activityToCombo(const QString &d) const;
QString comboToActivity(int val) const;
void updateActivitiesList();
KActivities::Consumer *m_activities;

View file

@ -86,10 +86,10 @@ AniData::AniData(AnimationEffect::Attribute a, int meta_, const FPx2 &to_,
, to(to_)
, meta(meta_)
, startTime(AnimationEffect::clock() + delay)
, fullScreenEffectLock(fullScreenEffectLock_)
, fullScreenEffectLock(std::move(fullScreenEffectLock_))
, waitAtSource(waitAtSource_)
, keepAlive(keepAlive)
, previousWindowPixmapLock(previousWindowPixmapLock_)
, previousWindowPixmapLock(std::move(previousWindowPixmapLock_))
{
}

View file

@ -76,7 +76,7 @@ public:
AniData();
AniData(AnimationEffect::Attribute a, int meta, const FPx2 &to,
int delay, const FPx2 &from, bool waitAtSource,
FullScreenEffectLockPtr=FullScreenEffectLockPtr(),
FullScreenEffectLockPtr =FullScreenEffectLockPtr(),
bool keepAlive = true, PreviousWindowPixmapLockPtr previousWindowPixmapLock = {});
bool isActive() const;

View file

@ -217,7 +217,7 @@ void AnimationEffect::validate(Attribute a, uint &meta, FPx2 *from, FPx2 *to, co
}
}
quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive)
quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, const QEasingCurve &curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive)
{
const bool waitAtSource = from.isValid();
validate(a, meta, &from, &to, w);

View file

@ -258,7 +258,7 @@ protected:
* @returns An ID that you can use to cancel a running animation.
* @since 4.8
*/
quint64 animate( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2(), bool fullScreen = false, bool keepAlive = true)
quint64 animate( EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve = QEasingCurve(), int delay = 0, const FPx2 &from = FPx2(), bool fullScreen = false, bool keepAlive = true)
{ return p_animate(w, a, meta, ms, to, curve, delay, from, false, fullScreen, keepAlive); }
/**
@ -288,7 +288,7 @@ protected:
* @returns An ID that you need to use to cancel this manipulation.
* @since 4.11
*/
quint64 set( EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve = QEasingCurve(), int delay = 0, FPx2 from = FPx2(), bool fullScreen = false, bool keepAlive = true)
quint64 set( EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve = QEasingCurve(), int delay = 0, const FPx2 &from = FPx2(), bool fullScreen = false, bool keepAlive = true)
{ return p_animate(w, a, meta, ms, to, curve, delay, from, true, fullScreen, keepAlive); }
/**
@ -386,7 +386,7 @@ protected:
AniMap state() const;
private:
quint64 p_animate(EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, QEasingCurve curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive);
quint64 p_animate(EffectWindow *w, Attribute a, uint meta, int ms, FPx2 to, const QEasingCurve &curve, int delay, FPx2 from, bool keepAtTarget, bool fullScreenEffect, bool keepAlive);
QRect clipRect(const QRect &windowRect, const AniData&) const;
void clipWindow(const EffectWindow *, const AniData &, WindowQuadList &) const;
float interpolated( const AniData&, int i = 0 ) const;

View file

@ -565,7 +565,7 @@ void Effect::prePaintScreen(ScreenPrePaintData& data, int time)
effects->prePaintScreen(data, time);
}
void Effect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void Effect::paintScreen(int mask, const QRegion &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data);
}
@ -590,7 +590,7 @@ void Effect::postPaintWindow(EffectWindow* w)
effects->postPaintWindow(w);
}
void Effect::paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
void Effect::paintEffectFrame(KWin::EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity)
{
effects->paintEffectFrame(frame, region, opacity, frameOpacity);
}
@ -610,7 +610,7 @@ QString Effect::debug(const QString &) const
return QString();
}
void Effect::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
void Effect::drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data)
{
effects->drawWindow(w, mask, region, data);
}
@ -778,7 +778,7 @@ EffectWindow::~EffectWindow()
{
}
bool EffectWindow::isOnActivity(QString activity) const
bool EffectWindow::isOnActivity(const QString &activity) const
{
const QStringList _activities = activities();
return _activities.isEmpty() || _activities.contains(activity);

View file

@ -428,7 +428,7 @@ public:
* In OpenGL based compositing, the frameworks ensures that the context is current
* when this method is invoked.
*/
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void paintScreen(int mask, const QRegion &region, ScreenPaintData& data);
/**
* Called after all the painting has been finished.
* In this method you can:
@ -487,7 +487,7 @@ public:
* In OpenGL based compositing, the frameworks ensures that the context is current
* when this method is invoked.
*/
virtual void paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity);
virtual void paintEffectFrame(EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity);
/**
* Called on Transparent resizes.
@ -516,7 +516,7 @@ public:
* In OpenGL based compositing, the frameworks ensures that the context is current
* when this method is invoked.
*/
virtual void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data);
/**
* Define new window quads so that they can be transformed by other effects.
@ -832,13 +832,13 @@ public:
~EffectsHandler() override;
// for use by effects
virtual void prePaintScreen(ScreenPrePaintData& data, int time) = 0;
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data) = 0;
virtual void paintScreen(int mask, const QRegion &region, ScreenPaintData& data) = 0;
virtual void postPaintScreen() = 0;
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) = 0;
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) = 0;
virtual void paintWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) = 0;
virtual void postPaintWindow(EffectWindow* w) = 0;
virtual void paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity) = 0;
virtual void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) = 0;
virtual void paintEffectFrame(EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity) = 0;
virtual void drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) = 0;
virtual void buildQuads(EffectWindow* w, WindowQuadList& quadList) = 0;
virtual QVariant kwinOption(KWinOption kwopt) = 0;
/**
@ -2140,7 +2140,7 @@ public:
virtual bool hasAlpha() const = 0;
bool isOnCurrentActivity() const;
Q_SCRIPTABLE bool isOnActivity(QString id) const;
Q_SCRIPTABLE bool isOnActivity(const QString &id) const;
bool isOnAllActivities() const;
virtual QStringList activities() const = 0;
@ -3226,7 +3226,7 @@ public:
/**
* Register a list of windows for managing.
*/
inline void manage(EffectWindowList list) {
inline void manage(const EffectWindowList &list) {
for (int i = 0; i < list.size(); i++)
manage(list.at(i));
}
@ -3380,7 +3380,7 @@ public:
/**
* Render the frame.
*/
virtual void render(QRegion region = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0) = 0;
virtual void render(const QRegion &region = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0) = 0;
virtual void setPosition(const QPoint& point) = 0;
/**

View file

@ -682,7 +682,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
// Parse the Mesa version
const int mesaIndex = versionTokens.indexOf("Mesa");
if (mesaIndex != -1) {
const QByteArray version = versionTokens.at(mesaIndex + 1);
const QByteArray &version = versionTokens.at(mesaIndex + 1);
m_mesaVersion = parseVersionString(version);
}
@ -720,7 +720,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
if (m_renderer.startsWith("Mesa DRI R")) {
// Sample renderer string: Mesa DRI R600 (RV740 94B3) 20090101 x86/MMX/SSE2 TCL DRI2
const QList<QByteArray> tokens = m_renderer.split(' ');
const QByteArray chipClass = tokens.at(2);
const QByteArray &chipClass = tokens.at(2);
m_chipset = tokens.at(3).mid(1, -1); // Strip the leading '('
if (chipClass == "R100")

View file

@ -467,7 +467,7 @@ void GLTexture::unbind()
glBindTexture(d->m_target, 0);
}
void GLTexture::render(QRegion region, const QRect& rect, bool hardwareClipping)
void GLTexture::render(const QRegion &region, const QRect& rect, bool hardwareClipping)
{
Q_D(GLTexture);
if (rect.isEmpty())

View file

@ -106,7 +106,7 @@ public:
virtual void discard();
void bind();
void unbind();
void render(QRegion region, const QRect& rect, bool hardwareClipping = false);
void render(const QRegion &region, const QRect& rect, bool hardwareClipping = false);
GLuint texture() const;
GLenum target() const;

View file

@ -61,7 +61,7 @@ static QList<QByteArray> glExtensions;
// Functions
void initGL(std::function<resolveFuncPtr(const char*)> resolveFunction)
void initGL(const std::function<resolveFuncPtr(const char*)> &resolveFunction)
{
// Get list of supported OpenGL extensions
if (hasGLVersion(3, 0)) {

View file

@ -52,7 +52,7 @@ class GLVertexBufferPrivate;
// well as checking for GL version and extensions
// Note that GL context has to be created by the time this function is called
typedef void (*resolveFuncPtr)();
void KWINGLUTILS_EXPORT initGL(std::function<resolveFuncPtr(const char*)> resolveFunction);
void KWINGLUTILS_EXPORT initGL(const std::function<resolveFuncPtr(const char*)> &resolveFunction);
// Cleans up all resources hold by the GL Context
void KWINGLUTILS_EXPORT cleanupGL();

View file

@ -40,7 +40,7 @@ glGetGraphicsResetStatus_func glGetGraphicsResetStatus;
glReadnPixels_func glReadnPixels;
glGetnUniformfv_func glGetnUniformfv;
void glResolveFunctions(std::function<resolveFuncPtr(const char*)> resolveFunction)
void glResolveFunctions(const std::function<resolveFuncPtr(const char*)> &resolveFunction)
{
const bool haveArbRobustness = hasGLExtension(QByteArrayLiteral("GL_ARB_robustness"));
const bool haveExtRobustness = hasGLExtension(QByteArrayLiteral("GL_EXT_robustness"));

View file

@ -43,7 +43,7 @@ namespace KWin
{
typedef void (*resolveFuncPtr)();
void KWINGLUTILS_EXPORT glResolveFunctions(std::function<resolveFuncPtr(const char*)> resolveFunction);
void KWINGLUTILS_EXPORT glResolveFunctions(const std::function<resolveFuncPtr(const char*)> &resolveFunction);
// GL_ARB_robustness / GL_EXT_robustness
using glGetGraphicsResetStatus_func = GLenum (*)();

6
main.h
View file

@ -84,21 +84,21 @@ public:
return m_config;
}
void setConfig(KSharedConfigPtr config) {
m_config = config;
m_config = std::move(config);
}
KSharedConfigPtr kxkbConfig() const {
return m_kxkbConfig;
}
void setKxkbConfig(KSharedConfigPtr config) {
m_kxkbConfig = config;
m_kxkbConfig = std::move(config);
}
KSharedConfigPtr inputConfig() const {
return m_inputConfig;
}
void setInputConfig(KSharedConfigPtr config) {
m_inputConfig = config;
m_inputConfig = std::move(config);
}
void start();

View file

@ -61,7 +61,7 @@ public:
}
void setConfig(KSharedConfig::Ptr config) {
m_config = config;
m_config = std::move(config);
}
bool isUserEnabled() const {

View file

@ -710,7 +710,7 @@ bool VirtualDesktopManager::isNavigationWrappingAround() const
inline
void VirtualDesktopManager::setConfig(KSharedConfig::Ptr config)
{
m_config = config;
m_config = std::move(config);
}
inline

4
xkb.h
View file

@ -56,10 +56,10 @@ public:
Xkb(QObject *parent = nullptr);
~Xkb() override;
void setConfig(KSharedConfigPtr config) {
m_config = config;
m_config = std::move(config);
}
void setNumLockConfig(KSharedConfigPtr config) {
m_numLockConfig = config;
m_numLockConfig = std::move(config);
}
void reconfigure();