Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | #include <QFileInfo> | 55 | #include <QFileInfo> | ||
56 | #include <QOpenGLFramebufferObject> | 56 | #include <QOpenGLFramebufferObject> | ||
57 | #include <QWindow> | 57 | #include <QWindow> | ||
58 | 58 | | |||
59 | #include <sys/types.h> | 59 | #include <sys/types.h> | ||
60 | #include <unistd.h> | 60 | #include <unistd.h> | ||
61 | #include <signal.h> | 61 | #include <signal.h> | ||
62 | 62 | | |||
63 | Q_DECLARE_METATYPE(NET::WindowType) | ||||
64 | | ||||
63 | using namespace KWayland::Server; | 65 | using namespace KWayland::Server; | ||
64 | 66 | | |||
65 | static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION"); | 67 | static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION"); | ||
66 | 68 | | |||
67 | namespace KWin | 69 | namespace KWin | ||
68 | { | 70 | { | ||
69 | 71 | | |||
70 | ShellClient::ShellClient(ShellSurfaceInterface *surface) | 72 | ShellClient::ShellClient(ShellSurfaceInterface *surface) | ||
▲ Show 20 Lines • Show All 1067 Lines • ▼ Show 20 Line(s) | 1133 | for (QWindow *w: windows) { | |||
1138 | } | 1140 | } | ||
1139 | m_internalWindow = w; | 1141 | m_internalWindow = w; | ||
1140 | m_internalWindowFlags = m_internalWindow->flags(); | 1142 | m_internalWindowFlags = m_internalWindow->flags(); | ||
1141 | connect(m_internalWindow, &QWindow::xChanged, this, &ShellClient::updateInternalWindowGeometry); | 1143 | connect(m_internalWindow, &QWindow::xChanged, this, &ShellClient::updateInternalWindowGeometry); | ||
1142 | connect(m_internalWindow, &QWindow::yChanged, this, &ShellClient::updateInternalWindowGeometry); | 1144 | connect(m_internalWindow, &QWindow::yChanged, this, &ShellClient::updateInternalWindowGeometry); | ||
1143 | connect(m_internalWindow, &QWindow::destroyed, this, [this] { m_internalWindow = nullptr; }); | 1145 | connect(m_internalWindow, &QWindow::destroyed, this, [this] { m_internalWindow = nullptr; }); | ||
1144 | connect(m_internalWindow, &QWindow::opacityChanged, this, &ShellClient::setOpacity); | 1146 | connect(m_internalWindow, &QWindow::opacityChanged, this, &ShellClient::setOpacity); | ||
1145 | 1147 | | |||
1146 | // Try reading the window type from the QWindow. PlasmaCore.Dialog provides a dynamic type property | 1148 | const QVariant windowType = m_internalWindow->property("kwin_windowType"); | ||
1147 | // let's check whether it exists, if it does it's our window type | | |||
1148 | const QVariant windowType = m_internalWindow->property("type"); | | |||
1149 | if (!windowType.isNull()) { | 1149 | if (!windowType.isNull()) { | ||
1150 | m_windowType = static_cast<NET::WindowType>(windowType.toInt()); | 1150 | m_windowType = windowType.value<NET::WindowType>(); | ||
1151 | } | 1151 | } | ||
1152 | setOpacity(m_internalWindow->opacity()); | 1152 | setOpacity(m_internalWindow->opacity()); | ||
1153 | 1153 | | |||
1154 | // skip close animation support | 1154 | // skip close animation support | ||
1155 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | 1155 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | ||
1156 | m_internalWindow->installEventFilter(this); | 1156 | m_internalWindow->installEventFilter(this); | ||
1157 | return; | 1157 | return; | ||
1158 | } | 1158 | } | ||
▲ Show 20 Lines • Show All 341 Lines • ▼ Show 20 Line(s) | |||||
1500 | 1500 | | |||
1501 | bool ShellClient::eventFilter(QObject *watched, QEvent *event) | 1501 | bool ShellClient::eventFilter(QObject *watched, QEvent *event) | ||
1502 | { | 1502 | { | ||
1503 | if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) { | 1503 | if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) { | ||
1504 | QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent*>(event); | 1504 | QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent*>(event); | ||
1505 | if (pe->propertyName() == s_skipClosePropertyName) { | 1505 | if (pe->propertyName() == s_skipClosePropertyName) { | ||
1506 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | 1506 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | ||
1507 | } | 1507 | } | ||
1508 | if (pe->propertyName() == "kwin_windowType") { | ||||
1509 | m_windowType = m_internalWindow->property("kwin_windowType").value<NET::WindowType>(); | ||||
1510 | workspace()->updateClientArea(); | ||||
1511 | } | ||||
1508 | } | 1512 | } | ||
1509 | return false; | 1513 | return false; | ||
1510 | } | 1514 | } | ||
1511 | 1515 | | |||
1512 | void ShellClient::updateColorScheme() | 1516 | void ShellClient::updateColorScheme() | ||
1513 | { | 1517 | { | ||
1514 | if (m_paletteInterface) { | 1518 | if (m_paletteInterface) { | ||
1515 | AbstractClient::updateColorScheme(rules()->checkDecoColor(m_paletteInterface->palette())); | 1519 | AbstractClient::updateColorScheme(rules()->checkDecoColor(m_paletteInterface->palette())); | ||
▲ Show 20 Lines • Show All 480 Lines • Show Last 20 Lines |