diff --git a/effects/boxswitch.cpp b/effects/boxswitch.cpp index cac369221a..0beb4b3009 100644 --- a/effects/boxswitch.cpp +++ b/effects/boxswitch.cpp @@ -91,9 +91,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da paintWindowThumbnail( w ); paintWindowIcon( w ); } - int maxwidth = text_area.width(); - QColor color = KColorScheme( KColorScheme::Window ).foreground(); - effects->paintText( selected_window->caption(), text_area.center(), maxwidth, color ); + paintText( selected_window->caption() ); } else { @@ -110,9 +108,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da paintDesktopThumbnail( painting_desktop ); } - int maxwidth = text_area.width(); - QColor color = KColorScheme( KColorScheme::Window ).foreground(); - effects->paintText( effects->desktopName( selected_desktop ), text_area.center(), maxwidth, color ); + paintText( effects->desktopName( selected_desktop )); painting_desktop = 0; } } @@ -381,7 +377,9 @@ void BoxSwitchEffect::calculateFrameSize() item_max_size.setHeight( 200 ); } // How much height to reserve for a one-line text label - text_area.setHeight( int( kapp->fontMetrics().height() * 1.2 )); + text_font.setBold( true ); + text_font.setPointSize( 12 ); + text_area.setHeight( QFontMetrics( text_font ).height() * 1.2 ); // Shrink the size until all windows/desktops can fit onscreen frame_area.setWidth( frame_margin * 2 + itemcount * item_max_size.width()); while( frame_area.width() > displayWidth()) @@ -432,7 +430,7 @@ void BoxSwitchEffect::calculateItemSizes() void BoxSwitchEffect::paintFrame() { - QColor color = KColorScheme( KColorScheme::Window ).background(); + QColor color = KColorScheme( QPalette::Active, KColorScheme::Window ).background(); color.setAlphaF( 0.9 ); #ifdef HAVE_OPENGL if( effects->compositingType() == OpenGLCompositing ) @@ -467,7 +465,7 @@ void BoxSwitchEffect::paintFrame() void BoxSwitchEffect::paintHighlight( QRect area ) { - QColor color = KColorScheme( KColorScheme::Selection ).background(); + QColor color = KColorScheme( QPalette::Active, KColorScheme::Selection ).background(); color.setAlphaF( 0.9 ); #ifdef HAVE_OPENGL if( effects->compositingType() == OpenGLCompositing ) @@ -619,4 +617,11 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w ) #endif } +void BoxSwitchEffect::paintText( const QString& text ) +{ + int maxwidth = text_area.width(); + QColor color = KColorScheme( QPalette::Active, KColorScheme::Window ).foreground(); + effects->paintText( text, text_area.center(), maxwidth, color, text_font ); +} + } // namespace diff --git a/effects/boxswitch.h b/effects/boxswitch.h index 6824b3a443..7bb9b02ce4 100644 --- a/effects/boxswitch.h +++ b/effects/boxswitch.h @@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include #include @@ -59,6 +60,7 @@ class BoxSwitchEffect void paintWindowThumbnail( EffectWindow* w ); void paintDesktopThumbnail( int iDesktop ); void paintWindowIcon( EffectWindow* w ); + void paintText( const QString& text ); bool mActivated; Window mInput; @@ -69,6 +71,7 @@ class BoxSwitchEffect int highlight_margin; // TODO graphical background QSize item_max_size; // maximum item display size (including highlight) QRect text_area; + QFont text_font; QHash< EffectWindow*, ItemInfo* > windows; EffectWindowList original_windows;