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

twin

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

twin

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

twin

Skip menu "twin"
  • kate
  • libkonq
  • twin
  •   lib
Generated for twin by doxygen 1.7.1
This website is maintained by Timothy Pearson.