Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Line(s) | 304 | { | |||
---|---|---|---|---|---|
306 | return QStringList(); | 306 | return QStringList(); | ||
307 | } | 307 | } | ||
308 | 308 | | |||
309 | QPoint XdgShellClient::clientContentPos() const | 309 | QPoint XdgShellClient::clientContentPos() const | ||
310 | { | 310 | { | ||
311 | return -1 * clientPos(); | 311 | return -1 * clientPos(); | ||
312 | } | 312 | } | ||
313 | 313 | | |||
314 | static QRect subSurfaceTreeRect(const SurfaceInterface *surface, const QPoint &position = QPoint()) | ||||
315 | { | ||||
316 | QRect rect(position, surface->size()); | ||||
317 | | ||||
318 | const QList<QPointer<SubSurfaceInterface>> subSurfaces = surface->childSubSurfaces(); | ||||
319 | for (const QPointer<SubSurfaceInterface> &subSurface : subSurfaces) { | ||||
320 | if (Q_UNLIKELY(!subSurface)) { | ||||
321 | continue; | ||||
322 | } | ||||
323 | const SurfaceInterface *child = subSurface->surface(); | ||||
324 | if (Q_UNLIKELY(!child)) { | ||||
325 | continue; | ||||
326 | } | ||||
327 | rect |= subSurfaceTreeRect(child, position + subSurface->position()); | ||||
328 | } | ||||
329 | | ||||
330 | return rect; | ||||
331 | } | ||||
332 | | ||||
314 | QSize XdgShellClient::clientSize() const | 333 | QSize XdgShellClient::clientSize() const | ||
315 | { | 334 | { | ||
316 | return m_windowGeometry.size(); | 335 | const QRect boundingRect = subSurfaceTreeRect(surface()); | ||
336 | return m_windowGeometry.size().boundedTo(boundingRect.size()); | ||||
317 | } | 337 | } | ||
318 | 338 | | |||
319 | void XdgShellClient::debug(QDebug &stream) const | 339 | void XdgShellClient::debug(QDebug &stream) const | ||
320 | { | 340 | { | ||
321 | stream.nospace(); | 341 | stream.nospace(); | ||
322 | stream << "\'XdgShellClient:" << surface() << ";WMCLASS:" << resourceClass() << ":" | 342 | stream << "\'XdgShellClient:" << surface() << ";WMCLASS:" << resourceClass() << ":" | ||
323 | << resourceName() << ";Caption:" << caption() << "\'"; | 343 | << resourceName() << ";Caption:" << caption() << "\'"; | ||
324 | } | 344 | } | ||
▲ Show 20 Lines • Show All 833 Lines • ▼ Show 20 Line(s) | 1177 | { | |||
1158 | setResourceClass(resourceName(), windowClass); | 1178 | setResourceClass(resourceName(), windowClass); | ||
1159 | if (m_isInitialized && supportsWindowRules()) { | 1179 | if (m_isInitialized && supportsWindowRules()) { | ||
1160 | setupWindowRules(true); | 1180 | setupWindowRules(true); | ||
1161 | applyWindowRules(); | 1181 | applyWindowRules(); | ||
1162 | } | 1182 | } | ||
1163 | setDesktopFileName(windowClass); | 1183 | setDesktopFileName(windowClass); | ||
1164 | } | 1184 | } | ||
1165 | 1185 | | |||
1166 | static QRect subSurfaceTreeRect(const SurfaceInterface *surface, const QPoint &position = QPoint()) | | |||
1167 | { | | |||
1168 | QRect rect(position, surface->size()); | | |||
1169 | | ||||
1170 | const QList<QPointer<SubSurfaceInterface>> subSurfaces = surface->childSubSurfaces(); | | |||
1171 | for (const QPointer<SubSurfaceInterface> &subSurface : subSurfaces) { | | |||
1172 | if (Q_UNLIKELY(!subSurface)) { | | |||
1173 | continue; | | |||
1174 | } | | |||
1175 | const SurfaceInterface *child = subSurface->surface(); | | |||
1176 | if (Q_UNLIKELY(!child)) { | | |||
1177 | continue; | | |||
1178 | } | | |||
1179 | rect |= subSurfaceTreeRect(child, position + subSurface->position()); | | |||
1180 | } | | |||
1181 | | ||||
1182 | return rect; | | |||
1183 | } | | |||
1184 | | ||||
1185 | void XdgShellClient::handleWindowGeometryChanged(const QRect &windowGeometry) | 1186 | void XdgShellClient::handleWindowGeometryChanged(const QRect &windowGeometry) | ||
1186 | { | 1187 | { | ||
1187 | const QRect boundingRect = subSurfaceTreeRect(surface()); | 1188 | m_windowGeometry = windowGeometry; | ||
1188 | m_windowGeometry = windowGeometry & boundingRect; | | |||
1189 | m_hasWindowGeometry = true; | 1189 | m_hasWindowGeometry = true; | ||
1190 | } | 1190 | } | ||
1191 | 1191 | | |||
1192 | void XdgShellClient::handleWindowTitleChanged(const QString &title) | 1192 | void XdgShellClient::handleWindowTitleChanged(const QString &title) | ||
1193 | { | 1193 | { | ||
1194 | const QString oldSuffix = m_captionSuffix; | 1194 | const QString oldSuffix = m_captionSuffix; | ||
1195 | m_caption = title.simplified(); | 1195 | m_caption = title.simplified(); | ||
1196 | updateCaption(); | 1196 | updateCaption(); | ||
▲ Show 20 Lines • Show All 792 Lines • Show Last 20 Lines |