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