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