behave better with modal windows
svn path=/trunk/KDE/kdebase/workspace/; revision=957551
This commit is contained in:
parent
a5d8b15573
commit
95cb1b2744
2 changed files with 41 additions and 6 deletions
|
@ -46,7 +46,6 @@ void SlideBackEffect::windowActivated( EffectWindow* w )
|
||||||
disabled = false;
|
disabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isWindowUsable( w ) || !isWindowOnTop( w ) ) // Focus changed but stacking still the same
|
if( !isWindowUsable( w ) || !isWindowOnTop( w ) ) // Focus changed but stacking still the same
|
||||||
{
|
{
|
||||||
updateStackingOrder();
|
updateStackingOrder();
|
||||||
|
@ -68,12 +67,24 @@ void SlideBackEffect::windowActivated( EffectWindow* w )
|
||||||
if( isWindowUsable( tmp ) && tmp->isOnDesktop( w->desktop() ) )
|
if( isWindowUsable( tmp ) && tmp->isOnDesktop( w->desktop() ) )
|
||||||
{
|
{
|
||||||
// Do we have to move it?
|
// Do we have to move it?
|
||||||
if( tmp->geometry().intersects( w->geometry() ) )
|
if( intersects( w, tmp->geometry() ) )
|
||||||
{
|
{
|
||||||
|
QRect slideRect;
|
||||||
|
if( w->isModal() )
|
||||||
|
{
|
||||||
|
QRect modalGroupGeometry = w->geometry();
|
||||||
|
foreach( EffectWindow *modalWindow, w->mainWindows() )
|
||||||
|
{
|
||||||
|
modalGroupGeometry = modalGroupGeometry.united( modalWindow->geometry() );
|
||||||
|
/* effects->setElevatedWindow( modalWindow, true );
|
||||||
|
elevatedList.append( modalWindow );*/
|
||||||
|
}
|
||||||
|
slideRect = getSlideDestination( modalGroupGeometry, tmp->geometry() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
slideRect = getSlideDestination( w->geometry(), tmp->geometry() );
|
||||||
effects->setElevatedWindow( tmp, true );
|
effects->setElevatedWindow( tmp, true );
|
||||||
elevatedList.append( tmp );
|
elevatedList.append( tmp );
|
||||||
|
|
||||||
QRect slideRect = getSlideDestination( w->geometry(), tmp->geometry() );
|
|
||||||
motionManager.manage( tmp );
|
motionManager.manage( tmp );
|
||||||
motionManager.moveWindow( tmp, slideRect );
|
motionManager.moveWindow( tmp, slideRect );
|
||||||
destinationList.insert( tmp, slideRect );
|
destinationList.insert( tmp, slideRect );
|
||||||
|
@ -233,7 +244,16 @@ void SlideBackEffect::postPaintWindow( EffectWindow* w )
|
||||||
{
|
{
|
||||||
if( effects->activeWindow() && effects->activeWindow()->geometry().intersects( tmp->geometry() ) )
|
if( effects->activeWindow() && effects->activeWindow()->geometry().intersects( tmp->geometry() ) )
|
||||||
{
|
{
|
||||||
QRect newDestination = getSlideDestination( effects->activeWindow()->geometry(), tmp->geometry() );
|
QRect newDestination;
|
||||||
|
if( effects->activeWindow()->isModal() )
|
||||||
|
{
|
||||||
|
QRect modalGroupGeometry = w->geometry();
|
||||||
|
foreach( EffectWindow *modalWindow, effects->activeWindow()->mainWindows() )
|
||||||
|
modalGroupGeometry = modalGroupGeometry.united( modalWindow->geometry() );
|
||||||
|
newDestination = getSlideDestination( modalGroupGeometry, tmp->geometry() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newDestination = getSlideDestination( effects->activeWindow()->geometry(), tmp->geometry() );
|
||||||
if( !motionManager.isManaging( tmp ) )
|
if( !motionManager.isManaging( tmp ) )
|
||||||
motionManager.manage( tmp );
|
motionManager.manage( tmp );
|
||||||
motionManager.moveWindow( tmp, newDestination );
|
motionManager.moveWindow( tmp, newDestination );
|
||||||
|
@ -282,7 +302,7 @@ void SlideBackEffect::postPaintWindow( EffectWindow* w )
|
||||||
{
|
{
|
||||||
// It could happen that there is no aciveWindow() here if the user clicks the close-button on an inactive window.
|
// It could happen that there is no aciveWindow() here if the user clicks the close-button on an inactive window.
|
||||||
// Just skip... the window will be removed in windowDeleted() later
|
// Just skip... the window will be removed in windowDeleted() later
|
||||||
if( effects->activeWindow() && !motionManager.transformedGeometry( w ).intersects( effects->activeWindow()->geometry() ) )
|
if( effects->activeWindow() && !intersects( effects->activeWindow(), motionManager.transformedGeometry( w ).toAlignedRect() ) )
|
||||||
{
|
{
|
||||||
coveringWindows.removeAll( w );
|
coveringWindows.removeAll( w );
|
||||||
if( coveringWindows.isEmpty() )
|
if( coveringWindows.isEmpty() )
|
||||||
|
@ -310,6 +330,7 @@ void SlideBackEffect::windowDeleted( EffectWindow* w )
|
||||||
|
|
||||||
void SlideBackEffect::windowAdded( KWin::EffectWindow* w )
|
void SlideBackEffect::windowAdded( KWin::EffectWindow* w )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( w );
|
||||||
updateStackingOrder();
|
updateStackingOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +350,19 @@ bool SlideBackEffect::isWindowUsable( EffectWindow* w )
|
||||||
return w && ( w->isNormalWindow() || w->isDialog() ) && !w->isDeleted() && !w->isMinimized();
|
return w && ( w->isNormalWindow() || w->isDialog() ) && !w->isDeleted() && !w->isMinimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SlideBackEffect::intersects( EffectWindow* windowUnder, const QRect &windowOverGeometry )
|
||||||
|
{
|
||||||
|
QRect windowUnderGeometry = windowUnder->geometry();
|
||||||
|
if( windowUnder->isModal() )
|
||||||
|
{
|
||||||
|
foreach( EffectWindow *tmp, windowUnder->mainWindows() )
|
||||||
|
{
|
||||||
|
windowUnderGeometry = windowUnderGeometry.united( tmp->geometry() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return windowUnderGeometry.intersects( windowOverGeometry );
|
||||||
|
}
|
||||||
|
|
||||||
EffectWindowList SlideBackEffect::usableWindows( const EffectWindowList & allWindows )
|
EffectWindowList SlideBackEffect::usableWindows( const EffectWindowList & allWindows )
|
||||||
{
|
{
|
||||||
EffectWindowList retList;
|
EffectWindowList retList;
|
||||||
|
|
|
@ -62,6 +62,7 @@ class SlideBackEffect
|
||||||
bool isWindowOnTop( EffectWindow *w );
|
bool isWindowOnTop( EffectWindow *w );
|
||||||
bool isWindowUsable( EffectWindow *w );
|
bool isWindowUsable( EffectWindow *w );
|
||||||
bool stackingOrderChanged();
|
bool stackingOrderChanged();
|
||||||
|
bool intersects( EffectWindow *windowUnder, const QRect &windowOverGeometry );
|
||||||
EffectWindowList usableWindows( const EffectWindowList &allWindows );
|
EffectWindowList usableWindows( const EffectWindowList &allWindows );
|
||||||
EffectWindow *newTopWindow();
|
EffectWindow *newTopWindow();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue