- Draw caption for all windows.

- Correctly apply alpha to text as well (in OpenGL mode)

svn path=/trunk/KDE/kdebase/workspace/; revision=707675
This commit is contained in:
Rivo Laks 2007-09-02 16:43:31 +00:00
parent 1a587da8d6
commit 106fbc23ab

View file

@ -193,13 +193,12 @@ void PresentWindowsEffect::paintWindow( EffectWindow* w, int mask, QRegion regio
{ {
const WindowData& windata = mWindowData[w]; const WindowData& windata = mWindowData[w];
paintWindowIcon( w, data ); paintWindowIcon( w, data );
if( windata.hover > 0.0f )
{ QString text = w->caption();
QString text = w->caption(); float centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f;
float centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f; float centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f;
float centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f; float textopacity = (0.7 + 0.2*windata.hover) * data.opacity;
paintText( text, QPointF(centerx, centery), w->width() * data.xScale - 20, windata.hover ); paintText( text, QPointF(centerx, centery), w->width() * data.xScale - 20, textopacity );
}
} }
} }
@ -927,12 +926,13 @@ void PresentWindowsEffect::paintText( const QString& text, const QPointF& center
if( effects->compositingType() == OpenGLCompositing ) if( effects->compositingType() == OpenGLCompositing )
{ {
GLTexture textTexture( textPixmap, GL_TEXTURE_RECTANGLE_ARB ); GLTexture textTexture( textPixmap, GL_TEXTURE_RECTANGLE_ARB );
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT );
glEnable( GL_BLEND ); glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glColor4f( 0.0f, 0.0f, 0.0f, alpha ); glColor4f( 0.0f, 0.0f, 0.0f, alpha );
renderRoundBox( area.adjusted( -8, -3, 8, 3 ), 5 ); renderRoundBox( area.adjusted( -8, -3, 8, 3 ), 5 );
textTexture.bind(); textTexture.bind();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f( 1.0f, 1.0f, 1.0f, alpha ); glColor4f( 1.0f, 1.0f, 1.0f, alpha );
const float verts[ 4 * 2 ] = const float verts[ 4 * 2 ] =
{ {