From 6c71bfd8001faa3e6f4bd48ec0ca996000998d8e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 18 Dec 2022 23:56:41 +0200 Subject: [PATCH] scene: Rename Scene to WorkspaceScene Currently, the Scene class is used to represent the contents of the Workspace so rename it to match its usage. --- .../integration/buffer_size_change_test.cpp | 6 +- .../effects/maximize_animation_test.cpp | 2 +- .../integration/generic_scene_opengl_test.cpp | 2 +- .../integration/xwaylandserver_crash_test.cpp | 4 +- .../xwaylandserver_restart_test.cpp | 4 +- src/CMakeLists.txt | 6 +- .../x11/standalone/x11_standalone_backend.cpp | 2 +- .../x11/standalone/x11_standalone_backend.h | 4 +- .../x11/standalone/x11_standalone_effects.cpp | 2 +- .../x11/standalone/x11_standalone_effects.h | 2 +- .../standalone/x11_standalone_egl_backend.cpp | 2 +- .../standalone/x11_standalone_glx_backend.cpp | 2 +- .../x11_standalone_overlaywindow.cpp | 2 +- src/composite.cpp | 8 +- src/composite.h | 6 +- src/cursor.cpp | 2 +- src/deleted.cpp | 2 +- src/deleted.h | 2 +- src/effects.cpp | 2 +- src/effects.h | 8 +- src/internalwindow.cpp | 2 +- src/internalwindow.h | 2 +- src/main.cpp | 2 +- src/main.h | 4 +- src/main_x11.cpp | 2 +- src/main_x11.h | 2 +- .../screencast/outputscreencastsource.cpp | 2 +- .../screencast/regionscreencastsource.cpp | 2 +- src/plugins/screencast/screencastmanager.cpp | 6 +- src/plugins/screencast/screencaststream.cpp | 2 +- .../screencast/windowscreencastsource.cpp | 4 +- src/scene/decorationitem.cpp | 4 +- src/scene/decorationitem.h | 2 +- src/scene/dndiconitem.cpp | 2 +- src/scene/dndiconitem.h | 2 +- src/scene/item.cpp | 8 +- src/scene/item.h | 8 +- src/scene/itemrenderer_opengl.cpp | 4 +- src/scene/itemrenderer_qpainter.cpp | 6 +- src/scene/shadowitem.cpp | 2 +- src/scene/shadowitem.h | 2 +- src/scene/surfaceitem.cpp | 2 +- src/scene/surfaceitem.h | 2 +- src/scene/surfaceitem_internal.cpp | 2 +- src/scene/surfaceitem_internal.h | 2 +- src/scene/surfaceitem_wayland.cpp | 4 +- src/scene/surfaceitem_wayland.h | 4 +- src/scene/surfaceitem_x11.cpp | 2 +- src/scene/surfaceitem_x11.h | 2 +- src/scene/windowitem.cpp | 8 +- src/scene/windowitem.h | 8 +- src/scene/{scene.cpp => workspacescene.cpp} | 76 +++++++++---------- src/scene/{scene.h => workspacescene.h} | 14 ++-- ...e_opengl.cpp => workspacescene_opengl.cpp} | 30 ++++---- ...scene_opengl.h => workspacescene_opengl.h} | 8 +- ...ainter.cpp => workspacescene_qpainter.cpp} | 12 +-- ...e_qpainter.h => workspacescene_qpainter.h} | 8 +- src/scripting/windowthumbnailitem.cpp | 8 +- src/shadow.cpp | 2 +- src/unmanaged.cpp | 2 +- src/unmanaged.h | 2 +- src/wayland_server.cpp | 2 +- src/waylandwindow.cpp | 2 +- src/waylandwindow.h | 2 +- src/window.cpp | 2 +- src/window.h | 2 +- src/x11syncmanager.cpp | 2 +- src/x11window.cpp | 2 +- src/x11window.h | 2 +- 69 files changed, 177 insertions(+), 177 deletions(-) rename src/scene/{scene.cpp => workspacescene.cpp} (89%) rename src/scene/{scene.h => workspacescene.h} (94%) rename src/scene/{scene_opengl.cpp => workspacescene_opengl.cpp} (94%) rename src/scene/{scene_opengl.h => workspacescene_opengl.h} (92%) rename src/scene/{scene_qpainter.cpp => workspacescene_qpainter.cpp} (91%) rename src/scene/{scene_qpainter.h => workspacescene_qpainter.h} (87%) diff --git a/autotests/integration/buffer_size_change_test.cpp b/autotests/integration/buffer_size_change_test.cpp index 09640ee075..1f31e4dd26 100644 --- a/autotests/integration/buffer_size_change_test.cpp +++ b/autotests/integration/buffer_size_change_test.cpp @@ -9,7 +9,7 @@ #include "generic_scene_opengl_test.h" #include "composite.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "wayland_server.h" #include "window.h" @@ -55,7 +55,7 @@ void BufferSizeChangeTest::testShmBufferSizeChange() QVERIFY(window); // add a first repaint - QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &Scene::frameRendered); + QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &WorkspaceScene::frameRendered); Compositor::self()->scene()->addRepaintFull(); QVERIFY(frameRenderedSpy.wait()); @@ -88,7 +88,7 @@ void BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface() QVERIFY(parent); // add a first repaint - QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &Scene::frameRendered); + QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &WorkspaceScene::frameRendered); Compositor::self()->scene()->addRepaintFull(); QVERIFY(frameRenderedSpy.wait()); diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp index 31f06b9b15..15eb4dcfc8 100644 --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -13,7 +13,7 @@ #include "core/outputbackend.h" #include "effectloader.h" #include "effects.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" diff --git a/autotests/integration/generic_scene_opengl_test.cpp b/autotests/integration/generic_scene_opengl_test.cpp index 7b7a4e84ed..66c6432654 100644 --- a/autotests/integration/generic_scene_opengl_test.cpp +++ b/autotests/integration/generic_scene_opengl_test.cpp @@ -12,7 +12,7 @@ #include "core/renderbackend.h" #include "cursor.h" #include "effectloader.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "wayland_server.h" #include "window.h" diff --git a/autotests/integration/xwaylandserver_crash_test.cpp b/autotests/integration/xwaylandserver_crash_test.cpp index b805cbd17c..ed23dc1382 100644 --- a/autotests/integration/xwaylandserver_crash_test.cpp +++ b/autotests/integration/xwaylandserver_crash_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "main.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "unmanaged.h" #include "wayland_server.h" #include "workspace.h" @@ -125,7 +125,7 @@ void XwaylandServerCrashTest::testCrash() // Render a frame to ensure that the compositor doesn't crash. Compositor::self()->scene()->addRepaintFull(); - QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &Scene::frameRendered); + QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &WorkspaceScene::frameRendered); QVERIFY(frameRenderedSpy.wait()); } diff --git a/autotests/integration/xwaylandserver_restart_test.cpp b/autotests/integration/xwaylandserver_restart_test.cpp index 90c5ef67f1..df80e69475 100644 --- a/autotests/integration/xwaylandserver_restart_test.cpp +++ b/autotests/integration/xwaylandserver_restart_test.cpp @@ -9,7 +9,7 @@ #include "composite.h" #include "core/outputbackend.h" #include "main.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -100,7 +100,7 @@ void XwaylandServerRestartTest::testRestart() // Render a frame to ensure that the compositor doesn't crash. Compositor::self()->scene()->addRepaintFull(); - QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &Scene::frameRendered); + QSignalSpy frameRenderedSpy(Compositor::self()->scene(), &WorkspaceScene::frameRendered); QVERIFY(frameRenderedSpy.wait()); // Destroy the test window. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d00a4480be..635ff430c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,15 +123,15 @@ target_sources(kwin PRIVATE scene/itemrenderer.cpp scene/itemrenderer_opengl.cpp scene/itemrenderer_qpainter.cpp - scene/scene.cpp - scene/scene_opengl.cpp - scene/scene_qpainter.cpp scene/shadowitem.cpp scene/surfaceitem.cpp scene/surfaceitem_internal.cpp scene/surfaceitem_wayland.cpp scene/surfaceitem_x11.cpp scene/windowitem.cpp + scene/workspacescene.cpp + scene/workspacescene_opengl.cpp + scene/workspacescene_qpainter.cpp screenedge.cpp scripting/dbuscall.cpp scripting/desktopbackgrounditem.cpp diff --git a/src/backends/x11/standalone/x11_standalone_backend.cpp b/src/backends/x11/standalone/x11_standalone_backend.cpp index 51741328d6..dddebd3861 100644 --- a/src/backends/x11/standalone/x11_standalone_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_backend.cpp @@ -241,7 +241,7 @@ std::unique_ptr X11StandaloneBackend::createOutline(Outline *outl return std::make_unique(outline); } -void X11StandaloneBackend::createEffectsHandler(Compositor *compositor, Scene *scene) +void X11StandaloneBackend::createEffectsHandler(Compositor *compositor, WorkspaceScene *scene) { new EffectsHandlerImplX11(compositor, scene); } diff --git a/src/backends/x11/standalone/x11_standalone_backend.h b/src/backends/x11/standalone/x11_standalone_backend.h index 191408cd0f..f069f532c0 100644 --- a/src/backends/x11/standalone/x11_standalone_backend.h +++ b/src/backends/x11/standalone/x11_standalone_backend.h @@ -33,7 +33,7 @@ class ScreenEdges; class Outline; class OutlineVisual; class Compositor; -class Scene; +class WorkspaceScene; class Window; class KWIN_EXPORT X11StandaloneBackend : public OutputBackend @@ -58,7 +58,7 @@ public: void startInteractivePositionSelection(std::function callback); PlatformCursorImage cursorImage() const; std::unique_ptr createOutline(Outline *outline); - void createEffectsHandler(Compositor *compositor, Scene *scene); + void createEffectsHandler(Compositor *compositor, WorkspaceScene *scene); X11Keyboard *keyboard() const; RenderLoop *renderLoop() const; diff --git a/src/backends/x11/standalone/x11_standalone_effects.cpp b/src/backends/x11/standalone/x11_standalone_effects.cpp index a5aeacf94c..f8fc3edcb2 100644 --- a/src/backends/x11/standalone/x11_standalone_effects.cpp +++ b/src/backends/x11/standalone/x11_standalone_effects.cpp @@ -20,7 +20,7 @@ namespace KWin { -EffectsHandlerImplX11::EffectsHandlerImplX11(Compositor *compositor, Scene *scene) +EffectsHandlerImplX11::EffectsHandlerImplX11(Compositor *compositor, WorkspaceScene *scene) : EffectsHandlerImpl(compositor, scene) { connect(this, &EffectsHandlerImpl::virtualScreenGeometryChanged, this, [this]() { diff --git a/src/backends/x11/standalone/x11_standalone_effects.h b/src/backends/x11/standalone/x11_standalone_effects.h index b570b6c94c..8bcc16dcf8 100644 --- a/src/backends/x11/standalone/x11_standalone_effects.h +++ b/src/backends/x11/standalone/x11_standalone_effects.h @@ -23,7 +23,7 @@ class EffectsHandlerImplX11 : public EffectsHandlerImpl { Q_OBJECT public: - explicit EffectsHandlerImplX11(Compositor *compositor, Scene *scene); + explicit EffectsHandlerImplX11(Compositor *compositor, WorkspaceScene *scene); ~EffectsHandlerImplX11() override; void defineCursor(Qt::CursorShape shape) override; diff --git a/src/backends/x11/standalone/x11_standalone_egl_backend.cpp b/src/backends/x11/standalone/x11_standalone_egl_backend.cpp index ae3476778f..e5a069d6f1 100644 --- a/src/backends/x11/standalone/x11_standalone_egl_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_egl_backend.cpp @@ -11,8 +11,8 @@ #include "core/renderloop_p.h" #include "kwinglplatform.h" #include "options.h" -#include "scene/scene.h" #include "scene/surfaceitem_x11.h" +#include "scene/workspacescene.h" #include "softwarevsyncmonitor.h" #include "workspace.h" #include "x11_standalone_backend.h" diff --git a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp index 358700f900..eb091d425a 100644 --- a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp @@ -28,8 +28,8 @@ #include "core/overlaywindow.h" #include "core/renderloop_p.h" #include "options.h" -#include "scene/scene.h" #include "scene/surfaceitem_x11.h" +#include "scene/workspacescene.h" #include "utils/xcbutils.h" #include "workspace.h" // kwin libs diff --git a/src/backends/x11/standalone/x11_standalone_overlaywindow.cpp b/src/backends/x11/standalone/x11_standalone_overlaywindow.cpp index 6391f63eb2..f3ac72c623 100644 --- a/src/backends/x11/standalone/x11_standalone_overlaywindow.cpp +++ b/src/backends/x11/standalone/x11_standalone_overlaywindow.cpp @@ -11,7 +11,7 @@ #include "composite.h" #include "kwinglobals.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "utils/common.h" #include "utils/xcbutils.h" #include "workspace.h" diff --git a/src/composite.cpp b/src/composite.cpp index 98d5b868f9..b443685f4c 100644 --- a/src/composite.cpp +++ b/src/composite.cpp @@ -26,9 +26,9 @@ #include "internalwindow.h" #include "openglbackend.h" #include "qpainterbackend.h" -#include "scene/scene_opengl.h" -#include "scene/scene_qpainter.h" #include "scene/surfaceitem_x11.h" +#include "scene/workspacescene_opengl.h" +#include "scene/workspacescene_qpainter.h" #include "shadow.h" #include "unmanaged.h" #include "useractions.h" @@ -205,7 +205,7 @@ bool Compositor::attemptOpenGLCompositing() return false; } - m_scene = std::make_unique(backend.get()); + m_scene = std::make_unique(backend.get()); m_backend = std::move(backend); // set strict binding @@ -224,7 +224,7 @@ bool Compositor::attemptQPainterCompositing() return false; } - m_scene = std::make_unique(backend.get()); + m_scene = std::make_unique(backend.get()); m_backend = std::move(backend); qCDebug(KWIN_CORE) << "QPainter compositing has been successfully initialized"; diff --git a/src/composite.h b/src/composite.h index 38f0b1d195..ba756151d9 100644 --- a/src/composite.h +++ b/src/composite.h @@ -26,7 +26,7 @@ class RenderBackend; class RenderLayer; class RenderLoop; class RenderTarget; -class Scene; +class WorkspaceScene; class Window; class X11Window; class X11SyncManager; @@ -69,7 +69,7 @@ public: */ bool isActive(); - Scene *scene() const + WorkspaceScene *scene() const { return m_scene.get(); } @@ -195,7 +195,7 @@ private: QTimer m_releaseSelectionTimer; QList m_unusedSupportProperties; QTimer m_unusedSupportPropertyTimer; - std::unique_ptr m_scene; + std::unique_ptr m_scene; std::unique_ptr m_backend; QHash m_superlayers; CompositingType m_selectedCompositor = NoCompositing; diff --git a/src/cursor.cpp b/src/cursor.cpp index 847b2532d9..bd13fe4d7e 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -15,7 +15,7 @@ #include "input.h" #include "keyboard_input.h" #include "main.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "utils/common.h" #include "utils/xcbutils.h" // KDE diff --git a/src/deleted.cpp b/src/deleted.cpp index aa26a4a2f0..16a3008bc3 100644 --- a/src/deleted.cpp +++ b/src/deleted.cpp @@ -52,7 +52,7 @@ Deleted::~Deleted() deleteShadow(); } -WindowItem *Deleted::createItem(Scene *scene) +WindowItem *Deleted::createItem(WorkspaceScene *scene) { Q_UNREACHABLE(); } diff --git a/src/deleted.h b/src/deleted.h index 12d438003e..19730909f3 100644 --- a/src/deleted.h +++ b/src/deleted.h @@ -104,7 +104,7 @@ public: { /* nothing to do */ return geometry; } - WindowItem *createItem(Scene *scene) override; + WindowItem *createItem(WorkspaceScene *scene) override; /** * Returns whether the client was a popup. diff --git a/src/effects.cpp b/src/effects.cpp index 106fb0712c..b8c86d2df4 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -118,7 +118,7 @@ static xcb_atom_t registerSupportProperty(const QByteArray &propertyName) //--------------------- -EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) +EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *scene) : EffectsHandler(Compositor::self()->backend()->compositingType()) , keyboard_grab_effect(nullptr) , fullscreen_effect(nullptr) diff --git a/src/effects.h b/src/effects.h index 547d03101c..f306d305cf 100644 --- a/src/effects.h +++ b/src/effects.h @@ -13,7 +13,7 @@ #include "kwineffects.h" #include "kwinoffscreenquickview.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include #include @@ -52,7 +52,7 @@ class KWIN_EXPORT EffectsHandlerImpl : public EffectsHandler Q_PROPERTY(QStringList loadedEffects READ loadedEffects) Q_PROPERTY(QStringList listOfEffects READ listOfEffects) public: - EffectsHandlerImpl(Compositor *compositor, Scene *scene); + EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *scene); ~EffectsHandlerImpl() override; void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override; void paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) override; @@ -214,7 +214,7 @@ public: KSharedConfigPtr config() const override; KSharedConfigPtr inputConfig() const override; - Scene *scene() const + WorkspaceScene *scene() const { return m_scene; } @@ -342,7 +342,7 @@ private: PropertyEffectMap m_propertiesForEffects; QHash m_managedProperties; Compositor *m_compositor; - Scene *m_scene; + WorkspaceScene *m_scene; QList m_grabbedMouseEffects; EffectLoader *m_effectLoader; int m_trackingCursorChanges; diff --git a/src/internalwindow.cpp b/src/internalwindow.cpp index 1c546761ad..ee5eb24120 100644 --- a/src/internalwindow.cpp +++ b/src/internalwindow.cpp @@ -67,7 +67,7 @@ InternalWindow::~InternalWindow() { } -WindowItem *InternalWindow::createItem(Scene *scene) +WindowItem *InternalWindow::createItem(WorkspaceScene *scene) { return new WindowItemInternal(this, scene); } diff --git a/src/internalwindow.h b/src/internalwindow.h index a7e930a810..75ae9a1bef 100644 --- a/src/internalwindow.h +++ b/src/internalwindow.h @@ -72,7 +72,7 @@ protected: void doInteractiveResizeSync(const QRectF &rect) override; void updateCaption() override; void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override; - WindowItem *createItem(Scene *scene) override; + WindowItem *createItem(WorkspaceScene *scene) override; private: void requestGeometry(const QRectF &rect); diff --git a/src/main.cpp b/src/main.cpp index c3e58b28b7..744571b77b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -354,7 +354,7 @@ std::unique_ptr Application::createOutline(Outline *outline) return nullptr; } -void Application::createEffectsHandler(Compositor *compositor, Scene *scene) +void Application::createEffectsHandler(Compositor *compositor, WorkspaceScene *scene) { new EffectsHandlerImpl(compositor, scene); } diff --git a/src/main.h b/src/main.h index 47c289ba2d..d93b0df001 100644 --- a/src/main.h +++ b/src/main.h @@ -40,7 +40,7 @@ class ScreenEdges; class Outline; class OutlineVisual; class Compositor; -class Scene; +class WorkspaceScene; class Window; class XcbEventFilter : public QAbstractNativeEventFilter @@ -254,7 +254,7 @@ public: virtual std::unique_ptr createScreenEdge(ScreenEdges *parent); virtual void createPlatformCursor(QObject *parent = nullptr); virtual std::unique_ptr createOutline(Outline *outline); - virtual void createEffectsHandler(Compositor *compositor, Scene *scene); + virtual void createEffectsHandler(Compositor *compositor, WorkspaceScene *scene); static void setupMalloc(); static void setupLocalizedString(); diff --git a/src/main_x11.cpp b/src/main_x11.cpp index a8388d28e9..1442e42718 100644 --- a/src/main_x11.cpp +++ b/src/main_x11.cpp @@ -217,7 +217,7 @@ std::unique_ptr ApplicationX11::createOutline(Outline *outline) return static_cast(outputBackend())->createOutline(outline); } -void ApplicationX11::createEffectsHandler(Compositor *compositor, Scene *scene) +void ApplicationX11::createEffectsHandler(Compositor *compositor, WorkspaceScene *scene) { static_cast(outputBackend())->createEffectsHandler(compositor, scene); } diff --git a/src/main_x11.h b/src/main_x11.h index 1c4855a5b4..1ddb277ab3 100644 --- a/src/main_x11.h +++ b/src/main_x11.h @@ -26,7 +26,7 @@ public: std::unique_ptr createScreenEdge(ScreenEdges *parent) override; void createPlatformCursor(QObject *parent = nullptr) override; std::unique_ptr createOutline(Outline *outline) override; - void createEffectsHandler(Compositor *compositor, Scene *scene) override; + void createEffectsHandler(Compositor *compositor, WorkspaceScene *scene) override; void startInteractiveWindowSelection(std::function callback, const QByteArray &cursorName = QByteArray()) override; void startInteractivePositionSelection(std::function callback) override; PlatformCursorImage cursorImage() const override; diff --git a/src/plugins/screencast/outputscreencastsource.cpp b/src/plugins/screencast/outputscreencastsource.cpp index 94041b4281..18fe2febeb 100644 --- a/src/plugins/screencast/outputscreencastsource.cpp +++ b/src/plugins/screencast/outputscreencastsource.cpp @@ -12,7 +12,7 @@ #include "core/renderloop.h" #include "kwingltexture.h" #include "kwinglutils.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" namespace KWin { diff --git a/src/plugins/screencast/regionscreencastsource.cpp b/src/plugins/screencast/regionscreencastsource.cpp index eb231fad96..4d5ab495a8 100644 --- a/src/plugins/screencast/regionscreencastsource.cpp +++ b/src/plugins/screencast/regionscreencastsource.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/plugins/screencast/screencastmanager.cpp b/src/plugins/screencast/screencastmanager.cpp index a48653bad0..75bcd4a926 100644 --- a/src/plugins/screencast/screencastmanager.cpp +++ b/src/plugins/screencast/screencastmanager.cpp @@ -15,7 +15,7 @@ #include "kwingltexture.h" #include "outputscreencastsource.h" #include "regionscreencastsource.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "screencaststream.h" #include "wayland/display.h" #include "wayland/output_interface.h" @@ -70,7 +70,7 @@ public: private: void startFeeding() { - connect(Compositor::self()->scene(), &Scene::frameRendered, this, &WindowStream::bufferToStream); + connect(Compositor::self()->scene(), &WorkspaceScene::frameRendered, this, &WindowStream::bufferToStream); connect(m_window, &Window::damaged, this, &WindowStream::markDirty); markDirty(); @@ -79,7 +79,7 @@ private: void stopFeeding() { - disconnect(Compositor::self()->scene(), &Scene::frameRendered, this, &WindowStream::bufferToStream); + disconnect(Compositor::self()->scene(), &WorkspaceScene::frameRendered, this, &WindowStream::bufferToStream); } void markDirty() diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index b1bcfde05e..f010d1177b 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -20,7 +20,7 @@ #include "kwinscreencast_logging.h" #include "main.h" #include "pipewirecore.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "screencastsource.h" #include "utils/common.h" diff --git a/src/plugins/screencast/windowscreencastsource.cpp b/src/plugins/screencast/windowscreencastsource.cpp index c2e25f92db..f385374f80 100644 --- a/src/plugins/screencast/windowscreencastsource.cpp +++ b/src/plugins/screencast/windowscreencastsource.cpp @@ -16,8 +16,8 @@ #include "kwingltexture.h" #include "kwinglutils.h" #include "scene/itemrenderer.h" -#include "scene/scene.h" #include "scene/windowitem.h" +#include "scene/workspacescene.h" #include "window.h" namespace KWin @@ -63,7 +63,7 @@ void WindowScreenCastSource::render(GLFramebuffer *target) GLFramebuffer::pushFramebuffer(target); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); - Compositor::self()->scene()->renderer()->renderItem(m_window->windowItem(), Scene::PAINT_WINDOW_TRANSFORMED, infiniteRegion(), data); + Compositor::self()->scene()->renderer()->renderItem(m_window->windowItem(), WorkspaceScene::PAINT_WINDOW_TRANSFORMED, infiniteRegion(), data); GLFramebuffer::popFramebuffer(); } diff --git a/src/scene/decorationitem.cpp b/src/scene/decorationitem.cpp index 05d60cb56f..3bea5d0235 100644 --- a/src/scene/decorationitem.cpp +++ b/src/scene/decorationitem.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "decorations/decoratedclient.h" #include "deleted.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "utils/common.h" #include "window.h" @@ -124,7 +124,7 @@ void DecorationRenderer::renderToPainter(QPainter *painter, const QRect &rect) client()->decoration()->paint(painter, rect); } -DecorationItem::DecorationItem(KDecoration2::Decoration *decoration, Window *window, Scene *scene, Item *parent) +DecorationItem::DecorationItem(KDecoration2::Decoration *decoration, Window *window, WorkspaceScene *scene, Item *parent) : Item(scene, parent) , m_window(window) { diff --git a/src/scene/decorationitem.h b/src/scene/decorationitem.h index 64a6fb6778..3bb09f2925 100644 --- a/src/scene/decorationitem.h +++ b/src/scene/decorationitem.h @@ -79,7 +79,7 @@ class KWIN_EXPORT DecorationItem : public Item Q_OBJECT public: - explicit DecorationItem(KDecoration2::Decoration *decoration, Window *window, Scene *scene, Item *parent = nullptr); + explicit DecorationItem(KDecoration2::Decoration *decoration, Window *window, WorkspaceScene *scene, Item *parent = nullptr); DecorationRenderer *renderer() const; Window *window() const; diff --git a/src/scene/dndiconitem.cpp b/src/scene/dndiconitem.cpp index c2577b6f51..5caed21f35 100644 --- a/src/scene/dndiconitem.cpp +++ b/src/scene/dndiconitem.cpp @@ -12,7 +12,7 @@ namespace KWin { -DragAndDropIconItem::DragAndDropIconItem(KWaylandServer::DragAndDropIcon *icon, Scene *scene, Item *parent) +DragAndDropIconItem::DragAndDropIconItem(KWaylandServer::DragAndDropIcon *icon, WorkspaceScene *scene, Item *parent) : Item(scene, parent) { m_surfaceItem = std::make_unique(icon->surface(), scene, this); diff --git a/src/scene/dndiconitem.h b/src/scene/dndiconitem.h index d79f09e12a..c779584f2b 100644 --- a/src/scene/dndiconitem.h +++ b/src/scene/dndiconitem.h @@ -23,7 +23,7 @@ class DragAndDropIconItem : public Item Q_OBJECT public: - explicit DragAndDropIconItem(KWaylandServer::DragAndDropIcon *icon, Scene *scene, Item *parent = nullptr); + explicit DragAndDropIconItem(KWaylandServer::DragAndDropIcon *icon, WorkspaceScene *scene, Item *parent = nullptr); ~DragAndDropIconItem() override; void frameRendered(quint32 timestamp); diff --git a/src/scene/item.cpp b/src/scene/item.cpp index 3069856c16..f81f053353 100644 --- a/src/scene/item.cpp +++ b/src/scene/item.cpp @@ -7,17 +7,17 @@ #include "scene/item.h" #include "core/renderlayer.h" #include "core/renderloop.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "utils/common.h" namespace KWin { -Item::Item(Scene *scene, Item *parent) +Item::Item(WorkspaceScene *scene, Item *parent) : m_scene(scene) { setParentItem(parent); - connect(m_scene, &Scene::delegateRemoved, this, &Item::removeRepaints); + connect(m_scene, &WorkspaceScene::delegateRemoved, this, &Item::removeRepaints); } Item::~Item() @@ -30,7 +30,7 @@ Item::~Item() } } -Scene *Item::scene() const +WorkspaceScene *Item::scene() const { return m_scene; } diff --git a/src/scene/item.h b/src/scene/item.h index 51b57bc90e..e17d96cde0 100644 --- a/src/scene/item.h +++ b/src/scene/item.h @@ -19,7 +19,7 @@ namespace KWin { class SceneDelegate; -class Scene; +class WorkspaceScene; /** * The Item class is the base class for items in the scene. @@ -29,10 +29,10 @@ class KWIN_EXPORT Item : public QObject Q_OBJECT public: - explicit Item(Scene *scene, Item *parent = nullptr); + explicit Item(WorkspaceScene *scene, Item *parent = nullptr); ~Item() override; - Scene *scene() const; + WorkspaceScene *scene() const; qreal opacity() const; void setOpacity(qreal opacity); @@ -142,7 +142,7 @@ private: void updateEffectiveVisibility(); void removeRepaints(SceneDelegate *delegate); - Scene *m_scene; + WorkspaceScene *m_scene; QPointer m_parentItem; QList m_childItems; QMatrix4x4 m_transform; diff --git a/src/scene/itemrenderer_opengl.cpp b/src/scene/itemrenderer_opengl.cpp index 0ccda15766..cbee9aaa0a 100644 --- a/src/scene/itemrenderer_opengl.cpp +++ b/src/scene/itemrenderer_opengl.cpp @@ -7,9 +7,9 @@ #include "scene/itemrenderer_opengl.h" #include "platformsupport/scenes/opengl/openglsurfacetexture.h" #include "scene/decorationitem.h" -#include "scene/scene_opengl.h" #include "scene/shadowitem.h" #include "scene/surfaceitem.h" +#include "scene/workspacescene_opengl.h" namespace KWin { @@ -252,7 +252,7 @@ void ItemRendererOpenGL::renderItem(Item *item, int mask, const QRegion ®ion, RenderContext renderContext{ .clip = region, - .hardwareClipping = region != infiniteRegion() && ((mask & Scene::PAINT_WINDOW_TRANSFORMED) || (mask & Scene::PAINT_SCREEN_TRANSFORMED)), + .hardwareClipping = region != infiniteRegion() && ((mask & WorkspaceScene::PAINT_WINDOW_TRANSFORMED) || (mask & WorkspaceScene::PAINT_SCREEN_TRANSFORMED)), .renderTargetScale = data.renderTargetScale().value_or(renderTargetScale()), }; diff --git a/src/scene/itemrenderer_qpainter.cpp b/src/scene/itemrenderer_qpainter.cpp index c6b7c4e597..7b13c183eb 100644 --- a/src/scene/itemrenderer_qpainter.cpp +++ b/src/scene/itemrenderer_qpainter.cpp @@ -6,7 +6,7 @@ #include "scene/itemrenderer_qpainter.h" #include "platformsupport/scenes/qpainter/qpaintersurfacetexture.h" -#include "scene/scene_qpainter.h" +#include "scene/workspacescene_qpainter.h" #include @@ -53,7 +53,7 @@ void ItemRendererQPainter::renderItem(Item *item, int mask, const QRegion &_regi QRegion region = _region; const QRect boundingRect = item->mapToGlobal(item->boundingRect()).toAlignedRect(); - if (!(mask & (Scene::PAINT_WINDOW_TRANSFORMED | Scene::PAINT_SCREEN_TRANSFORMED))) { + if (!(mask & (WorkspaceScene::PAINT_WINDOW_TRANSFORMED | WorkspaceScene::PAINT_SCREEN_TRANSFORMED))) { region &= boundingRect; } @@ -66,7 +66,7 @@ void ItemRendererQPainter::renderItem(Item *item, int mask, const QRegion &_regi m_painter->setClipping(true); m_painter->setOpacity(data.opacity()); - if (mask & Scene::PAINT_WINDOW_TRANSFORMED) { + if (mask & WorkspaceScene::PAINT_WINDOW_TRANSFORMED) { m_painter->translate(data.xTranslation(), data.yTranslation()); m_painter->scale(data.xScale(), data.yScale()); } diff --git a/src/scene/shadowitem.cpp b/src/scene/shadowitem.cpp index 28dbf213df..e1d0279ffe 100644 --- a/src/scene/shadowitem.cpp +++ b/src/scene/shadowitem.cpp @@ -11,7 +11,7 @@ namespace KWin { -ShadowItem::ShadowItem(Shadow *shadow, Window *window, Scene *scene, Item *parent) +ShadowItem::ShadowItem(Shadow *shadow, Window *window, WorkspaceScene *scene, Item *parent) : Item(scene, parent) , m_window(window) , m_shadow(shadow) diff --git a/src/scene/shadowitem.h b/src/scene/shadowitem.h index 45eca20d99..51cd39daca 100644 --- a/src/scene/shadowitem.h +++ b/src/scene/shadowitem.h @@ -23,7 +23,7 @@ class KWIN_EXPORT ShadowItem : public Item Q_OBJECT public: - explicit ShadowItem(Shadow *shadow, Window *window, Scene *scene, Item *parent = nullptr); + explicit ShadowItem(Shadow *shadow, Window *window, WorkspaceScene *scene, Item *parent = nullptr); ~ShadowItem() override; Shadow *shadow() const; diff --git a/src/scene/surfaceitem.cpp b/src/scene/surfaceitem.cpp index deb0b99d97..e13049275e 100644 --- a/src/scene/surfaceitem.cpp +++ b/src/scene/surfaceitem.cpp @@ -9,7 +9,7 @@ namespace KWin { -SurfaceItem::SurfaceItem(Scene *scene, Item *parent) +SurfaceItem::SurfaceItem(WorkspaceScene *scene, Item *parent) : Item(scene, parent) { } diff --git a/src/scene/surfaceitem.h b/src/scene/surfaceitem.h index 492f9a3b65..3e458724dc 100644 --- a/src/scene/surfaceitem.h +++ b/src/scene/surfaceitem.h @@ -45,7 +45,7 @@ Q_SIGNALS: void damaged(); protected: - explicit SurfaceItem(Scene *scene, Item *parent = nullptr); + explicit SurfaceItem(WorkspaceScene *scene, Item *parent = nullptr); virtual std::unique_ptr createPixmap() = 0; void preprocess() override; diff --git a/src/scene/surfaceitem_internal.cpp b/src/scene/surfaceitem_internal.cpp index e660c971ea..8088536c1c 100644 --- a/src/scene/surfaceitem_internal.cpp +++ b/src/scene/surfaceitem_internal.cpp @@ -15,7 +15,7 @@ namespace KWin { -SurfaceItemInternal::SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent) +SurfaceItemInternal::SurfaceItemInternal(InternalWindow *window, WorkspaceScene *scene, Item *parent) : SurfaceItem(scene, parent) , m_window(window) { diff --git a/src/scene/surfaceitem_internal.h b/src/scene/surfaceitem_internal.h index b284696b66..67626379b5 100644 --- a/src/scene/surfaceitem_internal.h +++ b/src/scene/surfaceitem_internal.h @@ -24,7 +24,7 @@ class KWIN_EXPORT SurfaceItemInternal : public SurfaceItem Q_OBJECT public: - explicit SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr); + explicit SurfaceItemInternal(InternalWindow *window, WorkspaceScene *scene, Item *parent = nullptr); Window *window() const; diff --git a/src/scene/surfaceitem_wayland.cpp b/src/scene/surfaceitem_wayland.cpp index 66d1063a28..e8a3238de6 100644 --- a/src/scene/surfaceitem_wayland.cpp +++ b/src/scene/surfaceitem_wayland.cpp @@ -15,7 +15,7 @@ namespace KWin { -SurfaceItemWayland::SurfaceItemWayland(KWaylandServer::SurfaceInterface *surface, Scene *scene, Item *parent) +SurfaceItemWayland::SurfaceItemWayland(KWaylandServer::SurfaceInterface *surface, WorkspaceScene *scene, Item *parent) : SurfaceItem(scene, parent) , m_surface(surface) { @@ -202,7 +202,7 @@ void SurfacePixmapWayland::setBuffer(KWaylandServer::ClientBuffer *buffer) } } -SurfaceItemXwayland::SurfaceItemXwayland(Window *window, Scene *scene, Item *parent) +SurfaceItemXwayland::SurfaceItemXwayland(Window *window, WorkspaceScene *scene, Item *parent) : SurfaceItemWayland(window->surface(), scene, parent) , m_window(window) { diff --git a/src/scene/surfaceitem_wayland.h b/src/scene/surfaceitem_wayland.h index 1d279deb74..4b8845dbb2 100644 --- a/src/scene/surfaceitem_wayland.h +++ b/src/scene/surfaceitem_wayland.h @@ -28,7 +28,7 @@ class KWIN_EXPORT SurfaceItemWayland : public SurfaceItem Q_OBJECT public: - explicit SurfaceItemWayland(KWaylandServer::SurfaceInterface *surface, Scene *scene, Item *parent = nullptr); + explicit SurfaceItemWayland(KWaylandServer::SurfaceInterface *surface, WorkspaceScene *scene, Item *parent = nullptr); QVector shape() const override; QRegion opaque() const override; @@ -87,7 +87,7 @@ class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland Q_OBJECT public: - explicit SurfaceItemXwayland(Window *window, Scene *scene, Item *parent = nullptr); + explicit SurfaceItemXwayland(Window *window, WorkspaceScene *scene, Item *parent = nullptr); QVector shape() const override; diff --git a/src/scene/surfaceitem_x11.cpp b/src/scene/surfaceitem_x11.cpp index 8859f8be9c..27200cb2ff 100644 --- a/src/scene/surfaceitem_x11.cpp +++ b/src/scene/surfaceitem_x11.cpp @@ -13,7 +13,7 @@ namespace KWin { -SurfaceItemX11::SurfaceItemX11(Window *window, Scene *scene, Item *parent) +SurfaceItemX11::SurfaceItemX11(Window *window, WorkspaceScene *scene, Item *parent) : SurfaceItem(scene, parent) , m_window(window) { diff --git a/src/scene/surfaceitem_x11.h b/src/scene/surfaceitem_x11.h index 0ab3a5826c..0761cd16f8 100644 --- a/src/scene/surfaceitem_x11.h +++ b/src/scene/surfaceitem_x11.h @@ -24,7 +24,7 @@ class KWIN_EXPORT SurfaceItemX11 : public SurfaceItem Q_OBJECT public: - explicit SurfaceItemX11(Window *window, Scene *scene, Item *parent = nullptr); + explicit SurfaceItemX11(Window *window, WorkspaceScene *scene, Item *parent = nullptr); ~SurfaceItemX11() override; Window *window() const; diff --git a/src/scene/windowitem.cpp b/src/scene/windowitem.cpp index b926dd1c5e..074e5ff0cd 100644 --- a/src/scene/windowitem.cpp +++ b/src/scene/windowitem.cpp @@ -19,7 +19,7 @@ namespace KWin { -WindowItem::WindowItem(Window *window, Scene *scene, Item *parent) +WindowItem::WindowItem(Window *window, WorkspaceScene *scene, Item *parent) : Item(scene, parent) , m_window(window) { @@ -248,7 +248,7 @@ void WindowItem::markDamaged() Q_EMIT m_window->damaged(m_window); } -WindowItemX11::WindowItemX11(Window *window, Scene *scene, Item *parent) +WindowItemX11::WindowItemX11(Window *window, WorkspaceScene *scene, Item *parent) : WindowItem(window, scene, parent) { initialize(); @@ -275,13 +275,13 @@ void WindowItemX11::initialize() } } -WindowItemWayland::WindowItemWayland(Window *window, Scene *scene, Item *parent) +WindowItemWayland::WindowItemWayland(Window *window, WorkspaceScene *scene, Item *parent) : WindowItem(window, scene, parent) { updateSurfaceItem(new SurfaceItemWayland(window->surface(), scene, this)); } -WindowItemInternal::WindowItemInternal(InternalWindow *window, Scene *scene, Item *parent) +WindowItemInternal::WindowItemInternal(InternalWindow *window, WorkspaceScene *scene, Item *parent) : WindowItem(window, scene, parent) { updateSurfaceItem(new SurfaceItemInternal(window, scene, this)); diff --git a/src/scene/windowitem.h b/src/scene/windowitem.h index 8e0eaaffa5..2da77cf9fb 100644 --- a/src/scene/windowitem.h +++ b/src/scene/windowitem.h @@ -53,7 +53,7 @@ public: void unrefVisible(int reason); protected: - explicit WindowItem(Window *window, Scene *scene, Item *parent = nullptr); + explicit WindowItem(Window *window, WorkspaceScene *scene, Item *parent = nullptr); void updateSurfaceItem(SurfaceItem *surfaceItem); private Q_SLOTS: @@ -92,7 +92,7 @@ class KWIN_EXPORT WindowItemX11 : public WindowItem Q_OBJECT public: - explicit WindowItemX11(Window *window, Scene *scene, Item *parent = nullptr); + explicit WindowItemX11(Window *window, WorkspaceScene *scene, Item *parent = nullptr); private Q_SLOTS: void initialize(); @@ -106,7 +106,7 @@ class KWIN_EXPORT WindowItemWayland : public WindowItem Q_OBJECT public: - explicit WindowItemWayland(Window *window, Scene *scene, Item *parent = nullptr); + explicit WindowItemWayland(Window *window, WorkspaceScene *scene, Item *parent = nullptr); }; /** @@ -118,7 +118,7 @@ class KWIN_EXPORT WindowItemInternal : public WindowItem Q_OBJECT public: - explicit WindowItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr); + explicit WindowItemInternal(InternalWindow *window, WorkspaceScene *scene, Item *parent = nullptr); }; } // namespace KWin diff --git a/src/scene/scene.cpp b/src/scene/workspacescene.cpp similarity index 89% rename from src/scene/scene.cpp rename to src/scene/workspacescene.cpp index eb1d495c86..680c0cc566 100644 --- a/src/scene/scene.cpp +++ b/src/scene/workspacescene.cpp @@ -52,7 +52,7 @@ */ -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "composite.h" #include "core/output.h" #include "core/renderlayer.h" @@ -79,13 +79,13 @@ namespace KWin { -SceneDelegate::SceneDelegate(Scene *scene) +SceneDelegate::SceneDelegate(WorkspaceScene *scene) : m_scene(scene) { m_scene->addDelegate(this); } -SceneDelegate::SceneDelegate(Scene *scene, Output *output) +SceneDelegate::SceneDelegate(WorkspaceScene *scene, Output *output) : m_scene(scene) , m_output(output) { @@ -136,18 +136,18 @@ QRect SceneDelegate::viewport() const // Scene //**************************************** -Scene::Scene(std::unique_ptr renderer) +WorkspaceScene::WorkspaceScene(std::unique_ptr renderer) : m_renderer(std::move(renderer)) { } -Scene::~Scene() +WorkspaceScene::~WorkspaceScene() { } -void Scene::initialize() +void WorkspaceScene::initialize() { - connect(workspace(), &Workspace::stackingOrderChanged, this, &Scene::addRepaintFull); + connect(workspace(), &Workspace::stackingOrderChanged, this, &WorkspaceScene::addRepaintFull); setGeometry(workspace()->geometry()); connect(workspace(), &Workspace::geometryChanged, this, [this]() { @@ -155,12 +155,12 @@ void Scene::initialize() }); if (waylandServer()) { - connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragStarted, this, &Scene::createDndIconItem); - connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this, &Scene::destroyDndIconItem); + connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragStarted, this, &WorkspaceScene::createDndIconItem); + connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this, &WorkspaceScene::destroyDndIconItem); } } -void Scene::createDndIconItem() +void WorkspaceScene::createDndIconItem() { KWaylandServer::DragAndDropIcon *dragIcon = waylandServer()->seat()->dragIcon(); if (!dragIcon) { @@ -180,22 +180,22 @@ void Scene::createDndIconItem() } } -void Scene::destroyDndIconItem() +void WorkspaceScene::destroyDndIconItem() { m_dndIcon.reset(); } -void Scene::addRepaintFull() +void WorkspaceScene::addRepaintFull() { addRepaint(geometry()); } -void Scene::addRepaint(int x, int y, int width, int height) +void WorkspaceScene::addRepaint(int x, int y, int width, int height) { addRepaint(QRegion(x, y, width, height)); } -void Scene::addRepaint(const QRegion ®ion) +void WorkspaceScene::addRepaint(const QRegion ®ion) { for (const auto &delegate : std::as_const(m_delegates)) { const QRect viewport = delegate->viewport(); @@ -207,17 +207,17 @@ void Scene::addRepaint(const QRegion ®ion) } } -QRegion Scene::damage() const +QRegion WorkspaceScene::damage() const { return m_paintContext.damage; } -QRect Scene::geometry() const +QRect WorkspaceScene::geometry() const { return m_geometry; } -void Scene::setGeometry(const QRect &rect) +void WorkspaceScene::setGeometry(const QRect &rect) { if (m_geometry != rect) { m_geometry = rect; @@ -225,17 +225,17 @@ void Scene::setGeometry(const QRect &rect) } } -QList Scene::delegates() const +QList WorkspaceScene::delegates() const { return m_delegates; } -void Scene::addDelegate(SceneDelegate *delegate) +void WorkspaceScene::addDelegate(SceneDelegate *delegate) { m_delegates.append(delegate); } -void Scene::removeDelegate(SceneDelegate *delegate) +void WorkspaceScene::removeDelegate(SceneDelegate *delegate) { m_delegates.removeOne(delegate); Q_EMIT delegateRemoved(delegate); @@ -251,7 +251,7 @@ static SurfaceItem *findTopMostSurface(SurfaceItem *item) } } -SurfaceItem *Scene::scanoutCandidate() const +SurfaceItem *WorkspaceScene::scanoutCandidate() const { if (!waylandServer()) { return nullptr; @@ -290,7 +290,7 @@ SurfaceItem *Scene::scanoutCandidate() const return candidate; } -void Scene::prePaint(SceneDelegate *delegate) +void WorkspaceScene::prePaint(SceneDelegate *delegate) { createStackingOrder(); @@ -362,7 +362,7 @@ static void accumulateRepaints(Item *item, SceneDelegate *delegate, QRegion *rep } } -void Scene::preparePaintGenericScreen() +void WorkspaceScene::preparePaintGenericScreen() { for (WindowItem *windowItem : std::as_const(stacking_order)) { resetRepaintsHelper(windowItem, painted_delegate); @@ -383,7 +383,7 @@ void Scene::preparePaintGenericScreen() m_paintContext.damage = m_renderer->renderTargetRect(); } -void Scene::preparePaintSimpleScreen() +void WorkspaceScene::preparePaintSimpleScreen() { for (WindowItem *windowItem : std::as_const(stacking_order)) { Window *window = windowItem->window(); @@ -428,7 +428,7 @@ void Scene::preparePaintSimpleScreen() } } -void Scene::postPaint() +void WorkspaceScene::postPaint() { for (WindowItem *w : std::as_const(stacking_order)) { effects->postPaintWindow(w->window()->effectWindow()); @@ -458,7 +458,7 @@ void Scene::postPaint() clearStackingOrder(); } -void Scene::paint(RenderTarget *renderTarget, const QRegion ®ion) +void WorkspaceScene::paint(RenderTarget *renderTarget, const QRegion ®ion) { m_renderer->beginFrame(renderTarget); @@ -470,13 +470,13 @@ void Scene::paint(RenderTarget *renderTarget, const QRegion ®ion) m_renderer->endFrame(); } -ItemRenderer *Scene::renderer() const +ItemRenderer *WorkspaceScene::renderer() const { return m_renderer.get(); } // the function that'll be eventually called by paintScreen() above -void Scene::finalPaintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) +void WorkspaceScene::finalPaintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) { m_paintScreenCount++; if (mask & (PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) { @@ -488,7 +488,7 @@ void Scene::finalPaintScreen(int mask, const QRegion ®ion, ScreenPaintData &d // The generic painting code that can handle even transformations. // It simply paints bottom-to-top. -void Scene::paintGenericScreen(int, const ScreenPaintData &) +void WorkspaceScene::paintGenericScreen(int, const ScreenPaintData &) { if (m_paintContext.mask & PAINT_SCREEN_BACKGROUND_FIRST) { if (m_paintScreenCount == 1) { @@ -506,7 +506,7 @@ void Scene::paintGenericScreen(int, const ScreenPaintData &) // The optimized case without any transformations at all. // It can paint only the requested region and can use clipping // to reduce painting and improve performance. -void Scene::paintSimpleScreen(int, const QRegion ®ion) +void WorkspaceScene::paintSimpleScreen(int, const QRegion ®ion) { // This is the occlusion culling pass QRegion visible = region; @@ -537,7 +537,7 @@ void Scene::paintSimpleScreen(int, const QRegion ®ion) } } -void Scene::createStackingOrder() +void WorkspaceScene::createStackingOrder() { // Create a list of all windows in the stacking order QList windows = workspace()->stackingOrder(); @@ -567,12 +567,12 @@ void Scene::createStackingOrder() } } -void Scene::clearStackingOrder() +void WorkspaceScene::clearStackingOrder() { stacking_order.clear(); } -void Scene::paintWindow(WindowItem *item, int mask, const QRegion ®ion) +void WorkspaceScene::paintWindow(WindowItem *item, int mask, const QRegion ®ion) { if (region.isEmpty()) { // completely clipped return; @@ -583,27 +583,27 @@ void Scene::paintWindow(WindowItem *item, int mask, const QRegion ®ion) } // the function that'll be eventually called by paintWindow() above -void Scene::finalPaintWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data) +void WorkspaceScene::finalPaintWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data) { effects->drawWindow(w, mask, region, data); } // will be eventually called from drawWindow() -void Scene::finalDrawWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data) +void WorkspaceScene::finalDrawWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data) { m_renderer->renderItem(w->windowItem(), mask, region, data); } -bool Scene::makeOpenGLContextCurrent() +bool WorkspaceScene::makeOpenGLContextCurrent() { return false; } -void Scene::doneOpenGLContextCurrent() +void WorkspaceScene::doneOpenGLContextCurrent() { } -bool Scene::supportsNativeFence() const +bool WorkspaceScene::supportsNativeFence() const { return false; } diff --git a/src/scene/scene.h b/src/scene/workspacescene.h similarity index 94% rename from src/scene/scene.h rename to src/scene/workspacescene.h index 00ae48a0f0..fc75470ce1 100644 --- a/src/scene/scene.h +++ b/src/scene/workspacescene.h @@ -36,7 +36,7 @@ class EffectWindowImpl; class GLTexture; class Item; class RenderLoop; -class Scene; +class WorkspaceScene; class Shadow; class ShadowItem; class SurfaceItem; @@ -45,8 +45,8 @@ class WindowItem; class SceneDelegate : public RenderLayerDelegate { public: - explicit SceneDelegate(Scene *scene); - explicit SceneDelegate(Scene *scene, Output *output); + explicit SceneDelegate(WorkspaceScene *scene); + explicit SceneDelegate(WorkspaceScene *scene, Output *output); ~SceneDelegate() override; Output *output() const; @@ -59,17 +59,17 @@ public: void paint(RenderTarget *renderTarget, const QRegion ®ion) override; private: - Scene *m_scene; + WorkspaceScene *m_scene; Output *m_output = nullptr; }; -class KWIN_EXPORT Scene : public QObject +class KWIN_EXPORT WorkspaceScene : public QObject { Q_OBJECT public: - explicit Scene(std::unique_ptr renderer); - ~Scene() override; + explicit WorkspaceScene(std::unique_ptr renderer); + ~WorkspaceScene() override; void initialize(); diff --git a/src/scene/scene_opengl.cpp b/src/scene/workspacescene_opengl.cpp similarity index 94% rename from src/scene/scene_opengl.cpp rename to src/scene/workspacescene_opengl.cpp index 72e45749d0..00488ddf6e 100644 --- a/src/scene/scene_opengl.cpp +++ b/src/scene/workspacescene_opengl.cpp @@ -11,7 +11,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ -#include "scene_opengl.h" +#include "workspacescene_opengl.h" #include @@ -38,8 +38,8 @@ namespace KWin * SceneOpenGL ***********************************************/ -SceneOpenGL::SceneOpenGL(OpenGLBackend *backend) - : Scene(std::make_unique()) +WorkspaceSceneOpenGL::WorkspaceSceneOpenGL(OpenGLBackend *backend) + : WorkspaceScene(std::make_unique()) , m_backend(backend) { // It is not legal to not have a vertex array object bound in a core context @@ -49,42 +49,42 @@ SceneOpenGL::SceneOpenGL(OpenGLBackend *backend) } } -SceneOpenGL::~SceneOpenGL() +WorkspaceSceneOpenGL::~WorkspaceSceneOpenGL() { makeOpenGLContextCurrent(); } -bool SceneOpenGL::makeOpenGLContextCurrent() +bool WorkspaceSceneOpenGL::makeOpenGLContextCurrent() { return m_backend->makeCurrent(); } -void SceneOpenGL::doneOpenGLContextCurrent() +void WorkspaceSceneOpenGL::doneOpenGLContextCurrent() { m_backend->doneCurrent(); } -bool SceneOpenGL::supportsNativeFence() const +bool WorkspaceSceneOpenGL::supportsNativeFence() const { return m_backend->supportsNativeFence(); } -Shadow *SceneOpenGL::createShadow(Window *window) +Shadow *WorkspaceSceneOpenGL::createShadow(Window *window) { return new SceneOpenGLShadow(window); } -DecorationRenderer *SceneOpenGL::createDecorationRenderer(Decoration::DecoratedClientImpl *impl) +DecorationRenderer *WorkspaceSceneOpenGL::createDecorationRenderer(Decoration::DecoratedClientImpl *impl) { return new SceneOpenGLDecorationRenderer(impl); } -bool SceneOpenGL::animationsSupported() const +bool WorkspaceSceneOpenGL::animationsSupported() const { return !GLPlatform::instance()->isSoftwareEmulation(); } -std::shared_ptr SceneOpenGL::textureForOutput(Output *output) const +std::shared_ptr WorkspaceSceneOpenGL::textureForOutput(Output *output) const { return m_backend->textureForOutput(output); } @@ -172,7 +172,7 @@ SceneOpenGLShadow::SceneOpenGLShadow(Window *window) SceneOpenGLShadow::~SceneOpenGLShadow() { - Scene *scene = Compositor::self()->scene(); + WorkspaceScene *scene = Compositor::self()->scene(); if (scene) { scene->makeOpenGLContextCurrent(); DecorationShadowTextureCache::instance().unregister(this); @@ -184,7 +184,7 @@ bool SceneOpenGLShadow::prepareBackend() { if (hasDecorationShadow()) { // simplifies a lot by going directly to - Scene *scene = Compositor::self()->scene(); + WorkspaceScene *scene = Compositor::self()->scene(); scene->makeOpenGLContextCurrent(); m_texture = DecorationShadowTextureCache::instance().getTexture(this); @@ -251,7 +251,7 @@ bool SceneOpenGLShadow::prepareBackend() } } - Scene *scene = Compositor::self()->scene(); + WorkspaceScene *scene = Compositor::self()->scene(); scene->makeOpenGLContextCurrent(); m_texture = std::make_shared(image); @@ -272,7 +272,7 @@ SceneOpenGLDecorationRenderer::SceneOpenGLDecorationRenderer(Decoration::Decorat SceneOpenGLDecorationRenderer::~SceneOpenGLDecorationRenderer() { - if (Scene *scene = Compositor::self()->scene()) { + if (WorkspaceScene *scene = Compositor::self()->scene()) { scene->makeOpenGLContextCurrent(); } } diff --git a/src/scene/scene_opengl.h b/src/scene/workspacescene_opengl.h similarity index 92% rename from src/scene/scene_opengl.h rename to src/scene/workspacescene_opengl.h index 830172cf30..0818acfb50 100644 --- a/src/scene/scene_opengl.h +++ b/src/scene/workspacescene_opengl.h @@ -13,7 +13,7 @@ #include "openglbackend.h" #include "scene/decorationitem.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "shadow.h" #include "kwinglutils.h" @@ -22,13 +22,13 @@ namespace KWin { class OpenGLBackend; -class KWIN_EXPORT SceneOpenGL : public Scene +class KWIN_EXPORT WorkspaceSceneOpenGL : public WorkspaceScene { Q_OBJECT public: - explicit SceneOpenGL(OpenGLBackend *backend); - ~SceneOpenGL() override; + explicit WorkspaceSceneOpenGL(OpenGLBackend *backend); + ~WorkspaceSceneOpenGL() override; Shadow *createShadow(Window *window) override; bool makeOpenGLContextCurrent() override; diff --git a/src/scene/scene_qpainter.cpp b/src/scene/workspacescene_qpainter.cpp similarity index 91% rename from src/scene/scene_qpainter.cpp rename to src/scene/workspacescene_qpainter.cpp index 51cce283bb..1f16777e98 100644 --- a/src/scene/scene_qpainter.cpp +++ b/src/scene/workspacescene_qpainter.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ -#include "scene_qpainter.h" +#include "workspacescene_qpainter.h" // KWin #include "decorations/decoratedclient.h" #include "scene/itemrenderer_qpainter.h" @@ -26,22 +26,22 @@ namespace KWin // SceneQPainter //**************************************** -SceneQPainter::SceneQPainter(QPainterBackend *backend) - : Scene(std::make_unique()) +WorkspaceSceneQPainter::WorkspaceSceneQPainter(QPainterBackend *backend) + : WorkspaceScene(std::make_unique()) , m_backend(backend) { } -SceneQPainter::~SceneQPainter() +WorkspaceSceneQPainter::~WorkspaceSceneQPainter() { } -Shadow *SceneQPainter::createShadow(Window *window) +Shadow *WorkspaceSceneQPainter::createShadow(Window *window) { return new SceneQPainterShadow(window); } -DecorationRenderer *SceneQPainter::createDecorationRenderer(Decoration::DecoratedClientImpl *impl) +DecorationRenderer *WorkspaceSceneQPainter::createDecorationRenderer(Decoration::DecoratedClientImpl *impl) { return new SceneQPainterDecorationRenderer(impl); } diff --git a/src/scene/scene_qpainter.h b/src/scene/workspacescene_qpainter.h similarity index 87% rename from src/scene/scene_qpainter.h rename to src/scene/workspacescene_qpainter.h index 714c564a0a..b1b39e34e2 100644 --- a/src/scene/scene_qpainter.h +++ b/src/scene/workspacescene_qpainter.h @@ -11,19 +11,19 @@ #include "qpainterbackend.h" #include "scene/decorationitem.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "shadow.h" namespace KWin { -class KWIN_EXPORT SceneQPainter : public Scene +class KWIN_EXPORT WorkspaceSceneQPainter : public WorkspaceScene { Q_OBJECT public: - explicit SceneQPainter(QPainterBackend *backend); - ~SceneQPainter() override; + explicit WorkspaceSceneQPainter(QPainterBackend *backend); + ~WorkspaceSceneQPainter() override; Shadow *createShadow(Window *window) override; DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override; diff --git a/src/scripting/windowthumbnailitem.cpp b/src/scripting/windowthumbnailitem.cpp index 07e15d0b78..19aec3faa6 100644 --- a/src/scripting/windowthumbnailitem.cpp +++ b/src/scripting/windowthumbnailitem.cpp @@ -11,8 +11,8 @@ #include "core/renderbackend.h" #include "effects.h" #include "scene/itemrenderer.h" -#include "scene/scene.h" #include "scene/windowitem.h" +#include "scene/workspacescene.h" #include "scripting_logging.h" #include "virtualdesktops.h" #include "window.h" @@ -166,7 +166,7 @@ void WindowThumbnailItem::updateFrameRenderingConnection() } if (useGlThumbnails()) { - m_frameRenderingConnection = connect(Compositor::self()->scene(), &Scene::preFrameRender, this, &WindowThumbnailItem::updateOffscreenTexture); + m_frameRenderingConnection = connect(Compositor::self()->scene(), &WorkspaceScene::preFrameRender, this, &WindowThumbnailItem::updateOffscreenTexture); } } @@ -200,7 +200,7 @@ void WindowThumbnailItem::destroyOffscreenTexture() } if (m_offscreenTexture) { - Scene *scene = Compositor::self()->scene(); + WorkspaceScene *scene = Compositor::self()->scene(); scene->makeOpenGLContextCurrent(); m_offscreenTarget.reset(); m_offscreenTexture.reset(); @@ -443,7 +443,7 @@ void WindowThumbnailItem::updateOffscreenTexture() // The thumbnail must be rendered using kwin's opengl context as VAOs are not // shared across contexts. Unfortunately, this also introduces a latency of 1 // frame, which is not ideal, but it is acceptable for things such as thumbnails. - const int mask = Scene::PAINT_WINDOW_TRANSFORMED; + const int mask = WorkspaceScene::PAINT_WINDOW_TRANSFORMED; Compositor::self()->scene()->renderer()->renderItem(m_client->windowItem(), mask, infiniteRegion(), data); GLFramebuffer::popFramebuffer(); diff --git a/src/shadow.cpp b/src/shadow.cpp index 15f3d42f17..b081948b92 100644 --- a/src/shadow.cpp +++ b/src/shadow.cpp @@ -12,7 +12,7 @@ #include "atoms.h" #include "composite.h" #include "internalwindow.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "wayland/shadow_interface.h" #include "wayland/shmclientbuffer.h" #include "wayland/surface_interface.h" diff --git a/src/unmanaged.cpp b/src/unmanaged.cpp index 41e4725daf..29546690d7 100644 --- a/src/unmanaged.cpp +++ b/src/unmanaged.cpp @@ -71,7 +71,7 @@ Unmanaged::~Unmanaged() { } -WindowItem *Unmanaged::createItem(Scene *scene) +WindowItem *Unmanaged::createItem(WorkspaceScene *scene) { return new WindowItemX11(this, scene); } diff --git a/src/unmanaged.h b/src/unmanaged.h index 721ceffe1d..0fcd81f1b7 100644 --- a/src/unmanaged.h +++ b/src/unmanaged.h @@ -59,7 +59,7 @@ public: { /* nothing to do */ return geometry; } - WindowItem *createItem(Scene *scene) override; + WindowItem *createItem(WorkspaceScene *scene) override; public Q_SLOTS: void release(ReleaseReason releaseReason = ReleaseReason::Release); diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index b4cae9433e..5e79213586 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -19,7 +19,7 @@ #include "keyboard_input.h" #include "layershellv1integration.h" #include "main.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "unmanaged.h" #include "utils/serviceutils.h" #include "virtualdesktops.h" diff --git a/src/waylandwindow.cpp b/src/waylandwindow.cpp index 1aba0f0e96..10b849d6af 100644 --- a/src/waylandwindow.cpp +++ b/src/waylandwindow.cpp @@ -53,7 +53,7 @@ WaylandWindow::WaylandWindow(SurfaceInterface *surface) updateIcon(); } -WindowItem *WaylandWindow::createItem(Scene *scene) +WindowItem *WaylandWindow::createItem(WorkspaceScene *scene) { return new WindowItemWayland(this, scene); } diff --git a/src/waylandwindow.h b/src/waylandwindow.h index 857d97ae50..baf563edbc 100644 --- a/src/waylandwindow.h +++ b/src/waylandwindow.h @@ -44,7 +44,7 @@ protected: bool belongsToDesktop() const override; void doSetActive() override; void updateCaption() override; - WindowItem *createItem(Scene *scene) override; + WindowItem *createItem(WorkspaceScene *scene) override; void cleanGrouping(); void updateGeometry(const QRectF &rect); diff --git a/src/window.cpp b/src/window.cpp index 2f9dd4a87a..eba8e2af63 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -341,7 +341,7 @@ void Window::setOpacity(qreal opacity) bool Window::setupCompositing() { - Scene *scene = Compositor::self()->scene(); + WorkspaceScene *scene = Compositor::self()->scene(); if (!scene) { return false; } diff --git a/src/window.h b/src/window.h index a7577f1358..821d079701 100644 --- a/src/window.h +++ b/src/window.h @@ -1579,7 +1579,7 @@ protected: void getWmOpaqueRegion(); void discardShapeRegion(); - virtual WindowItem *createItem(Scene *scene) = 0; + virtual WindowItem *createItem(WorkspaceScene *scene) = 0; void deleteItem(); void getResourceClass(); diff --git a/src/x11syncmanager.cpp b/src/x11syncmanager.cpp index f39fa98d55..984fa978a6 100644 --- a/src/x11syncmanager.cpp +++ b/src/x11syncmanager.cpp @@ -11,7 +11,7 @@ #include "core/outputbackend.h" #include "core/renderbackend.h" #include "main.h" -#include "scene/scene.h" +#include "scene/workspacescene.h" #include "utils/common.h" #include "kwinglplatform.h" diff --git a/src/x11window.cpp b/src/x11window.cpp index f490f4c6ff..e831a7f518 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -316,7 +316,7 @@ X11Window::~X11Window() Q_ASSERT(!check_active_modal); } -WindowItem *X11Window::createItem(Scene *scene) +WindowItem *X11Window::createItem(WorkspaceScene *scene) { return new WindowItemX11(this, scene); } diff --git a/src/x11window.h b/src/x11window.h index 90f3329545..8ebc4399f8 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -357,7 +357,7 @@ protected: QSizeF resizeIncrements() const override; bool acceptsFocus() const override; void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override; - WindowItem *createItem(Scene *scene) override; + WindowItem *createItem(WorkspaceScene *scene) override; // Signals for the scripting interface // Signals make an excellent way for communication