kwin Library API Documentation

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