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