From 43a945cd338d519190f5e488cfa8ec7049942bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 16 Nov 2006 16:56:16 +0000 Subject: [PATCH] Fix finding the most recently raised window when updating mouse grab for click raise (#137119). And I think I'll have somewhen to fix all the tabs and other horrible things porting has done to indentation. svn path=/trunk/KDE/kdebase/workspace/; revision=605401 --- events.cpp | 2 +- layers.cpp | 24 ++++++++++-------- workspace.h | 72 +++++++---------------------------------------------- 3 files changed, 23 insertions(+), 75 deletions(-) diff --git a/events.cpp b/events.cpp index 288398eab8..803d9640b1 100644 --- a/events.cpp +++ b/events.cpp @@ -1014,7 +1014,7 @@ void Client::updateMouseGrab() // is unobscured or if the user doesn't want click raise // (it is unobscured if it the topmost in the unconstrained stacking order, i.e. it is // the most recently raised window) - bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), true ) == this; + bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), true, false ) == this; if( !options->clickRaise || not_obscured ) ungrabButton( None ); else diff --git a/layers.cpp b/layers.cpp index 3bd0902f9c..62c9a181d0 100644 --- a/layers.cpp +++ b/layers.cpp @@ -191,24 +191,26 @@ 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 ) const +Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained, bool only_normal ) const { // TODO Q_ASSERT( block_stacking_updates == 0 ); ClientList list; if( !unconstrained ) - { - list = stacking_order; - } + list = stacking_order; else + list = unconstrained_stacking_order; + for( int i = list.size() - 1; + i >= 0; + --i ) { - list = unconstrained_stacking_order; + 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 ); + } } - 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; } diff --git a/workspace.h b/workspace.h index a79d029799..e5f64da0c3 100644 --- a/workspace.h +++ b/workspace.h @@ -18,8 +18,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include -#include #include "utils.h" #include "kdecoration.h" @@ -79,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines virtual ~Workspace(); static Workspace * self() { return _self; } - + bool workspaceEvent( XEvent * ); KDecoration* createDecoration( KDecorationBridge* bridge ); @@ -89,9 +87,6 @@ class Workspace : public QObject, public KDecorationDefines template< typename T > Client* findClient( T predicate ); template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate ); template< typename T > void forEachClient( T procedure ); - template< typename T > Unmanaged* findUnmanaged( T predicate ); - template< typename T1, typename T2 > void forEachUnmanaged( T1 procedure, T2 predicate ); - template< typename T > void forEachUnmanaged( T procedure ); QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; QRect clientArea( clientAreaOption, const Client* c ) const; @@ -186,7 +181,7 @@ class Workspace : public QObject, public KDecorationDefines ClientList ensureStackingOrder( const ClientList& clients ) const; - Client* topClientOnDesktop( int desktop, bool unconstrained = false ) const; + Client* topClientOnDesktop( int desktop, bool unconstrained = false, bool only_normal = true ) const; Client* findDesktop( bool topmost, int desktop ) const; void sendClientToDesktop( Client* c, int desktop, bool dont_activate ); void windowToPreviousDesktop( Client* c ); @@ -247,9 +242,6 @@ class Workspace : public QObject, public KDecorationDefines void removeGroup( Group* group, allowed_t ); Group* findClientLeaderGroup( const Client* c ) const; - // only called from Unmanaged::release() - void removeUnmanaged( Unmanaged*, allowed_t ); - bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data ); void focusToNull(); // SELI public? @@ -284,17 +276,6 @@ class Workspace : public QObject, public KDecorationDefines void requestDelayFocus( Client* ); void toggleTopDockShadows(bool on); - - void addDamage( const QRect& r ); - void addDamage( int x, int y, int w, int h ); - void addDamageFull(); - // creates XComposite overlay window, cal initOverlay() afterwards - bool createOverlay(); - // init overlay and the destination window in it - void setupOverlay( Window window ); - // destroys XComposite overlay window - void destroyOverlay(); - Window overlayWindow(); public slots: void refresh(); @@ -425,11 +406,11 @@ class Workspace : public QObject, public KDecorationDefines void cleanupTemporaryRules(); void writeWindowRules(); void slotBlockShortcuts(int data); + // kompmgr void setPopupClientOpacity(int v); void resetClientOpacity(); void setTransButtonText(int value); - void performCompositing(); - void lostCMSelection(); + // end protected: bool keyPressMouseEmulation( XKeyEvent& ev ); @@ -477,8 +458,6 @@ class Workspace : public QObject, public KDecorationDefines // this is the right way to create a new client Client* createClient( Window w, bool is_mapped ); void addClient( Client* c, allowed_t ); - Unmanaged* createUnmanaged( Window w ); - void addUnmanaged( Unmanaged* c, allowed_t ); Window findSpecialEventWindow( XEvent* e ); @@ -520,9 +499,6 @@ class Workspace : public QObject, public KDecorationDefines void closeActivePopup(); void updateClientArea( bool force ); - - void setupCompositing(); - void finishCompositing(); SystemTrayWindowList systemTrayWins; @@ -559,11 +535,10 @@ class Workspace : public QObject, public KDecorationDefines ClientList clients; ClientList desktops; - UnmanagedList unmanaged; - ClientList unconstrained_stacking_order; - ClientList stacking_order; - QVector< ClientList > focus_chain; + ClientList unconstrained_stacking_order; // topmost last + ClientList stacking_order; // topmost last + QVector< ClientList > focus_chain; // currently ative last ClientList global_focus_chain; // this one is only for things like tabbox's MRU ClientList should_get_focus; // last is most recent ClientList attention_chain; @@ -680,11 +655,7 @@ class Workspace : public QObject, public KDecorationDefines bool forced_global_mouse_grab; friend class StackingUpdatesBlocker; - KSelectionOwner* cm_selection; - QTimer compositeTimer; - QTime lastCompositePaint; - QRegion damage_region; - Window overlay; // XComposite overlay window + //kompmgr QSlider *transSlider; QPushButton *transButton; }; @@ -829,11 +800,6 @@ inline bool Workspace::globalShortcutsDisabled() const return global_shortcuts_disabled || global_shortcuts_disabled_for_client; } -inline Window Workspace::overlayWindow() - { - return overlay; - } - template< typename T > inline Client* Workspace::findClient( T predicate ) { @@ -861,27 +827,7 @@ inline void Workspace::forEachClient( T procedure ) return forEachClient( procedure, TruePredicate()); } -template< typename T > -inline Unmanaged* Workspace::findUnmanaged( T predicate ) - { - return findUnmanagedInList( unmanaged, predicate ); - } - -template< typename T1, typename T2 > -inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate ) - { - for ( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it) - if ( predicate( const_cast< const Unmanaged* >( *it))) - procedure( *it ); - } - -template< typename T > -inline void Workspace::forEachUnmanaged( T procedure ) - { - return forEachUnmanaged( procedure, TruePredicate()); - } - -KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value ); +KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value ); inline bool Workspace::hasClient( const Client* c ) { return findClient( ClientMatchPredicate( c ));