• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kwin
 

kwin

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

kwin

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

kwin

Skip menu "kwin"
  • kate
  • kwin
  •   lib
  • libkonq
Generated for kwin by doxygen 1.5.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |