From 1bb6e17c5458eb05dc079e358ed524616cff99de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 1 Aug 2006 11:50:10 +0000 Subject: [PATCH] KGlobalAccel has no longer the hack that maps numbered keys to a slot with int argument. svn path=/trunk/KDE/kdebase/workspace/; revision=568494 --- kwinbindings.cpp | 80 +++++++++++++++++------------------ workspace.h | 108 +++++++++++++++++++++++++++-------------------- 2 files changed, 103 insertions(+), 85 deletions(-) diff --git a/kwinbindings.cpp b/kwinbindings.cpp index 971c1d8886..cf728d10bd 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -84,26 +84,26 @@ new KAction( i18n("Window & Desktop"), actionCollection, "Group:Window Desktop" ); DEF2( "Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"), 0, slotWindowOnAllDesktops() ); - DEF( I18N_NOOP("Window to Desktop 1"), Qt::META+Qt::ALT+Qt::Key_F1, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 2"), Qt::META+Qt::ALT+Qt::Key_F2, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 3"), Qt::META+Qt::ALT+Qt::Key_F3, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 4"), Qt::META+Qt::ALT+Qt::Key_F4, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 5"), Qt::META+Qt::ALT+Qt::Key_F5, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 6"), Qt::META+Qt::ALT+Qt::Key_F6, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 7"), Qt::META+Qt::ALT+Qt::Key_F7, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 8"), Qt::META+Qt::ALT+Qt::Key_F8, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 9"), Qt::META+Qt::ALT+Qt::Key_F9, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 10"), Qt::META+Qt::ALT+Qt::Key_F10, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 11"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 12"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 13"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 14"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 15"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 16"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 17"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 18"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 19"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 20"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 1"), Qt::META+Qt::ALT+Qt::Key_F1, slotWindowToDesktop1() ); + DEF( I18N_NOOP("Window to Desktop 2"), Qt::META+Qt::ALT+Qt::Key_F2, slotWindowToDesktop2() ); + DEF( I18N_NOOP("Window to Desktop 3"), Qt::META+Qt::ALT+Qt::Key_F3, slotWindowToDesktop3() ); + DEF( I18N_NOOP("Window to Desktop 4"), Qt::META+Qt::ALT+Qt::Key_F4, slotWindowToDesktop4() ); + DEF( I18N_NOOP("Window to Desktop 5"), Qt::META+Qt::ALT+Qt::Key_F5, slotWindowToDesktop5() ); + DEF( I18N_NOOP("Window to Desktop 6"), Qt::META+Qt::ALT+Qt::Key_F6, slotWindowToDesktop6() ); + DEF( I18N_NOOP("Window to Desktop 7"), Qt::META+Qt::ALT+Qt::Key_F7, slotWindowToDesktop7() ); + DEF( I18N_NOOP("Window to Desktop 8"), Qt::META+Qt::ALT+Qt::Key_F8, slotWindowToDesktop8() ); + DEF( I18N_NOOP("Window to Desktop 9"), Qt::META+Qt::ALT+Qt::Key_F9, slotWindowToDesktop9() ); + DEF( I18N_NOOP("Window to Desktop 10"), Qt::META+Qt::ALT+Qt::Key_F10, slotWindowToDesktop10() ); + DEF( I18N_NOOP("Window to Desktop 11"), 0, slotWindowToDesktop11() ); + DEF( I18N_NOOP("Window to Desktop 12"), 0, slotWindowToDesktop12() ); + DEF( I18N_NOOP("Window to Desktop 13"), 0, slotWindowToDesktop13() ); + DEF( I18N_NOOP("Window to Desktop 14"), 0, slotWindowToDesktop14() ); + DEF( I18N_NOOP("Window to Desktop 15"), 0, slotWindowToDesktop15() ); + DEF( I18N_NOOP("Window to Desktop 16"), 0, slotWindowToDesktop16() ); + DEF( I18N_NOOP("Window to Desktop 17"), 0, slotWindowToDesktop17() ); + DEF( I18N_NOOP("Window to Desktop 18"), 0, slotWindowToDesktop18() ); + DEF( I18N_NOOP("Window to Desktop 19"), 0, slotWindowToDesktop19() ); + DEF( I18N_NOOP("Window to Desktop 20"), 0, slotWindowToDesktop20() ); DEF( I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop() ); DEF( I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop() ); DEF( I18N_NOOP("Window One Desktop to the Right"), 0, slotWindowToDesktopRight() ); @@ -112,26 +112,26 @@ DEF( I18N_NOOP("Window One Desktop Down"), 0, slotWindowToDesktopDown() ); new KAction( i18n("Desktop Switching"), actionCollection, "Group:Desktop Switching" ); - DEF( I18N_NOOP("Switch to Desktop 1"), Qt::META+Qt::Key_F1, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 2"), Qt::META+Qt::Key_F2, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 3"), Qt::META+Qt::Key_F3, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 4"), Qt::META+Qt::Key_F4, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 5"), Qt::META+Qt::Key_F5, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 6"), Qt::META+Qt::Key_F6, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 7"), Qt::META+Qt::Key_F7, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 8"), Qt::META+Qt::Key_F8, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 9"), Qt::META+Qt::Key_F9, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 10"), Qt::META+Qt::Key_F10, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 11"), Qt::CTRL+Qt::Key_F11, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 12"), Qt::CTRL+Qt::Key_F12, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 13"), Qt::CTRL+Qt::SHIFT+Qt::Key_F1, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 14"), Qt::CTRL+Qt::SHIFT+Qt::Key_F2, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 15"), Qt::CTRL+Qt::SHIFT+Qt::Key_F3, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 16"), Qt::CTRL+Qt::SHIFT+Qt::Key_F4, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 17"), Qt::CTRL+Qt::SHIFT+Qt::Key_F5, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 18"), Qt::CTRL+Qt::SHIFT+Qt::Key_F6, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 19"), Qt::CTRL+Qt::SHIFT+Qt::Key_F7, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 20"), Qt::CTRL+Qt::SHIFT+Qt::Key_F8, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 1"), Qt::META+Qt::Key_F1, slotSwitchToDesktop1() ); + DEF( I18N_NOOP("Switch to Desktop 2"), Qt::META+Qt::Key_F2, slotSwitchToDesktop2() ); + DEF( I18N_NOOP("Switch to Desktop 3"), Qt::META+Qt::Key_F3, slotSwitchToDesktop3() ); + DEF( I18N_NOOP("Switch to Desktop 4"), Qt::META+Qt::Key_F4, slotSwitchToDesktop4() ); + DEF( I18N_NOOP("Switch to Desktop 5"), Qt::META+Qt::Key_F5, slotSwitchToDesktop5() ); + DEF( I18N_NOOP("Switch to Desktop 6"), Qt::META+Qt::Key_F6, slotSwitchToDesktop6() ); + DEF( I18N_NOOP("Switch to Desktop 7"), Qt::META+Qt::Key_F7, slotSwitchToDesktop7() ); + DEF( I18N_NOOP("Switch to Desktop 8"), Qt::META+Qt::Key_F8, slotSwitchToDesktop8() ); + DEF( I18N_NOOP("Switch to Desktop 9"), Qt::META+Qt::Key_F9, slotSwitchToDesktop9() ); + DEF( I18N_NOOP("Switch to Desktop 10"), Qt::META+Qt::Key_F10, slotSwitchToDesktop10() ); + DEF( I18N_NOOP("Switch to Desktop 11"), Qt::CTRL+Qt::Key_F11, slotSwitchToDesktop11() ); + DEF( I18N_NOOP("Switch to Desktop 12"), Qt::CTRL+Qt::Key_F12, slotSwitchToDesktop12() ); + DEF( I18N_NOOP("Switch to Desktop 13"), Qt::CTRL+Qt::SHIFT+Qt::Key_F1, slotSwitchToDesktop13() ); + DEF( I18N_NOOP("Switch to Desktop 14"), Qt::CTRL+Qt::SHIFT+Qt::Key_F2, slotSwitchToDesktop14() ); + DEF( I18N_NOOP("Switch to Desktop 15"), Qt::CTRL+Qt::SHIFT+Qt::Key_F3, slotSwitchToDesktop15() ); + DEF( I18N_NOOP("Switch to Desktop 16"), Qt::CTRL+Qt::SHIFT+Qt::Key_F4, slotSwitchToDesktop16() ); + DEF( I18N_NOOP("Switch to Desktop 17"), Qt::CTRL+Qt::SHIFT+Qt::Key_F5, slotSwitchToDesktop17() ); + DEF( I18N_NOOP("Switch to Desktop 18"), Qt::CTRL+Qt::SHIFT+Qt::Key_F6, slotSwitchToDesktop18() ); + DEF( I18N_NOOP("Switch to Desktop 19"), Qt::CTRL+Qt::SHIFT+Qt::Key_F7, slotSwitchToDesktop19() ); + DEF( I18N_NOOP("Switch to Desktop 20"), Qt::CTRL+Qt::SHIFT+Qt::Key_F8, slotSwitchToDesktop20() ); DEF( I18N_NOOP("Switch to Next Desktop"), 0, slotSwitchDesktopNext() ); DEF( I18N_NOOP("Switch to Previous Desktop"), 0, slotSwitchDesktopPrevious() ); DEF( I18N_NOOP("Switch One Desktop to the Right"), 0, slotSwitchDesktopRight() ); diff --git a/workspace.h b/workspace.h index a438cb2d21..56ad4def3e 100644 --- a/workspace.h +++ b/workspace.h @@ -77,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines virtual ~Workspace(); static Workspace * self() { return _self; } - + bool workspaceEvent( XEvent * ); KDecoration* createDecoration( KDecorationBridge* bridge ); @@ -87,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; @@ -237,6 +234,12 @@ class Workspace : public QObject, public KDecorationDefines void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow() void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity() + void stopKompmgr(); + bool kompmgrIsRunning(); + void setOpacity(unsigned long winId, unsigned int opacityPercent); + void setShadowSize(unsigned long winId, unsigned int shadowSizePercent); + void setUnshadowed(unsigned long winId); // redundant, equals setShadowSize(inId, 0) + // only called from Client::destroyClient() or Client::releaseWindow() void removeClient( Client*, allowed_t ); void setActiveClient( Client*, allowed_t ); @@ -245,9 +248,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? @@ -282,13 +282,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 addDamage( XserverRegion r, bool destroy ); - void addDamage( Toplevel* c, const QRect& r ); - void addDamage( Toplevel* c, int x, int y, int w, int h ); - void addDamage( Toplevel* c, XserverRegion r, bool destroy ); public slots: void refresh(); @@ -301,8 +294,48 @@ class Workspace : public QObject, public KDecorationDefines void slotSwitchDesktopDown(); void slotSwitchToDesktop( int ); + void slotSwitchToDesktop1() { return slotSwitchToDesktop( 1 ); } + void slotSwitchToDesktop2() { return slotSwitchToDesktop( 2 ); } + void slotSwitchToDesktop3() { return slotSwitchToDesktop( 3 ); } + void slotSwitchToDesktop4() { return slotSwitchToDesktop( 4 ); } + void slotSwitchToDesktop5() { return slotSwitchToDesktop( 5 ); } + void slotSwitchToDesktop6() { return slotSwitchToDesktop( 6 ); } + void slotSwitchToDesktop7() { return slotSwitchToDesktop( 7 ); } + void slotSwitchToDesktop8() { return slotSwitchToDesktop( 8 ); } + void slotSwitchToDesktop9() { return slotSwitchToDesktop( 9 ); } + void slotSwitchToDesktop10() { return slotSwitchToDesktop( 10 ); } + void slotSwitchToDesktop11() { return slotSwitchToDesktop( 11 ); } + void slotSwitchToDesktop12() { return slotSwitchToDesktop( 12 ); } + void slotSwitchToDesktop13() { return slotSwitchToDesktop( 13 ); } + void slotSwitchToDesktop14() { return slotSwitchToDesktop( 14 ); } + void slotSwitchToDesktop15() { return slotSwitchToDesktop( 15 ); } + void slotSwitchToDesktop16() { return slotSwitchToDesktop( 16 ); } + void slotSwitchToDesktop17() { return slotSwitchToDesktop( 17 ); } + void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); } + void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); } + void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); } //void slotSwitchToWindow( int ); void slotWindowToDesktop( int ); + void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); } + void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); } + void slotWindowToDesktop3() { return slotWindowToDesktop( 3 ); } + void slotWindowToDesktop4() { return slotWindowToDesktop( 4 ); } + void slotWindowToDesktop5() { return slotWindowToDesktop( 5 ); } + void slotWindowToDesktop6() { return slotWindowToDesktop( 6 ); } + void slotWindowToDesktop7() { return slotWindowToDesktop( 7 ); } + void slotWindowToDesktop8() { return slotWindowToDesktop( 8 ); } + void slotWindowToDesktop9() { return slotWindowToDesktop( 9 ); } + void slotWindowToDesktop10() { return slotWindowToDesktop( 10 ); } + void slotWindowToDesktop11() { return slotWindowToDesktop( 11 ); } + void slotWindowToDesktop12() { return slotWindowToDesktop( 12 ); } + void slotWindowToDesktop13() { return slotWindowToDesktop( 13 ); } + void slotWindowToDesktop14() { return slotWindowToDesktop( 14 ); } + void slotWindowToDesktop15() { return slotWindowToDesktop( 15 ); } + void slotWindowToDesktop16() { return slotWindowToDesktop( 16 ); } + void slotWindowToDesktop17() { return slotWindowToDesktop( 17 ); } + void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); } + void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); } + void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); } //void slotWindowToListPosition( int ); void slotWindowMaximize(); @@ -364,6 +397,9 @@ class Workspace : public QObject, public KDecorationDefines void updateClientArea(); + // kompmgr, also dcop + void startKompmgr(); + private slots: void desktopPopupAboutToShow(); void clientPopupAboutToShow(); @@ -383,8 +419,10 @@ class Workspace : public QObject, public KDecorationDefines void setPopupClientOpacity(int v); void resetClientOpacity(); void setTransButtonText(int value); + void unblockKompmgrRestart(); + void restartKompmgr(); + void handleKompmgrOutput( KProcess *proc, char *buffer, int buflen); // end - void compositeTimeout(); protected: bool keyPressMouseEmulation( XKeyEvent& ev ); @@ -432,8 +470,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 ); @@ -475,9 +511,6 @@ class Workspace : public QObject, public KDecorationDefines void closeActivePopup(); void updateClientArea( bool force ); - - void setupCompositing(); - void finishCompositing(); SystemTrayWindowList systemTrayWins; @@ -514,7 +547,6 @@ class Workspace : public QObject, public KDecorationDefines ClientList clients; ClientList desktops; - UnmanagedList unmanaged; ClientList unconstrained_stacking_order; ClientList stacking_order; @@ -634,13 +666,19 @@ class Workspace : public QObject, public KDecorationDefines Window null_focus_window; bool forced_global_mouse_grab; friend class StackingUpdatesBlocker; - - QTimer compositeTimer; - XserverRegion damage_region; //kompmgr QSlider *transSlider; QPushButton *transButton; + // not used yet + /*Client* topDock; + int maximizedWindowCounter; + int topDockShadowSize;*/ + //end + + signals: + void kompmgrStarted(); + void kompmgrStopped(); }; // helper for Workspace::blockStackingUpdates() being called in pairs (true/false) @@ -810,27 +848,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 ));