Changeset View
Changeset View
Standalone View
Standalone View
decorations/decoratedclient.cpp
Show All 24 Lines | |||||
25 | #include "cursor.h" | 25 | #include "cursor.h" | ||
26 | #include "options.h" | 26 | #include "options.h" | ||
27 | #include "scene.h" | 27 | #include "scene.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | 29 | | |||
30 | #include <KDecoration2/DecoratedClient> | 30 | #include <KDecoration2/DecoratedClient> | ||
31 | #include <KDecoration2/Decoration> | 31 | #include <KDecoration2/Decoration> | ||
32 | 32 | | |||
33 | #include <KLocalizedString> | ||||
34 | | ||||
33 | #include <QDebug> | 35 | #include <QDebug> | ||
34 | 36 | | |||
35 | namespace KWin | 37 | namespace KWin | ||
36 | { | 38 | { | ||
37 | namespace Decoration | 39 | namespace Decoration | ||
38 | { | 40 | { | ||
39 | 41 | | |||
40 | DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration) | 42 | DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration) | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 48 | { | |||
108 | connect(client, &AbstractClient::shadeableChanged, decoratedClient, &KDecoration2::DecoratedClient::shadeableChanged); | 110 | connect(client, &AbstractClient::shadeableChanged, decoratedClient, &KDecoration2::DecoratedClient::shadeableChanged); | ||
109 | connect(client, &AbstractClient::minimizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::minimizeableChanged); | 111 | connect(client, &AbstractClient::minimizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::minimizeableChanged); | ||
110 | connect(client, &AbstractClient::maximizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::maximizeableChanged); | 112 | connect(client, &AbstractClient::maximizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::maximizeableChanged); | ||
111 | 113 | | |||
112 | connect(client, &AbstractClient::paletteChanged, decoratedClient, &KDecoration2::DecoratedClient::paletteChanged); | 114 | connect(client, &AbstractClient::paletteChanged, decoratedClient, &KDecoration2::DecoratedClient::paletteChanged); | ||
113 | 115 | | |||
114 | connect(client, &AbstractClient::hasApplicationMenuChanged, decoratedClient, &KDecoration2::DecoratedClient::hasApplicationMenuChanged); | 116 | connect(client, &AbstractClient::hasApplicationMenuChanged, decoratedClient, &KDecoration2::DecoratedClient::hasApplicationMenuChanged); | ||
115 | connect(client, &AbstractClient::applicationMenuActiveChanged, decoratedClient, &KDecoration2::DecoratedClient::applicationMenuActiveChanged); | 117 | connect(client, &AbstractClient::applicationMenuActiveChanged, decoratedClient, &KDecoration2::DecoratedClient::applicationMenuActiveChanged); | ||
118 | | ||||
119 | connect(client, &AbstractClient::unresponsiveChanged, decoratedClient, [this, decoratedClient]() { | ||||
120 | emit decoratedClient->captionChanged(decoratedClient->caption()); | ||||
121 | }); | ||||
116 | } | 122 | } | ||
117 | 123 | | |||
118 | DecoratedClientImpl::~DecoratedClientImpl() = default; | 124 | DecoratedClientImpl::~DecoratedClientImpl() = default; | ||
119 | 125 | | |||
120 | void DecoratedClientImpl::signalShadeChange() { | 126 | void DecoratedClientImpl::signalShadeChange() { | ||
121 | emit decoratedClient()->shadedChanged(m_client->isShade()); | 127 | emit decoratedClient()->shadedChanged(m_client->isShade()); | ||
122 | } | 128 | } | ||
123 | 129 | | |||
124 | #define DELEGATE(type, name, clientName) \ | 130 | #define DELEGATE(type, name, clientName) \ | ||
125 | type DecoratedClientImpl::name() const \ | 131 | type DecoratedClientImpl::name() const \ | ||
126 | { \ | 132 | { \ | ||
127 | return m_client->clientName(); \ | 133 | return m_client->clientName(); \ | ||
128 | } | 134 | } | ||
129 | 135 | | |||
130 | #define DELEGATE2(type, name) DELEGATE(type, name, name) | 136 | #define DELEGATE2(type, name) DELEGATE(type, name, name) | ||
131 | 137 | | |||
132 | DELEGATE2(QString, caption) | 138 | QString DecoratedClientImpl::caption() const | ||
139 | { | ||||
140 | QString caption = m_client->caption(); | ||||
141 | if (m_client->unresponsive()) { | ||||
142 | caption += i18nc("Application is not responding, appended to window title", " (Not Responding)"); | ||||
143 | } | ||||
144 | return caption; | ||||
145 | } | ||||
133 | DELEGATE2(bool, isActive) | 146 | DELEGATE2(bool, isActive) | ||
graesslin: instead of moving this into the decoration plugin, you could just adjust the caption directly. | |||||
134 | DELEGATE2(bool, isCloseable) | 147 | DELEGATE2(bool, isCloseable) | ||
135 | DELEGATE(bool, isMaximizeable, isMaximizable) | 148 | DELEGATE(bool, isMaximizeable, isMaximizable) | ||
136 | DELEGATE(bool, isMinimizeable, isMinimizable) | 149 | DELEGATE(bool, isMinimizeable, isMinimizable) | ||
137 | DELEGATE2(bool, isModal) | 150 | DELEGATE2(bool, isModal) | ||
138 | DELEGATE(bool, isMoveable, isMovable) | 151 | DELEGATE(bool, isMoveable, isMovable) | ||
139 | DELEGATE(bool, isResizeable, isResizable) | 152 | DELEGATE(bool, isResizeable, isResizable) | ||
140 | DELEGATE2(bool, isShadeable) | 153 | DELEGATE2(bool, isShadeable) | ||
141 | DELEGATE2(bool, providesContextHelp) | 154 | DELEGATE2(bool, providesContextHelp) | ||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |
instead of moving this into the decoration plugin, you could just adjust the caption directly. We already manipulate it anyway for adding things like (2). The advantage is that it would be available everywhere where we use the caption. E.g. Alt+Tab, PresentWindows...