Changeset View
Changeset View
Standalone View
Standalone View
scene.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
76 | #include "effects.h" | 76 | #include "effects.h" | ||
77 | #include "overlaywindow.h" | 77 | #include "overlaywindow.h" | ||
78 | #include "screens.h" | 78 | #include "screens.h" | ||
79 | #include "shadow.h" | 79 | #include "shadow.h" | ||
80 | #include "wayland_server.h" | 80 | #include "wayland_server.h" | ||
81 | 81 | | |||
82 | #include "thumbnailitem.h" | 82 | #include "thumbnailitem.h" | ||
83 | 83 | | |||
84 | #include <KWayland/Server/buffer_interface.h> | 84 | #include <KWaylandServer/buffer_interface.h> | ||
85 | #include <KWayland/Server/subcompositor_interface.h> | 85 | #include <KWaylandServer/subcompositor_interface.h> | ||
86 | #include <KWayland/Server/surface_interface.h> | 86 | #include <KWaylandServer/surface_interface.h> | ||
87 | 87 | | |||
88 | namespace KWin | 88 | namespace KWin | ||
89 | { | 89 | { | ||
90 | 90 | | |||
91 | //**************************************** | 91 | //**************************************** | ||
92 | // Scene | 92 | // Scene | ||
93 | //**************************************** | 93 | //**************************************** | ||
94 | 94 | | |||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Line(s) | |||||
388 | { | 388 | { | ||
389 | Q_ASSERT(!m_windows.contains(c)); | 389 | Q_ASSERT(!m_windows.contains(c)); | ||
390 | Scene::Window *w = createWindow(c); | 390 | Scene::Window *w = createWindow(c); | ||
391 | m_windows[ c ] = w; | 391 | m_windows[ c ] = w; | ||
392 | connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(windowGeometryShapeChanged(KWin::Toplevel*))); | 392 | connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(windowGeometryShapeChanged(KWin::Toplevel*))); | ||
393 | connect(c, SIGNAL(windowClosed(KWin::Toplevel*,KWin::Deleted*)), SLOT(windowClosed(KWin::Toplevel*,KWin::Deleted*))); | 393 | connect(c, SIGNAL(windowClosed(KWin::Toplevel*,KWin::Deleted*)), SLOT(windowClosed(KWin::Toplevel*,KWin::Deleted*))); | ||
394 | //A change of scale won't affect the geometry in compositor co-ordinates, but will affect the window quads. | 394 | //A change of scale won't affect the geometry in compositor co-ordinates, but will affect the window quads. | ||
395 | if (c->surface()) { | 395 | if (c->surface()) { | ||
396 | connect(c->surface(), &KWayland::Server::SurfaceInterface::scaleChanged, this, std::bind(&Scene::windowGeometryShapeChanged, this, c)); | 396 | connect(c->surface(), &KWaylandServer::SurfaceInterface::scaleChanged, this, std::bind(&Scene::windowGeometryShapeChanged, this, c)); | ||
397 | } | 397 | } | ||
398 | connect(c, &Toplevel::screenScaleChanged, this, | 398 | connect(c, &Toplevel::screenScaleChanged, this, | ||
399 | [this, c] { | 399 | [this, c] { | ||
400 | windowGeometryShapeChanged(c); | 400 | windowGeometryShapeChanged(c); | ||
401 | } | 401 | } | ||
402 | ); | 402 | ); | ||
403 | c->effectWindow()->setSceneWindow(w); | 403 | c->effectWindow()->setSceneWindow(w); | ||
404 | c->updateShadow(); | 404 | c->updateShadow(); | ||
▲ Show 20 Lines • Show All 618 Lines • ▼ Show 20 Line(s) | |||||
1023 | //**************************************** | 1023 | //**************************************** | ||
1024 | WindowPixmap::WindowPixmap(Scene::Window *window) | 1024 | WindowPixmap::WindowPixmap(Scene::Window *window) | ||
1025 | : m_window(window) | 1025 | : m_window(window) | ||
1026 | , m_pixmap(XCB_PIXMAP_NONE) | 1026 | , m_pixmap(XCB_PIXMAP_NONE) | ||
1027 | , m_discarded(false) | 1027 | , m_discarded(false) | ||
1028 | { | 1028 | { | ||
1029 | } | 1029 | } | ||
1030 | 1030 | | |||
1031 | WindowPixmap::WindowPixmap(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface, WindowPixmap *parent) | 1031 | WindowPixmap::WindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent) | ||
1032 | : m_window(parent->m_window) | 1032 | : m_window(parent->m_window) | ||
1033 | , m_pixmap(XCB_PIXMAP_NONE) | 1033 | , m_pixmap(XCB_PIXMAP_NONE) | ||
1034 | , m_discarded(false) | 1034 | , m_discarded(false) | ||
1035 | , m_parent(parent) | 1035 | , m_parent(parent) | ||
1036 | , m_subSurface(subSurface) | 1036 | , m_subSurface(subSurface) | ||
1037 | { | 1037 | { | ||
1038 | } | 1038 | } | ||
1039 | 1039 | | |||
1040 | WindowPixmap::~WindowPixmap() | 1040 | WindowPixmap::~WindowPixmap() | ||
1041 | { | 1041 | { | ||
1042 | qDeleteAll(m_children); | 1042 | qDeleteAll(m_children); | ||
1043 | 1043 | | |||
1044 | if (m_pixmap != XCB_WINDOW_NONE) { | 1044 | if (m_pixmap != XCB_WINDOW_NONE) { | ||
1045 | xcb_free_pixmap(connection(), m_pixmap); | 1045 | xcb_free_pixmap(connection(), m_pixmap); | ||
1046 | } | 1046 | } | ||
1047 | if (m_buffer) { | 1047 | if (m_buffer) { | ||
1048 | using namespace KWayland::Server; | 1048 | using namespace KWaylandServer; | ||
1049 | QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDestroyed, m_buffer.data(), &BufferInterface::unref); | 1049 | QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDestroyed, m_buffer.data(), &BufferInterface::unref); | ||
1050 | m_buffer->unref(); | 1050 | m_buffer->unref(); | ||
1051 | } | 1051 | } | ||
1052 | } | 1052 | } | ||
1053 | 1053 | | |||
1054 | void WindowPixmap::create() | 1054 | void WindowPixmap::create() | ||
1055 | { | 1055 | { | ||
1056 | if (isValid() || toplevel()->isDeleted()) { | 1056 | if (isValid() || toplevel()->isDeleted()) { | ||
Show All 32 Lines | 1086 | if (windowGeometry.size() != bufferGeometry.size()) { | |||
1089 | return; | 1089 | return; | ||
1090 | } | 1090 | } | ||
1091 | m_pixmap = pix; | 1091 | m_pixmap = pix; | ||
1092 | m_pixmapSize = bufferGeometry.size(); | 1092 | m_pixmapSize = bufferGeometry.size(); | ||
1093 | m_contentsRect = QRect(toplevel()->clientPos(), toplevel()->clientSize()); | 1093 | m_contentsRect = QRect(toplevel()->clientPos(), toplevel()->clientSize()); | ||
1094 | m_window->unreferencePreviousPixmap(); | 1094 | m_window->unreferencePreviousPixmap(); | ||
1095 | } | 1095 | } | ||
1096 | 1096 | | |||
1097 | WindowPixmap *WindowPixmap::createChild(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface) | 1097 | WindowPixmap *WindowPixmap::createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface) | ||
1098 | { | 1098 | { | ||
1099 | Q_UNUSED(subSurface) | 1099 | Q_UNUSED(subSurface) | ||
1100 | return nullptr; | 1100 | return nullptr; | ||
1101 | } | 1101 | } | ||
1102 | 1102 | | |||
1103 | bool WindowPixmap::isValid() const | 1103 | bool WindowPixmap::isValid() const | ||
1104 | { | 1104 | { | ||
1105 | if (!m_buffer.isNull() || !m_fbo.isNull() || !m_internalImage.isNull()) { | 1105 | if (!m_buffer.isNull() || !m_fbo.isNull() || !m_internalImage.isNull()) { | ||
1106 | return true; | 1106 | return true; | ||
1107 | } | 1107 | } | ||
1108 | return m_pixmap != XCB_PIXMAP_NONE; | 1108 | return m_pixmap != XCB_PIXMAP_NONE; | ||
1109 | } | 1109 | } | ||
1110 | 1110 | | |||
1111 | void WindowPixmap::updateBuffer() | 1111 | void WindowPixmap::updateBuffer() | ||
1112 | { | 1112 | { | ||
1113 | using namespace KWayland::Server; | 1113 | using namespace KWaylandServer; | ||
1114 | if (SurfaceInterface *s = surface()) { | 1114 | if (SurfaceInterface *s = surface()) { | ||
1115 | QVector<WindowPixmap*> oldTree = m_children; | 1115 | QVector<WindowPixmap*> oldTree = m_children; | ||
1116 | QVector<WindowPixmap*> children; | 1116 | QVector<WindowPixmap*> children; | ||
1117 | using namespace KWayland::Server; | 1117 | using namespace KWaylandServer; | ||
1118 | const auto subSurfaces = s->childSubSurfaces(); | 1118 | const auto subSurfaces = s->childSubSurfaces(); | ||
1119 | for (const auto &subSurface : subSurfaces) { | 1119 | for (const auto &subSurface : subSurfaces) { | ||
1120 | if (subSurface.isNull()) { | 1120 | if (subSurface.isNull()) { | ||
1121 | continue; | 1121 | continue; | ||
1122 | } | 1122 | } | ||
1123 | auto it = std::find_if(oldTree.begin(), oldTree.end(), [subSurface] (WindowPixmap *p) { return p->m_subSurface == subSurface; }); | 1123 | auto it = std::find_if(oldTree.begin(), oldTree.end(), [subSurface] (WindowPixmap *p) { return p->m_subSurface == subSurface; }); | ||
1124 | if (it != oldTree.end()) { | 1124 | if (it != oldTree.end()) { | ||
1125 | children << *it; | 1125 | children << *it; | ||
Show All 36 Lines | 1161 | } else { | |||
1162 | if (m_buffer) { | 1162 | if (m_buffer) { | ||
1163 | QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDestroyed, m_buffer.data(), &BufferInterface::unref); | 1163 | QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDestroyed, m_buffer.data(), &BufferInterface::unref); | ||
1164 | m_buffer->unref(); | 1164 | m_buffer->unref(); | ||
1165 | m_buffer.clear(); | 1165 | m_buffer.clear(); | ||
1166 | } | 1166 | } | ||
1167 | } | 1167 | } | ||
1168 | } | 1168 | } | ||
1169 | 1169 | | |||
1170 | KWayland::Server::SurfaceInterface *WindowPixmap::surface() const | 1170 | KWaylandServer::SurfaceInterface *WindowPixmap::surface() const | ||
1171 | { | 1171 | { | ||
1172 | if (!m_subSurface.isNull()) { | 1172 | if (!m_subSurface.isNull()) { | ||
1173 | return m_subSurface->surface().data(); | 1173 | return m_subSurface->surface().data(); | ||
1174 | } else { | 1174 | } else { | ||
1175 | return toplevel()->surface(); | 1175 | return toplevel()->surface(); | ||
1176 | } | 1176 | } | ||
1177 | } | 1177 | } | ||
1178 | 1178 | | |||
Show All 22 Lines |