Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
62 | 62 | | |||
63 | using namespace KWayland::Server; | 63 | using namespace KWayland::Server; | ||
64 | 64 | | |||
65 | namespace KWin | 65 | namespace KWin | ||
66 | { | 66 | { | ||
67 | 67 | | |||
68 | XdgShellClient::XdgShellClient(XdgShellSurfaceInterface *surface) | 68 | XdgShellClient::XdgShellClient(XdgShellSurfaceInterface *surface) | ||
69 | : AbstractClient() | 69 | : AbstractClient() | ||
70 | , m_xdgShellSurface(surface) | 70 | , m_xdgShellToplevel(surface) | ||
71 | , m_xdgShellPopup(nullptr) | 71 | , m_xdgShellPopup(nullptr) | ||
72 | { | 72 | { | ||
73 | setSurface(surface->surface()); | 73 | setSurface(surface->surface()); | ||
74 | init(); | 74 | init(); | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | XdgShellClient::XdgShellClient(XdgShellPopupInterface *surface) | 77 | XdgShellClient::XdgShellClient(XdgShellPopupInterface *surface) | ||
78 | : AbstractClient() | 78 | : AbstractClient() | ||
79 | , m_xdgShellSurface(nullptr) | 79 | , m_xdgShellToplevel(nullptr) | ||
80 | , m_xdgShellPopup(surface) | 80 | , m_xdgShellPopup(surface) | ||
81 | { | 81 | { | ||
82 | setSurface(surface->surface()); | 82 | setSurface(surface->surface()); | ||
83 | init(); | 83 | init(); | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | XdgShellClient::~XdgShellClient() = default; | 86 | XdgShellClient::~XdgShellClient() = default; | ||
87 | 87 | | |||
Show All 13 Lines | 89 | { | |||
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); | ||
107 | connect(surface(), &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); | 107 | connect(surface(), &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); | ||
108 | 108 | | |||
109 | if (m_xdgShellSurface) { | 109 | if (m_xdgShellToplevel) { | ||
110 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); | 110 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); | ||
111 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::configureAcknowledged, this, &XdgShellClient::handleConfigureAcknowledged); | 111 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::configureAcknowledged, this, &XdgShellClient::handleConfigureAcknowledged); | ||
112 | 112 | | |||
113 | m_caption = m_xdgShellSurface->title().simplified(); | 113 | m_caption = m_xdgShellToplevel->title().simplified(); | ||
114 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::titleChanged, this, &XdgShellClient::handleWindowTitleChanged); | 114 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::titleChanged, this, &XdgShellClient::handleWindowTitleChanged); | ||
115 | QTimer::singleShot(0, this, &XdgShellClient::updateCaption); | 115 | QTimer::singleShot(0, this, &XdgShellClient::updateCaption); | ||
116 | 116 | | |||
117 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::moveRequested, this, &XdgShellClient::handleMoveRequested); | 117 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::moveRequested, this, &XdgShellClient::handleMoveRequested); | ||
118 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::resizeRequested, this, &XdgShellClient::handleResizeRequested); | 118 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::resizeRequested, this, &XdgShellClient::handleResizeRequested); | ||
119 | 119 | | |||
120 | // Determine the resource name, this is inspired from ICCCM 4.1.2.5 | 120 | // Determine the resource name, this is inspired from ICCCM 4.1.2.5 | ||
121 | // the binary name of the invoked client. | 121 | // the binary name of the invoked client. | ||
122 | QFileInfo info{m_xdgShellSurface->client()->executablePath()}; | 122 | QFileInfo info{m_xdgShellToplevel->client()->executablePath()}; | ||
123 | QByteArray resourceName; | 123 | QByteArray resourceName; | ||
124 | if (info.exists()) { | 124 | if (info.exists()) { | ||
125 | resourceName = info.fileName().toUtf8(); | 125 | resourceName = info.fileName().toUtf8(); | ||
126 | } | 126 | } | ||
127 | setResourceClass(resourceName, m_xdgShellSurface->windowClass()); | 127 | setResourceClass(resourceName, m_xdgShellToplevel->windowClass()); | ||
128 | setDesktopFileName(m_xdgShellSurface->windowClass()); | 128 | setDesktopFileName(m_xdgShellToplevel->windowClass()); | ||
129 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::windowClassChanged, this, &XdgShellClient::handleWindowClassChanged); | 129 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::windowClassChanged, this, &XdgShellClient::handleWindowClassChanged); | ||
130 | 130 | | |||
131 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::minimizeRequested, this, &XdgShellClient::handleMinimizeRequested); | 131 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::minimizeRequested, this, &XdgShellClient::handleMinimizeRequested); | ||
132 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::maximizedChanged, this, &XdgShellClient::handleMaximizeRequested); | 132 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::maximizedChanged, this, &XdgShellClient::handleMaximizeRequested); | ||
133 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::fullscreenChanged, this, &XdgShellClient::handleFullScreenRequested); | 133 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::fullscreenChanged, this, &XdgShellClient::handleFullScreenRequested); | ||
134 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::windowMenuRequested, this, &XdgShellClient::handleWindowMenuRequested); | 134 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::windowMenuRequested, this, &XdgShellClient::handleWindowMenuRequested); | ||
135 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::transientForChanged, this, &XdgShellClient::handleTransientForChanged); | 135 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::transientForChanged, this, &XdgShellClient::handleTransientForChanged); | ||
136 | connect(m_xdgShellSurface, &XdgShellSurfaceInterface::windowGeometryChanged, this, &XdgShellClient::handleWindowGeometryChanged); | 136 | connect(m_xdgShellToplevel, &XdgShellSurfaceInterface::windowGeometryChanged, this, &XdgShellClient::handleWindowGeometryChanged); | ||
137 | 137 | | |||
138 | auto global = static_cast<XdgShellInterface *>(m_xdgShellSurface->global()); | 138 | auto global = static_cast<XdgShellInterface *>(m_xdgShellToplevel->global()); | ||
139 | connect(global, &XdgShellInterface::pingDelayed, this, &XdgShellClient::handlePingDelayed); | 139 | connect(global, &XdgShellInterface::pingDelayed, this, &XdgShellClient::handlePingDelayed); | ||
140 | connect(global, &XdgShellInterface::pingTimeout, this, &XdgShellClient::handlePingTimeout); | 140 | connect(global, &XdgShellInterface::pingTimeout, this, &XdgShellClient::handlePingTimeout); | ||
141 | connect(global, &XdgShellInterface::pongReceived, this, &XdgShellClient::handlePongReceived); | 141 | connect(global, &XdgShellInterface::pongReceived, this, &XdgShellClient::handlePongReceived); | ||
142 | 142 | | |||
143 | auto configure = [this] { | 143 | auto configure = [this] { | ||
144 | if (m_closing) { | 144 | if (m_closing) { | ||
145 | return; | 145 | return; | ||
146 | } | 146 | } | ||
147 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | 147 | if (m_requestGeometryBlockCounter != 0 || areGeometryUpdatesBlocked()) { | ||
148 | return; | 148 | return; | ||
149 | } | 149 | } | ||
150 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | 150 | m_xdgShellToplevel->configure(xdgSurfaceStates(), m_requestedClientSize); | ||
151 | }; | 151 | }; | ||
152 | connect(this, &AbstractClient::activeChanged, this, configure); | 152 | connect(this, &AbstractClient::activeChanged, this, configure); | ||
153 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | 153 | connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); | ||
154 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | 154 | connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); | ||
155 | 155 | | |||
156 | connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateClientOutputs); | 156 | connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateClientOutputs); | ||
157 | connect(screens(), &Screens::changed, this, &XdgShellClient::updateClientOutputs); | 157 | connect(screens(), &Screens::changed, this, &XdgShellClient::updateClientOutputs); | ||
158 | } else if (m_xdgShellPopup) { | 158 | } else if (m_xdgShellPopup) { | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 279 | } else { | |||
280 | ++it; | 280 | ++it; | ||
281 | } | 281 | } | ||
282 | } | 282 | } | ||
283 | 283 | | |||
284 | waylandServer()->removeClient(this); | 284 | waylandServer()->removeClient(this); | ||
285 | 285 | | |||
286 | deleted->unrefWindow(); | 286 | deleted->unrefWindow(); | ||
287 | 287 | | |||
288 | m_xdgShellSurface = nullptr; | 288 | m_xdgShellToplevel = nullptr; | ||
289 | m_xdgShellPopup = nullptr; | 289 | m_xdgShellPopup = nullptr; | ||
290 | deleteClient(this); | 290 | deleteClient(this); | ||
291 | } | 291 | } | ||
292 | 292 | | |||
293 | void XdgShellClient::deleteClient(XdgShellClient *c) | 293 | void XdgShellClient::deleteClient(XdgShellClient *c) | ||
294 | { | 294 | { | ||
295 | delete c; | 295 | delete c; | ||
296 | } | 296 | } | ||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Line(s) | 484 | } else | |||
485 | destroyDecoration(); | 485 | destroyDecoration(); | ||
486 | if (m_serverDecoration && isDecorated()) { | 486 | if (m_serverDecoration && isDecorated()) { | ||
487 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | 487 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | ||
488 | } | 488 | } | ||
489 | if (m_xdgDecoration) { | 489 | if (m_xdgDecoration) { | ||
490 | auto mode = isDecorated() || m_userNoBorder ? XdgDecorationInterface::Mode::ServerSide: XdgDecorationInterface::Mode::ClientSide; | 490 | auto mode = isDecorated() || m_userNoBorder ? XdgDecorationInterface::Mode::ServerSide: XdgDecorationInterface::Mode::ClientSide; | ||
491 | m_xdgDecoration->configure(mode); | 491 | m_xdgDecoration->configure(mode); | ||
492 | if (m_requestGeometryBlockCounter == 0) { | 492 | if (m_requestGeometryBlockCounter == 0) { | ||
493 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | 493 | m_xdgShellToplevel->configure(xdgSurfaceStates(), m_requestedClientSize); | ||
494 | } | 494 | } | ||
495 | } | 495 | } | ||
496 | updateShadow(); | 496 | updateShadow(); | ||
497 | if (check_workspace_pos) | 497 | if (check_workspace_pos) | ||
498 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | 498 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | ||
499 | blockGeometryUpdates(false); | 499 | blockGeometryUpdates(false); | ||
500 | } | 500 | } | ||
501 | 501 | | |||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 635 | { | |||
645 | } | 645 | } | ||
646 | if (m_captionSuffix != oldSuffix) { | 646 | if (m_captionSuffix != oldSuffix) { | ||
647 | emit captionChanged(); | 647 | emit captionChanged(); | ||
648 | } | 648 | } | ||
649 | } | 649 | } | ||
650 | 650 | | |||
651 | void XdgShellClient::closeWindow() | 651 | void XdgShellClient::closeWindow() | ||
652 | { | 652 | { | ||
653 | if (m_xdgShellSurface && isCloseable()) { | 653 | if (m_xdgShellToplevel && isCloseable()) { | ||
654 | m_xdgShellSurface->close(); | 654 | m_xdgShellToplevel->close(); | ||
655 | ping(PingReason::CloseWindow); | 655 | ping(PingReason::CloseWindow); | ||
656 | } | 656 | } | ||
657 | } | 657 | } | ||
658 | 658 | | |||
659 | AbstractClient *XdgShellClient::findModal(bool allow_itself) | 659 | AbstractClient *XdgShellClient::findModal(bool allow_itself) | ||
660 | { | 660 | { | ||
661 | Q_UNUSED(allow_itself) | 661 | Q_UNUSED(allow_itself) | ||
662 | return nullptr; | 662 | return nullptr; | ||
663 | } | 663 | } | ||
664 | 664 | | |||
665 | bool XdgShellClient::isCloseable() const | 665 | bool XdgShellClient::isCloseable() const | ||
666 | { | 666 | { | ||
667 | if (m_windowType == NET::Desktop || m_windowType == NET::Dock) { | 667 | if (m_windowType == NET::Desktop || m_windowType == NET::Dock) { | ||
668 | return false; | 668 | return false; | ||
669 | } | 669 | } | ||
670 | if (m_xdgShellSurface) { | 670 | if (m_xdgShellToplevel) { | ||
671 | return true; | 671 | return true; | ||
672 | } | 672 | } | ||
673 | return false; | 673 | return false; | ||
674 | } | 674 | } | ||
675 | 675 | | |||
676 | bool XdgShellClient::isFullScreen() const | 676 | bool XdgShellClient::isFullScreen() const | ||
677 | { | 677 | { | ||
678 | return m_fullScreen; | 678 | return m_fullScreen; | ||
▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Line(s) | |||||
982 | void XdgShellClient::setOnAllActivities(bool set) | 982 | void XdgShellClient::setOnAllActivities(bool set) | ||
983 | { | 983 | { | ||
984 | Q_UNUSED(set) | 984 | Q_UNUSED(set) | ||
985 | } | 985 | } | ||
986 | 986 | | |||
987 | void XdgShellClient::takeFocus() | 987 | void XdgShellClient::takeFocus() | ||
988 | { | 988 | { | ||
989 | if (rules()->checkAcceptFocus(wantsInput())) { | 989 | if (rules()->checkAcceptFocus(wantsInput())) { | ||
990 | if (m_xdgShellSurface) { | 990 | if (m_xdgShellToplevel) { | ||
991 | ping(PingReason::FocusWindow); | 991 | ping(PingReason::FocusWindow); | ||
992 | } | 992 | } | ||
993 | setActive(true); | 993 | setActive(true); | ||
994 | } | 994 | } | ||
995 | 995 | | |||
996 | if (!keepAbove() && !isOnScreenDisplay() && !belongsToDesktop()) { | 996 | if (!keepAbove() && !isOnScreenDisplay() && !belongsToDesktop()) { | ||
997 | workspace()->setShowingDesktop(false); | 997 | workspace()->setShowingDesktop(false); | ||
998 | } | 998 | } | ||
999 | } | 999 | } | ||
1000 | 1000 | | |||
1001 | void XdgShellClient::doSetActive() | 1001 | void XdgShellClient::doSetActive() | ||
1002 | { | 1002 | { | ||
1003 | if (!isActive()) { | 1003 | if (!isActive()) { | ||
1004 | return; | 1004 | return; | ||
1005 | } | 1005 | } | ||
1006 | StackingUpdatesBlocker blocker(workspace()); | 1006 | StackingUpdatesBlocker blocker(workspace()); | ||
1007 | workspace()->focusToNull(); | 1007 | workspace()->focusToNull(); | ||
1008 | } | 1008 | } | ||
1009 | 1009 | | |||
1010 | bool XdgShellClient::userCanSetFullScreen() const | 1010 | bool XdgShellClient::userCanSetFullScreen() const | ||
1011 | { | 1011 | { | ||
1012 | if (m_xdgShellSurface) { | 1012 | if (m_xdgShellToplevel) { | ||
1013 | return true; | 1013 | return true; | ||
1014 | } | 1014 | } | ||
1015 | return false; | 1015 | return false; | ||
1016 | } | 1016 | } | ||
1017 | 1017 | | |||
1018 | bool XdgShellClient::userCanSetNoBorder() const | 1018 | bool XdgShellClient::userCanSetNoBorder() const | ||
1019 | { | 1019 | { | ||
1020 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | 1020 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | ||
Show All 29 Lines | 1035 | { | |||
1050 | if (m_closing) { | 1050 | if (m_closing) { | ||
1051 | // a closing window does not accept focus | 1051 | // a closing window does not accept focus | ||
1052 | return false; | 1052 | return false; | ||
1053 | } | 1053 | } | ||
1054 | if (m_unmapped) { | 1054 | if (m_unmapped) { | ||
1055 | // an unmapped window does not accept focus | 1055 | // an unmapped window does not accept focus | ||
1056 | return false; | 1056 | return false; | ||
1057 | } | 1057 | } | ||
1058 | if (m_xdgShellSurface) { | 1058 | if (m_xdgShellToplevel) { | ||
1059 | // TODO: proper | 1059 | // TODO: proper | ||
1060 | return true; | 1060 | return true; | ||
1061 | } | 1061 | } | ||
1062 | return false; | 1062 | return false; | ||
1063 | } | 1063 | } | ||
1064 | 1064 | | |||
1065 | void XdgShellClient::createWindowId() | 1065 | void XdgShellClient::createWindowId() | ||
1066 | { | 1066 | { | ||
Show All 27 Lines | 1093 | if (rect.isValid()) { | |||
1094 | size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | 1094 | size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
1095 | } else { | 1095 | } else { | ||
1096 | size = QSize(0, 0); | 1096 | size = QSize(0, 0); | ||
1097 | } | 1097 | } | ||
1098 | m_requestedClientSize = size; | 1098 | m_requestedClientSize = size; | ||
1099 | 1099 | | |||
1100 | quint64 serialId = 0; | 1100 | quint64 serialId = 0; | ||
1101 | 1101 | | |||
1102 | if (m_xdgShellSurface) { | 1102 | if (m_xdgShellToplevel) { | ||
1103 | serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size); | 1103 | serialId = m_xdgShellToplevel->configure(xdgSurfaceStates(), size); | ||
1104 | } | 1104 | } | ||
1105 | if (m_xdgShellPopup) { | 1105 | if (m_xdgShellPopup) { | ||
1106 | auto parent = transientFor(); | 1106 | auto parent = transientFor(); | ||
1107 | if (parent) { | 1107 | if (parent) { | ||
1108 | const QPoint globalClientContentPos = parent->frameGeometry().topLeft() + parent->clientPos(); | 1108 | const QPoint globalClientContentPos = parent->frameGeometry().topLeft() + parent->clientPos(); | ||
1109 | const QPoint relativeOffset = rect.topLeft() - globalClientContentPos; | 1109 | const QPoint relativeOffset = rect.topLeft() - globalClientContentPos; | ||
1110 | serialId = m_xdgShellPopup->configure(QRect(relativeOffset, size)); | 1110 | serialId = m_xdgShellPopup->configure(QRect(relativeOffset, size)); | ||
1111 | } | 1111 | } | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
1157 | void XdgShellClient::handleConfigureAcknowledged(quint32 serial) | 1157 | void XdgShellClient::handleConfigureAcknowledged(quint32 serial) | ||
1158 | { | 1158 | { | ||
1159 | m_lastAckedConfigureRequest = serial; | 1159 | m_lastAckedConfigureRequest = serial; | ||
1160 | } | 1160 | } | ||
1161 | 1161 | | |||
1162 | void XdgShellClient::handleTransientForChanged() | 1162 | void XdgShellClient::handleTransientForChanged() | ||
1163 | { | 1163 | { | ||
1164 | SurfaceInterface *transientSurface = nullptr; | 1164 | SurfaceInterface *transientSurface = nullptr; | ||
1165 | if (m_xdgShellSurface) { | 1165 | if (m_xdgShellToplevel) { | ||
1166 | if (auto transient = m_xdgShellSurface->transientFor().data()) { | 1166 | if (auto transient = m_xdgShellToplevel->transientFor().data()) { | ||
1167 | transientSurface = transient->surface(); | 1167 | transientSurface = transient->surface(); | ||
1168 | } | 1168 | } | ||
1169 | } | 1169 | } | ||
1170 | if (m_xdgShellPopup) { | 1170 | if (m_xdgShellPopup) { | ||
1171 | transientSurface = m_xdgShellPopup->transientFor().data(); | 1171 | transientSurface = m_xdgShellPopup->transientFor().data(); | ||
1172 | } | 1172 | } | ||
1173 | if (!transientSurface) { | 1173 | if (!transientSurface) { | ||
1174 | transientSurface = waylandServer()->findForeignTransientForSurface(surface()); | 1174 | transientSurface = waylandServer()->findForeignTransientForSurface(surface()); | ||
▲ Show 20 Lines • Show All 667 Lines • ▼ Show 20 Line(s) | 1841 | if (changed && !m_unmapped) { | |||
1842 | updateDecoration(false); | 1842 | updateDecoration(false); | ||
1843 | } | 1843 | } | ||
1844 | } | 1844 | } | ||
1845 | ); | 1845 | ); | ||
1846 | } | 1846 | } | ||
1847 | 1847 | | |||
1848 | void XdgShellClient::installXdgDecoration(XdgDecorationInterface *deco) | 1848 | void XdgShellClient::installXdgDecoration(XdgDecorationInterface *deco) | ||
1849 | { | 1849 | { | ||
1850 | Q_ASSERT(m_xdgShellSurface); | 1850 | Q_ASSERT(m_xdgShellToplevel); | ||
1851 | 1851 | | |||
1852 | m_xdgDecoration = deco; | 1852 | m_xdgDecoration = deco; | ||
1853 | 1853 | | |||
1854 | connect(m_xdgDecoration, &QObject::destroyed, this, | 1854 | connect(m_xdgDecoration, &QObject::destroyed, this, | ||
1855 | [this] { | 1855 | [this] { | ||
1856 | m_xdgDecoration = nullptr; | 1856 | m_xdgDecoration = nullptr; | ||
1857 | if (m_closing || !Workspace::self()) { | 1857 | if (m_closing || !Workspace::self()) { | ||
1858 | return; | 1858 | return; | ||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 1984 | { | |||
1991 | return false; | 1991 | return false; | ||
1992 | } | 1992 | } | ||
1993 | 1993 | | |||
1994 | bool XdgShellClient::supportsWindowRules() const | 1994 | bool XdgShellClient::supportsWindowRules() const | ||
1995 | { | 1995 | { | ||
1996 | if (m_plasmaShellSurface) { | 1996 | if (m_plasmaShellSurface) { | ||
1997 | return false; | 1997 | return false; | ||
1998 | } | 1998 | } | ||
1999 | return m_xdgShellSurface; | 1999 | return m_xdgShellToplevel; | ||
2000 | } | 2000 | } | ||
2001 | 2001 | | |||
2002 | QRect XdgShellClient::adjustMoveGeometry(const QRect &rect) const | 2002 | QRect XdgShellClient::adjustMoveGeometry(const QRect &rect) const | ||
2003 | { | 2003 | { | ||
2004 | QRect geometry = rect; | 2004 | QRect geometry = rect; | ||
2005 | geometry.moveTopLeft(moveResizeGeometry().topLeft()); | 2005 | geometry.moveTopLeft(moveResizeGeometry().topLeft()); | ||
2006 | return geometry; | 2006 | return geometry; | ||
2007 | } | 2007 | } | ||
Show All 30 Lines | 2037 | case PositionCenter: | |||
2038 | Q_UNREACHABLE(); | 2038 | Q_UNREACHABLE(); | ||
2039 | } | 2039 | } | ||
2040 | 2040 | | |||
2041 | return geometry; | 2041 | return geometry; | ||
2042 | } | 2042 | } | ||
2043 | 2043 | | |||
2044 | void XdgShellClient::ping(PingReason reason) | 2044 | void XdgShellClient::ping(PingReason reason) | ||
2045 | { | 2045 | { | ||
2046 | Q_ASSERT(m_xdgShellSurface); | 2046 | Q_ASSERT(m_xdgShellToplevel); | ||
2047 | 2047 | | |||
2048 | XdgShellInterface *shell = static_cast<XdgShellInterface *>(m_xdgShellSurface->global()); | 2048 | XdgShellInterface *shell = static_cast<XdgShellInterface *>(m_xdgShellToplevel->global()); | ||
2049 | const quint32 serial = shell->ping(m_xdgShellSurface); | 2049 | const quint32 serial = shell->ping(m_xdgShellToplevel); | ||
2050 | m_pingSerials.insert(serial, reason); | 2050 | m_pingSerials.insert(serial, reason); | ||
2051 | } | 2051 | } | ||
2052 | 2052 | | |||
2053 | } | 2053 | } |