Store Toplevel surface using QPointer
This makes Toplevel::setSurface() simpler.
This commit is contained in:
parent
52c9dbb487
commit
73162e8fae
2 changed files with 7 additions and 9 deletions
|
@ -609,6 +609,11 @@ void Toplevel::setSkipCloseAnimation(bool set)
|
|||
Q_EMIT skipCloseAnimationChanged();
|
||||
}
|
||||
|
||||
KWaylandServer::SurfaceInterface *Toplevel::surface() const
|
||||
{
|
||||
return m_surface;
|
||||
}
|
||||
|
||||
void Toplevel::setSurface(KWaylandServer::SurfaceInterface *surface)
|
||||
{
|
||||
if (m_surface == surface) {
|
||||
|
@ -616,9 +621,6 @@ void Toplevel::setSurface(KWaylandServer::SurfaceInterface *surface)
|
|||
}
|
||||
m_surface = surface;
|
||||
m_pendingSurfaceId = 0;
|
||||
connect(m_surface, &KWaylandServer::SurfaceInterface::destroyed, this, [this]() {
|
||||
m_surface = nullptr;
|
||||
});
|
||||
Q_EMIT surfaceChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
// Qt
|
||||
#include <QObject>
|
||||
#include <QMatrix4x4>
|
||||
#include <QPointer>
|
||||
#include <QRect>
|
||||
#include <QUuid>
|
||||
// c++
|
||||
|
@ -718,7 +719,7 @@ private:
|
|||
AbstractOutput *m_output = nullptr;
|
||||
bool m_skipCloseAnimation;
|
||||
quint32 m_pendingSurfaceId = 0;
|
||||
KWaylandServer::SurfaceInterface *m_surface = nullptr;
|
||||
QPointer<KWaylandServer::SurfaceInterface> m_surface;
|
||||
// when adding new data members, check also copyToDeleted()
|
||||
qreal m_screenScale = 1.0;
|
||||
qreal m_opacity = 1.0;
|
||||
|
@ -963,11 +964,6 @@ inline quint32 Toplevel::pendingSurfaceId() const
|
|||
return m_pendingSurfaceId;
|
||||
}
|
||||
|
||||
inline KWaylandServer::SurfaceInterface *Toplevel::surface() const
|
||||
{
|
||||
return m_surface;
|
||||
}
|
||||
|
||||
inline const QSharedPointer<QOpenGLFramebufferObject> &Toplevel::internalFramebufferObject() const
|
||||
{
|
||||
return m_internalFBO;
|
||||
|
|
Loading…
Reference in a new issue