diff --git a/src/internalwindow.cpp b/src/internalwindow.cpp index 5ba98ff60a..c7d811d364 100644 --- a/src/internalwindow.cpp +++ b/src/internalwindow.cpp @@ -384,9 +384,19 @@ void InternalWindow::popupDone() m_handle->hide(); } +const std::shared_ptr &InternalWindow::fbo() const +{ + return m_fbo; +} + +QImage InternalWindow::image() const +{ + return m_image; +} + void InternalWindow::present(const std::shared_ptr fbo) { - Q_ASSERT(m_internalImage.isNull()); + Q_ASSERT(m_image.isNull()); const QSizeF bufferSize = fbo->size() / bufferScale(); QRectF geometry(pos(), clientSizeToFrameSize(bufferSize)); @@ -397,7 +407,7 @@ void InternalWindow::present(const std::shared_ptr fbo commitGeometry(geometry); markAsMapped(); - m_internalFBO = fbo; + m_fbo = fbo; setDepth(32); surfaceItem()->addDamage(surfaceItem()->rect().toAlignedRect()); @@ -405,7 +415,7 @@ void InternalWindow::present(const std::shared_ptr fbo void InternalWindow::present(const QImage &image, const QRegion &damage) { - Q_ASSERT(m_internalFBO == nullptr); + Q_ASSERT(m_fbo == nullptr); const QSize bufferSize = image.size() / bufferScale(); QRectF geometry(pos(), clientSizeToFrameSize(bufferSize)); @@ -416,7 +426,7 @@ void InternalWindow::present(const QImage &image, const QRegion &damage) commitGeometry(geometry); markAsMapped(); - m_internalImage = image; + m_image = image; setDepth(32); surfaceItem()->addDamage(damage); diff --git a/src/internalwindow.h b/src/internalwindow.h index b7e647f2af..a09330f514 100644 --- a/src/internalwindow.h +++ b/src/internalwindow.h @@ -11,6 +11,8 @@ #include "window.h" +class QOpenGLFramebufferObject; + namespace KWin { @@ -61,6 +63,9 @@ public: void pointerEnterEvent(const QPointF &globalPos) override; void pointerLeaveEvent() override; + const std::shared_ptr &fbo() const; + QImage image() const; + void present(const std::shared_ptr fbo); void present(const QImage &image, const QRegion &damage); qreal bufferScale() const; @@ -91,6 +96,8 @@ private: NET::WindowType m_windowType = NET::Normal; Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags(); bool m_userNoBorder = false; + std::shared_ptr m_fbo; + QImage m_image; Q_DISABLE_COPY(InternalWindow) }; diff --git a/src/scene/surfaceitem_internal.cpp b/src/scene/surfaceitem_internal.cpp index a08f57a8ed..cfb42382a6 100644 --- a/src/scene/surfaceitem_internal.cpp +++ b/src/scene/surfaceitem_internal.cpp @@ -29,7 +29,7 @@ SurfaceItemInternal::SurfaceItemInternal(InternalWindow *window, Scene *scene, I setSurfaceToBufferMatrix(surfaceToBufferMatrix); } -Window *SurfaceItemInternal::window() const +InternalWindow *SurfaceItemInternal::window() const { return m_window; } @@ -75,14 +75,14 @@ void SurfacePixmapInternal::create() void SurfacePixmapInternal::update() { - const Window *window = m_item->window(); + const InternalWindow *window = m_item->window(); - if (window->internalFramebufferObject()) { - m_fbo = window->internalFramebufferObject(); + if (window->fbo()) { + m_fbo = window->fbo(); m_size = m_fbo->size(); m_hasAlphaChannel = true; - } else if (!window->internalImageObject().isNull()) { - m_rasterBuffer = window->internalImageObject(); + } else if (!window->image().isNull()) { + m_rasterBuffer = window->image(); m_size = m_rasterBuffer.size(); m_hasAlphaChannel = m_rasterBuffer.hasAlphaChannel(); } diff --git a/src/scene/surfaceitem_internal.h b/src/scene/surfaceitem_internal.h index c1d5141af7..0fc1db8499 100644 --- a/src/scene/surfaceitem_internal.h +++ b/src/scene/surfaceitem_internal.h @@ -25,7 +25,7 @@ class KWIN_EXPORT SurfaceItemInternal : public SurfaceItem public: explicit SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr); - Window *window() const; + InternalWindow *window() const; QVector shape() const override; @@ -36,7 +36,7 @@ protected: std::unique_ptr createPixmap() override; private: - Window *m_window; + InternalWindow *m_window; }; class KWIN_EXPORT SurfacePixmapInternal final : public SurfacePixmap diff --git a/src/window.h b/src/window.h index f74d8306be..5fa6ba1516 100644 --- a/src/window.h +++ b/src/window.h @@ -31,7 +31,6 @@ #include class QMouseEvent; -class QOpenGLFramebufferObject; namespace KWaylandServer { @@ -741,9 +740,6 @@ public: KWaylandServer::SurfaceInterface *surface() const; void setSurface(KWaylandServer::SurfaceInterface *surface); - const std::shared_ptr &internalFramebufferObject() const; - QImage internalImageObject() const; - /** * @returns Transformation to map from global to window coordinates. * @@ -1541,11 +1537,6 @@ protected: int bit_depth; NETWinInfo *info; bool ready_for_painting; - /** - * An FBO object KWin internal windows might render to. - */ - std::shared_ptr m_internalFBO; - QImage m_internalImage; protected: Window(); @@ -2243,16 +2234,6 @@ inline quint32 Window::pendingSurfaceId() const return m_pendingSurfaceId; } -inline const std::shared_ptr &Window::internalFramebufferObject() const -{ - return m_internalFBO; -} - -inline QImage Window::internalImageObject() const -{ - return m_internalImage; -} - template inline T *Window::findInList(const QList &list, std::function func) {