Raise electric border windows when an effect mouse input window is

created to allow effects to be toggled by active screen edges.

svn path=/trunk/KDE/kdebase/workspace/; revision=922121
This commit is contained in:
Lucas Murray 2009-02-06 14:21:20 +00:00
parent a1c82cd52b
commit 81ffa5aec9
6 changed files with 44 additions and 24 deletions

View file

@ -665,6 +665,11 @@ Window EffectsHandlerImpl::createInputWindow( Effect* e, int x, int y, int w, in
XDefineCursor( display(), win, cursor.handle());
XMapWindow( display(), win );
input_windows.append( qMakePair( e, win ));
// Raise electric border windows above the input windows
// so they can still be triggered.
Workspace::self()->raiseElectricBorderWindows();
return win;
}
@ -740,6 +745,9 @@ void EffectsHandlerImpl::checkInputWindowStacking()
XRaiseWindow( display(), wins[ 0 ] );
XRestackWindows( display(), wins, pos );
delete[] wins;
// Raise electric border windows above the input windows
// so they can still be triggered. TODO: Do both at once.
Workspace::self()->raiseElectricBorderWindows();
}
QPoint EffectsHandlerImpl::cursorPos() const

View file

@ -1506,16 +1506,14 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
bool CubeEffect::borderActivated( ElectricBorder border )
{
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
if( border != borderActivate )
return false;
if( border == borderActivate && !activated )
{
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return true;
kDebug(1212) << "border activated";
toggle();
return true;
}
return false;
}
void CubeEffect::toggle()
{

View file

@ -406,15 +406,13 @@ void DesktopGridEffect::grabbedKeyboardEvent( QKeyEvent* e )
bool DesktopGridEffect::borderActivated( ElectricBorder border )
{
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
if( border != borderActivate )
return false;
if( border == borderActivate && !activated )
{
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return true;
toggle();
return true;
}
return false;
}
//-----------------------------------------------------------------------------
// Helper functions

View file

@ -290,20 +290,16 @@ void PresentWindowsEffect::windowDeleted( EffectWindow *w )
bool PresentWindowsEffect::borderActivated( ElectricBorder border )
{
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
if( border != m_borderActivate && border != m_borderActivateAll )
return false;
if( border == m_borderActivate && !m_activated )
{
toggleActive();
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return true;
}
if( border == m_borderActivateAll && !m_activated )
{
if( border == m_borderActivate )
toggleActive();
else
toggleActiveAllDesktops();
return true;
}
return false;
}
void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent *e )
{

View file

@ -222,6 +222,24 @@ void Workspace::propagateClients( bool propagate_new_clients )
x_stacking_dirty = true;
}
/**
* Raise electric border windows to the real top of the screen. We only need
* to do this if an effect input window is active.
*/
void Workspace::raiseElectricBorderWindows()
{
Window* windows = new Window[ 8 ]; // There are up to 8 borders
int pos = 0;
for( int i = 0; i < ELECTRIC_COUNT; ++i )
if( electric_windows[ i ] != None )
windows[ pos++ ] = electric_windows[ i ];
if( !pos )
return; // No borders at all
XRaiseWindow( display(), windows[ 0 ] );
XRestackWindows( display(), windows, pos );
delete [] windows;
}
/*!
Returns topmost visible client. Windows on the dock, the desktop

View file

@ -361,6 +361,8 @@ class Workspace : public QObject, public KDecorationDefines
void startMousePolling();
void stopMousePolling();
void raiseElectricBorderWindows();
public slots:
void addRepaintFull();
void refresh();