Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 89 | { | |||
---|---|---|---|---|---|
90 | m_requestGeometryBlockCounter++; | 90 | m_requestGeometryBlockCounter++; | ||
91 | 91 | | |||
92 | connect(this, &XdgShellClient::desktopFileNameChanged, this, &XdgShellClient::updateIcon); | 92 | connect(this, &XdgShellClient::desktopFileNameChanged, this, &XdgShellClient::updateIcon); | ||
93 | createWindowId(); | 93 | createWindowId(); | ||
94 | setupCompositing(); | 94 | setupCompositing(); | ||
95 | updateIcon(); | 95 | updateIcon(); | ||
96 | 96 | | |||
97 | // TODO: Initialize with null rect. | 97 | // TODO: Initialize with null rect. | ||
98 | geom = QRect(0, 0, -1, -1); | 98 | m_frameGeometry = QRect(0, 0, -1, -1); | ||
99 | m_windowGeometry = QRect(0, 0, -1, -1); | 99 | m_windowGeometry = QRect(0, 0, -1, -1); | ||
100 | 100 | | |||
101 | if (waylandServer()->inputMethodConnection() == surface()->client()) { | 101 | if (waylandServer()->inputMethodConnection() == surface()->client()) { | ||
102 | m_windowType = NET::OnScreenDisplay; | 102 | m_windowType = NET::OnScreenDisplay; | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | connect(surface(), &SurfaceInterface::unmapped, this, &XdgShellClient::unmap); | 105 | connect(surface(), &SurfaceInterface::unmapped, this, &XdgShellClient::unmap); | ||
106 | connect(surface(), &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient); | 106 | connect(surface(), &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient); | ||
▲ Show 20 Lines • Show All 365 Lines • ▼ Show 20 Line(s) | |||||
472 | 472 | | |||
473 | void XdgShellClient::setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 473 | void XdgShellClient::setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
474 | { | 474 | { | ||
475 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | 475 | const QRect newGeometry = rules()->checkGeometry(QRect(x, y, w, h)); | ||
476 | 476 | | |||
477 | if (areGeometryUpdatesBlocked()) { | 477 | if (areGeometryUpdatesBlocked()) { | ||
478 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | 478 | // when the GeometryUpdateBlocker exits the current geom is passed to setGeometry | ||
479 | // thus we need to set it here. | 479 | // thus we need to set it here. | ||
480 | geom = newGeometry; | 480 | m_frameGeometry = newGeometry; | ||
481 | if (pendingGeometryUpdate() == PendingGeometryForced) { | 481 | if (pendingGeometryUpdate() == PendingGeometryForced) { | ||
482 | // maximum, nothing needed | 482 | // maximum, nothing needed | ||
483 | } else if (force == ForceGeometrySet) { | 483 | } else if (force == ForceGeometrySet) { | ||
484 | setPendingGeometryUpdate(PendingGeometryForced); | 484 | setPendingGeometryUpdate(PendingGeometryForced); | ||
485 | } else { | 485 | } else { | ||
486 | setPendingGeometryUpdate(PendingGeometryNormal); | 486 | setPendingGeometryUpdate(PendingGeometryNormal); | ||
487 | } | 487 | } | ||
488 | return; | 488 | return; | ||
489 | } | 489 | } | ||
490 | 490 | | |||
491 | if (pendingGeometryUpdate() != PendingGeometryNone) { | 491 | if (pendingGeometryUpdate() != PendingGeometryNone) { | ||
492 | // reset geometry to the one before blocking, so that we can compare properly | 492 | // reset geometry to the one before blocking, so that we can compare properly | ||
493 | geom = frameGeometryBeforeUpdateBlocking(); | 493 | m_frameGeometry = frameGeometryBeforeUpdateBlocking(); | ||
494 | } | 494 | } | ||
495 | 495 | | |||
496 | const QSize requestedClientSize = newGeometry.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | 496 | const QSize requestedClientSize = newGeometry.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
497 | 497 | | |||
498 | if (requestedClientSize == m_windowGeometry.size() && | 498 | if (requestedClientSize == m_windowGeometry.size() && | ||
499 | (m_requestedClientSize.isEmpty() || requestedClientSize == m_requestedClientSize)) { | 499 | (m_requestedClientSize.isEmpty() || requestedClientSize == m_requestedClientSize)) { | ||
500 | // size didn't change, and we don't need to explicitly request a new size | 500 | // size didn't change, and we don't need to explicitly request a new size | ||
501 | doSetGeometry(newGeometry); | 501 | doSetGeometry(newGeometry); | ||
Show All 18 Lines | 510 | { | |||
520 | return bufferGeometry; | 520 | return bufferGeometry; | ||
521 | } | 521 | } | ||
522 | 522 | | |||
523 | void XdgShellClient::doSetGeometry(const QRect &rect) | 523 | void XdgShellClient::doSetGeometry(const QRect &rect) | ||
524 | { | 524 | { | ||
525 | bool frameGeometryIsChanged = false; | 525 | bool frameGeometryIsChanged = false; | ||
526 | bool bufferGeometryIsChanged = false; | 526 | bool bufferGeometryIsChanged = false; | ||
527 | 527 | | |||
528 | if (geom != rect) { | 528 | if (m_frameGeometry != rect) { | ||
529 | geom = rect; | 529 | m_frameGeometry = rect; | ||
530 | frameGeometryIsChanged = true; | 530 | frameGeometryIsChanged = true; | ||
531 | } | 531 | } | ||
532 | 532 | | |||
533 | const QRect bufferGeometry = determineBufferGeometry(); | 533 | const QRect bufferGeometry = determineBufferGeometry(); | ||
534 | if (m_bufferGeometry != bufferGeometry) { | 534 | if (m_bufferGeometry != bufferGeometry) { | ||
535 | m_bufferGeometry = bufferGeometry; | 535 | m_bufferGeometry = bufferGeometry; | ||
536 | bufferGeometryIsChanged = true; | 536 | bufferGeometryIsChanged = true; | ||
537 | } | 537 | } | ||
538 | 538 | | |||
539 | if (!frameGeometryIsChanged && !bufferGeometryIsChanged) { | 539 | if (!frameGeometryIsChanged && !bufferGeometryIsChanged) { | ||
540 | return; | 540 | return; | ||
541 | } | 541 | } | ||
542 | 542 | | |||
543 | if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !geom.isEmpty()) { | 543 | if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !m_frameGeometry.isEmpty()) { | ||
544 | // use first valid geometry as restore geometry | 544 | // use first valid geometry as restore geometry | ||
545 | m_geomMaximizeRestore = geom; | 545 | m_geomMaximizeRestore = m_frameGeometry; | ||
546 | } | 546 | } | ||
547 | 547 | | |||
548 | if (frameGeometryIsChanged) { | 548 | if (frameGeometryIsChanged) { | ||
549 | if (hasStrut()) { | 549 | if (hasStrut()) { | ||
550 | workspace()->updateClientArea(); | 550 | workspace()->updateClientArea(); | ||
551 | } | 551 | } | ||
552 | updateWindowRules(Rules::Position | Rules::Size); | 552 | updateWindowRules(Rules::Position | Rules::Size); | ||
553 | } | 553 | } | ||
▲ Show 20 Lines • Show All 1432 Lines • Show Last 20 Lines |