Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
43 | #include <KWayland/Server/buffer_interface.h> | 43 | #include <KWayland/Server/buffer_interface.h> | ||
44 | #include <KWayland/Server/plasmashell_interface.h> | 44 | #include <KWayland/Server/plasmashell_interface.h> | ||
45 | #include <KWayland/Server/shadow_interface.h> | 45 | #include <KWayland/Server/shadow_interface.h> | ||
46 | #include <KWayland/Server/server_decoration_interface.h> | 46 | #include <KWayland/Server/server_decoration_interface.h> | ||
47 | #include <KWayland/Server/qtsurfaceextension_interface.h> | 47 | #include <KWayland/Server/qtsurfaceextension_interface.h> | ||
48 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | 48 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | ||
49 | #include <KWayland/Server/appmenu_interface.h> | 49 | #include <KWayland/Server/appmenu_interface.h> | ||
50 | #include <KWayland/Server/server_decoration_palette_interface.h> | 50 | #include <KWayland/Server/server_decoration_palette_interface.h> | ||
51 | #include <KWayland/Server/xdgdecoration_interface.h> | ||||
51 | 52 | | |||
52 | #include <KDesktopFile> | 53 | #include <KDesktopFile> | ||
53 | 54 | | |||
54 | #include <QFileInfo> | 55 | #include <QFileInfo> | ||
55 | #include <QOpenGLFramebufferObject> | 56 | #include <QOpenGLFramebufferObject> | ||
56 | #include <QWindow> | 57 | #include <QWindow> | ||
57 | 58 | | |||
58 | #include <sys/types.h> | 59 | #include <sys/types.h> | ||
▲ Show 20 Lines • Show All 515 Lines • ▼ Show 20 Line(s) | 574 | if (force) | |||
574 | destroyDecoration(); | 575 | destroyDecoration(); | ||
575 | if (!noBorder()) { | 576 | if (!noBorder()) { | ||
576 | createDecoration(oldgeom); | 577 | createDecoration(oldgeom); | ||
577 | } else | 578 | } else | ||
578 | destroyDecoration(); | 579 | destroyDecoration(); | ||
579 | if (m_serverDecoration && isDecorated()) { | 580 | if (m_serverDecoration && isDecorated()) { | ||
580 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | 581 | m_serverDecoration->setMode(KWayland::Server::ServerSideDecorationManagerInterface::Mode::Server); | ||
581 | } | 582 | } | ||
583 | if (m_xdgDecoration) { | ||||
584 | auto mode = isDecorated() ? XdgDecorationInterface::Mode::ServerSide: XdgDecorationInterface::Mode::ClientSide; | ||||
585 | m_xdgDecoration->configure(mode); | ||||
586 | m_xdgShellSurface->configure(xdgSurfaceStates(), m_requestedClientSize); | ||||
587 | } | ||||
582 | getShadow(); | 588 | getShadow(); | ||
583 | if (check_workspace_pos) | 589 | if (check_workspace_pos) | ||
584 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | 590 | checkWorkspacePosition(oldgeom, -2, oldClientGeom); | ||
585 | blockGeometryUpdates(false); | 591 | blockGeometryUpdates(false); | ||
586 | } | 592 | } | ||
587 | 593 | | |||
588 | void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 594 | void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
589 | { | 595 | { | ||
▲ Show 20 Lines • Show All 337 Lines • ▼ Show 20 Line(s) | 932 | { | |||
927 | if (isInternal()) { | 933 | if (isInternal()) { | ||
928 | return m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); | 934 | return m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); | ||
929 | } | 935 | } | ||
930 | if (m_serverDecoration) { | 936 | if (m_serverDecoration) { | ||
931 | if (m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | 937 | if (m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | ||
932 | return m_userNoBorder || isFullScreen(); | 938 | return m_userNoBorder || isFullScreen(); | ||
933 | } | 939 | } | ||
934 | } | 940 | } | ||
941 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | ||||
942 | return m_userNoBorder || isFullScreen(); | ||||
943 | } | ||||
935 | return true; | 944 | return true; | ||
936 | } | 945 | } | ||
937 | 946 | | |||
938 | void ShellClient::setFullScreen(bool set, bool user) | 947 | void ShellClient::setFullScreen(bool set, bool user) | ||
939 | { | 948 | { | ||
940 | if (!isFullScreen() && !set) | 949 | if (!isFullScreen() && !set) | ||
941 | return; | 950 | return; | ||
942 | if (user && !userCanSetFullScreen()) | 951 | if (user && !userCanSetFullScreen()) | ||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 1056 | { | |||
1051 | return false; | 1060 | return false; | ||
1052 | } | 1061 | } | ||
1053 | 1062 | | |||
1054 | bool ShellClient::userCanSetNoBorder() const | 1063 | bool ShellClient::userCanSetNoBorder() const | ||
1055 | { | 1064 | { | ||
1056 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | 1065 | if (m_serverDecoration && m_serverDecoration->mode() == ServerSideDecorationManagerInterface::Mode::Server) { | ||
1057 | return !isFullScreen() && !isShade() && !tabGroup(); | 1066 | return !isFullScreen() && !isShade() && !tabGroup(); | ||
1058 | } | 1067 | } | ||
1068 | if (m_xdgDecoration && m_xdgDecoration->requestedMode() != XdgDecorationInterface::Mode::ClientSide) { | ||||
1069 | return !isFullScreen() && !isShade() && !tabGroup(); | ||||
1070 | } | ||||
1059 | if (m_internal) { | 1071 | if (m_internal) { | ||
1060 | return !m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); | 1072 | return !m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); | ||
1061 | } | 1073 | } | ||
1062 | return false; | 1074 | return false; | ||
1063 | } | 1075 | } | ||
1064 | 1076 | | |||
1065 | bool ShellClient::wantsInput() const | 1077 | bool ShellClient::wantsInput() const | ||
1066 | { | 1078 | { | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 1200 | if (m_requestGeometryBlockCounter != 0) { | |||
1189 | m_blockedRequestGeometry = rect; | 1201 | m_blockedRequestGeometry = rect; | ||
1190 | return; | 1202 | return; | ||
1191 | } | 1203 | } | ||
1192 | PendingConfigureRequest configureRequest; | 1204 | PendingConfigureRequest configureRequest; | ||
1193 | configureRequest.positionAfterResize = rect.topLeft(); | 1205 | configureRequest.positionAfterResize = rect.topLeft(); | ||
1194 | configureRequest.maximizeMode = m_requestedMaximizeMode; | 1206 | configureRequest.maximizeMode = m_requestedMaximizeMode; | ||
1195 | 1207 | | |||
1196 | const QSize size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | 1208 | const QSize size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
1197 | m_requestedClientSize = QSize(0, 0); | 1209 | m_requestedClientSize = size; | ||
1198 | 1210 | | |||
1199 | if (m_shellSurface) { | 1211 | if (m_shellSurface) { | ||
1200 | m_shellSurface->requestSize(size); | 1212 | m_shellSurface->requestSize(size); | ||
1201 | } | 1213 | } | ||
1202 | if (m_xdgShellSurface) { | 1214 | if (m_xdgShellSurface) { | ||
1203 | configureRequest.serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size); | 1215 | configureRequest.serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size); | ||
1204 | } | 1216 | } | ||
1205 | if (m_xdgShellPopup) { | 1217 | if (m_xdgShellPopup) { | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 1265 | { | |||
1269 | if (m_internal) { | 1281 | if (m_internal) { | ||
1270 | m_internalWindow->setGeometry(QRect(pos() + QPoint(borderLeft(), borderTop()), QSize(w, h) - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | 1282 | m_internalWindow->setGeometry(QRect(pos() + QPoint(borderLeft(), borderTop()), QSize(w, h) - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | ||
1271 | } | 1283 | } | ||
1272 | } | 1284 | } | ||
1273 | 1285 | | |||
1274 | void ShellClient::unmap() | 1286 | void ShellClient::unmap() | ||
1275 | { | 1287 | { | ||
1276 | m_unmapped = true; | 1288 | m_unmapped = true; | ||
1277 | m_requestedClientSize = QSize(); | 1289 | m_requestedClientSize = QSize(0, 0); | ||
1278 | destroyWindowManagementInterface(); | 1290 | destroyWindowManagementInterface(); | ||
1279 | if (Workspace::self()) { | 1291 | if (Workspace::self()) { | ||
1280 | addWorkspaceRepaint(visibleRect()); | 1292 | addWorkspaceRepaint(visibleRect()); | ||
1281 | workspace()->clientHidden(this); | 1293 | workspace()->clientHidden(this); | ||
1282 | } | 1294 | } | ||
1283 | emit windowHidden(this); | 1295 | emit windowHidden(this); | ||
1284 | } | 1296 | } | ||
1285 | 1297 | | |||
▲ Show 20 Lines • Show All 515 Lines • ▼ Show 20 Line(s) | 1812 | [this] (ServerSideDecorationManagerInterface::Mode mode) { | |||
1801 | const bool changed = mode != m_serverDecoration->mode(); | 1813 | const bool changed = mode != m_serverDecoration->mode(); | ||
1802 | if (changed && !m_unmapped) { | 1814 | if (changed && !m_unmapped) { | ||
1803 | updateDecoration(false); | 1815 | updateDecoration(false); | ||
1804 | } | 1816 | } | ||
1805 | } | 1817 | } | ||
1806 | ); | 1818 | ); | ||
1807 | } | 1819 | } | ||
1808 | 1820 | | |||
1821 | void ShellClient::installXdgDecoration(XdgDecorationInterface *deco) | ||||
1822 | { | ||||
1823 | Q_ASSERT(m_xdgShellSurface); | ||||
1824 | | ||||
1825 | m_xdgDecoration = deco; | ||||
1826 | | ||||
1827 | connect(m_xdgDecoration, &QObject::destroyed, this, | ||||
1828 | [this] { | ||||
1829 | m_xdgDecoration = nullptr; | ||||
1830 | if (m_closing || !Workspace::self()) { | ||||
1831 | return; | ||||
1832 | } | ||||
1833 | updateDecoration(true); | ||||
1834 | } | ||||
1835 | ); | ||||
1836 | | ||||
1837 | connect(m_xdgDecoration, &XdgDecorationInterface::modeRequested, this, | ||||
1838 | [this] () { | ||||
1839 | //force is true as we must send a new configure response | ||||
1840 | updateDecoration(false, true); | ||||
1841 | }); | ||||
1842 | } | ||||
1843 | | ||||
1809 | bool ShellClient::shouldExposeToWindowManagement() | 1844 | bool ShellClient::shouldExposeToWindowManagement() | ||
1810 | { | 1845 | { | ||
1811 | if (isInternal()) { | 1846 | if (isInternal()) { | ||
1812 | return false; | 1847 | return false; | ||
1813 | } | 1848 | } | ||
1814 | if (isLockScreen()) { | 1849 | if (isLockScreen()) { | ||
1815 | return false; | 1850 | return false; | ||
1816 | } | 1851 | } | ||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |