protect kwin against broken tabbox installation

This happens because some distros ship broken installations
of KWin and KWinActive, but could also appear to QML hacking users

BUG: 322830
FIXED-IN: 4.11
REVIEW: 111732
This commit is contained in:
Thomas Lübking 2013-07-26 19:58:42 +02:00
parent b92ebe02aa
commit 127cf45626
2 changed files with 17 additions and 4 deletions

View file

@ -328,6 +328,8 @@ void DeclarativeView::currentIndexChanged(int row)
void DeclarativeView::updateQmlSource(bool force)
{
if (status() != Ready)
return;
if (tabBox->config().tabBoxMode() != m_mode) {
return;
}

View file

@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/Xlib.h>
// KDE
#include <KDebug>
#include <KProcess>
#include <KWindowSystem>
namespace KWin
@ -216,19 +217,29 @@ void TabBoxHandler::show()
d->lastRaisedClient = 0;
d->lastRaisedClientSucc = 0;
if (d->config.isShowTabBox()) {
DeclarativeView *dv(NULL);
if (d->config.tabBoxMode() == TabBoxConfig::ClientTabBox) {
// use declarative view
if (!d->m_declarativeView) {
d->m_declarativeView = new DeclarativeView(d->clientModel(), TabBoxConfig::ClientTabBox);
}
d->m_declarativeView->show();
d->m_declarativeView->setCurrentIndex(d->index, true);
dv = d->m_declarativeView;
} else {
if (!d->m_declarativeDesktopView) {
d->m_declarativeDesktopView = new DeclarativeView(d->desktopModel(), TabBoxConfig::DesktopTabBox);
}
d->m_declarativeDesktopView->show();
d->m_declarativeDesktopView->setCurrentIndex(d->index);
dv = d->m_declarativeDesktopView;
}
if (dv->status() == QDeclarativeView::Ready && dv->rootObject()) {
dv->show();
dv->setCurrentIndex(d->index, d->config.tabBoxMode() == TabBoxConfig::ClientTabBox);
} else {
QStringList args;
args << "--passivepopup" << /*i18n*/("The Window Switcher installation is broken, resources are missing.\n"
"Contact your distribution about this.") << "20";
KProcess::startDetached("kdialog", args);
hide();
return;
}
}
if (d->config.isHighlightWindows()) {