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