Changeset View
Changeset View
Standalone View
Standalone View
decorations/decoratedclient.cpp
Show All 35 Lines | |||||
36 | { | 36 | { | ||
37 | namespace Decoration | 37 | namespace Decoration | ||
38 | { | 38 | { | ||
39 | 39 | | |||
40 | DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration) | 40 | DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration) | ||
41 | : QObject() | 41 | : QObject() | ||
42 | , DecoratedClientPrivate(decoratedClient, decoration) | 42 | , DecoratedClientPrivate(decoratedClient, decoration) | ||
43 | , m_client(client) | 43 | , m_client(client) | ||
44 | , m_clientSize(client->clientSize()) | ||||
44 | , m_renderer(nullptr) | 45 | , m_renderer(nullptr) | ||
45 | { | 46 | { | ||
46 | createRenderer(); | 47 | createRenderer(); | ||
47 | client->setDecoratedClient(QPointer<DecoratedClientImpl>(this)); | 48 | client->setDecoratedClient(QPointer<DecoratedClientImpl>(this)); | ||
48 | connect(client, &AbstractClient::activeChanged, this, | 49 | connect(client, &AbstractClient::activeChanged, this, | ||
49 | [decoratedClient, client]() { | 50 | [decoratedClient, client]() { | ||
50 | emit decoratedClient->activeChanged(client->isActive()); | 51 | emit decoratedClient->activeChanged(client->isActive()); | ||
51 | } | 52 | } | ||
52 | ); | 53 | ); | ||
53 | connect(client, &AbstractClient::geometryChanged, this, | 54 | connect(client, &AbstractClient::geometryChanged, this, | ||
54 | [decoratedClient, client]() { | 55 | [decoratedClient, this]() { | ||
55 | emit decoratedClient->widthChanged(client->clientSize().width()); | 56 | if (m_client->clientSize() == m_clientSize) { | ||
56 | emit decoratedClient->heightChanged(client->clientSize().height()); | 57 | return; | ||
58 | } | ||||
59 | const auto oldSize = m_clientSize; | ||||
60 | m_clientSize = m_client->clientSize(); | ||||
61 | if (oldSize.width() != m_clientSize.width()) { | ||||
62 | emit decoratedClient->widthChanged(m_clientSize.width()); | ||||
63 | } | ||||
64 | if (oldSize.height() != m_clientSize.height()) { | ||||
65 | emit decoratedClient->heightChanged(m_clientSize.height()); | ||||
66 | } | ||||
57 | } | 67 | } | ||
58 | ); | 68 | ); | ||
59 | connect(client, &AbstractClient::desktopChanged, this, | 69 | connect(client, &AbstractClient::desktopChanged, this, | ||
60 | [decoratedClient, client]() { | 70 | [decoratedClient, client]() { | ||
61 | emit decoratedClient->onAllDesktopsChanged(client->isOnAllDesktops()); | 71 | emit decoratedClient->onAllDesktopsChanged(client->isOnAllDesktops()); | ||
62 | } | 72 | } | ||
63 | ); | 73 | ); | ||
64 | connect(client, &AbstractClient::captionChanged, this, | 74 | connect(client, &AbstractClient::captionChanged, this, | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | |||||
200 | 210 | | |||
201 | void DecoratedClientImpl::delayedRequestToggleMaximization(Options::WindowOperation operation) | 211 | void DecoratedClientImpl::delayedRequestToggleMaximization(Options::WindowOperation operation) | ||
202 | { | 212 | { | ||
203 | Workspace::self()->performWindowOperation(m_client, operation); | 213 | Workspace::self()->performWindowOperation(m_client, operation); | ||
204 | } | 214 | } | ||
205 | 215 | | |||
206 | int DecoratedClientImpl::width() const | 216 | int DecoratedClientImpl::width() const | ||
207 | { | 217 | { | ||
208 | return m_client->clientSize().width(); | 218 | return m_clientSize.width(); | ||
209 | } | 219 | } | ||
210 | 220 | | |||
211 | int DecoratedClientImpl::height() const | 221 | int DecoratedClientImpl::height() const | ||
212 | { | 222 | { | ||
213 | return m_client->clientSize().height(); | 223 | return m_clientSize.height(); | ||
214 | } | 224 | } | ||
215 | 225 | | |||
216 | bool DecoratedClientImpl::isMaximizedVertically() const | 226 | bool DecoratedClientImpl::isMaximizedVertically() const | ||
217 | { | 227 | { | ||
218 | return m_client->maximizeMode() & MaximizeVertical; | 228 | return m_client->maximizeMode() & MaximizeVertical; | ||
219 | } | 229 | } | ||
220 | 230 | | |||
221 | bool DecoratedClientImpl::isMaximized() const | 231 | bool DecoratedClientImpl::isMaximized() const | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |