From d4a58f4152e9861003a5822d41cb0422ad3c6f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 14 Mar 2007 16:50:19 +0000 Subject: [PATCH] QMap -> QHash svn path=/branches/work/kwin_composite/; revision=642532 --- effects.cpp | 4 +- effects.h | 2 +- effects/boxswitch.h | 6 +-- effects/dialogparent.h | 2 +- effects/fade.h | 2 +- effects/fallapart.h | 2 +- effects/minimizeanimation.h | 2 +- effects/presentwindows.cpp | 2 +- effects/presentwindows.h | 2 +- effects/scalein.h | 2 +- effects/shakymove.cpp | 2 +- effects/shakymove.h | 2 +- layers.cpp | 105 ++++++++++++++---------------------- scene_opengl.cpp | 2 +- scene_opengl.h | 2 +- scene_xrender.cpp | 2 +- scene_xrender.h | 2 +- 17 files changed, 59 insertions(+), 84 deletions(-) diff --git a/effects.cpp b/effects.cpp index 1e1b1909e9..06bbb83f16 100644 --- a/effects.cpp +++ b/effects.cpp @@ -479,7 +479,7 @@ void EffectsHandler::activateWindow( EffectWindow* c ) void EffectsHandler::registerEffect( const QString& name, EffectFactory* factory ) { - QMap::const_iterator factories_iterator = effect_factories.find(name); + QHash::const_iterator factories_iterator = effect_factories.find(name); if( factories_iterator != effect_factories.end() ) { kDebug( 1212 ) << "EffectsHandler::registerEffect : Effect name already registered : " << name << endl; @@ -506,7 +506,7 @@ void EffectsHandler::loadEffect( const QString& name ) } } - QMap::const_iterator factories_iterator = effect_factories.find(name); + QHash::const_iterator factories_iterator = effect_factories.find(name); if( factories_iterator != effect_factories.end() ) { kDebug( 1212 ) << "EffectsHandler::loadEffect : Loading effect : " << name << endl; diff --git a/effects.h b/effects.h index a6f20f376d..2924585aff 100644 --- a/effects.h +++ b/effects.h @@ -177,7 +177,7 @@ class EffectsHandler QVector< EffectPair > loaded_effects; typedef QPair< Effect*, Window > InputWindowPair; QList< InputWindowPair > input_windows; - QMap< QString, EffectFactory* > effect_factories; + QHash< QString, EffectFactory* > effect_factories; int current_paint_screen; int current_paint_window; int current_draw_window; diff --git a/effects/boxswitch.h b/effects/boxswitch.h index 595f614fec..f61fed0559 100644 --- a/effects/boxswitch.h +++ b/effects/boxswitch.h @@ -15,7 +15,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include -#include +#include #include #include #include @@ -66,8 +66,8 @@ class BoxSwitchEffect QSize item_max_size; // maximum item display size (including highlight) int highlight_margin; // TODO graphical background, highlight - QMap< int, ItemInfo > desktops; - QMap< EffectWindow*, ItemInfo > windows; + QHash< int, ItemInfo > desktops; + QHash< EffectWindow*, ItemInfo > windows; int selected_desktop; ClientList tab_clients; diff --git a/effects/dialogparent.h b/effects/dialogparent.h index 65f1e4a042..9c272491ef 100644 --- a/effects/dialogparent.h +++ b/effects/dialogparent.h @@ -39,7 +39,7 @@ class DialogParentEffect bool hasModalWindow( Toplevel* t ); private: // The progress of the fading. - QMap effectStrength; + QHash effectStrength; }; } // namespace diff --git a/effects/fade.h b/effects/fade.h index 7f54b25fb1..674adc94b2 100644 --- a/effects/fade.h +++ b/effects/fade.h @@ -32,7 +32,7 @@ class FadeEffect private: int fade_in_speed, fade_out_speed; // TODO make these configurable class WindowInfo; - QMap< const EffectWindow*, WindowInfo > windows; + QHash< const EffectWindow*, WindowInfo > windows; }; class FadeEffect::WindowInfo diff --git a/effects/fallapart.h b/effects/fallapart.h index 45115bcef7..ab13dc7c1e 100644 --- a/effects/fallapart.h +++ b/effects/fallapart.h @@ -27,7 +27,7 @@ class FallApartEffect virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); private: - QMap< const EffectWindow*, double > windows; + QHash< const EffectWindow*, double > windows; }; } // namespace diff --git a/effects/minimizeanimation.h b/effects/minimizeanimation.h index a3f8a62c5a..fe80fcd1fd 100644 --- a/effects/minimizeanimation.h +++ b/effects/minimizeanimation.h @@ -36,7 +36,7 @@ class MinimizeAnimationEffect virtual void windowUnminimized( EffectWindow* c ); private: - QMap< EffectWindow*, float > mAnimationProgress; + QHash< EffectWindow*, float > mAnimationProgress; int mActiveAnimations; }; diff --git a/effects/presentwindows.cpp b/effects/presentwindows.cpp index f1a2825b71..3bde5c7fcf 100644 --- a/effects/presentwindows.cpp +++ b/effects/presentwindows.cpp @@ -121,7 +121,7 @@ void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent* e ) // Find out which window (if any) was clicked and activate it QPoint pos = static_cast< QMouseEvent* >( e )->pos(); - for( QMap::iterator it = mWindowData.begin(); + for( QHash::iterator it = mWindowData.begin(); it != mWindowData.end(); ++it ) { if( it.value().area.contains(pos) ) diff --git a/effects/presentwindows.h b/effects/presentwindows.h index 18307ade67..753ca8d7fe 100644 --- a/effects/presentwindows.h +++ b/effects/presentwindows.h @@ -72,7 +72,7 @@ class PresentWindowsEffect QRect area; float scale; }; - QMap mWindowData; + QHash mWindowData; }; } // namespace diff --git a/effects/scalein.h b/effects/scalein.h index 78e4b38848..be4a4b3c52 100644 --- a/effects/scalein.h +++ b/effects/scalein.h @@ -28,7 +28,7 @@ class ScaleInEffect virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); private: - QMap< const EffectWindow*, double > windows; + QHash< const EffectWindow*, double > windows; }; } // namespace diff --git a/effects/shakymove.cpp b/effects/shakymove.cpp index 0eb86abf62..4c8a7f8c52 100644 --- a/effects/shakymove.cpp +++ b/effects/shakymove.cpp @@ -72,7 +72,7 @@ void ShakyMoveEffect::windowClosed( EffectWindow* c ) // TODO use time provided with prePaintWindow() instead void ShakyMoveEffect::tick() { - for( QMap< const EffectWindow*, int >::Iterator it = windows.begin(); + for( QHash< const EffectWindow*, int >::Iterator it = windows.begin(); it != windows.end(); ++it ) { diff --git a/effects/shakymove.h b/effects/shakymove.h index b301463350..fdb0efd78c 100644 --- a/effects/shakymove.h +++ b/effects/shakymove.h @@ -32,7 +32,7 @@ class ShakyMoveEffect private slots: void tick(); private: - QMap< const EffectWindow*, int > windows; + QHash< const EffectWindow*, int > windows; QTimer timer; }; diff --git a/layers.cpp b/layers.cpp index 061e89c4d9..21261fe0e8 100644 --- a/layers.cpp +++ b/layers.cpp @@ -119,8 +119,7 @@ void Workspace::updateStackingOrder( bool propagate_new_clients ) if( changed || propagate_new_clients ) { propagateClients( propagate_new_clients ); - if( active_client ) - active_client->updateMouseGrab(); + addRepaintFull(); } } @@ -192,26 +191,24 @@ void Workspace::propagateClients( bool propagate_new_clients ) doesn't accept focus it's excluded. */ // TODO misleading name for this method -Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained, bool only_normal ) const +Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained ) const { // TODO Q_ASSERT( block_stacking_updates == 0 ); ClientList list; if( !unconstrained ) - list = stacking_order; - else - list = unconstrained_stacking_order; - for( int i = list.size() - 1; - i >= 0; - --i ) { - if( list.at( i )->isOnDesktop( desktop ) && list.at( i )->isShown( false )) - { - if( !only_normal ) - return list.at( i ); - if( list.at( i )->wantsTabFocus() && !list.at( i )->isSpecialWindow()) - return list.at( i ); - } + list = stacking_order; } + else + { + list = unconstrained_stacking_order; + } + for ( int i = list.size() - 1; i>=0; i-- ) + { + if ( list.at( i )->isOnDesktop( desktop ) && !list.at( i )->isSpecialWindow() + && list.at( i )->isShown( false ) && list.at( i )->wantsTabFocus()) + return list.at( i ); + } return 0; } @@ -401,27 +398,20 @@ void Workspace::restackClientUnderActive( Client* c ) return; } + // put in the stacking order below _all_ windows belonging to the active application assert( unconstrained_stacking_order.contains( active_client )); - if( Client::belongToSameApplication( active_client, c )) - { // put it below the active window if it's the same app - unconstrained_stacking_order.removeAll( c ); - unconstrained_stacking_order.insert( unconstrained_stacking_order.find( active_client ), c ); - } - else - { // put in the stacking order below _all_ windows belonging to the active application - for( ClientList::Iterator it = unconstrained_stacking_order.begin(); - it != unconstrained_stacking_order.end(); - ++it ) - { // TODO ignore topmenus? - if( Client::belongToSameApplication( active_client, *it )) + for( ClientList::Iterator it = unconstrained_stacking_order.begin(); + it != unconstrained_stacking_order.end(); + ++it ) + { // TODO ignore topmenus? + if( Client::belongToSameApplication( active_client, *it )) + { + if( *it != c ) { - if( *it != c ) - { - unconstrained_stacking_order.removeAll( c ); - unconstrained_stacking_order.insert( it, c ); - } - break; + unconstrained_stacking_order.removeAll( c ); + unconstrained_stacking_order.insert( it, c ); } + break; } } assert( unconstrained_stacking_order.contains( c )); @@ -431,23 +421,16 @@ void Workspace::restackClientUnderActive( Client* c ) { // do for every virtual desktop to handle the case of onalldesktop windows if( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( active_client )) { - if( Client::belongToSameApplication( active_client, c )) - { // put it after the active window if it's the same app - focus_chain[ desktop ].removeAll( c ); - focus_chain[ desktop ].insert( focus_chain[ desktop ].find( active_client ), c ); - } - else - { // put it in focus_chain[currentDesktop()] after all windows belonging to the active applicationa - focus_chain[ desktop ].removeAll( c ); - for( int i = focus_chain[ desktop ].size() - 1; - i >= 0; - --i ) + // also put in focus_chain[currentDesktop()] after all windows belonging to the active applicationa + focus_chain[ desktop ].removeAll( c ); + for ( int i = focus_chain[ desktop ].size() - 1; + i >= 0; + --i ) + { + if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ) )) { - if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ))) - { - focus_chain[ desktop ].insert( i, c ); - break; - } + focus_chain[ desktop ].insert( i, c ); + break; } } } @@ -455,23 +438,15 @@ void Workspace::restackClientUnderActive( Client* c ) // the same for global_focus_chain if( c->wantsTabFocus() && global_focus_chain.contains( active_client )) { - if( Client::belongToSameApplication( active_client, c )) + global_focus_chain.removeAll( c ); + for ( int i = global_focus_chain.size() - 1; + i >= 0; + --i ) { - global_focus_chain.removeAll( c ); - global_focus_chain.insert( global_focus_chain.find( active_client ), c ); - } - else - { - global_focus_chain.removeAll( c ); - for ( int i = global_focus_chain.size() - 1; - i >= 0; - --i ) + if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) )) { - if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) )) - { - global_focus_chain.insert( i, c ); - break; - } + global_focus_chain.insert( i, c ); + break; } } } diff --git a/scene_opengl.cpp b/scene_opengl.cpp index fa19c19044..6465a42f0c 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -163,7 +163,7 @@ SceneOpenGL::SceneOpenGL( Workspace* ws ) SceneOpenGL::~SceneOpenGL() { - for( QMap< Toplevel*, Window >::Iterator it = windows.begin(); + for( QHash< Toplevel*, Window >::Iterator it = windows.begin(); it != windows.end(); ++it ) (*it).free(); diff --git a/scene_opengl.h b/scene_opengl.h index 7b67d94098..514dcf0482 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -79,7 +79,7 @@ class SceneOpenGL static bool supports_npot_textures; static bool supports_fbo; static bool supports_saturation; - QMap< Toplevel*, Window > windows; + QHash< Toplevel*, Window > windows; #ifdef HAVE_XSHM static XShmSegmentInfo shm; #endif diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 83f1404d33..444f63b79f 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -97,7 +97,7 @@ SceneXrender::~SceneXrender() XRenderFreePicture( display(), front ); XRenderFreePicture( display(), buffer ); wspace->destroyOverlay(); - for( QMap< Toplevel*, Window >::Iterator it = windows.begin(); + for( QHash< Toplevel*, Window >::Iterator it = windows.begin(); it != windows.end(); ++it ) (*it).free(); diff --git a/scene_xrender.h b/scene_xrender.h index e24f089224..2fbb6557da 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -48,7 +48,7 @@ class SceneXrender static Picture buffer; static ScreenPaintData screen_paint; class Window; - QMap< Toplevel*, Window > windows; + QHash< Toplevel*, Window > windows; }; class SceneXrender::Window