diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index 850f6da7ac..0d0bdb9077 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -57,7 +57,7 @@ CoverSwitchEffect::CoverSwitchEffect() , scaleFactor(0.0) , direction(Left) , selected_window(0) - , captionFrame(effects->effectFrame(EffectFrameStyled)) + , captionFrame(NULL) , primaryTabBox(false) , secondaryTabBox(false) { @@ -66,8 +66,6 @@ CoverSwitchEffect::CoverSwitchEffect() // Caption frame captionFont.setBold(true); captionFont.setPointSize(captionFont.pointSize() * 2); - captionFrame->setFont(captionFont); - captionFrame->enableCrossFade(true); const QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/coverswitch-reflection.glsl"); m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader); @@ -576,6 +574,11 @@ void CoverSwitchEffect::slotTabBoxAdded(int mode) area.height() * 0.9f + area.y(), area.width() * 0.5f, QFontMetrics(captionFont).height()); + if (!captionFrame) { + captionFrame = effects->effectFrame(EffectFrameStyled); + captionFrame->setFont(captionFont); + captionFrame->enableCrossFade(true); + } captionFrame->setGeometry(frameRect); captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height())); // And initial contents diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 8151561c8b..282a3fc08f 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -60,7 +60,7 @@ CubeEffect::CubeEffect() , cubeOpacity(1.0) , opacityDesktopOnly(true) , displayDesktopName(false) - , desktopNameFrame(effects->effectFrame(EffectFrameStyled)) + , desktopNameFrame(NULL) , reflection(true) , rotating(false) , desktopChangedWhileRotating(false) @@ -97,7 +97,6 @@ CubeEffect::CubeEffect() { desktopNameFont.setBold(true); desktopNameFont.setPointSize(14); - desktopNameFrame->setFont(desktopNameFont); const QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cube-reflection.glsl"); m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader); @@ -592,6 +591,10 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) QRect screenRect = effects->clientArea(ScreenArea, activeScreen, frontDesktop); QRect frameRect = QRect(screenRect.width() * 0.33f + screenRect.x(), screenRect.height() * 0.95f + screenRect.y(), screenRect.width() * 0.34f, QFontMetrics(desktopNameFont).height()); + if (!desktopNameFrame) { + desktopNameFrame = effects->effectFrame(EffectFrameStyled); + desktopNameFrame->setFont(desktopNameFont); + } desktopNameFrame->setGeometry(frameRect); desktopNameFrame->setText(effects->desktopName(frontDesktop)); desktopNameFrame->render(region, opacity); diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index 54f4a29a32..da49244004 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -47,15 +47,13 @@ FlipSwitchEffect::FlipSwitchEffect() , m_stop(false) , m_animation(false) , m_hasKeyboardGrab(false) - , m_captionFrame(effects->effectFrame(EffectFrameStyled)) + , m_captionFrame(NULL) { reconfigure(ReconfigureAll); // Caption frame m_captionFont.setBold(true); m_captionFont.setPointSize(m_captionFont.pointSize() * 2); - m_captionFrame->setFont(m_captionFont); - m_captionFrame->enableCrossFade(true); KActionCollection* actionCollection = new KActionCollection(this); KAction* a = (KAction*)actionCollection->addAction("FlipSwitchCurrent"); @@ -660,6 +658,11 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode) m_screenArea.height() * 0.1f + m_screenArea.y() - QFontMetrics(m_captionFont).height(), m_screenArea.width() * 0.5f, QFontMetrics(m_captionFont).height()); + if (!m_captionFrame) { + m_captionFrame = effects->effectFrame(EffectFrameStyled); + m_captionFrame->setFont(m_captionFont); + m_captionFrame->enableCrossFade(true); + } m_captionFrame->setGeometry(frameRect); m_captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height())); updateCaption(); diff --git a/effects/outline/outline.cpp b/effects/outline/outline.cpp index 9b98f71bab..97c3735a6b 100644 --- a/effects/outline/outline.cpp +++ b/effects/outline/outline.cpp @@ -28,8 +28,8 @@ KWIN_EFFECT(outline, OutlineEffect) OutlineEffect::OutlineEffect() : Effect() , m_active(false) + , m_outline(NULL) { - m_outline = effects->effectFrame(EffectFrameNone); connect(effects, SIGNAL(showOutline(QRect)), SLOT(slotShowOutline(QRect))); connect(effects, SIGNAL(hideOutline()), SLOT(slotHideOutline())); } @@ -70,6 +70,9 @@ void OutlineEffect::slotShowOutline(const QRect& geometry) } m_active = true; m_geometry = geometry; + if (!m_outline) { + m_outline = effects->effectFrame(EffectFrameNone); + } m_outline->setGeometry(geometry); m_outline->setSelection(geometry); effects->addRepaint(geometry); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index bcede22ccc..ab2fc90257 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -61,7 +61,7 @@ PresentWindowsEffect::PresentWindowsEffect() , m_mode(ModeCurrentDesktop) , m_managerWindow(NULL) , m_highlightedWindow(NULL) - , m_filterFrame(effects->effectFrame(EffectFrameStyled, false)) + , m_filterFrame(NULL) , m_closeView(NULL) , m_dragInProgress(false) , m_dragWindow(NULL) @@ -78,11 +78,6 @@ PresentWindowsEffect::PresentWindowsEffect() XChangeProperty(display(), rootWindow(), m_atomDesktop, m_atomDesktop, 8, PropModeReplace, &dummy, 1); XChangeProperty(display(), rootWindow(), m_atomWindows, m_atomWindows, 8, PropModeReplace, &dummy, 1); - QFont font; - font.setPointSize(font.pointSize() * 2); - font.setBold(true); - m_filterFrame->setFont(font); - KActionCollection* actionCollection = new KActionCollection(this); KAction* a = (KAction*)actionCollection->addAction("Expose"); a->setText(i18n("Toggle Present Windows (Current desktop)")); @@ -1635,6 +1630,13 @@ void PresentWindowsEffect::setActive(bool active, bool closingTab) void PresentWindowsEffect::updateFilterFrame() { QRect area = effects->clientArea(ScreenArea, effects->activeScreen(), effects->currentDesktop()); + if (!m_filterFrame){ + m_filterFrame = effects->effectFrame(EffectFrameStyled, false); + QFont font; + font.setPointSize(font.pointSize() * 2); + font.setBold(true); + m_filterFrame->setFont(font); + } m_filterFrame->setPosition(QPoint(area.x() + area.width() / 2, area.y() + area.height() / 2)); m_filterFrame->setText(i18n("Filter:\n%1", m_windowFilter)); }