• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • @topname@
  • Sitemap
  • Contact Us
 

kwin

workspace.h

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

kwin

Skip menu "kwin"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

@topname@

Skip menu "@topname@"
  • kate
  • kwin
  •   lib
  • libkonq
Generated for @topname@ by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal