Coverswitch works on GLES.

No multi-screen, no reflections yet
This commit is contained in:
Martin Gräßlin 2010-12-12 14:14:22 +01:00
parent 5dfa8becb5
commit 18814c66a3
2 changed files with 10 additions and 2 deletions

View file

@ -89,6 +89,7 @@ endif( NOT KWIN_HAVE_OPENGLES_COMPOSITING )
# OpenGL-specific effects # OpenGL-specific effects
if( KWIN_HAVE_OPENGL_COMPOSITING ) if( KWIN_HAVE_OPENGL_COMPOSITING )
include( coverswitch/CMakeLists.txt )
include( flipswitch/CMakeLists.txt ) include( flipswitch/CMakeLists.txt )
include( glide/CMakeLists.txt ) include( glide/CMakeLists.txt )
include( sheet/CMakeLists.txt ) include( sheet/CMakeLists.txt )
@ -98,7 +99,6 @@ if( KWIN_HAVE_OPENGL_COMPOSITING )
endif( KWIN_HAVE_OPENGL_COMPOSITING ) endif( KWIN_HAVE_OPENGL_COMPOSITING )
if( KWIN_HAVE_OPENGL_COMPOSITING AND NOT KWIN_HAVE_OPENGLES_COMPOSITING ) if( KWIN_HAVE_OPENGL_COMPOSITING AND NOT KWIN_HAVE_OPENGLES_COMPOSITING )
include( blur/CMakeLists.txt ) include( blur/CMakeLists.txt )
include( coverswitch/CMakeLists.txt )
include( cube/CMakeLists.txt ) include( cube/CMakeLists.txt )
include( explosion/CMakeLists.txt ) include( explosion/CMakeLists.txt )
include( invert/CMakeLists.txt ) include( invert/CMakeLists.txt )

View file

@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kdebug.h> #include <kdebug.h>
#include <GL/gl.h> #include <kwinglutils.h>
#include "../boxswitch/boxswitch_proxy.h" #include "../boxswitch/boxswitch_proxy.h"
namespace KWin namespace KWin
@ -129,6 +129,7 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
{ {
if( effects->numScreens() > 1 ) if( effects->numScreens() > 1 )
{ {
#ifndef KWIN_HAVE_OPENGLES
// unfortunatelly we have to change the projection matrix in dual screen mode // unfortunatelly we have to change the projection matrix in dual screen mode
QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION );
@ -180,6 +181,7 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glPushMatrix(); glPushMatrix();
glTranslatef( xTranslate, yTranslate, 0.0 ); glTranslatef( xTranslate, yTranslate, 0.0 );
#endif
} }
QList< EffectWindow* > tempList = currentWindowList; QList< EffectWindow* > tempList = currentWindowList;
@ -246,6 +248,7 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
if( reflection ) if( reflection )
{ {
#ifndef KWIN_HAVE_OPENGLES
// restrict painting the reflections to the current screen // restrict painting the reflections to the current screen
QRegion clip = QRegion( area ); QRegion clip = QRegion( area );
PaintClipper::push( clip ); PaintClipper::push( clip );
@ -309,16 +312,19 @@ void CoverSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
glPopMatrix(); glPopMatrix();
glDisable( GL_BLEND ); glDisable( GL_BLEND );
#endif
} }
paintScene( frontWindow, leftWindows, rightWindows ); paintScene( frontWindow, leftWindows, rightWindows );
if( effects->numScreens() > 1 ) if( effects->numScreens() > 1 )
{ {
#ifndef KWIN_HAVE_OPENGLES
glPopMatrix(); glPopMatrix();
// revert change of projection matrix // revert change of projection matrix
glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION );
glPopMatrix(); glPopMatrix();
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
#endif
} }
// Render the caption frame // Render the caption frame
@ -764,6 +770,7 @@ void CoverSwitchEffect::paintWindowCover( EffectWindow* w, bool reflectedWindow,
if( reflectedWindow ) if( reflectedWindow )
{ {
#ifndef KWIN_HAVE_OPENGLES
glPushMatrix(); glPushMatrix();
glScalef( 1.0, -1.0, 1.0 ); glScalef( 1.0, -1.0, 1.0 );
data.yTranslate = - area.height() - windowRect.y() - windowRect.height(); data.yTranslate = - area.height() - windowRect.y() - windowRect.height();
@ -771,6 +778,7 @@ void CoverSwitchEffect::paintWindowCover( EffectWindow* w, bool reflectedWindow,
PAINT_WINDOW_TRANSFORMED, PAINT_WINDOW_TRANSFORMED,
infiniteRegion(), data ); infiniteRegion(), data );
glPopMatrix(); glPopMatrix();
#endif
} }
else else
{ {