diff --git a/effects/presentwindows.cpp b/effects/presentwindows.cpp
index 6412f3f72b..7ae247ca26 100644
--- a/effects/presentwindows.cpp
+++ b/effects/presentwindows.cpp
@@ -64,6 +64,7 @@ PresentWindowsEffect::PresentWindowsEffect()
borderActivate = (ElectricBorder)conf.readEntry("BorderActivate", (int)ElectricNone);
borderActivateAll = (ElectricBorder)conf.readEntry("BorderActivateAll", (int)ElectricTopLeft);
+ drawWindowCaptions = conf.readEntry("DrawWindowCaptions", false);
effects->reserveElectricBorder( borderActivate );
effects->reserveElectricBorder( borderActivateAll );
@@ -84,7 +85,7 @@ PresentWindowsEffect::~PresentWindowsEffect()
void PresentWindowsEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{
// How long does it take for the effect to get it's full strength (in ms)
- const double changeTime = 300;
+ const double changeTime = 125;
if(mActivated)
{
mActiveness = qMin(1.0, mActiveness + time/changeTime);
@@ -122,7 +123,7 @@ void PresentWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData&
data.setTranslucent();
// Change window's highlight
WindowData& windata = mWindowData[w];
- const double highlightchangetime = 200;
+ const double highlightchangetime = 100;
if( w == mHighlightedWindow )
windata.highlight = qMin(1.0, windata.highlight + time / highlightchangetime);
else
@@ -205,18 +206,21 @@ void PresentWindowsEffect::paintWindow( EffectWindow* w, int mask, QRegion regio
const WindowData& windata = mWindowData[w];
paintWindowIcon( w, data );
- QString text = w->caption();
- double centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f;
- double centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f;
- int maxwidth = (int)(w->width() * data.xScale - 20);
- double opacity = (0.7 + 0.2*windata.highlight) * data.opacity * mActiveness;
- QColor textcolor( 255, 255, 255, (int)(255*opacity) );
- QColor bgcolor( 0, 0, 0, (int)(255*opacity) );
- QFont f;
- f.setBold( true );
- f.setPointSize( 12 );
- effects->paintTextWithBackground( text, QPoint( (int)centerx, (int)centery ), maxwidth,
- textcolor, bgcolor, f);
+ if (drawWindowCaptions)
+ {
+ QString text = w->caption();
+ double centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f;
+ double centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f;
+ int maxwidth = (int)(w->width() * data.xScale - 20);
+ double opacity = (0.7 + 0.2*windata.highlight) * data.opacity * mActiveness;
+ QColor textcolor( 255, 255, 255, (int)(255*opacity) );
+ QColor bgcolor( 0, 0, 0, (int)(255*opacity) );
+ QFont f;
+ f.setBold( true );
+ f.setPointSize( 12 );
+ effects->paintTextWithBackground( text, QPoint( (int)centerx, (int)centery ), maxwidth,
+ textcolor, bgcolor, f);
+ }
}
}
diff --git a/effects/presentwindows.h b/effects/presentwindows.h
index 5c77f15996..14fb5e2b40 100644
--- a/effects/presentwindows.h
+++ b/effects/presentwindows.h
@@ -137,6 +137,7 @@ class PresentWindowsEffect
ElectricBorder borderActivate;
ElectricBorder borderActivateAll;
+ bool drawWindowCaptions;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
XRenderPictFormat* alphaFormat;
diff --git a/effects/presentwindows_config.cpp b/effects/presentwindows_config.cpp
index 37102ae71b..8845a4a333 100644
--- a/effects/presentwindows_config.cpp
+++ b/effects/presentwindows_config.cpp
@@ -34,6 +34,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
KWIN_EFFECT_CONFIG_FACTORY
@@ -47,23 +48,27 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
QGridLayout* layout = new QGridLayout(this);
- layout->addWidget(new QLabel(i18n("Activate when cursor is at a specific edge "
- "or corner of the screen:"), this), 0, 0, 1, 3);
- layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Fixed), 1, 0, 2, 1);
+ mDrawWindowText = new QCheckBox(i18n("Draw window caption on top of window."), this);
+ connect(mDrawWindowText, SIGNAL(stateChanged(int)), this, SLOT(changed()));
+ layout->addWidget(mDrawWindowText, 0, 0);
- layout->addWidget(new QLabel(i18n("for windows on current desktop: "), this), 1, 1);
+ layout->addWidget(new QLabel(i18n("Activate when cursor is at a specific edge "
+ "or corner of the screen:"), this), 1, 0, 1, 3);
+ layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Fixed), 2, 0, 2, 1);
+
+ layout->addWidget(new QLabel(i18n("for windows on current desktop: "), this), 2, 1);
mActivateCombo = new QComboBox;
addItems(mActivateCombo);
connect(mActivateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- layout->addWidget(mActivateCombo, 1, 2);
+ layout->addWidget(mActivateCombo, 2, 2);
- layout->addWidget(new QLabel(i18n("for windows on all desktops: "), this), 2, 1);
+ layout->addWidget(new QLabel(i18n("for windows on all desktops: "), this), 3, 1);
mActivateAllCombo = new QComboBox;
addItems(mActivateAllCombo);
connect(mActivateAllCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- layout->addWidget(mActivateAllCombo, 2, 2);
+ layout->addWidget(mActivateAllCombo, 3, 2);
- layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding), 3, 0, 1, 3);
+ layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding), 4, 0, 1, 3);
// Shortcut config
KGlobalAccel::self()->overrideMainComponentData(componentData());
@@ -77,9 +82,9 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
mShortcutEditor = new KShortcutsEditor(actionCollection, this,
KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed);
connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
- layout->addWidget(mShortcutEditor, 4, 0, 1, 3);
+ layout->addWidget(mShortcutEditor, 5, 0, 1, 3);
- layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 5, 0, 1, 3);
+ layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0, 1, 3);
load();
@@ -119,6 +124,9 @@ void PresentWindowsEffectConfig::load()
activateAllBorder--;
mActivateAllCombo->setCurrentIndex(activateAllBorder);
+ bool drawWindowCaptions = conf.readEntry("DrawWindowCaptions", false);
+ mDrawWindowText->setChecked(drawWindowCaptions);
+
emit changed(false);
}
@@ -139,6 +147,9 @@ void PresentWindowsEffectConfig::save()
activateAllBorder = (int)ElectricNone;
conf.writeEntry("BorderActivateAll", activateAllBorder);
+ bool drawWindowCaptions = mDrawWindowText->isChecked();
+ conf.writeEntry("DrawWindowCaptions", drawWindowCaptions);
+
conf.sync();
emit changed(false);
@@ -150,6 +161,7 @@ void PresentWindowsEffectConfig::defaults()
kDebug() ;
mActivateCombo->setCurrentIndex( (int)ElectricNone - 1 );
mActivateAllCombo->setCurrentIndex( (int)ElectricTopLeft );
+ mDrawWindowText->setChecked(false);
mShortcutEditor->allDefault();
emit changed(true);
}
diff --git a/effects/presentwindows_config.h b/effects/presentwindows_config.h
index 2d073a327f..4a5e7ed1dc 100644
--- a/effects/presentwindows_config.h
+++ b/effects/presentwindows_config.h
@@ -25,6 +25,7 @@ along with this program. If not, see .
#include
#undef KDE3_SUPPORT
+class QCheckBox;
class QComboBox;
class KShortcutsEditor;
@@ -46,6 +47,7 @@ class PresentWindowsEffectConfig : public KCModule
void addItems(QComboBox* combo);
private:
+ QCheckBox* mDrawWindowText;
QComboBox* mActivateCombo;
QComboBox* mActivateAllCombo;
KShortcutsEditor* mShortcutEditor;