KWin
Loading...
Searching...
No Matches
workspacescene.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "core/colorspace.h"
13#include "scene/scene.h"
14
15namespace KWin
16{
17
18namespace Decoration
19{
20class DecoratedClientImpl;
21}
22
23class DecorationRenderer;
24class Deleted;
25class DragAndDropIconItem;
26class EffectWindow;
27class GLTexture;
28class Item;
29class RenderLoop;
30class WorkspaceScene;
31class Shadow;
32class ShadowItem;
33class ShadowTextureProvider;
34class SurfaceItem;
35class WindowItem;
36class WindowPaintData;
37
38class KWIN_EXPORT WorkspaceScene : public Scene
39{
40 Q_OBJECT
41
42public:
43 explicit WorkspaceScene(std::unique_ptr<ItemRenderer> renderer);
44 ~WorkspaceScene() override;
45
46 void initialize();
47
48 Item *containerItem() const;
49
50 SurfaceItem *scanoutCandidate() const override;
51 QRegion prePaint(SceneDelegate *delegate) override;
52 void postPaint() override;
53 void paint(const RenderTarget &renderTarget, const QRegion &region) override;
54 void frame(SceneDelegate *delegate, OutputFrame *frame) override;
55
56 virtual bool makeOpenGLContextCurrent();
57 virtual void doneOpenGLContextCurrent();
58 virtual bool supportsNativeFence() const;
59
60 virtual std::unique_ptr<DecorationRenderer> createDecorationRenderer(Decoration::DecoratedClientImpl *) = 0;
61 virtual std::unique_ptr<ShadowTextureProvider> createShadowTextureProvider(Shadow *shadow) = 0;
62
69 virtual bool animationsSupported() const = 0;
70
71 virtual std::pair<std::shared_ptr<GLTexture>, ColorDescription> textureForOutput(Output *output) const
72 {
73 return {nullptr, ColorDescription::sRGB};
74 }
75
76Q_SIGNALS:
79
80protected:
81 void createStackingOrder();
82 void clearStackingOrder();
83 friend class EffectsHandler;
84 // called after all effects had their paintScreen() called
85 void finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen);
86 // shared implementation of painting the screen in the generic
87 // (unoptimized) way
88 void preparePaintGenericScreen();
89 void paintGenericScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, Output *screen);
90 // shared implementation of painting the screen in an optimized way
91 void preparePaintSimpleScreen();
92 void paintSimpleScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region);
93 // called after all effects had their paintWindow() called
94 void finalPaintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data);
95 // shared implementation, starts painting the window
96 void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, WindowItem *w, int mask, const QRegion &region);
97 // called after all effects had their drawWindow() called
98 void finalDrawWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data);
99
100 // saved data for 2nd pass of optimized screen painting
102 {
103 WindowItem *item = nullptr;
104 QRegion region;
105 QRegion opaque;
106 int mask = 0;
107 };
108
110 {
111 QRegion damage;
112 int mask = 0;
113 QList<Phase2Data> phase2Data;
114 };
115
116 // The screen that is being currently painted
117 Output *painted_screen = nullptr;
118 SceneDelegate *painted_delegate = nullptr;
119
120 // windows in their stacking order
121 QList<WindowItem *> stacking_order;
122
123private:
124 void createDndIconItem();
125 void destroyDndIconItem();
126
127 std::chrono::milliseconds m_expectedPresentTimestamp = std::chrono::milliseconds::zero();
128 // how many times finalPaintScreen() has been called
129 int m_paintScreenCount = 0;
130 PaintContext m_paintContext;
131 std::unique_ptr<Item> m_containerItem;
132 std::unique_ptr<DragAndDropIconItem> m_dndIcon;
133};
134
135} // namespace
Representation of a window used by/for Effect classes.
Manager class that handles all the effects.
Class representing a Window's Shadow to be rendered by the Compositor.
Definition shadow.h:48
QList< WindowItem * > stacking_order
virtual std::unique_ptr< ShadowTextureProvider > createShadowTextureProvider(Shadow *shadow)=0
virtual std::unique_ptr< DecorationRenderer > createDecorationRenderer(Decoration::DecoratedClientImpl *)=0
virtual bool animationsSupported() const =0
virtual std::pair< std::shared_ptr< GLTexture >, ColorDescription > textureForOutput(Output *output) const