client.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_CLIENT_H
00013 #define KWIN_CLIENT_H
00014 
00015 #include <qframe.h>
00016 #include <qvbox.h>
00017 #include <qpixmap.h>
00018 #include <netwm.h>
00019 #include <kdebug.h>
00020 #include <assert.h>
00021 #include <kshortcut.h>
00022 #include <X11/X.h>
00023 #include <X11/Xlib.h>
00024 #include <X11/Xutil.h>
00025 #include <fixx11h.h>
00026 
00027 #include "utils.h"
00028 #include "options.h"
00029 #include "workspace.h"
00030 #include "kdecoration.h"
00031 #include "rules.h"
00032 
00033 class QTimer;
00034 class KProcess;
00035 class KStartupInfoData;
00036 
00037 namespace KWinInternal
00038 {
00039 
00040 class Workspace;
00041 class Client;
00042 class WinInfo;
00043 class SessionInfo;
00044 class Bridge;
00045 
00046 class Client : public QObject, public KDecorationDefines
00047     {
00048     Q_OBJECT
00049     public:
00050         Client( Workspace *ws );
00051         Window window() const;
00052         Window frameId() const;
00053         Window wrapperId() const;
00054         Window decorationId() const;
00055 
00056         Workspace* workspace() const;
00057         const Client* transientFor() const;
00058         Client* transientFor();
00059         bool isTransient() const;
00060         bool groupTransient() const;
00061         bool wasOriginallyGroupTransient() const;
00062         ClientList mainClients() const; // call once before loop , is not indirect
00063         bool hasTransient( const Client* c, bool indirect ) const;
00064         const ClientList& transients() const; // is not indirect
00065         void checkTransient( Window w );
00066         Client* findModal();
00067         const Group* group() const;
00068         Group* group();
00069         void checkGroup( Group* gr = NULL, bool force = false );
00070     // prefer isXXX() instead
00071         NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
00072         const WindowRules* rules() const;
00073         void removeRule( Rules* r );
00074         void setupWindowRules( bool ignore_temporary );
00075         void applyWindowRules();
00076 
00077         QRect geometry() const;
00078         QSize size() const;
00079         QSize minSize() const;
00080         QSize maxSize() const;
00081         QPoint pos() const;
00082         QRect rect() const;
00083         int x() const;
00084         int y() const;
00085         int width() const;
00086         int height() const;
00087         QPoint clientPos() const; // inside of geometry()
00088         QSize clientSize() const;
00089 
00090         bool windowEvent( XEvent* e );
00091         virtual bool eventFilter( QObject* o, QEvent* e );
00092 
00093         bool manage( Window w, bool isMapped );
00094 
00095         void releaseWindow( bool on_shutdown = false );
00096 
00097         enum Sizemode // how to resize the window in order to obey constains (mainly aspect ratios)
00098             {
00099             SizemodeAny,
00100             SizemodeFixedW, // try not to affect width
00101             SizemodeFixedH, // try not to affect height
00102             SizemodeMax // try not to make it larger in either direction
00103             };
00104         QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
00105         QSize adjustedSize() const;
00106 
00107         QPixmap icon() const;
00108         QPixmap miniIcon() const;
00109 
00110         bool isActive() const;
00111         void setActive( bool, bool updateOpacity = true );
00112 
00113         int desktop() const;
00114         void setDesktop( int );
00115         bool isOnDesktop( int d ) const;
00116         bool isOnCurrentDesktop() const;
00117         bool isOnAllDesktops() const;
00118         void setOnAllDesktops( bool set );
00119 
00120     // !isMinimized() && not hidden, i.e. normally visible on some virtual desktop
00121         bool isShown( bool shaded_is_shown ) const;
00122 
00123         bool isShade() const; // true only for ShadeNormal
00124         ShadeMode shadeMode() const; // prefer isShade()
00125         void setShade( ShadeMode mode );
00126         bool isShadeable() const;
00127 
00128         bool isMinimized() const;
00129         bool isMaximizable() const;
00130         QRect geometryRestore() const;
00131         MaximizeMode maximizeModeRestore() const;
00132         MaximizeMode maximizeMode() const;
00133         bool isMinimizable() const;
00134         void setMaximize( bool vertically, bool horizontally );
00135 
00136         void setFullScreen( bool set, bool user );
00137         bool isFullScreen() const;
00138         bool isFullScreenable( bool fullscreen_hack = false ) const;
00139         bool userCanSetFullScreen() const;
00140         QRect geometryFSRestore() const { return geom_fs_restore; } // only for session saving
00141         int fullScreenMode() const { return fullscreen_mode; } // only for session saving
00142 
00143         bool isUserNoBorder() const;
00144         void setUserNoBorder( bool set );
00145         bool userCanSetNoBorder() const;
00146         bool noBorder() const;
00147 
00148         bool skipTaskbar( bool from_outside = false ) const;
00149         void setSkipTaskbar( bool set, bool from_outside );
00150 
00151         bool skipPager() const;
00152         void setSkipPager( bool );
00153 
00154         bool keepAbove() const;
00155         void setKeepAbove( bool );
00156         bool keepBelow() const;
00157         void setKeepBelow( bool );
00158         Layer layer() const;
00159         Layer belongsToLayer() const;
00160         void invalidateLayer();
00161 
00162         void setModal( bool modal );
00163         bool isModal() const;
00164 
00165     // auxiliary functions, depend on the windowType
00166         bool wantsTabFocus() const;
00167         bool wantsInput() const;
00168         bool hasNETSupport() const;
00169         bool isMovable() const;
00170         bool isDesktop() const;
00171         bool isDock() const;
00172         bool isToolbar() const;
00173         bool isTopMenu() const;
00174         bool isMenu() const;
00175         bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
00176         bool isDialog() const;
00177         bool isSplash() const;
00178         bool isUtility() const;
00179     // returns true for "special" windows and false for windows which are "normal"
00180     // (normal=window which has a border, can be moved by the user, can be closed, etc.)
00181     // true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
00182     // false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
00183         bool isSpecialWindow() const;
00184 
00185         bool isResizable() const;
00186         bool isCloseable() const; // may be closed by the user (may have a close button)
00187 
00188         void takeActivity( int flags, bool handled, allowed_t ); // takes ActivityFlags as arg (in utils.h)
00189         void takeFocus( allowed_t );
00190         void demandAttention( bool set = true );
00191 
00192         void setMask( const QRegion& r, int mode = X::Unsorted );
00193         QRegion mask() const;
00194 
00195         void updateDecoration( bool check_workspace_pos, bool force = false );
00196         void checkBorderSizes();
00197 
00198     // shape extensions
00199         bool shape() const;
00200         void updateShape();
00201 
00202         void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
00203         void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
00204         void move( int x, int y, ForceGeometry_t force = NormalGeometrySet );
00205         void move( const QPoint & p, ForceGeometry_t force = NormalGeometrySet );
00206         // plainResize() simply resizes
00207         void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet );
00208         void plainResize( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
00209         // resizeWithChecks() resizes according to gravity, and checks workarea position
00210         void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
00211         void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
00212         void keepInArea( QRect area, bool partial = false );
00213 
00214         void growHorizontal();
00215         void shrinkHorizontal();
00216         void growVertical();
00217         void shrinkVertical();
00218 
00219         bool providesContextHelp() const;
00220         KShortcut shortcut() const;
00221         void setShortcut( const QString& cut );
00222 
00223         bool performMouseCommand( Options::MouseCommand, QPoint globalPos, bool handled = false );
00224 
00225         QCString windowRole() const;
00226         QCString sessionId();
00227         QCString resourceName() const;
00228         QCString resourceClass() const;
00229         QCString wmCommand();
00230         QCString wmClientMachine( bool use_localhost ) const;
00231         Window   wmClientLeader() const;
00232         pid_t pid() const;
00233 
00234         QRect adjustedClientArea( const QRect& desktop, const QRect& area ) const;
00235 
00236         Colormap colormap() const;
00237 
00238     // updates visibility depending on being shaded, virtual desktop, etc.
00239         void updateVisibility();
00240     // hides a client - basically like minimize, but without effects, it's simply hidden
00241         void hideClient( bool hide );
00242 
00243         QString caption( bool full = true ) const;
00244         void updateCaption();
00245 
00246         void keyPressEvent( uint key_code ); // FRAME ??
00247         void updateMouseGrab();
00248         Window moveResizeGrabWindow() const;
00249 
00250         const QPoint calculateGravitation( bool invert, int gravity = 0 ) const; // FRAME public?
00251 
00252         void NETMoveResize( int x_root, int y_root, NET::Direction direction );
00253         void NETMoveResizeWindow( int flags, int x, int y, int width, int height );
00254         void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp, bool send_event = false );
00255         
00256         void gotPing( Time timestamp );
00257 
00258         static QCString staticWindowRole(WId);
00259         static QCString staticSessionId(WId);
00260         static QCString staticWmCommand(WId);
00261         static QCString staticWmClientMachine(WId);
00262         static Window   staticWmClientLeader(WId);
00263 
00264         void checkWorkspacePosition();
00265         void updateUserTime( Time time = CurrentTime );
00266         Time userTime() const;
00267         bool hasUserTimeSupport() const;
00268         bool ignoreFocusStealing() const;
00269 
00270     // does 'delete c;'
00271         static void deleteClient( Client* c, allowed_t );
00272 
00273         static bool resourceMatch( const Client* c1, const Client* c2 );
00274         static bool belongToSameApplication( const Client* c1, const Client* c2, bool active_hack = false );
00275         static void readIcons( Window win, QPixmap* icon, QPixmap* miniicon );
00276 
00277         void minimize( bool avoid_animation = false );
00278         void unminimize( bool avoid_animation = false );
00279         void closeWindow();
00280         void killWindow();
00281         void maximize( MaximizeMode );
00282         void toggleShade();
00283         void showContextHelp();
00284         void cancelShadeHover();
00285         void cancelAutoRaise();
00286         void destroyClient();
00287         void checkActiveModal();
00288         void setOpacity(bool translucent, uint opacity = 0);
00289         void setShadowSize(uint shadowSize);
00290         void updateOpacity();
00291         void updateShadowSize();
00292         bool hasCustomOpacity(){return custom_opacity;}
00293         void setCustomOpacityFlag(bool custom = true);
00294         bool getWindowOpacity();
00295         int opacityPercentage();
00296         void checkAndSetInitialRuledOpacity();
00297         uint ruleOpacityInactive();
00298         uint ruleOpacityActive();
00299         unsigned int opacity();
00300         bool isBMP();
00301         void setBMP(bool b);
00302         bool touches(const Client* c);
00303         void setShapable(bool b);
00304         bool hasStrut() const;
00305 
00306     private slots:
00307         void autoRaise();
00308         void shadeHover();
00309         void shortcutActivated();
00310 
00311     private:
00312         friend class Bridge; // FRAME
00313         virtual void processMousePressEvent( QMouseEvent* e );
00314 
00315     private: // TODO cleanup the order of things in the .h file
00316     // use Workspace::createClient()
00317         virtual ~Client(); // use destroyClient() or releaseWindow()
00318 
00319         Position mousePosition( const QPoint& ) const;
00320         void setCursor( Position m );
00321         void setCursor( const QCursor& c );
00322 
00323         void  animateMinimizeOrUnminimize( bool minimize );
00324         QPixmap animationPixmap( int w );
00325     // transparent stuff
00326         void drawbound( const QRect& geom );
00327         void clearbound();
00328         void doDrawbound( const QRect& geom, bool clear );
00329 
00330     // handlers for X11 events
00331         bool mapRequestEvent( XMapRequestEvent* e );
00332         void unmapNotifyEvent( XUnmapEvent*e );
00333         void destroyNotifyEvent( XDestroyWindowEvent*e );
00334         void configureRequestEvent( XConfigureRequestEvent* e );
00335         void propertyNotifyEvent( XPropertyEvent* e );
00336         void clientMessageEvent( XClientMessageEvent* e );
00337         void enterNotifyEvent( XCrossingEvent* e );
00338         void leaveNotifyEvent( XCrossingEvent* e );
00339         void focusInEvent( XFocusInEvent* e );
00340         void focusOutEvent( XFocusOutEvent* e );
00341 
00342         bool buttonPressEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
00343         bool buttonReleaseEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
00344         bool motionNotifyEvent( Window w, int state, int x, int y, int x_root, int y_root );
00345 
00346         void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
00347 
00348     private slots:
00349         void pingTimeout();
00350         void processKillerExited();
00351         void demandAttentionKNotify();
00352 
00353     private:
00354     // ICCCM 4.1.3.1, 4.1.4 , NETWM 2.5.1
00355         void setMappingState( int s );
00356         int mappingState() const;
00357         bool isIconicState() const;
00358         bool isNormalState() const;
00359         bool isManaged() const; // returns false if this client is not yet managed
00360         void updateAllowedActions( bool force = false );
00361         QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny, bool noframe = false ) const;
00362         void changeMaximize( bool horizontal, bool vertical, bool adjust );
00363         void checkMaximizeGeometry();
00364         int checkFullScreenHack( const QRect& geom ) const; // 0 - none, 1 - one xinerama screen, 2 - full area
00365         void updateFullScreenHack( const QRect& geom );
00366         void getWmNormalHints();
00367         void getMotifHints();
00368         void getIcons();
00369         void getWmClientLeader();
00370         void getWmClientMachine();
00371         void fetchName();
00372         void fetchIconicName();
00373         QString readName() const;
00374         void setCaption( const QString& s, bool force = false );
00375         bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
00376         void updateWindowRules();
00377         void finishWindowRules();
00378         void setShortcutInternal( const KShortcut& cut );
00379 
00380         void updateWorkareaDiffs();
00381         void checkDirection( int new_diff, int old_diff, QRect& rect, const QRect& area );
00382         static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
00383         void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
00384         NETExtendedStrut strut() const;
00385         int checkShadeGeometry( int w, int h );
00386         void postponeGeometryUpdates( bool postpone );
00387 
00388         bool startMoveResize();
00389         void finishMoveResize( bool cancel );
00390         void leaveMoveResize();
00391         void checkUnrestrictedMoveResize();
00392         void handleMoveResize( int x, int y, int x_root, int y_root );
00393         void positionGeometryTip();
00394         void grabButton( int mod );
00395         void ungrabButton( int mod );
00396         void resetMaximize();
00397         void resizeDecoration( const QSize& s );
00398         void setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth);
00399         void unsetDecoHashProperty();
00400 
00401         void pingWindow();
00402         void killProcess( bool ask, Time timestamp = CurrentTime );
00403         void updateUrgency();
00404         static void sendClientMessage( Window w, Atom a, Atom protocol,
00405             long data1 = 0, long data2 = 0, long data3 = 0 );
00406 
00407         void embedClient( Window w, const XWindowAttributes &attr );    
00408         void detectNoBorder();
00409         void detectShapable();
00410         void destroyDecoration();
00411         void updateFrameExtents();
00412 
00413         void rawShow(); // just shows it
00414         void rawHide(); // just hides it
00415 
00416         Time readUserTimeMapTimestamp( const KStartupInfoId* asn_id, const KStartupInfoData* asn_data,
00417             bool session ) const;
00418         Time readUserCreationTime() const;
00419         static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );
00420         void startupIdChanged();
00421 
00422         Window client;
00423         Window wrapper;
00424         Window frame;
00425         KDecoration* decoration;
00426         Workspace* wspace;
00427         Bridge* bridge;
00428         int desk;
00429         bool buttonDown;
00430         bool moveResizeMode;
00431         bool move_faked_activity;
00432         Window move_resize_grab_window;
00433         bool unrestrictedMoveResize;
00434         bool isMove() const 
00435             {
00436             return moveResizeMode && mode == PositionCenter;
00437             }
00438         bool isResize() const 
00439             {
00440             return moveResizeMode && mode != PositionCenter;
00441             }
00442 
00443         Position mode;
00444         QPoint moveOffset;
00445         QPoint invertedMoveOffset;
00446         QRect moveResizeGeom;
00447         QRect initialMoveResizeGeom;
00448         XSizeHints  xSizeHint;
00449         void sendSyntheticConfigureNotify();
00450         int mapping_state;
00451         void readTransient();
00452         Window verifyTransientFor( Window transient_for, bool set );
00453         void addTransient( Client* cl );
00454         void removeTransient( Client* cl );
00455         void removeFromMainClients();
00456         void cleanGrouping();
00457         void checkGroupTransients();
00458         void setTransient( Window new_transient_for_id );
00459         Client* transient_for;
00460         Window transient_for_id;
00461         Window original_transient_for_id;
00462         ClientList transients_list; // SELI make this ordered in stacking order?
00463         ShadeMode shade_mode;
00464         uint active :1;
00465         uint deleting : 1; // true when doing cleanup and destroying the client
00466         uint keep_above : 1; // NET::KeepAbove (was stays_on_top)
00467         uint is_shape :1;
00468         uint skip_taskbar :1;
00469         uint original_skip_taskbar :1; // unaffected by KWin
00470         uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
00471         uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
00472         uint Ptakeactivity : 1; // does it support _NET_WM_TAKE_ACTIVITY
00473         uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol?
00474         uint Pping : 1; // does it support _NET_WM_PING?
00475         uint input :1; // does the window want input in its wm_hints
00476         uint skip_pager : 1;
00477         uint motif_noborder : 1;
00478         uint motif_may_resize : 1;
00479         uint motif_may_move :1;
00480         uint motif_may_close : 1;
00481         uint keep_below : 1; // NET::KeepBelow
00482         uint minimized : 1;
00483         uint hidden : 1; // forcibly hidden by calling hide()
00484         uint modal : 1; // NET::Modal
00485         uint noborder : 1;
00486         uint user_noborder : 1;
00487         uint urgency : 1; // XWMHints, UrgencyHint
00488         uint ignore_focus_stealing : 1; // don't apply focus stealing prevention to this client
00489         uint demands_attention : 1;
00490         WindowRules client_rules;
00491         void getWMHints();
00492         void readIcons();
00493         void getWindowProtocols();
00494         QPixmap icon_pix;
00495         QPixmap miniicon_pix;
00496         QCursor cursor;
00497     // FullScreenHack - non-NETWM fullscreen (noborder,size of desktop)
00498     // DON'T reorder - saved to config files !!!
00499         enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
00500         FullScreenMode fullscreen_mode;
00501         MaximizeMode max_mode;
00502         QRect geom_restore;
00503         QRect geom_fs_restore;
00504         MaximizeMode maxmode_restore;
00505         int workarea_diff_x, workarea_diff_y;
00506         WinInfo* info;
00507         QTimer* autoRaiseTimer;
00508         QTimer* shadeHoverTimer;
00509         Colormap cmap;
00510         QCString resource_name;
00511         QCString resource_class;
00512         QCString client_machine;
00513         QString cap_normal, cap_iconic, cap_suffix;
00514         WId wmClientLeaderWin;
00515         QCString window_role;
00516         Group* in_group;
00517         Window window_group;
00518         Layer in_layer;
00519         QTimer* ping_timer;
00520         KProcess* process_killer;
00521         Time ping_timestamp;
00522         Time user_time;
00523         unsigned long allowed_actions;
00524         QRect frame_geometry;
00525         QSize client_size;
00526         int postpone_geometry_updates; // >0 - new geometry is remembered, but not actually set
00527         bool pending_geometry_update;
00528         bool shade_geometry_change;
00529         int border_left, border_right, border_top, border_bottom;
00530         QRegion _mask;
00531         static bool check_active_modal; // see Client::checkActiveModal()
00532         KShortcut _shortcut;
00533         friend struct FetchNameInternalPredicate;
00534         friend struct CheckIgnoreFocusStealingProcedure;
00535         friend struct ResetupRulesProcedure;
00536         friend class GeometryUpdatesPostponer;
00537         void show() { assert( false ); } // SELI remove after Client is no longer QWidget
00538         void hide() { assert( false ); }
00539         uint opacity_;
00540         uint savedOpacity_;
00541         bool custom_opacity;
00542         uint rule_opacity_active; //translucency rules
00543         uint rule_opacity_inactive; //dto.
00544         //int shadeOriginalHeight;
00545         bool isBMP_;
00546         QTimer* demandAttentionKNotifyTimer;
00547     };
00548 
00549 // helper for Client::postponeGeometryUpdates() being called in pairs (true/false)
00550 class GeometryUpdatesPostponer
00551     {
00552     public:
00553         GeometryUpdatesPostponer( Client* c )
00554             : cl( c ) { cl->postponeGeometryUpdates( true ); }
00555         ~GeometryUpdatesPostponer()
00556             { cl->postponeGeometryUpdates( false ); }
00557     private:
00558         Client* cl;
00559     };
00560 
00561 
00562 // NET WM Protocol handler class
00563 class WinInfo : public NETWinInfo
00564     {
00565     private:
00566         typedef KWinInternal::Client Client; // because of NET::Client
00567     public:
00568         WinInfo( Client* c, Display * display, Window window,
00569                 Window rwin, const unsigned long pr[], int pr_size );
00570         virtual void changeDesktop(int desktop);
00571         virtual void changeState( unsigned long state, unsigned long mask );
00572     private:
00573         Client * m_client;
00574     };
00575 
00576 inline Window Client::window() const
00577     {
00578     return client;
00579     }
00580 
00581 inline Window Client::frameId() const
00582     {
00583     return frame;
00584     }
00585 
00586 inline Window Client::wrapperId() const
00587     {
00588     return wrapper;
00589     }
00590 
00591 inline Window Client::decorationId() const
00592     {
00593     return decoration != NULL ? decoration->widget()->winId() : None;
00594     }
00595 
00596 inline Workspace* Client::workspace() const
00597     {
00598     return wspace;
00599     }
00600 
00601 inline const Client* Client::transientFor() const
00602     {
00603     return transient_for;
00604     }
00605 
00606 inline Client* Client::transientFor()
00607     {
00608     return transient_for;
00609     }
00610 
00611 inline bool Client::groupTransient() const
00612     {
00613     return transient_for_id == workspace()->rootWin();
00614     }
00615 
00616 // needed because verifyTransientFor() may set transient_for_id to root window,
00617 // if the original value has a problem (window doesn't exist, etc.)
00618 inline bool Client::wasOriginallyGroupTransient() const
00619     {
00620     return original_transient_for_id == workspace()->rootWin();
00621     }
00622 
00623 inline bool Client::isTransient() const
00624     {
00625     return transient_for_id != None;
00626     }
00627 
00628 inline const ClientList& Client::transients() const
00629     {
00630     return transients_list;
00631     }
00632 
00633 inline const Group* Client::group() const
00634     {
00635     return in_group;
00636     }
00637 
00638 inline Group* Client::group()
00639     {
00640     return in_group;
00641     }
00642 
00643 inline int Client::mappingState() const
00644     {
00645     return mapping_state;
00646     }
00647 
00648 inline QCString Client::resourceName() const
00649     {
00650     return resource_name; // it is always lowercase
00651     }
00652 
00653 inline QCString Client::resourceClass() const
00654     {
00655     return resource_class; // it is always lowercase
00656     }
00657 
00658 inline
00659 bool Client::isMinimized() const
00660     {
00661     return minimized;
00662     }
00663 
00664 inline bool Client::isActive() const
00665     {
00666     return active;
00667     }
00668 
00675 inline int Client::desktop() const
00676     {
00677     return desk;
00678     }
00679 
00680 inline bool Client::isOnAllDesktops() const
00681     {
00682     return desk == NET::OnAllDesktops;
00683     }
00688 inline bool Client::isOnDesktop( int d ) const
00689     {
00690     return desk == d || /*desk == 0 ||*/ isOnAllDesktops();
00691     }
00692 
00693 inline
00694 bool Client::isShown( bool shaded_is_shown ) const
00695     {
00696     return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
00697     }
00698 
00699 inline
00700 bool Client::isShade() const
00701     {
00702     return shade_mode == ShadeNormal;
00703     }
00704 
00705 inline
00706 ShadeMode Client::shadeMode() const
00707     {
00708     return shade_mode;
00709     }
00710 
00711 inline QPixmap Client::icon() const
00712     {
00713     return icon_pix;
00714     }
00715 
00716 inline QPixmap Client::miniIcon() const
00717     {
00718     return miniicon_pix;
00719     }
00720 
00721 inline QRect Client::geometryRestore() const
00722     {
00723     return geom_restore;
00724     }
00725 
00726 inline Client::MaximizeMode Client::maximizeModeRestore() const
00727     {
00728     return maxmode_restore;
00729     }
00730 
00731 inline Client::MaximizeMode Client::maximizeMode() const
00732     {
00733     return max_mode;
00734     }
00735 
00736 inline bool Client::skipTaskbar( bool from_outside ) const
00737     {
00738     return from_outside ? original_skip_taskbar : skip_taskbar;
00739     }
00740 
00741 inline bool Client::skipPager() const
00742     {
00743     return skip_pager;
00744     }
00745 
00746 inline bool Client::keepAbove() const
00747     {
00748     return keep_above;
00749     }
00750 
00751 inline bool Client::keepBelow() const
00752     {
00753     return keep_below;
00754     }
00755 
00756 inline bool Client::shape() const
00757     {
00758     return is_shape;
00759     }
00760 
00761 
00762 inline bool Client::isFullScreen() const
00763     {
00764     return fullscreen_mode != FullScreenNone;
00765     }
00766 
00767 inline bool Client::isModal() const
00768     {
00769     return modal;
00770     }
00771 
00772 inline bool Client::hasNETSupport() const
00773     {
00774     return info->hasNETSupport();
00775     }
00776 
00777 inline Colormap Client::colormap() const
00778     {
00779     return cmap;
00780     }
00781 
00782 inline pid_t Client::pid() const
00783     {
00784     return info->pid();
00785     }
00786 
00787 inline void Client::invalidateLayer()
00788     {
00789     in_layer = UnknownLayer;
00790     }
00791 
00792 inline bool Client::isIconicState() const
00793     {
00794     return mapping_state == IconicState;
00795     }
00796 
00797 inline bool Client::isNormalState() const
00798     {
00799     return mapping_state == NormalState;
00800     }
00801 
00802 inline bool Client::isManaged() const
00803     {
00804     return mapping_state != WithdrawnState;
00805     }
00806 
00807 inline QCString Client::windowRole() const
00808     {
00809     return window_role;
00810     }
00811 
00812 inline QRect Client::geometry() const
00813     {
00814     return frame_geometry;
00815     }
00816 
00817 inline QSize Client::size() const
00818     {
00819     return frame_geometry.size();
00820     }
00821 
00822 inline QPoint Client::pos() const
00823     {
00824     return frame_geometry.topLeft();
00825     }
00826 
00827 inline int Client::x() const
00828     {
00829     return frame_geometry.x();
00830     }
00831 
00832 inline int Client::y() const
00833     {
00834     return frame_geometry.y();
00835     }
00836 
00837 inline int Client::width() const
00838     {
00839     return frame_geometry.width();
00840     }
00841 
00842 inline int Client::height() const
00843     {
00844     return frame_geometry.height();
00845     }
00846 
00847 inline QRect Client::rect() const
00848     {
00849     return QRect( 0, 0, width(), height());
00850     }
00851 
00852