KWin
Loading...
Searching...
No Matches
x11_standalone_backend.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: 2016 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include <config-kwin.h>
13
14#include "core/outputbackend.h"
15#include <kwin_export.h>
16
17#include <QObject>
18
19#include <memory>
20
21#include <X11/Xlib-xcb.h>
22#include <fixx11h.h>
23
24namespace KWin
25{
26class RenderLoop;
27class XInputIntegration;
28class WindowSelector;
29class X11EventFilter;
30class X11Output;
31class X11Keyboard;
32class Edge;
33class ScreenEdges;
34class Outline;
35class OutlineVisual;
36class Cursor;
37class Compositor;
38class WorkspaceScene;
39class Window;
40
41class KWIN_EXPORT X11StandaloneBackend : public OutputBackend
42{
43 Q_OBJECT
44
45public:
46 X11StandaloneBackend(QObject *parent = nullptr);
47 ~X11StandaloneBackend() override;
48 bool initialize() override;
49
50 ::Display *display() const;
51 xcb_connection_t *connection() const;
52 xcb_window_t rootWindow() const;
53
54 std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
55 QList<CompositingType> supportedCompositors() const override;
56
57 void initOutputs();
58 void scheduleUpdateOutputs();
59 void updateOutputs();
60
61 std::unique_ptr<Edge> createScreenEdge(ScreenEdges *parent);
62 std::unique_ptr<Cursor> createPlatformCursor();
63 void startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName = QByteArray());
64 void startInteractivePositionSelection(std::function<void(const QPointF &)> callback);
65 PlatformCursorImage cursorImage() const;
66 std::unique_ptr<OutlineVisual> createOutline(Outline *outline);
67 void createEffectsHandler(Compositor *compositor, WorkspaceScene *scene);
68
69 X11Keyboard *keyboard() const;
70 RenderLoop *renderLoop() const;
71 Outputs outputs() const override;
72
73 void setEglDisplay(std::unique_ptr<EglDisplay> &&display);
74 EglDisplay *sceneEglDisplayObject() const override;
75
76private:
86 static bool hasGlx();
87
88 X11Output *findX11Output(const QString &name) const;
89 template<typename T>
90 void doUpdateOutputs();
91 void updateRefreshRate();
92 void updateCursor();
93
94#if HAVE_X11_XINPUT
95 std::unique_ptr<XInputIntegration> m_xinputIntegration;
96#endif
97 std::unique_ptr<QTimer> m_updateOutputsTimer;
98 ::Display *m_x11Display;
99 std::unique_ptr<WindowSelector> m_windowSelector;
100 std::unique_ptr<X11EventFilter> m_screenEdgesFilter;
101 std::unique_ptr<X11EventFilter> m_randrEventFilter;
102 std::unique_ptr<X11Keyboard> m_keyboard;
103 std::unique_ptr<RenderLoop> m_renderLoop;
104 QList<Output *> m_outputs;
105 std::unique_ptr<EglDisplay> m_eglDisplay;
106};
107
108}
This class is used to show the outline of a given geometry.
Definition outline.h:38
Class for controlling screen edges.
Definition screenedge.h:222
KWIN_EXPORT xcb_window_t rootWindow()
Definition xcb.h:24
struct _XDisplay Display