Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Line(s) | 214 | { | |||
---|---|---|---|---|---|
233 | } | 233 | } | ||
234 | if (waylandServer()->inputMethodConnection() == s->client()) { | 234 | if (waylandServer()->inputMethodConnection() == s->client()) { | ||
235 | m_windowType = NET::OnScreenDisplay; | 235 | m_windowType = NET::OnScreenDisplay; | ||
236 | } | 236 | } | ||
237 | 237 | | |||
238 | connect(s, &SurfaceInterface::sizeChanged, this, | 238 | connect(s, &SurfaceInterface::sizeChanged, this, | ||
239 | [this] { | 239 | [this] { | ||
240 | m_clientSize = surface()->size(); | 240 | m_clientSize = surface()->size(); | ||
241 | doSetGeometry(QRect(geom.topLeft(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | 241 | doSetGeometry(QRect(pos(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | ||
242 | } | 242 | } | ||
243 | ); | 243 | ); | ||
244 | connect(s, &SurfaceInterface::unmapped, this, &ShellClient::unmap); | 244 | connect(s, &SurfaceInterface::unmapped, this, &ShellClient::unmap); | ||
245 | connect(s, &SurfaceInterface::unbound, this, &ShellClient::destroyClient); | 245 | connect(s, &SurfaceInterface::unbound, this, &ShellClient::destroyClient); | ||
246 | connect(s, &SurfaceInterface::destroyed, this, &ShellClient::destroyClient); | 246 | connect(s, &SurfaceInterface::destroyed, this, &ShellClient::destroyClient); | ||
247 | if (m_shellSurface) { | 247 | if (m_shellSurface) { | ||
248 | initSurface(m_shellSurface); | 248 | initSurface(m_shellSurface); | ||
249 | auto setPopup = [this] { | 249 | auto setPopup = [this] { | ||
▲ Show 20 Lines • Show All 976 Lines • ▼ Show 20 Line(s) | 1189 | { | |||
1226 | } | 1226 | } | ||
1227 | 1227 | | |||
1228 | m_blockedRequestGeometry = QRect(); | 1228 | m_blockedRequestGeometry = QRect(); | ||
1229 | return true; | 1229 | return true; | ||
1230 | } | 1230 | } | ||
1231 | 1231 | | |||
1232 | void ShellClient::updatePendingGeometry() | 1232 | void ShellClient::updatePendingGeometry() | ||
1233 | { | 1233 | { | ||
1234 | QPoint position = geom.topLeft(); | 1234 | QPoint position = pos(); | ||
1235 | MaximizeMode maximizeMode = m_maximizeMode; | 1235 | MaximizeMode maximizeMode = m_maximizeMode; | ||
1236 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | 1236 | for (auto it = m_pendingConfigureRequests.begin(); it != m_pendingConfigureRequests.end(); it++) { | ||
1237 | if (it->serialId > m_lastAckedConfigureRequest) { | 1237 | if (it->serialId > m_lastAckedConfigureRequest) { | ||
1238 | //this serial is not acked yet, therefore we know all future serials are not | 1238 | //this serial is not acked yet, therefore we know all future serials are not | ||
1239 | break; | 1239 | break; | ||
1240 | } | 1240 | } | ||
1241 | if (it->serialId == m_lastAckedConfigureRequest) { | 1241 | if (it->serialId == m_lastAckedConfigureRequest) { | ||
1242 | if (position != it->positionAfterResize) { | 1242 | if (position != it->positionAfterResize) { | ||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | 1381 | { | |||
1384 | } | 1384 | } | ||
1385 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | 1385 | if (m_unmapped || !m_plasmaShellSurface || m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { | ||
1386 | ScreenEdges::self()->reserve(this, ElectricNone); | 1386 | ScreenEdges::self()->reserve(this, ElectricNone); | ||
1387 | return; | 1387 | return; | ||
1388 | } | 1388 | } | ||
1389 | if ((m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide && m_hidden) || | 1389 | if ((m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide && m_hidden) || | ||
1390 | m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover) { | 1390 | m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover) { | ||
1391 | // screen edge API requires an edge, thus we need to figure out which edge the window borders | 1391 | // screen edge API requires an edge, thus we need to figure out which edge the window borders | ||
1392 | const QRect clientGeometry = geometry(); | ||||
1392 | Qt::Edges edges; | 1393 | Qt::Edges edges; | ||
1393 | for (int i = 0; i < screens()->count(); i++) { | 1394 | for (int i = 0; i < screens()->count(); i++) { | ||
1394 | const auto &screenGeo = screens()->geometry(i); | 1395 | const QRect screenGeometry = screens()->geometry(i); | ||
1395 | if (screenGeo.x() == geom.x()) { | 1396 | if (screenGeometry.left() == clientGeometry.left()) { | ||
1396 | edges |= Qt::LeftEdge; | 1397 | edges |= Qt::LeftEdge; | ||
1397 | } | 1398 | } | ||
1398 | if (screenGeo.x() + screenGeo.width() == geom.x() + geom.width()) { | 1399 | if (screenGeometry.right() == clientGeometry.right()) { | ||
1399 | edges |= Qt::RightEdge; | 1400 | edges |= Qt::RightEdge; | ||
1400 | } | 1401 | } | ||
1401 | if (screenGeo.y() == geom.y()) { | 1402 | if (screenGeometry.top() == clientGeometry.top()) { | ||
1402 | edges |= Qt::TopEdge; | 1403 | edges |= Qt::TopEdge; | ||
1403 | } | 1404 | } | ||
1404 | if (screenGeo.y() + screenGeo.height() == geom.y() + geom.height()) { | 1405 | if (screenGeometry.bottom() == clientGeometry.bottom()) { | ||
1405 | edges |= Qt::BottomEdge; | 1406 | edges |= Qt::BottomEdge; | ||
1406 | } | 1407 | } | ||
1407 | } | 1408 | } | ||
1408 | // a panel might border multiple screen edges. E.g. a horizontal panel at the bottom will | 1409 | // a panel might border multiple screen edges. E.g. a horizontal panel at the bottom will | ||
1409 | // also border the left and right edge | 1410 | // also border the left and right edge | ||
1410 | // let's remove such cases | 1411 | // let's remove such cases | ||
1411 | if (edges.testFlag(Qt::LeftEdge) && edges.testFlag(Qt::RightEdge)) { | 1412 | if (edges.testFlag(Qt::LeftEdge) && edges.testFlag(Qt::RightEdge)) { | ||
1412 | edges = edges & (~(Qt::LeftEdge | Qt::RightEdge)); | 1413 | edges = edges & (~(Qt::LeftEdge | Qt::RightEdge)); | ||
1413 | } | 1414 | } | ||
1414 | if (edges.testFlag(Qt::TopEdge) && edges.testFlag(Qt::BottomEdge)) { | 1415 | if (edges.testFlag(Qt::TopEdge) && edges.testFlag(Qt::BottomEdge)) { | ||
1415 | edges = edges & (~(Qt::TopEdge | Qt::BottomEdge)); | 1416 | edges = edges & (~(Qt::TopEdge | Qt::BottomEdge)); | ||
1416 | } | 1417 | } | ||
1417 | // it's still possible that a panel borders two edges, e.g. bottom and left | 1418 | // it's still possible that a panel borders two edges, e.g. bottom and left | ||
1418 | // in that case the one which is sharing more with the edge wins | 1419 | // in that case the one which is sharing more with the edge wins | ||
1419 | auto check = [this](Qt::Edges edges, Qt::Edge horiz, Qt::Edge vert) { | 1420 | auto check = [clientGeometry](Qt::Edges edges, Qt::Edge horiz, Qt::Edge vert) { | ||
1420 | if (edges.testFlag(horiz) && edges.testFlag(vert)) { | 1421 | if (edges.testFlag(horiz) && edges.testFlag(vert)) { | ||
1421 | if (geom.width() >= geom.height()) { | 1422 | if (clientGeometry.width() >= clientGeometry.height()) { | ||
1422 | return edges & ~horiz; | 1423 | return edges & ~horiz; | ||
1423 | } else { | 1424 | } else { | ||
1424 | return edges & ~vert; | 1425 | return edges & ~vert; | ||
1425 | } | 1426 | } | ||
1426 | } | 1427 | } | ||
1427 | return edges; | 1428 | return edges; | ||
1428 | }; | 1429 | }; | ||
1429 | edges = check(edges, Qt::LeftEdge, Qt::TopEdge); | 1430 | edges = check(edges, Qt::LeftEdge, Qt::TopEdge); | ||
▲ Show 20 Lines • Show All 589 Lines • Show Last 20 Lines |