From 81ffa5aec9b4af5393cf0cc4680f307d3db2b0dc Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Fri, 6 Feb 2009 14:21:20 +0000 Subject: [PATCH] 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 --- effects.cpp | 8 ++++++++ effects/cube/cube.cpp | 12 +++++------- effects/desktopgrid/desktopgrid.cpp | 10 ++++------ effects/presentwindows/presentwindows.cpp | 16 ++++++---------- layers.cpp | 20 +++++++++++++++++++- workspace.h | 2 ++ 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/effects.cpp b/effects.cpp index b39d2a6661..949ecd96b1 100644 --- a/effects.cpp +++ b/effects.cpp @@ -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 diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 589ab8615c..acecd4279c 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -1506,15 +1506,13 @@ 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 ) - { - kDebug(1212) << "border activated"; - toggle(); + if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) return true; - } - return false; + kDebug(1212) << "border activated"; + toggle(); + return true; } void CubeEffect::toggle() diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 15ea3aaef0..7ddd39e547 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -406,14 +406,12 @@ 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 ) - { - toggle(); + if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) return true; - } - return false; + toggle(); + return true; } //----------------------------------------------------------------------------- diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index cb653d6985..4f7a6d8d2c 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -290,19 +290,15 @@ 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 ) - { + if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) + return true; + if( border == m_borderActivate ) toggleActive(); - return true; - } - if( border == m_borderActivateAll && !m_activated ) - { + else toggleActiveAllDesktops(); - return true; - } - return false; + return true; } void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent *e ) diff --git a/layers.cpp b/layers.cpp index 7d85d73c8f..9a8e1850ce 100644 --- a/layers.cpp +++ b/layers.cpp @@ -219,7 +219,25 @@ void Workspace::propagateClients( bool propagate_new_clients ) // Make the cached stacking order invalid here, in case we need the new stacking order before we get // the matching event, due to X being asynchronous. - x_stacking_dirty = true; + 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; } diff --git a/workspace.h b/workspace.h index b3835c9d6c..a798b00777 100644 --- a/workspace.h +++ b/workspace.h @@ -361,6 +361,8 @@ class Workspace : public QObject, public KDecorationDefines void startMousePolling(); void stopMousePolling(); + void raiseElectricBorderWindows(); + public slots: void addRepaintFull(); void refresh();