QMap -> QHash

svn path=/branches/work/kwin_composite/; revision=642532
icc-effect-5.14.5
Luboš Luňák 2007-03-14 16:50:19 +00:00
parent 5d4178c40c
commit d4a58f4152
17 changed files with 59 additions and 84 deletions

View File

@ -479,7 +479,7 @@ void EffectsHandler::activateWindow( EffectWindow* c )
void EffectsHandler::registerEffect( const QString& name, EffectFactory* factory ) void EffectsHandler::registerEffect( const QString& name, EffectFactory* factory )
{ {
QMap<QString, EffectFactory*>::const_iterator factories_iterator = effect_factories.find(name); QHash<QString, EffectFactory*>::const_iterator factories_iterator = effect_factories.find(name);
if( factories_iterator != effect_factories.end() ) if( factories_iterator != effect_factories.end() )
{ {
kDebug( 1212 ) << "EffectsHandler::registerEffect : Effect name already registered : " << name << endl; kDebug( 1212 ) << "EffectsHandler::registerEffect : Effect name already registered : " << name << endl;
@ -506,7 +506,7 @@ void EffectsHandler::loadEffect( const QString& name )
} }
} }
QMap<QString, EffectFactory*>::const_iterator factories_iterator = effect_factories.find(name); QHash<QString, EffectFactory*>::const_iterator factories_iterator = effect_factories.find(name);
if( factories_iterator != effect_factories.end() ) if( factories_iterator != effect_factories.end() )
{ {
kDebug( 1212 ) << "EffectsHandler::loadEffect : Loading effect : " << name << endl; kDebug( 1212 ) << "EffectsHandler::loadEffect : Loading effect : " << name << endl;

View File

@ -177,7 +177,7 @@ class EffectsHandler
QVector< EffectPair > loaded_effects; QVector< EffectPair > loaded_effects;
typedef QPair< Effect*, Window > InputWindowPair; typedef QPair< Effect*, Window > InputWindowPair;
QList< InputWindowPair > input_windows; QList< InputWindowPair > input_windows;
QMap< QString, EffectFactory* > effect_factories; QHash< QString, EffectFactory* > effect_factories;
int current_paint_screen; int current_paint_screen;
int current_paint_window; int current_paint_window;
int current_draw_window; int current_draw_window;

View File

@ -15,7 +15,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <scene_xrender.h> #include <scene_xrender.h>
#include <scene_opengl.h> #include <scene_opengl.h>
#include <QMap> #include <QHash>
#include <QPixmap> #include <QPixmap>
#include <QRect> #include <QRect>
#include <QRegion> #include <QRegion>
@ -66,8 +66,8 @@ class BoxSwitchEffect
QSize item_max_size; // maximum item display size (including highlight) QSize item_max_size; // maximum item display size (including highlight)
int highlight_margin; // TODO graphical background, highlight int highlight_margin; // TODO graphical background, highlight
QMap< int, ItemInfo > desktops; QHash< int, ItemInfo > desktops;
QMap< EffectWindow*, ItemInfo > windows; QHash< EffectWindow*, ItemInfo > windows;
int selected_desktop; int selected_desktop;
ClientList tab_clients; ClientList tab_clients;

View File

@ -39,7 +39,7 @@ class DialogParentEffect
bool hasModalWindow( Toplevel* t ); bool hasModalWindow( Toplevel* t );
private: private:
// The progress of the fading. // The progress of the fading.
QMap<EffectWindow*, float> effectStrength; QHash<EffectWindow*, float> effectStrength;
}; };
} // namespace } // namespace

View File

@ -32,7 +32,7 @@ class FadeEffect
private: private:
int fade_in_speed, fade_out_speed; // TODO make these configurable int fade_in_speed, fade_out_speed; // TODO make these configurable
class WindowInfo; class WindowInfo;
QMap< const EffectWindow*, WindowInfo > windows; QHash< const EffectWindow*, WindowInfo > windows;
}; };
class FadeEffect::WindowInfo class FadeEffect::WindowInfo

View File

@ -27,7 +27,7 @@ class FallApartEffect
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
private: private:
QMap< const EffectWindow*, double > windows; QHash< const EffectWindow*, double > windows;
}; };
} // namespace } // namespace

View File

@ -36,7 +36,7 @@ class MinimizeAnimationEffect
virtual void windowUnminimized( EffectWindow* c ); virtual void windowUnminimized( EffectWindow* c );
private: private:
QMap< EffectWindow*, float > mAnimationProgress; QHash< EffectWindow*, float > mAnimationProgress;
int mActiveAnimations; int mActiveAnimations;
}; };

View File

@ -121,7 +121,7 @@ void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent* e )
// Find out which window (if any) was clicked and activate it // Find out which window (if any) was clicked and activate it
QPoint pos = static_cast< QMouseEvent* >( e )->pos(); QPoint pos = static_cast< QMouseEvent* >( e )->pos();
for( QMap<Toplevel*, WindowData>::iterator it = mWindowData.begin(); for( QHash<Toplevel*, WindowData>::iterator it = mWindowData.begin();
it != mWindowData.end(); ++it ) it != mWindowData.end(); ++it )
{ {
if( it.value().area.contains(pos) ) if( it.value().area.contains(pos) )

View File

@ -72,7 +72,7 @@ class PresentWindowsEffect
QRect area; QRect area;
float scale; float scale;
}; };
QMap<Toplevel*, WindowData> mWindowData; QHash<Toplevel*, WindowData> mWindowData;
}; };
} // namespace } // namespace

View File

@ -28,7 +28,7 @@ class ScaleInEffect
virtual void windowAdded( EffectWindow* c ); virtual void windowAdded( EffectWindow* c );
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
private: private:
QMap< const EffectWindow*, double > windows; QHash< const EffectWindow*, double > windows;
}; };
} // namespace } // namespace

View File

@ -72,7 +72,7 @@ void ShakyMoveEffect::windowClosed( EffectWindow* c )
// TODO use time provided with prePaintWindow() instead // TODO use time provided with prePaintWindow() instead
void ShakyMoveEffect::tick() 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 != windows.end();
++it ) ++it )
{ {

View File

@ -32,7 +32,7 @@ class ShakyMoveEffect
private slots: private slots:
void tick(); void tick();
private: private:
QMap< const EffectWindow*, int > windows; QHash< const EffectWindow*, int > windows;
QTimer timer; QTimer timer;
}; };

View File

@ -119,8 +119,7 @@ void Workspace::updateStackingOrder( bool propagate_new_clients )
if( changed || propagate_new_clients ) if( changed || propagate_new_clients )
{ {
propagateClients( propagate_new_clients ); propagateClients( propagate_new_clients );
if( active_client ) addRepaintFull();
active_client->updateMouseGrab();
} }
} }
@ -192,26 +191,24 @@ void Workspace::propagateClients( bool propagate_new_clients )
doesn't accept focus it's excluded. doesn't accept focus it's excluded.
*/ */
// TODO misleading name for this method // 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 ); // TODO Q_ASSERT( block_stacking_updates == 0 );
ClientList list; ClientList list;
if( !unconstrained ) 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 )) list = stacking_order;
{
if( !only_normal )
return list.at( i );
if( list.at( i )->wantsTabFocus() && !list.at( i )->isSpecialWindow())
return list.at( i );
}
} }
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; return 0;
} }
@ -401,27 +398,20 @@ void Workspace::restackClientUnderActive( Client* c )
return; return;
} }
// put in the stacking order below _all_ windows belonging to the active application
assert( unconstrained_stacking_order.contains( active_client )); assert( unconstrained_stacking_order.contains( active_client ));
if( Client::belongToSameApplication( active_client, c )) for( ClientList::Iterator it = unconstrained_stacking_order.begin();
{ // put it below the active window if it's the same app it != unconstrained_stacking_order.end();
unconstrained_stacking_order.removeAll( c ); ++it )
unconstrained_stacking_order.insert( unconstrained_stacking_order.find( active_client ), c ); { // TODO ignore topmenus?
} if( Client::belongToSameApplication( active_client, *it ))
else {
{ // put in the stacking order below _all_ windows belonging to the active application if( *it != c )
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 ) unconstrained_stacking_order.removeAll( c );
{ unconstrained_stacking_order.insert( it, c );
unconstrained_stacking_order.removeAll( c );
unconstrained_stacking_order.insert( it, c );
}
break;
} }
break;
} }
} }
assert( unconstrained_stacking_order.contains( c )); 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 { // 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( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( active_client ))
{ {
if( Client::belongToSameApplication( active_client, c )) // also put in focus_chain[currentDesktop()] after all windows belonging to the active applicationa
{ // put it after the active window if it's the same app focus_chain[ desktop ].removeAll( c );
focus_chain[ desktop ].removeAll( c ); for ( int i = focus_chain[ desktop ].size() - 1;
focus_chain[ desktop ].insert( focus_chain[ desktop ].find( active_client ), c ); i >= 0;
} --i )
else {
{ // put it in focus_chain[currentDesktop()] after all windows belonging to the active applicationa if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ) ))
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 ))) 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 // the same for global_focus_chain
if( c->wantsTabFocus() && global_focus_chain.contains( active_client )) 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 ); if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) ))
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 ) )) global_focus_chain.insert( i, c );
{ break;
global_focus_chain.insert( i, c );
break;
}
} }
} }
} }

View File

@ -163,7 +163,7 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
SceneOpenGL::~SceneOpenGL() SceneOpenGL::~SceneOpenGL()
{ {
for( QMap< Toplevel*, Window >::Iterator it = windows.begin(); for( QHash< Toplevel*, Window >::Iterator it = windows.begin();
it != windows.end(); it != windows.end();
++it ) ++it )
(*it).free(); (*it).free();

View File

@ -79,7 +79,7 @@ class SceneOpenGL
static bool supports_npot_textures; static bool supports_npot_textures;
static bool supports_fbo; static bool supports_fbo;
static bool supports_saturation; static bool supports_saturation;
QMap< Toplevel*, Window > windows; QHash< Toplevel*, Window > windows;
#ifdef HAVE_XSHM #ifdef HAVE_XSHM
static XShmSegmentInfo shm; static XShmSegmentInfo shm;
#endif #endif

View File

@ -97,7 +97,7 @@ SceneXrender::~SceneXrender()
XRenderFreePicture( display(), front ); XRenderFreePicture( display(), front );
XRenderFreePicture( display(), buffer ); XRenderFreePicture( display(), buffer );
wspace->destroyOverlay(); wspace->destroyOverlay();
for( QMap< Toplevel*, Window >::Iterator it = windows.begin(); for( QHash< Toplevel*, Window >::Iterator it = windows.begin();
it != windows.end(); it != windows.end();
++it ) ++it )
(*it).free(); (*it).free();

View File

@ -48,7 +48,7 @@ class SceneXrender
static Picture buffer; static Picture buffer;
static ScreenPaintData screen_paint; static ScreenPaintData screen_paint;
class Window; class Window;
QMap< Toplevel*, Window > windows; QHash< Toplevel*, Window > windows;
}; };
class SceneXrender::Window class SceneXrender::Window