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