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