Commit 0bb1f2e7 authored by Martin Flöser's avatar Martin Flöser

Make WindowPixmap::isValid virtual and override in concrete implementation

Summary:
If a buffer gets destroyed the texture created from it is still valid.
In such a situation the OpenGLWindowPixmap should return true for isValid
and not false as it did. Similar in QPainter compositor the pixmap is
valid if there is an image copied from the buffer.

This change ensures that for example minimizing an XWayland window
still has a texture during the minimize animation.

BUG: 368440

Test Plan:
Minimize animation plays for X windows and minimized windows
are shown in present windows.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2724
parent cdcee88b
......@@ -362,7 +362,7 @@ public:
/**
* @return @c true if the pixmap has been created and is valid, @c false otherwise
*/
bool isValid() const;
virtual bool isValid() const;
/**
* @return The native X11 pixmap handle
*/
......
......@@ -1740,6 +1740,14 @@ WindowPixmap *OpenGLWindowPixmap::createChild(const QPointer<KWayland::Server::S
return new OpenGLWindowPixmap(subSurface, this, m_scene);
}
bool OpenGLWindowPixmap::isValid() const
{
if (!m_texture->isNull()) {
return true;
}
return WindowPixmap::isValid();
}
//****************************************
// SceneOpenGL::EffectFrame
//****************************************
......
......@@ -275,6 +275,7 @@ public:
virtual ~OpenGLWindowPixmap();
SceneOpenGL::Texture *texture() const;
bool bind();
bool isValid() const override;
protected:
WindowPixmap *createChild(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface) override;
private:
......
......@@ -490,6 +490,14 @@ void QPainterWindowPixmap::updateBuffer()
}
}
bool QPainterWindowPixmap::isValid() const
{
if (!m_image.isNull()) {
return true;
}
return WindowPixmap::isValid();
}
QPainterEffectFrame::QPainterEffectFrame(EffectFrameImpl *frame, SceneQPainter *scene)
: Scene::EffectFrame(frame)
, m_scene(scene)
......
......@@ -163,6 +163,7 @@ public:
explicit QPainterWindowPixmap(Scene::Window *window);
virtual ~QPainterWindowPixmap();
virtual void create() override;
bool isValid() const override;
void updateBuffer() override;
const QImage &image();
......
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