Changeset View
Standalone View
kcmkwin/kwincompositing/main.cpp
Show All 14 Lines | |||||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
16 | * GNU General Public License for more details. * | 16 | * GNU General Public License for more details. * | ||
17 | * * | 17 | * * | ||
18 | * You should have received a copy of the GNU General Public License * | 18 | * You should have received a copy of the GNU General Public License * | ||
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
20 | **************************************************************************/ | 20 | **************************************************************************/ | ||
21 | 21 | | |||
22 | 22 | | |||
23 | #include "compositing.h" | | |||
24 | #include "ui_compositing.h" | 23 | #include "ui_compositing.h" | ||
24 | #include <kwin_compositing_interface.h> | ||||
25 | | ||||
25 | #include <QAction> | 26 | #include <QAction> | ||
26 | #include <QApplication> | 27 | #include <QApplication> | ||
27 | #include <QLayout> | 28 | #include <QLayout> | ||
28 | 29 | | |||
29 | #include <kcmodule.h> | 30 | #include <kcmodule.h> | ||
30 | #include <kservice.h> | 31 | #include <kservice.h> | ||
31 | 32 | | |||
32 | #include <algorithm> | 33 | #include <algorithm> | ||
33 | #include <functional> | 34 | #include <functional> | ||
34 | 35 | | |||
36 | #include "kwincompositing_setting.h" | ||||
37 | | ||||
35 | class KWinCompositingKCM : public KCModule | 38 | class KWinCompositingKCM : public KCModule | ||
zzag: Put the opening brace on newline. | |||||
36 | { | 39 | { | ||
37 | Q_OBJECT | 40 | Q_OBJECT | ||
Since isRunningPlasma is static, you don't need to put it in an anonymous namespace. Also, coding style nitpick: { must be on its own line. zzag: Since isRunningPlasma is static, you don't need to put it in an anonymous namespace. Also… | |||||
38 | public: | 41 | public: | ||
42 | enum CompositingTypeIndex { | ||||
43 | OPENGL31_INDEX = 0, | ||||
44 | OPENGL20_INDEX, | ||||
45 | XRENDER_INDEX | ||||
46 | }; | ||||
47 | | ||||
39 | explicit KWinCompositingKCM(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); | 48 | explicit KWinCompositingKCM(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); | ||
40 | 49 | | |||
41 | public Q_SLOTS: | 50 | public Q_SLOTS: | ||
42 | void load() override; | 51 | void load() override; | ||
43 | void save() override; | 52 | void save() override; | ||
44 | void defaults() override; | 53 | void defaults() override; | ||
45 | 54 | | |||
55 | private Q_SLOTS: | ||||
56 | void onBackendChanged(); | ||||
57 | | ||||
That one was oddly fine (yes, Qt is inconsistent with dealing with GL and we are as well ;-)) ervin: That one was oddly fine (yes, Qt is inconsistent with dealing with GL and we are as well ;-)) | |||||
46 | private: | 58 | private: | ||
47 | void init(); | 59 | void init(); | ||
48 | KWin::Compositing::Compositing *m_compositing; | 60 | void updateUnnamagedItemStatus(); | ||
61 | bool isRunningPlasma() const; | ||||
zzag: Make it static. | |||||
62 | bool compositingRequired() const; | ||||
63 | | ||||
zzag: typo: Unnamaged | |||||
49 | Ui_CompositingForm m_form; | 64 | Ui_CompositingForm m_form; | ||
65 | | ||||
66 | OrgKdeKwinCompositingInterface *m_compositingInterface; | ||||
67 | KWinCompositingSetting *m_settings; | ||||
50 | }; | 68 | }; | ||
51 | 69 | | |||
52 | static const QVector<qreal> s_animationMultipliers = {8, 4, 2, 1, 0.5, 0.25, 0.125, 0}; | 70 | static const QVector<qreal> s_animationMultipliers = {8, 4, 2, 1, 0.5, 0.25, 0.125, 0}; | ||
53 | 71 | | |||
72 | bool KWinCompositingKCM::compositingRequired() const | ||||
73 | { | ||||
74 | return m_compositingInterface->platformRequiresCompositing(); | ||||
75 | } | ||||
76 | | ||||
54 | KWinCompositingKCM::KWinCompositingKCM(QWidget *parent, const QVariantList &args) | 77 | KWinCompositingKCM::KWinCompositingKCM(QWidget *parent, const QVariantList &args) | ||
55 | : KCModule(parent, args) | 78 | : KCModule(parent, args) | ||
56 | , m_compositing(new KWin::Compositing::Compositing(this)) | 79 | //, m_compositing(new KWin::Compositing::Compositing(this)) | ||
80 | , m_compositingInterface(new OrgKdeKwinCompositingInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Compositor"), QDBusConnection::sessionBus(), this)) | ||||
81 | , m_settings(new KWinCompositingSetting(parent)) | ||||
Please don't submit commented code unless there is a reason, which must be stated in a comment. zzag: Please don't submit commented code unless there is a reason, which must be stated in a comment. | |||||
zzag: Is there a reason why the parent is not `this`? | |||||
57 | { | 82 | { | ||
58 | m_form.setupUi(this); | 83 | m_form.setupUi(this); | ||
84 | addConfig(m_settings, this); | ||||
85 | | ||||
59 | m_form.glCrashedWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | 86 | m_form.glCrashedWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | ||
60 | QAction *reenableGLAction = new QAction(i18n("Re-enable OpenGL detection"), this); | 87 | QAction *reenableGLAction = new QAction(i18n("Re-enable OpenGL detection"), this); | ||
61 | connect(reenableGLAction, &QAction::triggered, m_compositing, &KWin::Compositing::Compositing::reenableOpenGLDetection); | 88 | connect(reenableGLAction, &QAction::triggered, m_settings, [this]() { | ||
89 | m_settings->setOpenGLIsUnsafe(false); | ||||
90 | m_settings->save(); | ||||
91 | }); | ||||
zzag: We don't capture any variable so there is no point for using a lambda. | |||||
Well, this is captured because of m_settings, isn't it? It would be nice to have this as third connect parameter though. ervin: Well, this is captured because of m_settings, isn't it?
It would be nice to have this as third… | |||||
Yes, this is captured but I would say it's not an excuse for using a lambda. A method would be more appropriate in this case. zzag: Yes, this is captured but I would say it's not an excuse for using a lambda. A method would be… | |||||
62 | connect(reenableGLAction, &QAction::triggered, m_form.glCrashedWarning, &KMessageWidget::animatedHide); | 92 | connect(reenableGLAction, &QAction::triggered, m_form.glCrashedWarning, &KMessageWidget::animatedHide); | ||
63 | m_form.glCrashedWarning->addAction(reenableGLAction); | 93 | m_form.glCrashedWarning->addAction(reenableGLAction); | ||
64 | m_form.scaleWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | 94 | m_form.scaleWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | ||
65 | m_form.tearingWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | 95 | m_form.tearingWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | ||
66 | m_form.windowThumbnailWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | 96 | m_form.windowThumbnailWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning"))); | ||
67 | 97 | | |||
68 | m_form.compositingEnabled->setVisible(!m_compositing->compositingRequired()); | 98 | m_form.kcfg_Enabled->setVisible(!compositingRequired()); | ||
69 | m_form.windowsBlockCompositing->setVisible(!m_compositing->compositingRequired()); | 99 | m_form.kcfg_WindowsBlockCompositing ->setVisible(!compositingRequired()); | ||
stray whitespace between "kcfg_WindowsBlockCompositing" and "->". Please remove it. zzag: stray whitespace between "kcfg_WindowsBlockCompositing" and "->". Please remove it. | |||||
70 | 100 | | |||
71 | init(); | 101 | init(); | ||
72 | } | 102 | } | ||
73 | 103 | | |||
104 | bool KWinCompositingKCM::isRunningPlasma() const | ||||
105 | { | ||||
106 | return qgetenv("XDG_CURRENT_DESKTOP") == "KDE"; | ||||
107 | } | ||||
108 | | ||||
74 | void KWinCompositingKCM::init() | 109 | void KWinCompositingKCM::init() | ||
75 | { | 110 | { | ||
76 | using namespace KWin::Compositing; | | |||
77 | auto currentIndexChangedSignal = static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged); | 111 | auto currentIndexChangedSignal = static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged); | ||
ervin: { should be on its own line | |||||
78 | 112 | | |||
79 | connect(m_compositing, &Compositing::changed, this, qOverload<bool>(&KCModule::changed)); | | |||
80 | connect(m_compositing, &Compositing::defaulted, this, qOverload<bool>(&KCModule::defaulted)); | | |||
81 | | ||||
82 | // enabled check box | | |||
83 | m_form.compositingEnabled->setChecked(m_compositing->compositingEnabled()); | | |||
84 | connect(m_compositing, &Compositing::compositingEnabledChanged, m_form.compositingEnabled, &QCheckBox::setChecked); | | |||
85 | connect(m_form.compositingEnabled, &QCheckBox::toggled, m_compositing, &Compositing::setCompositingEnabled); | | |||
86 | | ||||
87 | // animation speed | 113 | // animation speed | ||
88 | m_form.animationSpeed->setMaximum(s_animationMultipliers.size() - 1); | 114 | m_form.unmanagedAnimationDurationFactor->setMaximum(s_animationMultipliers.size() - 1); | ||
89 | auto setSpeed = [this](const qreal multiplier) { | 115 | connect(m_form.unmanagedAnimationDurationFactor, &QSlider::valueChanged, this, [this]() { | ||
90 | auto const it = std::lower_bound(s_animationMultipliers.begin(), s_animationMultipliers.end(), multiplier, std::greater<qreal>()); | 116 | m_settings->setAnimationDurationFactor(s_animationMultipliers[m_form.unmanagedAnimationDurationFactor->value()]); | ||
91 | const int index = std::distance(s_animationMultipliers.begin(), it); | 117 | updateUnnamagedItemStatus(); | ||
92 | m_form.animationSpeed->setValue(index); | | |||
93 | }; | | |||
94 | setSpeed(m_compositing->animationSpeed()); | | |||
95 | connect(m_compositing, &Compositing::animationSpeedChanged, m_form.animationSpeed, setSpeed); | | |||
96 | connect(m_form.animationSpeed, &QSlider::valueChanged, m_compositing, [this](int index) { | | |||
97 | m_compositing->setAnimationSpeed(s_animationMultipliers[index]); | | |||
98 | }); | 118 | }); | ||
99 | 119 | | |||
100 | if (Compositing::isRunningPlasma()) { | 120 | if (isRunningPlasma()) { | ||
101 | m_form.animationSpeedLabel->hide(); | 121 | m_form.animationSpeedLabel->hide(); | ||
102 | m_form.animationSpeedControls->hide(); | 122 | m_form.animationSpeedControls->hide(); | ||
103 | } | 123 | } | ||
104 | 124 | | |||
105 | // gl scale filter | 125 | // gl scale filter | ||
106 | m_form.glScaleFilter->setCurrentIndex(m_compositing->glScaleFilter()); | 126 | connect(m_form.kcfg_GLTextureFilter, currentIndexChangedSignal, | ||
107 | connect(m_compositing, &Compositing::glScaleFilterChanged, m_form.glScaleFilter, &QComboBox::setCurrentIndex); | | |||
108 | connect(m_form.glScaleFilter, currentIndexChangedSignal, m_compositing, &Compositing::setGlScaleFilter); | | |||
109 | connect(m_form.glScaleFilter, currentIndexChangedSignal, | | |||
110 | [this](int index) { | 127 | [this](int index) { | ||
111 | if (index == 2) { | 128 | if (index == 2) { | ||
112 | m_form.scaleWarning->animatedShow(); | 129 | m_form.scaleWarning->animatedShow(); | ||
113 | } else { | 130 | } else { | ||
114 | m_form.scaleWarning->animatedHide(); | 131 | m_form.scaleWarning->animatedHide(); | ||
115 | } | 132 | } | ||
116 | } | 133 | } | ||
117 | ); | 134 | ); | ||
118 | 135 | | |||
119 | // xrender scale filter | | |||
120 | m_form.xrScaleFilter->setCurrentIndex(m_compositing->xrScaleFilter()); | | |||
121 | connect(m_compositing, &Compositing::xrScaleFilterChanged, m_form.xrScaleFilter, &QComboBox::setCurrentIndex); | | |||
122 | connect(m_form.xrScaleFilter, currentIndexChangedSignal, | | |||
123 | [this](int index) { | | |||
124 | if (index == 0) { | | |||
125 | m_compositing->setXrScaleFilter(false); | | |||
126 | } else { | | |||
127 | m_compositing->setXrScaleFilter(true); | | |||
128 | } | | |||
129 | }); | | |||
130 | | ||||
131 | // tearing prevention | 136 | // tearing prevention | ||
132 | m_form.tearingPrevention->setCurrentIndex(m_compositing->glSwapStrategy()); | 137 | connect(m_form.kcfg_GLPreferBufferSwap, currentIndexChangedSignal, | ||
133 | connect(m_compositing, &Compositing::glSwapStrategyChanged, m_form.tearingPrevention, &QComboBox::setCurrentIndex); | | |||
134 | connect(m_form.tearingPrevention, currentIndexChangedSignal, m_compositing, &Compositing::setGlSwapStrategy); | | |||
135 | connect(m_form.tearingPrevention, currentIndexChangedSignal, | | |||
136 | [this](int index) { | 138 | [this](int index) { | ||
137 | if (index == 2) { | 139 | if (index == 2) { | ||
138 | // only when cheap - tearing | 140 | // only when cheap - tearing | ||
139 | m_form.tearingWarning->setText(i18n("\"Only when cheap\" only prevents tearing for full screen changes like a video.")); | 141 | m_form.tearingWarning->setText(i18n("\"Only when cheap\" only prevents tearing for full screen changes like a video.")); | ||
140 | m_form.tearingWarning->animatedShow(); | 142 | m_form.tearingWarning->animatedShow(); | ||
141 | } else if (index == 3) { | 143 | } else if (index == 3) { | ||
142 | // full screen repaints | 144 | // full screen repaints | ||
143 | m_form.tearingWarning->setText(i18n("\"Full screen repaints\" can cause performance problems.")); | 145 | m_form.tearingWarning->setText(i18n("\"Full screen repaints\" can cause performance problems.")); | ||
144 | m_form.tearingWarning->animatedShow(); | 146 | m_form.tearingWarning->animatedShow(); | ||
145 | } else if (index == 4) { | 147 | } else if (index == 4) { | ||
146 | // re-use screen content | 148 | // re-use screen content | ||
147 | m_form.tearingWarning->setText(i18n("\"Re-use screen content\" causes severe performance problems on MESA drivers.")); | 149 | m_form.tearingWarning->setText(i18n("\"Re-use screen content\" causes severe performance problems on MESA drivers.")); | ||
148 | m_form.tearingWarning->animatedShow(); | 150 | m_form.tearingWarning->animatedShow(); | ||
149 | } else { | 151 | } else { | ||
150 | m_form.tearingWarning->animatedHide(); | 152 | m_form.tearingWarning->animatedHide(); | ||
151 | } | 153 | } | ||
152 | } | 154 | } | ||
153 | ); | 155 | ); | ||
154 | 156 | | |||
155 | // windowThumbnail | 157 | // windowThumbnail | ||
156 | m_form.windowThumbnail->setCurrentIndex(m_compositing->windowThumbnail()); | 158 | connect(m_form.kcfg_HiddenPreviews, currentIndexChangedSignal, | ||
ervin: Please add this as third connect parameter | |||||
157 | connect(m_compositing, &Compositing::windowThumbnailChanged, m_form.windowThumbnail, &QComboBox::setCurrentIndex); | | |||
158 | connect(m_form.windowThumbnail, currentIndexChangedSignal, m_compositing, &Compositing::setWindowThumbnail); | | |||
159 | connect(m_form.windowThumbnail, currentIndexChangedSignal, | | |||
160 | [this](int index) { | 159 | [this](int index) { | ||
161 | if (index == 2) { | 160 | if (index == 2) { | ||
162 | m_form.windowThumbnailWarning->animatedShow(); | 161 | m_form.windowThumbnailWarning->animatedShow(); | ||
163 | } else { | 162 | } else { | ||
164 | m_form.windowThumbnailWarning->animatedHide(); | 163 | m_form.windowThumbnailWarning->animatedHide(); | ||
165 | } | 164 | } | ||
166 | } | 165 | } | ||
167 | ); | 166 | ); | ||
168 | 167 | | |||
169 | // windows blocking compositing | | |||
170 | m_form.windowsBlockCompositing->setChecked(m_compositing->windowsBlockCompositing()); | | |||
171 | connect(m_compositing, &Compositing::windowsBlockCompositingChanged, m_form.windowsBlockCompositing, &QCheckBox::setChecked); | | |||
172 | connect(m_form.windowsBlockCompositing, &QCheckBox::toggled, m_compositing, &Compositing::setWindowsBlockCompositing); | | |||
173 | | ||||
174 | // compositing type | 168 | // compositing type | ||
175 | CompositingType *type = new CompositingType(this); | 169 | m_form.unmanagedBackend->addItem(i18n("OpenGL 3.1"), CompositingTypeIndex::OPENGL31_INDEX); | ||
176 | m_form.type->setModel(type); | 170 | m_form.unmanagedBackend->addItem(i18n("OpenGL 2.0"), CompositingTypeIndex::OPENGL20_INDEX); | ||
177 | auto updateCompositingType = [this, type]() { | 171 | m_form.unmanagedBackend->addItem(i18n("XRender"), CompositingTypeIndex::XRENDER_INDEX); | ||
178 | m_form.type->setCurrentIndex(type->indexForCompositingType(m_compositing->compositingType())); | 172 | connect(m_form.unmanagedBackend, currentIndexChangedSignal, this, &KWinCompositingKCM::onBackendChanged); | ||
anthonyfieroni: It's translatable ? | |||||
1/ That's not much related to this diff : this wasn't changed. 2/ That's up to translators to say I would guess. meven: 1/ That's not much related to this diff : this wasn't changed.
2/ That's up to translators to… | |||||
179 | }; | 173 | | ||
180 | updateCompositingType(); | 174 | if (m_settings->openGLIsUnsafe()) { | ||
181 | connect(m_compositing, &Compositing::compositingTypeChanged, | 175 | m_form.glCrashedWarning->animatedShow(); | ||
182 | [updateCompositingType]() { | | |||
183 | updateCompositingType(); | | |||
184 | } | 176 | } | ||
185 | ); | | |||
186 | auto showHideBasedOnType = [this, type]() { | | |||
187 | const int currentType = type->compositingTypeForIndex(m_form.type->currentIndex()); | | |||
188 | m_form.glScaleFilter->setVisible(currentType != CompositingType::XRENDER_INDEX); | | |||
189 | m_form.glScaleFilterLabel->setVisible(currentType != CompositingType::XRENDER_INDEX); | | |||
190 | m_form.xrScaleFilter->setVisible(currentType == CompositingType::XRENDER_INDEX); | | |||
191 | m_form.xrScaleFilterLabel->setVisible(currentType == CompositingType::XRENDER_INDEX); | | |||
192 | }; | | |||
193 | showHideBasedOnType(); | | |||
194 | connect(m_form.type, currentIndexChangedSignal, | | |||
195 | [this, type, showHideBasedOnType]() { | | |||
196 | m_compositing->setCompositingType(type->compositingTypeForIndex(m_form.type->currentIndex())); | | |||
197 | showHideBasedOnType(); | | |||
198 | } | 177 | } | ||
199 | ); | | |||
200 | 178 | | |||
201 | if (m_compositing->OpenGLIsUnsafe()) { | 179 | void KWinCompositingKCM::onBackendChanged() | ||
202 | m_form.glCrashedWarning->animatedShow(); | 180 | { | ||
181 | const int currentType = m_form.unmanagedBackend->currentData().toInt(); | ||||
182 | m_form.kcfg_GLTextureFilter->setVisible(currentType != CompositingTypeIndex::XRENDER_INDEX); | ||||
183 | m_form.glScaleFilterLabel->setVisible(currentType != CompositingTypeIndex::XRENDER_INDEX); | ||||
184 | | ||||
185 | m_form.kcfg_XRenderSmoothScale->setVisible(currentType == CompositingTypeIndex::XRENDER_INDEX); | ||||
186 | m_form.xrScaleFilterLabel->setVisible(currentType == CompositingTypeIndex::XRENDER_INDEX); | ||||
187 | | ||||
188 | int backend = KWinCompositingSetting::EnumBackend::OpenGL; | ||||
189 | bool glCore = true; | ||||
190 | switch (currentType) { | ||||
191 | case CompositingTypeIndex::OPENGL31_INDEX: | ||||
192 | // default already set | ||||
193 | break; | ||||
194 | case CompositingTypeIndex::OPENGL20_INDEX: | ||||
195 | backend = KWinCompositingSetting::EnumBackend::OpenGL; | ||||
196 | glCore = false; | ||||
197 | break; | ||||
198 | case CompositingTypeIndex::XRENDER_INDEX: | ||||
199 | backend = KWinCompositingSetting::EnumBackend::XRender; | ||||
200 | glCore = false; | ||||
201 | break; | ||||
202 | } | ||||
203 | | ||||
204 | m_settings->setBackend(backend); | ||||
205 | m_settings->setGLCore(glCore); | ||||
206 | | ||||
207 | updateUnnamagedItemStatus(); | ||||
203 | } | 208 | } | ||
209 | | ||||
210 | void KWinCompositingKCM::updateUnnamagedItemStatus() | ||||
211 | { | ||||
212 | const auto backendItem = m_settings->findItem("Backend"); | ||||
213 | const auto glcoreItem = m_settings->findItem("GLCore"); | ||||
214 | const auto animationDurationFactorItem = m_settings->findItem("AnimationDurationFactor"); | ||||
215 | | ||||
216 | const bool changed = glcoreItem->isSaveNeeded() || backendItem->isSaveNeeded() || animationDurationFactorItem->isSaveNeeded(); | ||||
217 | emit unmanagedWidgetChangeState(changed); | ||||
218 | const bool defaulted = glcoreItem->isDefault() && backendItem->isDefault() && animationDurationFactorItem->isDefault(); | ||||
219 | emit unmanagedWidgetDefaultState(defaulted); | ||||
204 | } | 220 | } | ||
205 | 221 | | |||
206 | void KWinCompositingKCM::load() | 222 | void KWinCompositingKCM::load() | ||
207 | { | 223 | { | ||
208 | KCModule::load(); | 224 | KCModule::load(); | ||
209 | m_compositing->load(); | 225 | | ||
226 | // unmanaged items | ||||
227 | m_settings->findItem("AnimationDurationFactor")->readConfig(m_settings->config()); | ||||
228 | const double multiplier = m_settings->animationDurationFactor(); | ||||
229 | auto const it = std::lower_bound(s_animationMultipliers.begin(), s_animationMultipliers.end(), multiplier, std::greater<qreal>()); | ||||
230 | const int index = static_cast<int>(std::distance(s_animationMultipliers.begin(), it)); | ||||
231 | m_form.unmanagedAnimationDurationFactor->setValue(index); | ||||
232 | | ||||
233 | m_settings->findItem("Backend")->readConfig(m_settings->config()); | ||||
234 | m_settings->findItem("GLCore")->readConfig(m_settings->config()); | ||||
zzag: Maybe `glCore`? | |||||
meven: Indeed this caused the crash when I changed the name for this entry. | |||||
235 | const int backend = m_settings->backend(); | ||||
236 | if (backend == KWinCompositingSetting::EnumBackend::OpenGL) { | ||||
237 | const bool glCore = m_settings->gLCore(); | ||||
238 | if (glCore) { | ||||
239 | m_form.unmanagedBackend->setCurrentIndex(CompositingTypeIndex::OPENGL31_INDEX); | ||||
240 | } else { | ||||
241 | m_form.unmanagedBackend->setCurrentIndex(CompositingTypeIndex::OPENGL20_INDEX); | ||||
242 | } | ||||
243 | } else { | ||||
We need to initialize m_glCore to something; otherwise it will cause problems in updateUnmanagedItemStatus() later on. zzag: We need to initialize m_glCore to something; otherwise it will cause problems in… | |||||
244 | m_form.unmanagedBackend->setCurrentIndex(CompositingTypeIndex::XRENDER_INDEX); | ||||
245 | } | ||||
210 | } | 246 | } | ||
211 | 247 | | |||
Using m_settings to track unmanaged state lead to settings containing old data and new data. Managed widget update settings only on save. bport: Using m_settings to track unmanaged state lead to settings containing old data and new data. | |||||
212 | void KWinCompositingKCM::defaults() | 248 | void KWinCompositingKCM::defaults() | ||
213 | { | 249 | { | ||
214 | KCModule::defaults(); | 250 | KCModule::defaults(); | ||
215 | m_compositing->defaults(); | 251 | | ||
252 | m_form.unmanagedBackend->setCurrentIndex(CompositingTypeIndex::OPENGL20_INDEX); | ||||
253 | // corresponds to 1.0 seconds in s_animationMultipliers | ||||
254 | m_form.unmanagedAnimationDurationFactor->setValue(3); | ||||
ervin: I'd split the clauses on several lines for readability | |||||
216 | } | 255 | } | ||
217 | 256 | | |||
Ah, not what I had in mind since I would have liked to keep the const but no big deal ervin: Ah, not what I had in mind since I would have liked to keep the const but no big deal | |||||
218 | void KWinCompositingKCM::save() | 257 | void KWinCompositingKCM::save() | ||
ervin: ditto (especially for that one the line is getting quite long) | |||||
219 | { | 258 | { | ||
259 | m_settings->save(); | ||||
260 | | ||||
220 | KCModule::save(); | 261 | KCModule::save(); | ||
221 | m_compositing->save(); | 262 | | ||
263 | // Send signal to all kwin instances | ||||
264 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/Compositor"), | ||||
265 | QStringLiteral("org.kde.kwin.Compositing"), | ||||
266 | QStringLiteral("reinit")); | ||||
267 | QDBusConnection::sessionBus().send(message); | ||||
222 | } | 268 | } | ||
223 | 269 | | |||
224 | K_PLUGIN_FACTORY(KWinCompositingConfigFactory, | 270 | K_PLUGIN_FACTORY(KWinCompositingConfigFactory, | ||
225 | registerPlugin<KWinCompositingKCM>("compositing"); | 271 | registerPlugin<KWinCompositingKCM>("compositing"); | ||
226 | ) | 272 | ) | ||
227 | 273 | | |||
228 | #include "main.moc" | 274 | #include "main.moc" |
Put the opening brace on newline.