Fix highlighting of several windows at once in highlight window effect. This is required by Plasma to highlight window groups.
svn path=/trunk/KDE/kdebase/workspace/; revision=963736
This commit is contained in:
parent
d7ecbaa14d
commit
ec88dc9828
2 changed files with 21 additions and 12 deletions
|
@ -30,7 +30,6 @@ KWIN_EFFECT( highlightwindow, HighlightWindowEffect )
|
||||||
HighlightWindowEffect::HighlightWindowEffect()
|
HighlightWindowEffect::HighlightWindowEffect()
|
||||||
: m_finishing( false )
|
: m_finishing( false )
|
||||||
, m_fadeDuration( double( animationTime( 150 )))
|
, m_fadeDuration( double( animationTime( 150 )))
|
||||||
, m_highlightedWindow( NULL )
|
|
||||||
, m_monitorWindow( NULL )
|
, m_monitorWindow( NULL )
|
||||||
{
|
{
|
||||||
m_atom = XInternAtom( display(), "_KDE_WINDOW_HIGHLIGHT", False );
|
m_atom = XInternAtom( display(), "_KDE_WINDOW_HIGHLIGHT", False );
|
||||||
|
@ -50,12 +49,12 @@ HighlightWindowEffect::~HighlightWindowEffect()
|
||||||
void HighlightWindowEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
void HighlightWindowEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||||
{
|
{
|
||||||
// Calculate window opacities
|
// Calculate window opacities
|
||||||
if( m_highlightedWindow )
|
if( !m_highlightedWindows.isEmpty() )
|
||||||
{ // Initial fade out and changing highlight animation
|
{ // Initial fade out and changing highlight animation
|
||||||
double oldOpacity = m_windowOpacity[w];
|
double oldOpacity = m_windowOpacity[w];
|
||||||
if( m_highlightedWindow == w )
|
if( m_highlightedWindows.contains( w ) )
|
||||||
m_windowOpacity[w] = qMin( 1.0, m_windowOpacity[w] + time / m_fadeDuration );
|
m_windowOpacity[w] = qMin( 1.0, m_windowOpacity[w] + time / m_fadeDuration );
|
||||||
else if( w->isNormalWindow() ) // Only fade out normal windows
|
else if( w->isNormalWindow() || w->isDialog() ) // Only fade out windows
|
||||||
m_windowOpacity[w] = qMax( 0.15, m_windowOpacity[w] - time / m_fadeDuration );
|
m_windowOpacity[w] = qMax( 0.15, m_windowOpacity[w] - time / m_fadeDuration );
|
||||||
|
|
||||||
if( m_windowOpacity[w] != 1.0 )
|
if( m_windowOpacity[w] != 1.0 )
|
||||||
|
@ -89,9 +88,9 @@ void HighlightWindowEffect::paintWindow( EffectWindow* w, int mask, QRegion regi
|
||||||
|
|
||||||
void HighlightWindowEffect::windowAdded( EffectWindow* w )
|
void HighlightWindowEffect::windowAdded( EffectWindow* w )
|
||||||
{
|
{
|
||||||
if( m_highlightedWindow )
|
if( !m_highlightedWindows.isEmpty() )
|
||||||
{ // The effect is activated thus we need to add it to the opacity hash
|
{ // The effect is activated thus we need to add it to the opacity hash
|
||||||
if( w->isNormalWindow() ) // Only fade out normal windows
|
if( w->isNormalWindow() || w->isDialog() ) // Only fade out windows
|
||||||
m_windowOpacity[w] = 0.15;
|
m_windowOpacity[w] = 0.15;
|
||||||
else
|
else
|
||||||
m_windowOpacity[w] = 1.0;
|
m_windowOpacity[w] = 1.0;
|
||||||
|
@ -129,12 +128,22 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_monitorWindow = w;
|
m_monitorWindow = w;
|
||||||
m_highlightedWindow = effects->findWindow( data[0] );
|
bool found = false;
|
||||||
if( !m_highlightedWindow )
|
int length = byteData.length() / sizeof( data[0] );
|
||||||
|
for( int i=0; i<length; i++ )
|
||||||
{
|
{
|
||||||
kDebug(1212) << "Invalid window targetted for highlight. Requested:" << data[0];
|
EffectWindow* foundWin = effects->findWindow( data[i] );
|
||||||
return;
|
if( !foundWin )
|
||||||
|
{
|
||||||
|
kDebug(1212) << "Invalid window targetted for highlight. Requested:" << data[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( foundWin->isOnCurrentDesktop() )
|
||||||
|
m_highlightedWindows.append( foundWin );
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
if( !found )
|
||||||
|
return;
|
||||||
prepareHighlighting();
|
prepareHighlighting();
|
||||||
m_windowOpacity[w] = 1.0; // Because it's not in stackingOrder() yet
|
m_windowOpacity[w] = 1.0; // Because it's not in stackingOrder() yet
|
||||||
|
|
||||||
|
@ -210,7 +219,7 @@ void HighlightWindowEffect::finishHighlighting()
|
||||||
{
|
{
|
||||||
m_finishing = true;
|
m_finishing = true;
|
||||||
m_monitorWindow = NULL;
|
m_monitorWindow = NULL;
|
||||||
m_highlightedWindow = NULL;
|
m_highlightedWindows.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -52,7 +52,7 @@ class HighlightWindowEffect
|
||||||
QHash<EffectWindow*, double> m_windowOpacity;
|
QHash<EffectWindow*, double> m_windowOpacity;
|
||||||
|
|
||||||
long m_atom;
|
long m_atom;
|
||||||
EffectWindow* m_highlightedWindow;
|
QList<EffectWindow*> m_highlightedWindows;
|
||||||
EffectWindow* m_monitorWindow;
|
EffectWindow* m_monitorWindow;
|
||||||
|
|
||||||
// Offscreen position cache
|
// Offscreen position cache
|
||||||
|
|
Loading…
Reference in a new issue