8947ece98f
On x11 when multiscreen is enabled often kwin crashes on laptop lid close, for two reasons: * m_outputLayer going dangling in RenderLayer: fixed by using a QPointer * m_activeOutput going dangling in Workspace For the latter, the output disabling was done correctly, but x11client did set the old deleted output again in X11Client::moveResizeInternal This is fixed by moving desktopResized() at the bottom of Workspace::slotOutputDisabled() after the reassign of outputs to the toplevels
97 lines
2.6 KiB
C++
97 lines
2.6 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "kwin_export.h"
|
|
|
|
#include "outputlayer.h"
|
|
|
|
#include <QMap>
|
|
#include <QObject>
|
|
#include <QPointer>
|
|
#include <QRegion>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class OutputLayer;
|
|
class RenderLayerDelegate;
|
|
class RenderLoop;
|
|
|
|
/**
|
|
* The RenderLayer class represents a composited layer.
|
|
*
|
|
* The contents of the layer is represented by the RenderLayerDelegate. The render layer
|
|
* takes the ownership of the delegate.
|
|
*
|
|
* Each render layer has a hardware layer assigned to it, represented by OutputLayer. If
|
|
* the output layer is not set explicitly, it's inherited from the parent render layer.
|
|
* Output layers can be freely assigned or unassigned to render layers.
|
|
*/
|
|
class KWIN_EXPORT RenderLayer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit RenderLayer(RenderLoop *loop, RenderLayer *superlayer = nullptr);
|
|
~RenderLayer() override;
|
|
|
|
OutputLayer *outputLayer() const;
|
|
void setOutputLayer(OutputLayer *layer);
|
|
|
|
RenderLoop *loop() const;
|
|
RenderLayerDelegate *delegate() const;
|
|
void setDelegate(RenderLayerDelegate *delegate);
|
|
|
|
QList<RenderLayer *> sublayers() const;
|
|
RenderLayer *superlayer() const;
|
|
void setSuperlayer(RenderLayer *layer);
|
|
|
|
bool isVisible() const;
|
|
void setVisible(bool visible);
|
|
|
|
QPoint mapToGlobal(const QPoint &point) const;
|
|
QRegion mapToGlobal(const QRegion ®ion) const;
|
|
QRect mapToGlobal(const QRect &rect) const;
|
|
|
|
QPoint mapFromGlobal(const QPoint &point) const;
|
|
QRegion mapFromGlobal(const QRegion ®ion) const;
|
|
QRect mapFromGlobal(const QRect &rect) const;
|
|
|
|
QRect rect() const;
|
|
QRect boundingRect() const;
|
|
|
|
QRect geometry() const;
|
|
void setGeometry(const QRect &rect);
|
|
|
|
void addRepaint(const QRegion ®ion);
|
|
void addRepaint(const QRect &rect);
|
|
void addRepaint(int x, int y, int width, int height);
|
|
void addRepaintFull();
|
|
QRegion repaints() const;
|
|
void resetRepaints();
|
|
|
|
private:
|
|
void addSublayer(RenderLayer *sublayer);
|
|
void removeSublayer(RenderLayer *sublayer);
|
|
void updateBoundingRect();
|
|
void updateEffectiveVisibility();
|
|
bool computeEffectiveVisibility() const;
|
|
|
|
RenderLoop *m_loop;
|
|
QScopedPointer<RenderLayerDelegate> m_delegate;
|
|
QRegion m_repaints;
|
|
QRect m_boundingRect;
|
|
QRect m_geometry;
|
|
QPointer<OutputLayer> m_outputLayer;
|
|
RenderLayer *m_superlayer = nullptr;
|
|
QList<RenderLayer *> m_sublayers;
|
|
bool m_effectiveVisible = true;
|
|
bool m_explicitVisible = true;
|
|
};
|
|
|
|
} // namespace KWin
|