Changeset View
Changeset View
Standalone View
Standalone View
abstract_client.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | 59 | | |||
60 | AbstractClient::AbstractClient() | 60 | AbstractClient::AbstractClient() | ||
61 | : Toplevel() | 61 | : Toplevel() | ||
62 | #ifdef KWIN_BUILD_TABBOX | 62 | #ifdef KWIN_BUILD_TABBOX | ||
63 | , m_tabBoxClient(QSharedPointer<TabBox::TabBoxClientImpl>(new TabBox::TabBoxClientImpl(this))) | 63 | , m_tabBoxClient(QSharedPointer<TabBox::TabBoxClientImpl>(new TabBox::TabBoxClientImpl(this))) | ||
64 | #endif | 64 | #endif | ||
65 | , m_colorScheme(QStringLiteral("kdeglobals")) | 65 | , m_colorScheme(QStringLiteral("kdeglobals")) | ||
66 | { | 66 | { | ||
67 | connect(this, &AbstractClient::geometryShapeChanged, this, &AbstractClient::geometryChanged); | | |||
68 | auto signalMaximizeChanged = static_cast<void (AbstractClient::*)(KWin::AbstractClient*, MaximizeMode)>(&AbstractClient::clientMaximizedStateChanged); | | |||
69 | connect(this, signalMaximizeChanged, this, &AbstractClient::geometryChanged); | | |||
70 | connect(this, &AbstractClient::clientStepUserMovedResized, this, &AbstractClient::geometryChanged); | | |||
71 | connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::moveResizedChanged); | 67 | connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::moveResizedChanged); | ||
72 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, &AbstractClient::moveResizedChanged); | 68 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, &AbstractClient::moveResizedChanged); | ||
73 | connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::removeCheckScreenConnection); | 69 | connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::removeCheckScreenConnection); | ||
74 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, &AbstractClient::setupCheckScreenConnection); | 70 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, &AbstractClient::setupCheckScreenConnection); | ||
75 | 71 | | |||
76 | connect(this, &AbstractClient::paletteChanged, this, &AbstractClient::triggerDecorationRepaint); | 72 | connect(this, &AbstractClient::paletteChanged, this, &AbstractClient::triggerDecorationRepaint); | ||
77 | 73 | | |||
78 | connect(Decoration::DecorationBridge::self(), &QObject::destroyed, this, &AbstractClient::destroyDecoration); | 74 | connect(Decoration::DecorationBridge::self(), &QObject::destroyed, this, &AbstractClient::destroyDecoration); | ||
79 | 75 | | |||
80 | // If the user manually moved the window, don't restore it after the keyboard closes | 76 | // If the user manually moved the window, don't restore it after the keyboard closes | ||
81 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, [this] () { | 77 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, [this] () { | ||
82 | m_keyboardGeometryRestore = QRect(); | 78 | m_keyboardGeometryRestore = QRect(); | ||
83 | }); | 79 | }); | ||
84 | connect(this, qOverload<AbstractClient *, bool, bool>(&AbstractClient::clientMaximizedStateChanged), this, [this] () { | 80 | connect(this, qOverload<AbstractClient *, bool, bool>(&AbstractClient::clientMaximizedStateChanged), this, [this] () { | ||
85 | m_keyboardGeometryRestore = QRect(); | 81 | m_keyboardGeometryRestore = QRect(); | ||
86 | }); | 82 | }); | ||
87 | connect(this, &AbstractClient::fullScreenChanged, this, [this] () { | 83 | connect(this, &AbstractClient::fullScreenChanged, this, [this] () { | ||
88 | m_keyboardGeometryRestore = QRect(); | 84 | m_keyboardGeometryRestore = QRect(); | ||
89 | }); | 85 | }); | ||
90 | 86 | | |||
91 | // replace on-screen-display on size changes | 87 | // replace on-screen-display on size changes | ||
92 | connect(this, &AbstractClient::geometryShapeChanged, this, | 88 | connect(this, &AbstractClient::frameGeometryChanged, this, | ||
93 | [this] (Toplevel *c, const QRect &old) { | 89 | [this] (Toplevel *c, const QRect &old) { | ||
94 | Q_UNUSED(c) | 90 | Q_UNUSED(c) | ||
95 | if (isOnScreenDisplay() && !frameGeometry().isEmpty() && old.size() != frameGeometry().size() && !isInitialPositionSet()) { | 91 | if (isOnScreenDisplay() && !frameGeometry().isEmpty() && old.size() != frameGeometry().size() && !isInitialPositionSet()) { | ||
96 | GeometryUpdatesBlocker blocker(this); | 92 | GeometryUpdatesBlocker blocker(this); | ||
97 | const QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); | 93 | const QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); | ||
98 | Placement::self()->place(this, area); | 94 | Placement::self()->place(this, area); | ||
99 | setGeometryRestore(frameGeometry()); | 95 | setGeometryRestore(frameGeometry()); | ||
100 | } | 96 | } | ||
▲ Show 20 Lines • Show All 715 Lines • ▼ Show 20 Line(s) | 811 | else | |||
816 | setPendingGeometryUpdate(PendingGeometryNormal); | 812 | setPendingGeometryUpdate(PendingGeometryNormal); | ||
817 | return; | 813 | return; | ||
818 | } | 814 | } | ||
819 | doMove(x, y); | 815 | doMove(x, y); | ||
820 | updateWindowRules(Rules::Position); | 816 | updateWindowRules(Rules::Position); | ||
821 | screens()->setCurrent(this); | 817 | screens()->setCurrent(this); | ||
822 | workspace()->updateStackingOrder(); | 818 | workspace()->updateStackingOrder(); | ||
823 | // client itself is not damaged | 819 | // client itself is not damaged | ||
820 | emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); | ||||
824 | addRepaintDuringGeometryUpdates(); | 821 | addRepaintDuringGeometryUpdates(); | ||
825 | updateGeometryBeforeUpdateBlocking(); | 822 | updateGeometryBeforeUpdateBlocking(); | ||
826 | emit geometryChanged(); | | |||
827 | } | 823 | } | ||
828 | 824 | | |||
829 | bool AbstractClient::startMoveResize() | 825 | bool AbstractClient::startMoveResize() | ||
830 | { | 826 | { | ||
831 | Q_ASSERT(!isMoveResize()); | 827 | Q_ASSERT(!isMoveResize()); | ||
832 | Q_ASSERT(QWidget::keyboardGrabber() == nullptr); | 828 | Q_ASSERT(QWidget::keyboardGrabber() == nullptr); | ||
833 | Q_ASSERT(QWidget::mouseGrabber() == nullptr); | 829 | Q_ASSERT(QWidget::mouseGrabber() == nullptr); | ||
834 | stopDelayedMoveResize(); | 830 | stopDelayedMoveResize(); | ||
▲ Show 20 Lines • Show All 592 Lines • ▼ Show 20 Line(s) | 1352 | { | |||
1427 | connect(this, &AbstractClient::windowClassChanged, w, updateAppId); | 1423 | connect(this, &AbstractClient::windowClassChanged, w, updateAppId); | ||
1428 | connect(this, &AbstractClient::desktopFileNameChanged, w, updateAppId); | 1424 | connect(this, &AbstractClient::desktopFileNameChanged, w, updateAppId); | ||
1429 | connect(this, &AbstractClient::shadeChanged, w, [w, this] { w->setShaded(isShade()); }); | 1425 | connect(this, &AbstractClient::shadeChanged, w, [w, this] { w->setShaded(isShade()); }); | ||
1430 | connect(this, &AbstractClient::transientChanged, w, | 1426 | connect(this, &AbstractClient::transientChanged, w, | ||
1431 | [w, this] { | 1427 | [w, this] { | ||
1432 | w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr); | 1428 | w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr); | ||
1433 | } | 1429 | } | ||
1434 | ); | 1430 | ); | ||
1435 | connect(this, &AbstractClient::geometryChanged, w, | 1431 | connect(this, &AbstractClient::frameGeometryChanged, w, | ||
1436 | [w, this] { | 1432 | [w, this] { | ||
1437 | w->setGeometry(frameGeometry()); | 1433 | w->setGeometry(frameGeometry()); | ||
1438 | } | 1434 | } | ||
1439 | ); | 1435 | ); | ||
1440 | connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); }); | 1436 | connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); }); | ||
1441 | connect(w, &PlasmaWindowInterface::moveRequested, this, | 1437 | connect(w, &PlasmaWindowInterface::moveRequested, this, | ||
1442 | [this] { | 1438 | [this] { | ||
1443 | Cursor::setPos(frameGeometry().center()); | 1439 | Cursor::setPos(frameGeometry().center()); | ||
▲ Show 20 Lines • Show All 1702 Lines • Show Last 20 Lines |