Changeset View
Changeset View
Standalone View
Standalone View
internal_client.cpp
Show All 25 Lines | |||||
26 | #include <KDecoration2/Decoration> | 26 | #include <KDecoration2/Decoration> | ||
27 | 27 | | |||
28 | #include <QOpenGLFramebufferObject> | 28 | #include <QOpenGLFramebufferObject> | ||
29 | #include <QWindow> | 29 | #include <QWindow> | ||
30 | 30 | | |||
31 | Q_DECLARE_METATYPE(NET::WindowType) | 31 | Q_DECLARE_METATYPE(NET::WindowType) | ||
32 | 32 | | |||
33 | static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION"); | 33 | static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION"); | ||
34 | static const QByteArray s_shadowEnabledPropertyName = QByteArrayLiteral("kwin_shadow_enabled"); | ||||
34 | 35 | | |||
35 | namespace KWin | 36 | namespace KWin | ||
36 | { | 37 | { | ||
37 | 38 | | |||
38 | InternalClient::InternalClient(QWindow *window) | 39 | InternalClient::InternalClient(QWindow *window) | ||
39 | : m_internalWindow(window) | 40 | : m_internalWindow(window) | ||
40 | , m_clientSize(window->size()) | 41 | , m_clientSize(window->size()) | ||
41 | , m_windowId(window->winId()) | 42 | , m_windowId(window->winId()) | ||
Show All 15 Lines | 44 | { | |||
57 | } | 58 | } | ||
58 | 59 | | |||
59 | setCaption(m_internalWindow->title()); | 60 | setCaption(m_internalWindow->title()); | ||
60 | setIcon(QIcon::fromTheme(QStringLiteral("kwin"))); | 61 | setIcon(QIcon::fromTheme(QStringLiteral("kwin"))); | ||
61 | setOnAllDesktops(true); | 62 | setOnAllDesktops(true); | ||
62 | setOpacity(m_internalWindow->opacity()); | 63 | setOpacity(m_internalWindow->opacity()); | ||
63 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | 64 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | ||
64 | 65 | | |||
66 | // Create scene window, effect window, and update server-side shadow. | ||||
65 | setupCompositing(); | 67 | setupCompositing(); | ||
66 | updateColorScheme(); | 68 | updateColorScheme(); | ||
67 | 69 | | |||
68 | blockGeometryUpdates(true); | 70 | blockGeometryUpdates(true); | ||
69 | commitGeometry(m_internalWindow->geometry()); | 71 | commitGeometry(m_internalWindow->geometry()); | ||
70 | updateDecoration(true); | 72 | updateDecoration(true); | ||
71 | setFrameGeometry(clientRectToFrameRect(m_internalWindow->geometry())); | 73 | setFrameGeometry(clientRectToFrameRect(m_internalWindow->geometry())); | ||
72 | setGeometryRestore(frameGeometry()); | 74 | setGeometryRestore(frameGeometry()); | ||
73 | blockGeometryUpdates(false); | 75 | blockGeometryUpdates(false); | ||
74 | 76 | | |||
75 | m_internalWindow->installEventFilter(this); | 77 | m_internalWindow->installEventFilter(this); | ||
76 | } | 78 | } | ||
77 | 79 | | |||
78 | InternalClient::~InternalClient() | 80 | InternalClient::~InternalClient() | ||
79 | { | 81 | { | ||
80 | } | 82 | } | ||
81 | 83 | | |||
82 | bool InternalClient::eventFilter(QObject *watched, QEvent *event) | 84 | bool InternalClient::eventFilter(QObject *watched, QEvent *event) | ||
83 | { | 85 | { | ||
84 | if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) { | 86 | if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) { | ||
85 | QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent*>(event); | 87 | QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent*>(event); | ||
86 | if (pe->propertyName() == s_skipClosePropertyName) { | 88 | if (pe->propertyName() == s_skipClosePropertyName) { | ||
87 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | 89 | setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); | ||
88 | } | 90 | } | ||
91 | if (pe->propertyName() == s_shadowEnabledPropertyName) { | ||||
92 | updateShadow(); | ||||
93 | } | ||||
89 | if (pe->propertyName() == "kwin_windowType") { | 94 | if (pe->propertyName() == "kwin_windowType") { | ||
90 | m_windowType = m_internalWindow->property("kwin_windowType").value<NET::WindowType>(); | 95 | m_windowType = m_internalWindow->property("kwin_windowType").value<NET::WindowType>(); | ||
91 | workspace()->updateClientArea(); | 96 | workspace()->updateClientArea(); | ||
92 | } | 97 | } | ||
93 | } | 98 | } | ||
94 | return false; | 99 | return false; | ||
95 | } | 100 | } | ||
96 | 101 | | |||
▲ Show 20 Lines • Show All 581 Lines • Show Last 20 Lines |