Added reset methods to WindowMotionManager.

Fixed bug in present windows when if there is only one window on a Xinerama screen it is zoomed into nothingness when using the natural layout.
CCBUG: 171812

svn path=/trunk/KDE/kdebase/workspace/; revision=865798
This commit is contained in:
Lucas Murray 2008-09-29 02:25:02 +00:00
parent cbc55bf9a1
commit 68d958c237
3 changed files with 46 additions and 0 deletions

View file

@ -730,6 +730,13 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose( EffectWindowLi
void PresentWindowsEffect::calculateWindowTransformationsNatural( EffectWindowList windowlist, int screen )
{
if( windowlist.count() == 1 )
{ // No idea why this is needed but if there is only one window on a Xinerama screen
// then the window is scaled into nothingness at (0,0) if its position isn't reset.
m_motionManager.reset( windowlist[0] );
return;
}
// As we are using pseudo-random movement (See "slot") we need to make sure the list
// is always sorted the same way no matter which window is currently active.
qSort( windowlist );

View file

@ -1153,6 +1153,34 @@ void WindowMotionManager::calculate( int time )
}
}
void WindowMotionManager::reset()
{
if( !m_managedWindows.count() )
return;
EffectWindowList windows = m_managedWindows.keys();
for( int i = 0; i < windows.size(); i++ )
{
EffectWindow *w = windows.at( i );
m_managedWindows[ w ].translation.setTarget( w->pos() );
m_managedWindows[ w ].translation.finish();
m_managedWindows[ w ].scale.setTarget( QPointF( 1.0, 1.0 ));
m_managedWindows[ w ].scale.finish();
}
}
void WindowMotionManager::reset( EffectWindow *w )
{
if( !m_managedWindows.contains( w ))
return;
m_managedWindows[ w ].translation.setTarget( w->pos() );
m_managedWindows[ w ].translation.finish();
m_managedWindows[ w ].scale.setTarget( QPointF( 1.0, 1.0 ));
m_managedWindows[ w ].scale.finish();
}
void WindowMotionManager::apply( EffectWindow *w, WindowPaintData &data )
{
if( !m_managedWindows.contains( w ))

View file

@ -1315,6 +1315,17 @@ class KWIN_EXPORT WindowMotionManager
* WindowPrePaintData::setTransformed()
*/
void apply( EffectWindow *w, WindowPaintData &data );
/**
* Set all motion targets and values back to where the
* windows were before transformations. The same as
* unmanaging then remanaging all windows.
*/
void reset();
/**
* Resets the motion target and current value of a single
* window.
*/
void reset( EffectWindow *w );
/**
* As the manager to move the window to the target position