Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/windowed/x11windowed_backend.h
Show All 29 Lines | |||||
30 | 30 | | |||
31 | struct _XDisplay; | 31 | struct _XDisplay; | ||
32 | typedef struct _XDisplay Display; | 32 | typedef struct _XDisplay Display; | ||
33 | typedef struct _XCBKeySymbols xcb_key_symbols_t; | 33 | typedef struct _XCBKeySymbols xcb_key_symbols_t; | ||
34 | class NETWinInfo; | 34 | class NETWinInfo; | ||
35 | 35 | | |||
36 | namespace KWin | 36 | namespace KWin | ||
37 | { | 37 | { | ||
38 | class X11WindowedOutput; | ||||
38 | 39 | | |||
39 | class KWIN_EXPORT X11WindowedBackend : public Platform | 40 | class KWIN_EXPORT X11WindowedBackend : public Platform | ||
40 | { | 41 | { | ||
41 | Q_OBJECT | 42 | Q_OBJECT | ||
42 | Q_INTERFACES(KWin::Platform) | 43 | Q_INTERFACES(KWin::Platform) | ||
43 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "x11.json") | 44 | Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "x11.json") | ||
44 | Q_PROPERTY(QSize size READ screenSize NOTIFY sizeChanged) | 45 | Q_PROPERTY(QSize size READ screenSize NOTIFY sizeChanged) | ||
45 | public: | 46 | public: | ||
46 | X11WindowedBackend(QObject *parent = nullptr); | 47 | X11WindowedBackend(QObject *parent = nullptr); | ||
47 | virtual ~X11WindowedBackend(); | 48 | virtual ~X11WindowedBackend(); | ||
48 | void init() override; | 49 | void init() override; | ||
49 | QVector<QRect> screenGeometries() const override; | | |||
50 | QVector<qreal> screenScales() const override; | | |||
51 | 50 | | |||
52 | xcb_connection_t *connection() const { | 51 | xcb_connection_t *connection() const { | ||
53 | return m_connection; | 52 | return m_connection; | ||
54 | } | 53 | } | ||
54 | xcb_screen_t *screen() const { | ||||
55 | return m_screen; | ||||
56 | } | ||||
55 | int screenNumer() const { | 57 | int screenNumer() const { | ||
56 | return m_screenNumber; | 58 | return m_screenNumber; | ||
57 | } | 59 | } | ||
58 | xcb_window_t window() const { | 60 | xcb_window_t window() const { | ||
59 | return windowForScreen(0); | 61 | return windowForScreen(0); | ||
60 | } | 62 | } | ||
61 | xcb_window_t windowForScreen(int screen) const; | 63 | xcb_window_t windowForScreen(int screen) const; | ||
62 | Display *display() const { | 64 | Display *display() const { | ||
63 | return m_display; | 65 | return m_display; | ||
64 | } | 66 | } | ||
65 | xcb_window_t rootWindow() const; | 67 | xcb_window_t rootWindow() const; | ||
68 | bool hasXInput() const { | ||||
69 | return m_hasXInput; | ||||
70 | } | ||||
66 | 71 | | |||
67 | Screens *createScreens(QObject *parent = nullptr) override; | 72 | Screens *createScreens(QObject *parent = nullptr) override; | ||
68 | OpenGLBackend *createOpenGLBackend() override; | 73 | OpenGLBackend *createOpenGLBackend() override; | ||
69 | QPainterBackend* createQPainterBackend() override; | 74 | QPainterBackend* createQPainterBackend() override; | ||
70 | void warpPointer(const QPointF &globalPos) override; | 75 | void warpPointer(const QPointF &globalPos) override; | ||
71 | 76 | | |||
72 | QVector<CompositingType> supportedCompositors() const override { | 77 | QVector<CompositingType> supportedCompositors() const override { | ||
73 | if (selectedCompositor() != NoCompositing) { | 78 | if (selectedCompositor() != NoCompositing) { | ||
74 | return {selectedCompositor()}; | 79 | return {selectedCompositor()}; | ||
75 | } | 80 | } | ||
76 | return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing}; | 81 | return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing}; | ||
77 | } | 82 | } | ||
78 | 83 | | |||
84 | Outputs outputs() const override; | ||||
85 | Outputs enabledOutputs() const override; | ||||
86 | | ||||
79 | Q_SIGNALS: | 87 | Q_SIGNALS: | ||
80 | void sizeChanged(); | 88 | void sizeChanged(); | ||
81 | 89 | | |||
82 | private: | 90 | private: | ||
83 | void createWindow(); | 91 | void createOutputs(); | ||
84 | void startEventReading(); | 92 | void startEventReading(); | ||
85 | void grabKeyboard(xcb_timestamp_t time); | 93 | void grabKeyboard(xcb_timestamp_t time); | ||
86 | void updateWindowTitle(); | 94 | void updateWindowTitle(); | ||
87 | void handleEvent(xcb_generic_event_t *event); | 95 | void handleEvent(xcb_generic_event_t *event); | ||
88 | void handleClientMessage(xcb_client_message_event_t *event); | 96 | void handleClientMessage(xcb_client_message_event_t *event); | ||
89 | void handleButtonPress(xcb_button_press_event_t *event); | 97 | void handleButtonPress(xcb_button_press_event_t *event); | ||
90 | void handleExpose(xcb_expose_event_t *event); | 98 | void handleExpose(xcb_expose_event_t *event); | ||
91 | void updateSize(xcb_configure_notify_event_t *event); | 99 | void updateSize(xcb_configure_notify_event_t *event); | ||
92 | void createCursor(const QImage &img, const QPoint &hotspot); | 100 | void createCursor(const QImage &img, const QPoint &hotspot); | ||
93 | void initXInputForWindow(xcb_window_t window); | | |||
94 | void initXInput(); | 101 | void initXInput(); | ||
95 | 102 | | |||
96 | xcb_connection_t *m_connection = nullptr; | 103 | xcb_connection_t *m_connection = nullptr; | ||
97 | xcb_screen_t *m_screen = nullptr; | 104 | xcb_screen_t *m_screen = nullptr; | ||
98 | xcb_key_symbols_t *m_keySymbols = nullptr; | 105 | xcb_key_symbols_t *m_keySymbols = nullptr; | ||
99 | int m_screenNumber = 0; | 106 | int m_screenNumber = 0; | ||
100 | struct Output { | 107 | | ||
101 | xcb_window_t window = XCB_WINDOW_NONE; | | |||
102 | QSize size; | | |||
103 | qreal scale = 1; | | |||
104 | QPoint xPosition; | | |||
105 | QPoint internalPosition; | | |||
106 | NETWinInfo *winInfo = nullptr; | | |||
107 | }; | | |||
108 | QVector<Output> m_windows; | | |||
109 | xcb_atom_t m_protocols = XCB_ATOM_NONE; | 108 | xcb_atom_t m_protocols = XCB_ATOM_NONE; | ||
110 | xcb_atom_t m_deleteWindowProtocol = XCB_ATOM_NONE; | 109 | xcb_atom_t m_deleteWindowProtocol = XCB_ATOM_NONE; | ||
111 | xcb_cursor_t m_cursor = XCB_CURSOR_NONE; | 110 | xcb_cursor_t m_cursor = XCB_CURSOR_NONE; | ||
112 | Display *m_display = nullptr; | 111 | Display *m_display = nullptr; | ||
113 | bool m_keyboardGrabbed = false; | 112 | bool m_keyboardGrabbed = false; | ||
114 | 113 | | |||
115 | bool m_hasXInput = false; | 114 | bool m_hasXInput = false; | ||
116 | int m_xiOpcode = 0; | 115 | int m_xiOpcode = 0; | ||
117 | int m_majorVersion = 0; | 116 | int m_majorVersion = 0; | ||
118 | int m_minorVersion = 0; | 117 | int m_minorVersion = 0; | ||
118 | | ||||
119 | QVector<X11WindowedOutput*> m_outputs; | ||||
zzag: Coding style nitpick: missing whitespace before `*`. | |||||
119 | }; | 120 | }; | ||
120 | 121 | | |||
121 | } | 122 | } | ||
122 | 123 | | |||
123 | #endif | 124 | #endif |
Coding style nitpick: missing whitespace before *.