From a09d1a775d169da44f85d4a67cd0ca7f91504772 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 14 Apr 2008 17:59:37 +0000 Subject: [PATCH] make cover switch look more elegent with a black reflective surface that "floats" on top of the desktop (by simply fading out to nothing) CCMAIL:ubuntu@martin-graesslin.com svn path=/trunk/KDE/kdebase/workspace/; revision=797007 --- effects/coverswitch.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/effects/coverswitch.cpp b/effects/coverswitch.cpp index 25b17107d4..be90cd29ec 100644 --- a/effects/coverswitch.cpp +++ b/effects/coverswitch.cpp @@ -2,7 +2,7 @@ KWin - the KDE window manager This file is part of the KDE project. - Copyright (C) 2008 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ CoverSwitchEffect::CoverSwitchEffect() , progress( 0.0 ) { KConfigGroup conf = effects->effectConfig( "CoverSwitch" ); - animationDuration = conf.readEntry( "Duration", 300 ); + animationDuration = conf.readEntry( "Duration", 200 ); animateSwitch = conf.readEntry( "AnimateSwitch", true ); animateStart = conf.readEntry( "AnimateStart", true ); animateStop = conf.readEntry( "AnimateStop", true ); @@ -82,6 +82,7 @@ void CoverSwitchEffect::prePaintScreen( ScreenPrePaintData& data, int time ) void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) { effects->paintScreen( mask, region, data ); + if( mActivated || stop || stopRequested ) { glMatrixMode( GL_PROJECTION ); @@ -161,20 +162,18 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& glBlendFunc( GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA ); glPolygonMode( GL_FRONT, GL_FILL ); glBegin( GL_POLYGON ); - float alpha = 0.9; - if( start ) - alpha = 0.9 * progress; - else if( stop ) - alpha = 0.9 - 0.9 * progress; - glColor4f( 0.3, 0.3, 0.3, alpha ); - glVertex3f( 0.0, QApplication::desktop()->geometry().height(), 0.0 ); - glVertex3f( QApplication::desktop()->geometry().width(), QApplication::desktop()->geometry().height(), 0.0 ); - alpha = 1.0; + // foreground + float alpha = 1.0; if( start ) alpha = progress; else if( stop ) alpha = 1.0 - progress; - glColor4f( 0.19, 0.19, 0.19, alpha ); + glColor4f( 0.0, 0.0, 0.0, alpha ); + glVertex3f( 0.0, QApplication::desktop()->geometry().height(), 0.0 ); + glVertex3f( QApplication::desktop()->geometry().width(), QApplication::desktop()->geometry().height(), 0.0 ); + // rearground + alpha = -1.0; + glColor4f( 0.0, 0.0, 0.0, alpha ); glVertex3f( QApplication::desktop()->geometry().width() * 5, QApplication::desktop()->geometry().height(), -60 ); glVertex3f( -QApplication::desktop()->geometry().width() * 4, QApplication::desktop()->geometry().height(), -60 ); glEnd();