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