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