Add a recreateDecorations signal to KDecorationFactory

A factory is supposed to emit this signal whenever the decorations
need to be recrated. The DecorationPlugins inside KWin Core connect
to the signal and recreate the decorations.

This signal is supposed to replace the reset method which encoded
this information in the return value and which is already ignored.
This commit is contained in:
Martin Gräßlin 2013-08-23 13:07:52 +02:00
parent e2583e679f
commit e923426930
4 changed files with 31 additions and 8 deletions

View file

@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "decorations.h"
#include "config-kwin.h"
#include "client.h"
#include "workspace.h"
#include <kdecorationfactory.h>
#include <KDE/KLocalizedString>
@ -43,6 +45,7 @@ DecorationPlugin::DecorationPlugin(QObject *parent)
#endif
#ifdef KWIN_BUILD_DECORATIONS
loadPlugin(QString()); // load the plugin specified in cfg file
connect(factory(), &KDecorationFactory::recreateDecorations, this, &DecorationPlugin::recreateDecorations);
#else
setDisabled(true);
#endif
@ -170,4 +173,21 @@ QString DecorationPlugin::supportInformation()
return support;
}
void DecorationPlugin::recreateDecorations()
{
if (m_disabled) {
return;
}
// Decorations need to be recreated
workspace()->forEachClient([](Client *c) {
c->updateDecoration(true, true);
});
// If the new decoration doesn't supports tabs then ungroup clients
if (!supportsTabbing()) {
workspace()->forEachClient([](Client *c) {
c->untab();
});
}
}
} // namespace

View file

@ -52,6 +52,7 @@ public:
public Q_SLOTS:
void resetCompositing();
void recreateDecorations();
protected:
virtual void error(const QString& error_msg);
private:

View file

@ -107,6 +107,14 @@ public:
* @internal
*/
void removeDecoration(KDecoration*);
Q_SIGNALS:
/**
* @brief An implementing class should emit this signal if it's decorations should
* be recreated. For example after a setting changed in a way that the only logical
* step is to recreate the decoration.
*/
void recreateDecorations();
protected:
/**
* Constructor. Called after loading the decoration plugin. All global

View file

@ -812,15 +812,9 @@ void Workspace::slotReconfigure()
DecorationPlugin *deco = DecorationPlugin::self();
if (!deco->isDisabled() && deco->reset()) {
// Decorations need to be recreated
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
(*it)->updateDecoration(true, true);
// If the new decoration doesn't supports tabs then ungroup clients
if (!decorationPlugin()->supportsTabbing()) {
foreach (Client * c, clients)
c->untab();
}
deco->recreateDecorations();
deco->destroyPreviousPlugin();
connect(deco->factory(), &KDecorationFactory::recreateDecorations, deco, &DecorationPlugin::recreateDecorations);
} else {
forEachClient(CheckBorderSizesProcedure());
foreach (Client * c, clients)