Changeset View
Changeset View
Standalone View
Standalone View
scene_xrender.cpp
Show All 27 Lines | |||||
28 | #include "toplevel.h" | 28 | #include "toplevel.h" | ||
29 | #include "client.h" | 29 | #include "client.h" | ||
30 | #include "composite.h" | 30 | #include "composite.h" | ||
31 | #include "deleted.h" | 31 | #include "deleted.h" | ||
32 | #include "effects.h" | 32 | #include "effects.h" | ||
33 | #include "main.h" | 33 | #include "main.h" | ||
34 | #include "overlaywindow.h" | 34 | #include "overlaywindow.h" | ||
35 | #include "platform.h" | 35 | #include "platform.h" | ||
36 | #include "screens.h" | ||||
36 | #include "xcbutils.h" | 37 | #include "xcbutils.h" | ||
37 | #include "kwinxrenderutils.h" | 38 | #include "kwinxrenderutils.h" | ||
38 | #include "decorations/decoratedclient.h" | 39 | #include "decorations/decoratedclient.h" | ||
39 | 40 | | |||
40 | #include <xcb/xfixes.h> | 41 | #include <xcb/xfixes.h> | ||
41 | 42 | | |||
42 | #include <QDebug> | 43 | #include <QDebug> | ||
43 | #include <QtGui/QPainter> | 44 | #include <QtGui/QPainter> | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 160 | } else { | |||
168 | xcb_render_create_picture(connection(), m_front, rootWindow(), m_format, XCB_RENDER_CP_SUBWINDOW_MODE, values); | 169 | xcb_render_create_picture(connection(), m_front, rootWindow(), m_format, XCB_RENDER_CP_SUBWINDOW_MODE, values); | ||
169 | } | 170 | } | ||
170 | createBuffer(); | 171 | createBuffer(); | ||
171 | } | 172 | } | ||
172 | 173 | | |||
173 | void X11XRenderBackend::createBuffer() | 174 | void X11XRenderBackend::createBuffer() | ||
174 | { | 175 | { | ||
175 | xcb_pixmap_t pixmap = xcb_generate_id(connection()); | 176 | xcb_pixmap_t pixmap = xcb_generate_id(connection()); | ||
176 | xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displayWidth(), displayHeight()); | 177 | const auto displaySize = screens()->displaySize(); | ||
178 | xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displaySize.width(), displaySize.height()); | ||||
177 | xcb_render_picture_t b = xcb_generate_id(connection()); | 179 | xcb_render_picture_t b = xcb_generate_id(connection()); | ||
178 | xcb_render_create_picture(connection(), b, pixmap, m_format, 0, NULL); | 180 | xcb_render_create_picture(connection(), b, pixmap, m_format, 0, NULL); | ||
179 | xcb_free_pixmap(connection(), pixmap); // The picture owns the pixmap now | 181 | xcb_free_pixmap(connection(), pixmap); // The picture owns the pixmap now | ||
180 | setBuffer(b); | 182 | setBuffer(b); | ||
181 | } | 183 | } | ||
182 | 184 | | |||
183 | void X11XRenderBackend::present(int mask, const QRegion &damage) | 185 | void X11XRenderBackend::present(int mask, const QRegion &damage) | ||
184 | { | 186 | { | ||
187 | const auto displaySize = screens()->displaySize(); | ||||
185 | if (mask & Scene::PAINT_SCREEN_REGION) { | 188 | if (mask & Scene::PAINT_SCREEN_REGION) { | ||
186 | // Use the damage region as the clip region for the root window | 189 | // Use the damage region as the clip region for the root window | ||
187 | XFixesRegion frontRegion(damage); | 190 | XFixesRegion frontRegion(damage); | ||
188 | xcb_xfixes_set_picture_clip_region(connection(), m_front, frontRegion, 0, 0); | 191 | xcb_xfixes_set_picture_clip_region(connection(), m_front, frontRegion, 0, 0); | ||
189 | // copy composed buffer to the root window | 192 | // copy composed buffer to the root window | ||
190 | xcb_xfixes_set_picture_clip_region(connection(), buffer(), XCB_XFIXES_REGION_NONE, 0, 0); | 193 | xcb_xfixes_set_picture_clip_region(connection(), buffer(), XCB_XFIXES_REGION_NONE, 0, 0); | ||
191 | xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, | 194 | xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, | ||
192 | m_front, 0, 0, 0, 0, 0, 0, displayWidth(), displayHeight()); | 195 | m_front, 0, 0, 0, 0, 0, 0, displaySize.width(), displaySize.height()); | ||
193 | xcb_xfixes_set_picture_clip_region(connection(), m_front, XCB_XFIXES_REGION_NONE, 0, 0); | 196 | xcb_xfixes_set_picture_clip_region(connection(), m_front, XCB_XFIXES_REGION_NONE, 0, 0); | ||
194 | xcb_flush(connection()); | 197 | xcb_flush(connection()); | ||
195 | } else { | 198 | } else { | ||
196 | // copy composed buffer to the root window | 199 | // copy composed buffer to the root window | ||
197 | xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, | 200 | xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, | ||
198 | m_front, 0, 0, 0, 0, 0, 0, displayWidth(), displayHeight()); | 201 | m_front, 0, 0, 0, 0, 0, 0, displaySize.width(), displaySize.height()); | ||
199 | xcb_flush(connection()); | 202 | xcb_flush(connection()); | ||
200 | } | 203 | } | ||
201 | } | 204 | } | ||
202 | 205 | | |||
203 | void X11XRenderBackend::screenGeometryChanged(const QSize &size) | 206 | void X11XRenderBackend::screenGeometryChanged(const QSize &size) | ||
204 | { | 207 | { | ||
205 | Q_UNUSED(size) | 208 | Q_UNUSED(size) | ||
206 | init(false); | 209 | init(false); | ||
▲ Show 20 Lines • Show All 1098 Lines • Show Last 20 Lines |