From 17ca566154321eb6d81204a8cd54429a6725ed92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 26 Mar 2014 18:03:54 +0100 Subject: [PATCH] setup desktopgrid for screencount change prevents segfaults.. CCBUG: 326032 Forward port of 4fe7460e03f5cd4f64d85d20a6d85ce3a66f4ae8 from kde-workspace --- effects/desktopgrid/desktopgrid.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 8b03a55f25..97cb2a3f11 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -79,6 +79,7 @@ DesktopGridEffect::DesktopGridEffect() connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); connect(effects, SIGNAL(numberDesktopsChanged(uint)), this, SLOT(slotNumberDesktopsChanged(uint))); connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect))); + connect(effects, &EffectsHandler::numberScreensChanged, this, &DesktopGridEffect::setup); // Load all other configuration details reconfigure(ReconfigureAll); @@ -1060,9 +1061,13 @@ void DesktopGridEffect::setActive(bool active) void DesktopGridEffect::setup() { - keyboardGrab = effects->grabKeyboard(this); - effects->startMouseInterception(this, Qt::PointingHandCursor); - effects->setActiveFullScreenEffect(this); + if (!isActive()) + return; + if (!keyboardGrab) { + keyboardGrab = effects->grabKeyboard(this); + effects->startMouseInterception(this, Qt::PointingHandCursor); + effects->setActiveFullScreenEffect(this); + } setHighlightedDesktop(effects->currentDesktop()); // Soft highlighting