00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef KWIN_WORKSPACE_H
00013 #define KWIN_WORKSPACE_H
00014
00015 #include <qtimer.h>
00016 #include <qvaluevector.h>
00017 #include <kshortcut.h>
00018 #include <qcursor.h>
00019 #include <netwm.h>
00020 #include <kxmessages.h>
00021
00022 #include "KWinInterface.h"
00023 #include "utils.h"
00024 #include "kdecoration.h"
00025 #include "sm.h"
00026
00027 #include <X11/Xlib.h>
00028
00029 class QPopupMenu;
00030 class KConfig;
00031 class KGlobalAccel;
00032 class KShortcutDialog;
00033 class KStartupInfo;
00034 class KStartupInfoId;
00035 class KStartupInfoData;
00036 class QSlider;
00037 class QPushButton;
00038 class KProcess;
00039
00040 namespace KWinInternal
00041 {
00042
00043 class Client;
00044 class TabBox;
00045 class PopupInfo;
00046 class RootInfo;
00047 class PluginMgr;
00048 class Placement;
00049 class Rules;
00050 class WindowRules;
00051
00052 class SystemTrayWindow
00053 {
00054 public:
00055 SystemTrayWindow()
00056 : win(0),winFor(0)
00057 {}
00058 SystemTrayWindow( WId w )
00059 : win(w),winFor(0)
00060 {}
00061 SystemTrayWindow( WId w, WId wf )
00062 : win(w),winFor(wf)
00063 {}
00064
00065 bool operator==( const SystemTrayWindow& other )
00066 { return win == other.win; }
00067 WId win;
00068 WId winFor;
00069 };
00070
00071 typedef QValueList<SystemTrayWindow> SystemTrayWindowList;
00072
00073 class Workspace : public QObject, public KWinInterface, public KDecorationDefines
00074 {
00075 Q_OBJECT
00076 public:
00077 Workspace( bool restore = FALSE );
00078 virtual ~Workspace();
00079
00080 static Workspace * self() { return _self; }
00081
00082 bool workspaceEvent( XEvent * );
00083
00084 KDecoration* createDecoration( KDecorationBridge* bridge );
00085
00086 bool hasClient( const Client * );
00087
00088 template< typename T > Client* findClient( T predicate );
00089 template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate );
00090 template< typename T > void forEachClient( T procedure );
00091
00092 QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
00093 QRect clientArea( clientAreaOption, const Client* c ) const;
00094
00098 void killWindowId( Window window);
00099
00100 void killWindow() { slotKillWindow(); }
00101
00102 WId rootWin() const;
00103
00104 bool initializing() const;
00105
00110 Client* activeClient() const;
00111
00112
00113
00114 Client* mostRecentlyActivatedClient() const;
00115
00116 void activateClient( Client*, bool force = FALSE );
00117 void requestFocus( Client* c, bool force = FALSE );
00118 void takeActivity( Client* c, int flags, bool handled );
00119 void handleTakeActivity( Client* c, Time timestamp, int flags );
00120 bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false );
00121 void restoreFocus();
00122 void gotFocusIn( const Client* );
00123 void setShouldGetFocus( Client* );
00124 bool fakeRequestedActivity( Client* c );
00125 void unfakeActivity( Client* c );
00126 bool activateNextClient( Client* c );
00127 bool focusChangeEnabled() { return block_focus == 0; }
00128
00129 void updateColormap();
00130
00134 void setClientIsMoving( Client *c );
00135
00136 void place( Client *c, QRect& area );
00137 void placeSmart( Client* c, const QRect& area );
00138
00139 QPoint adjustClientPosition( Client* c, QPoint pos );
00140 QRect adjustClientSize( Client* c, QRect moveResizeGeom, int mode );
00141 void raiseClient( Client* c );
00142 void lowerClient( Client* c );
00143 void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp );
00144 void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
00145 void restackClientUnderActive( Client* );
00146 void updateClientLayer( Client* c );
00147 void raiseOrLowerClient( Client * );
00148 void reconfigure();
00149
00150 void clientHidden( Client* );
00151 void clientAttentionChanged( Client* c, bool set );
00152
00153 void clientMoved(const QPoint &pos, Time time);
00154
00158 int currentDesktop() const;
00162 int numberOfDesktops() const;
00163 void setNumberOfDesktops( int n );
00164
00165 QWidget* desktopWidget();
00166
00167
00168 Client* nextFocusChainClient(Client*) const;
00169 Client* previousFocusChainClient(Client*) const;
00170 Client* nextStaticClient(Client*) const;
00171 Client* previousStaticClient(Client*) const;
00172 int nextDesktopFocusChain( int iDesktop ) const;
00173 int previousDesktopFocusChain( int iDesktop ) const;
00174 void closeTabBox();
00175
00180 const ClientList& stackingOrder() const;
00181
00182 ClientList ensureStackingOrder( const ClientList& clients ) const;
00183
00184 Client* topClientOnDesktop( int desktop, bool unconstrained = false, bool only_normal = true ) const;
00185 Client* findDesktop( bool topmost, int desktop ) const;
00186 void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
00187 void windowToPreviousDesktop( Client* c );
00188 void windowToNextDesktop( Client* c );
00189
00190
00191 void showWindowMenuAt( unsigned long id, int x, int y );
00192
00197 void showWindowMenu( const QRect &pos, Client* cl );
00201 void showWindowMenu( int x, int y, Client* cl );
00202 void showWindowMenu( QPoint pos, Client* cl );
00203
00204 void updateMinimizedOfTransients( Client* );
00205 void updateOnAllDesktopsOfTransients( Client* );
00206 void checkTransients( Window w );
00207
00208 void performWindowOperation( Client* c, WindowOperation op );
00209
00210 void storeSession( KConfig* config, SMSavePhase phase );
00211
00212 SessionInfo* takeSessionInfo( Client* );
00213 WindowRules findWindowRules( const Client*, bool );
00214 void rulesUpdated();
00215 void discardUsedWindowRules( Client* c, bool withdraw );
00216 void disableRulesUpdates( bool disable );
00217 bool rulesUpdatesDisabled() const;
00218
00219
00220 void cascadeDesktop();
00221 void unclutterDesktop();
00222 void doNotManage(QString);
00223 bool setCurrentDesktop( int new_desktop );
00224 void nextDesktop();
00225 void previousDesktop();
00226 void circulateDesktopApplications();
00227
00228 QString desktopName( int desk ) const;
00229 void setDesktopLayout(int o, int x, int y);
00230 void setShowingDesktop( bool showing );
00231 void resetShowingDesktop( bool keep_hidden );
00232 bool showingDesktop() const;
00233
00234 bool isNotManaged( const QString& title );
00235
00236 void sendPingToWindow( Window w, Time timestamp );
00237 void sendTakeActivity( Client* c, Time timestamp, long flags );
00238
00239 bool kompmgrIsRunning();
00240 void setOpacity(unsigned long winId, unsigned int opacityPercent);
00241 void setShadowSize(unsigned long winId, unsigned int shadowSizePercent);
00242 void setUnshadowed(unsigned long winId);
00243
00244
00245 void removeClient( Client*, allowed_t );
00246 void setActiveClient( Client*, allowed_t );
00247 Group* findGroup( Window leader ) const;
00248 void addGroup( Group* group, allowed_t );
00249 void removeGroup( Group* group, allowed_t );
00250 Group* findClientLeaderGroup( const Client* c ) const;
00251
00252 bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
00253
00254 void focusToNull();
00255 enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate };
00256 void updateFocusChains( Client* c, FocusChainChange change );
00257
00258 bool forcedGlobalMouseGrab() const;
00259 void clientShortcutUpdated( Client* c );
00260 bool shortcutAvailable( const KShortcut& cut, Client* ignore = NULL ) const;
00261 bool globalShortcutsDisabled() const;
00262 void disableGlobalShortcuts( bool disable );
00263 void disableGlobalShortcutsForClient( bool disable );
00264
00265 void sessionSaveStarted();
00266 void sessionSaveDone();
00267 void setWasUserInteraction();
00268 bool wasUserInteraction() const;
00269 bool sessionSaving() const;
00270
00271 bool managingTopMenus() const;
00272 int topMenuHeight() const;
00273 void updateCurrentTopMenu();
00274
00275 int packPositionLeft( const Client* cl, int oldx, bool left_edge ) const;
00276 int packPositionRight( const Client* cl, int oldx, bool right_edge ) const;
00277 int packPositionUp( const Client* cl, int oldy, bool top_edge ) const;
00278 int packPositionDown( const Client* cl, int oldy, bool bottom_edge ) const;
00279
00280 static QStringList configModules(bool controlCenter);
00281
00282 void cancelDelayFocus();
00283 void requestDelayFocus( Client* );
00284
00285 void toggleTopDockShadows(bool on);
00286
00287 public slots:
00288 void refresh();
00289
00290 void slotSwitchDesktopNext();
00291 void slotSwitchDesktopPrevious();
00292 void slotSwitchDesktopRight();
00293 void slotSwitchDesktopLeft();
00294 void slotSwitchDesktopUp();
00295 void slotSwitchDesktopDown();
00296
00297 void slotSwitchToDesktop( int );
00298
00299 void slotWindowToDesktop( int );
00300
00301
00302 void slotWindowMaximize();
00303 void slotWindowMaximizeVertical();
00304 void slotWindowMaximizeHorizontal();
00305 void slotWindowMinimize();
00306 void slotWindowShade();
00307 void slotWindowRaise();
00308 void slotWindowLower();
00309 void slotWindowRaiseOrLower();
00310 void slotActivateAttentionWindow();
00311 void slotWindowPackLeft();
00312 void slotWindowPackRight();
00313 void slotWindowPackUp();
00314 void slotWindowPackDown();
00315 void slotWindowGrowHorizontal();
00316 void slotWindowGrowVertical();
00317 void slotWindowShrinkHorizontal();
00318 void slotWindowShrinkVertical();
00319
00320 void slotWalkThroughDesktops();
00321 void slotWalkBackThroughDesktops();
00322 void slotWalkThroughDesktopList();
00323 void slotWalkBackThroughDesktopList();
00324 void slotWalkThroughWindows();
00325 void slotWalkBackThroughWindows();
00326
00327 void slotWindowOperations();
00328 void slotWindowClose();
00329 void slotWindowMove();
00330 void slotWindowResize();
00331 void slotWindowAbove();
00332 void slotWindowBelow();
00333 void slotWindowOnAllDesktops();
00334 void slotWindowFullScreen();
00335 void slotWindowNoBorder();
00336
00337 void slotWindowToNextDesktop();
00338 void slotWindowToPreviousDesktop();
00339 void slotWindowToDesktopRight();
00340 void slotWindowToDesktopLeft();
00341 void slotWindowToDesktopUp();
00342 void slotWindowToDesktopDown();
00343
00344 void slotMouseEmulation();
00345 void slotDisableGlobalShortcuts();
00346
00347 void slotSettingsChanged( int category );
00348
00349 void slotReconfigure();
00350
00351 void slotKillWindow();
00352
00353 void slotGrabWindow();
00354 void slotGrabDesktop();
00355
00356 void slotSetupWindowShortcut();
00357 void setupWindowShortcutDone( bool );
00358
00359 void updateClientArea();
00360
00361
00362 void startKompmgr();
00363
00364 private slots:
00365 void desktopPopupAboutToShow();
00366 void clientPopupAboutToShow();
00367 void slotSendToDesktop( int );
00368 void clientPopupActivated( int );
00369 void configureWM();
00370 void desktopResized();
00371 void slotUpdateToolWindows();
00372 void lostTopMenuSelection();
00373 void lostTopMenuOwner();
00374 void delayFocus();
00375 void gotTemporaryRulesMessage( const QString& );
00376 void cleanupTemporaryRules();
00377 void writeWindowRules();
00378 void kipcMessage( int id, int data );
00379
00380 void setPopupClientOpacity(int v);
00381 void resetClientOpacity();
00382 void setTransButtonText(int value);
00383 void unblockKompmgrRestart();
00384 void restartKompmgr();
00385 void handleKompmgrOutput( KProcess *proc, char *buffer, int buflen);
00386 void stopKompmgr();
00387
00388
00389 protected:
00390 bool keyPressMouseEmulation( XKeyEvent& ev );
00391 bool netCheck( XEvent* e );
00392
00393 private:
00394 void init();
00395 void initShortcuts();
00396 void readShortcuts();
00397 void initDesktopPopup();
00398 void setupWindowShortcut( Client* c );
00399
00400 bool startKDEWalkThroughWindows();
00401 bool startWalkThroughDesktops( int mode );
00402 bool startWalkThroughDesktops();
00403 bool startWalkThroughDesktopList();
00404 void KDEWalkThroughWindows( bool forward );
00405 void CDEWalkThroughWindows( bool forward );
00406 void walkThroughDesktops( bool forward );
00407 void KDEOneStepThroughWindows( bool forward );
00408 void oneStepThroughDesktops( bool forward, int mode );
00409 void oneStepThroughDesktops( bool forward );
00410 void oneStepThroughDesktopList( bool forward );
00411 bool establishTabBoxGrab();
00412 void removeTabBoxGrab();
00413 int desktopToRight( int desktop ) const;
00414 int desktopToLeft( int desktop ) const;
00415 int desktopUp( int desktop ) const;
00416 int desktopDown( int desktop ) const;
00417
00418 void updateStackingOrder( bool propagate_new_clients = false );
00419 void propagateClients( bool propagate_new_clients );
00420 ClientList constrainedStackingOrder();
00421 void raiseClientWithinApplication( Client* c );
00422 void lowerClientWithinApplication( Client* c );
00423 bool allowFullClientRaising( const Client* c, Time timestamp );
00424 bool keepTransientAbove( const Client* mainwindow, const Client* transient );
00425 void blockStackingUpdates( bool block );
00426 void addTopMenu( Client* c );
00427 void removeTopMenu( Client* c );
00428 void setupTopMenuHandling();
00429 void updateTopMenuGeometry( Client* c = NULL );
00430 void updateToolWindows( bool also_hide );
00431
00432
00433 Client* createClient( Window w, bool is_mapped );
00434 void addClient( Client* c, allowed_t );
00435
00436 Window findSpecialEventWindow( XEvent* e );
00437
00438 void randomPlacement(Client* c);
00439 void smartPlacement(Client* c);
00440 void cascadePlacement(Client* c, bool re_init = false);
00441
00442 bool addSystemTrayWin( WId w );
00443 bool removeSystemTrayWin( WId w, bool check );
00444 void propagateSystemTrayWins();
00445 SystemTrayWindow findSystemTrayWin( WId w );
00446
00447
00448 void loadDesktopSettings();
00449 void saveDesktopSettings();
00450
00451
00452 WId getMouseEmulationWindow();
00453 enum MouseEmulation { EmuPress, EmuRelease, EmuMove };
00454 unsigned int sendFakedMouseEvent( QPoint pos, WId win, MouseEmulation type, int button, unsigned int state );
00455
00456 void tabBoxKeyPress( const KKeyNative& keyX );
00457 void tabBoxKeyRelease( const XKeyEvent& ev );
00458
00459
00460 void checkElectricBorders( bool force = false );
00461 void createBorderWindows();
00462 void destroyBorderWindows();
00463 bool electricBorder(XEvent * e);
00464 void raiseElectricBorders();
00465
00466
00467
00468 void helperDialog( const QString& message, const Client* c );
00469
00470 void calcDesktopLayout(int &x, int &y) const;
00471
00472 QPopupMenu* clientPopup();
00473 void closeActivePopup();
00474
00475 void updateClientArea( bool force );
00476
00477 SystemTrayWindowList systemTrayWins;
00478
00479 int current_desktop;
00480 int number_of_desktops;
00481 QMemArray<int> desktop_focus_chain;
00482
00483 QWidget* active_popup;
00484 Client* active_popup_client;
00485
00486 QWidget* desktop_widget;
00487
00488 void loadSessionInfo();
00489 void loadWindowRules();
00490 void editWindowRules( Client* c, bool whole_app );
00491
00492 QPtrList<SessionInfo> session;
00493 QValueList<Rules*> rules;
00494 KXMessages temporaryRulesMessages;
00495 QTimer rulesUpdatedTimer;
00496 bool rules_updates_disabled;
00497 static const char* windowTypeToTxt( NET::WindowType type );
00498 static NET::WindowType txtToWindowType( const char* txt );
00499 static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
00500
00501 Client* active_client;
00502 Client* last_active_client;
00503 Client* most_recently_raised;
00504 Client* movingClient;
00505 Client* pending_take_activity;
00506
00507
00508 QTimer* delayFocusTimer;
00509 Client* delayfocus_client;
00510
00511 ClientList clients;
00512 ClientList desktops;
00513
00514 ClientList unconstrained_stacking_order;
00515 ClientList stacking_order;
00516 QValueVector< ClientList > focus_chain;
00517 ClientList global_focus_chain;
00518 ClientList should_get_focus;
00519 ClientList attention_chain;
00520
00521 bool showing_desktop;
00522 ClientList showing_desktop_clients;
00523 int block_showing_desktop;
00524
00525 GroupList groups;
00526
00527 bool was_user_interaction;
00528 bool session_saving;
00529 int session_active_client;
00530 int session_desktop;
00531
00532 bool control_grab;
00533 bool tab_grab;
00534
00535
00536
00537 KShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse;
00538 KShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse;
00539 KShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse;
00540 bool mouse_emulation;
00541 unsigned int mouse_emulation_state;
00542 WId mouse_emulation_window;
00543 int block_focus;
00544
00545 TabBox* tab_box;
00546 PopupInfo* popupinfo;
00547
00548 QPopupMenu *popup;
00549 QPopupMenu *advanced_popup;
00550 QPopupMenu *desk_popup;
00551 int desk_popup_index;
00552
00553 KGlobalAccel *keys;
00554 KGlobalAccel *client_keys;
00555 ShortcutDialog* client_keys_dialog;
00556 Client* client_keys_client;
00557 KGlobalAccel *disable_shortcuts_keys;
00558 bool global_shortcuts_disabled;
00559 bool global_shortcuts_disabled_for_client;
00560
00561 WId root;
00562
00563 PluginMgr *mgr;
00564
00565 RootInfo *rootInfo;
00566 QWidget* supportWindow;
00567
00568
00569 QStringList doNotManageList;
00570
00571
00572 Colormap default_colormap;
00573 Colormap installed_colormap;
00574
00575
00576 QTimer reconfigureTimer;
00577
00578 QTimer updateToolWindowsTimer;
00579
00580 static Workspace *_self;
00581
00582 bool workspaceInit;
00583
00584 KStartupInfo* startup;
00585
00586 bool electric_have_borders;
00587 int electric_current_border;
00588 WId electric_top_border;
00589 WId electric_bottom_border;
00590 WId electric_left_border;
00591 WId electric_right_border;
00592 int electricLeft;
00593 int electricRight;
00594 int electricTop;
00595 int electricBottom;
00596 Time electric_time_first;
00597 Time electric_time_last;
00598 QPoint electric_push_point;
00599
00600 Qt::Orientation layoutOrientation;
00601 int layoutX;
00602 int layoutY;
00603
00604 Placement *initPositioning;
00605
00606 QRect* workarea;
00607 QRect** screenarea;
00608
00609 bool managing_topmenus;
00610 KSelectionOwner* topmenu_selection;
00611 KSelectionWatcher* topmenu_watcher;
00612 ClientList topmenus;
00613 mutable int topmenu_height;
00614 QWidget* topmenu_space;
00615
00616 int set_active_client_recursion;
00617 int block_stacking_updates;
00618 bool blocked_propagating_new_clients;
00619 Window null_focus_window;
00620 bool forced_global_mouse_grab;
00621 friend class StackingUpdatesBlocker;
00622
00623
00624 QSlider *transSlider;
00625 QPushButton *transButton;
00626
00627
00628
00629
00630
00631
00632 signals:
00633 void kompmgrStarted();
00634 void kompmgrStopped();
00635
00636 private:
00637 friend bool performTransiencyCheck();
00638 };
00639
00640
00641 class StackingUpdatesBlocker
00642 {
00643 public:
00644 StackingUpdatesBlocker( Workspace* w )
00645 : ws( w ) { ws->blockStackingUpdates( true ); }
00646 ~StackingUpdatesBlocker()
00647 { ws->blockStackingUpdates( false ); }
00648 private:
00649 Workspace* ws;
00650 };
00651
00652
00653 class RootInfo : public NETRootInfo4
00654 {
00655 private:
00656 typedef KWinInternal::Client Client;
00657 public:
00658 RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr= -1);
00659 protected:
00660 virtual void changeNumberOfDesktops(int n);
00661 virtual void changeCurrentDesktop(int d);
00662
00663 virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
00664 virtual void closeWindow(Window w);
00665 virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
00666 virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
00667 virtual void gotPing(Window w, Time timestamp);
00668 virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
00669 virtual void gotTakeActivity(Window w, Time timestamp, long flags );
00670 virtual void changeShowingDesktop( bool showing );
00671 private:
00672 Workspace* workspace;
00673 };
00674
00675
00676 inline WId Workspace::rootWin() const
00677 {
00678 return root;
00679 }
00680
00681 inline bool Workspace::initializing() const
00682 {
00683 return workspaceInit;
00684 }
00685
00686 inline Client* Workspace::activeClient() const
00687 {
00688 return active_client;
00689 }
00690
00691 inline Client* Workspace::mostRecentlyActivatedClient() const
00692 {
00693 return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
00694 }
00695
00696 inline int Workspace::currentDesktop() const
00697 {
00698 return current_desktop;
00699 }
00700
00701 inline int Workspace::numberOfDesktops() const
00702 {
00703 return number_of_desktops;
00704 }
00705
00706 inline void Workspace::addGroup( Group* group, allowed_t )
00707 {
00708 groups.append( group );
00709 }
00710
00711 inline void Workspace::removeGroup( Group* group, allowed_t )
00712 {
00713 groups.remove( group );
00714 }
00715
00716 inline const ClientList& Workspace::stackingOrder() const
00717 {
00718
00719 return stacking_order;
00720 }
00721
00722 inline void Workspace::showWindowMenu(QPoint pos, Client* cl)
00723 {
00724 showWindowMenu(QRect(pos, pos), cl);
00725 }
00726
00727 inline void Workspace::showWindowMenu(int x, int y, Client* cl)
00728 {
00729 showWindowMenu(QRect(QPoint(x, y), QPoint(x, y)), cl);
00730 }
00731
00732 inline
00733 void Workspace::setWasUserInteraction()
00734 {
00735 was_user_interaction = true;
00736 }
00737
00738 inline
00739 bool Workspace::wasUserInteraction() const
00740 {
00741 return was_user_interaction;
00742 }
00743
00744 inline
00745 bool Workspace::managingTopMenus() const
00746 {
00747 return managing_topmenus;
00748 }
00749
00750 inline void Workspace::sessionSaveStarted()
00751 {
00752 session_saving = true;
00753 }
00754
00755 inline void Workspace::sessionSaveDone()
00756 {
00757 session_saving = false;
00758 }
00759
00760 inline bool Workspace::sessionSaving() const
00761 {
00762 return session_saving;
00763 }
00764
00765 inline bool Workspace::forcedGlobalMouseGrab() const
00766 {
00767 return forced_global_mouse_grab;
00768 }
00769
00770 inline bool Workspace::showingDesktop() const
00771 {
00772 return showing_desktop;
00773 }
00774
00775 inline bool Workspace::globalShortcutsDisabled() const
00776 {
00777 return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
00778 }
00779
00780 inline
00781 bool Workspace::rulesUpdatesDisabled() const
00782 {
00783 return rules_updates_disabled;
00784 }
00785
00786 template< typename T >
00787 inline Client* Workspace::findClient( T predicate )
00788 {
00789 if( Client* ret = findClientInList( clients, predicate ))
00790 return ret;
00791 if( Client* ret = findClientInList( desktops, predicate ))
00792 return ret;
00793 return NULL;
00794 }
00795
00796 template< typename T1, typename T2 >
00797 inline void Workspace::forEachClient( T1 procedure, T2 predicate )
00798 {
00799 for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
00800 if ( predicate( const_cast< const Client* >( *it)))
00801 procedure( *it );
00802 for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
00803 if ( predicate( const_cast< const Client* >( *it)))
00804 procedure( *it );
00805 }
00806
00807 template< typename T >
00808 inline void Workspace::forEachClient( T procedure )
00809 {
00810 return forEachClient( procedure, TruePredicate());
00811 }
00812
00813 KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
00814 inline bool Workspace::hasClient( const Client* c )
00815 {
00816 return findClient( ClientMatchPredicate( c ));
00817 }
00818
00819 }
00820
00821 #endif