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

twin

  • twin
client.h
1 /*****************************************************************
2  KWin - the KDE window manager
3  This file is part of the KDE project.
4 
5 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7 
8 You can Freely distribute this program under the GNU General Public
9 License. See the file "COPYING" for the exact licensing terms.
10 ******************************************************************/
11 
12 #ifndef KWIN_CLIENT_H
13 #define KWIN_CLIENT_H
14 
15 #include <tqframe.h>
16 #include <tqvbox.h>
17 #include <tqpixmap.h>
18 #include <netwm.h>
19 #include <kdebug.h>
20 #include <assert.h>
21 #include <tdeshortcut.h>
22 #include <X11/X.h>
23 #include <X11/Xlib.h>
24 #include <X11/Xutil.h>
25 #include <fixx11h.h>
26 
27 #include "utils.h"
28 #include "options.h"
29 #include "workspace.h"
30 #include "kdecoration.h"
31 #include "rules.h"
32 
33 class TQTimer;
34 class TDEProcess;
35 class TDEStartupInfoData;
36 
37 namespace KWinInternal
38 {
39 
40 class Workspace;
41 class Client;
42 class WinInfo;
43 class SessionInfo;
44 class Bridge;
45 
46 class Client : public TQObject, public KDecorationDefines
47  {
48  TQ_OBJECT
49  public:
50  Client( Workspace *ws );
51  Window window() const;
52  Window frameId() const;
53  Window wrapperId() const;
54  Window decorationId() const;
55 
56  Workspace* workspace() const;
57  const Client* transientFor() const;
58  Client* transientFor();
59  bool isTransient() const;
60  bool isModalSystemNotification() const;
61  bool groupTransient() const;
62  bool wasOriginallyGroupTransient() const;
63  ClientList mainClients() const; // call once before loop , is not indirect
64  bool hasTransient( const Client* c, bool indirect ) const;
65  const ClientList& transients() const; // is not indirect
66  void checkTransient( Window w );
67  Client* findModal();
68  const Group* group() const;
69  Group* group();
70  void checkGroup( Group* gr = NULL, bool force = false );
71  void changeClientLeaderGroup( Group* gr );
72  // prefer isXXX() instead
73  NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
74  const WindowRules* rules() const;
75  void removeRule( Rules* r );
76  void setupWindowRules( bool ignore_temporary );
77  void applyWindowRules();
78  void updateWindowRules();
79 
80  TQRect geometry() const;
81  TQSize size() const;
82  TQSize minSize() const;
83  TQSize maxSize() const;
84  TQPoint pos() const;
85  TQRect rect() const;
86  int x() const;
87  int y() const;
88  int width() const;
89  int height() const;
90  TQPoint clientPos() const; // inside of geometry()
91  TQSize clientSize() const;
92 
93  bool windowEvent( XEvent* e );
94  virtual bool eventFilter( TQObject* o, TQEvent* e );
95 
96  bool manage( Window w, bool isMapped );
97 
98  void releaseWindow( bool on_shutdown = false );
99 
100  enum Sizemode // how to resize the window in order to obey constains (mainly aspect ratios)
101  {
102  SizemodeAny,
103  SizemodeFixedW, // try not to affect width
104  SizemodeFixedH, // try not to affect height
105  SizemodeMax // try not to make it larger in either direction
106  };
107  TQSize adjustedSize( const TQSize&, Sizemode mode = SizemodeAny ) const;
108  TQSize adjustedSize() const;
109 
110  TQPixmap icon() const;
111  TQPixmap miniIcon() const;
112 
113  bool isActive() const;
114  void setActive( bool, bool updateOpacity = true );
115 
116  bool isSuspendable() const;
117  bool isResumeable() const;
118 
119  int desktop() const;
120  void setDesktop( int );
121  bool isOnDesktop( int d ) const;
122  bool isOnCurrentDesktop() const;
123  bool isOnAllDesktops() const;
124  void setOnAllDesktops( bool set );
125 
126  bool isOnScreen( int screen ) const; // true if it's at least partially there
127  int screen() const; // the screen where the center is
128 
129  // !isMinimized() && not hidden, i.e. normally visible on some virtual desktop
130  bool isShown( bool shaded_is_shown ) const;
131 
132  bool isShade() const; // true only for ShadeNormal
133  ShadeMode shadeMode() const; // prefer isShade()
134  void setShade( ShadeMode mode );
135  bool isShadeable() const;
136 
137  bool isMinimized() const;
138  bool isMaximizable() const;
139  TQRect geometryRestore() const;
140  MaximizeMode maximizeModeRestore() const;
141  MaximizeMode maximizeMode() const;
142  bool isMinimizable() const;
143  void setMaximize( bool vertically, bool horizontally );
144 
145  void setFullScreen( bool set, bool user );
146  bool isFullScreen() const;
147  bool isFullScreenable( bool fullscreen_hack = false ) const;
148  bool userCanSetFullScreen() const;
149  TQRect geometryFSRestore() const { return geom_fs_restore; } // only for session saving
150  int fullScreenMode() const { return fullscreen_mode; } // only for session saving
151 
152  bool isUserNoBorder() const;
153  void setUserNoBorder( bool set ); // BCI: merge with bellow
154  void setUserNoBorder( bool set, bool force /* =true */ );
155  bool userCanSetNoBorder() const;
156  bool isUserNoBorderForced() const;
157  bool noBorder() const;
158 
159  bool skipTaskbar( bool from_outside = false ) const;
160  void setSkipTaskbar( bool set, bool from_outside );
161 
162  bool skipPager() const;
163  void setSkipPager( bool );
164 
165  bool keepAbove() const;
166  void setKeepAbove( bool );
167  bool keepBelow() const;
168  void setKeepBelow( bool );
169  Layer layer() const;
170  Layer belongsToLayer() const;
171  void invalidateLayer();
172 
173  void setModal( bool modal );
174  bool isModal() const;
175 
176  // auxiliary functions, depend on the windowType
177  bool wantsTabFocus() const;
178  bool wantsInput() const;
179  bool hasNETSupport() const;
180  bool isMovable() const;
181  bool isDesktop() const;
182  bool isDock() const;
183  bool isToolbar() const;
184  bool isTopMenu() const;
185  bool isMenu() const;
186  bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
187  bool isDialog() const;
188  bool isSplash() const;
189  bool isUtility() const;
190  // returns true for "special" windows and false for windows which are "normal"
191  // (normal=window which has a border, can be moved by the user, can be closed, etc.)
192  // true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
193  // false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
194  bool isSpecialWindow() const;
195 
196  bool isResizable() const;
197  bool isCloseable() const; // may be closed by the user (may have a close button)
198 
199  void takeActivity( int flags, bool handled, allowed_t ); // takes ActivityFlags as arg (in utils.h)
200  void takeFocus( allowed_t );
201  void demandAttention( bool set = true );
202 
203  void setMask( const TQRegion& r, int mode = X::Unsorted );
204  TQRegion mask() const;
205 
206  void updateDecoration( bool check_workspace_pos, bool force = false );
207  void checkBorderSizes();
208 
209  // drop shadow
210  bool isShadowed() const;
211  void setShadowed(bool shadowed);
212  Window shadowId() const;
213  // Aieee, a friend function! Unpleasant, yes, but it's needed by
214  // raiseClient() to redraw a window's shadow when it is active prior to
215  // being raised.
216  friend void Workspace::raiseClient(Client *);
217  // Wouldn't you know it, friend functions breed. This one's needed to
218  // enable a DCOP function that causes all shadows obscuring a changed
219  // window to be redrawn.
220  friend void Workspace::updateOverlappingShadows(WId);
221 
222  // shape extensions
223  bool shape() const;
224  void updateShape();
225 
226  void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
227  void setGeometry( const TQRect& r, ForceGeometry_t force = NormalGeometrySet );
228  void move( int x, int y, ForceGeometry_t force = NormalGeometrySet );
229  void move( const TQPoint & p, ForceGeometry_t force = NormalGeometrySet );
230  // plainResize() simply resizes
231  void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet );
232  void plainResize( const TQSize& s, ForceGeometry_t force = NormalGeometrySet );
233  // resizeWithChecks() resizes according to gravity, and checks workarea position
234  void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
235  void resizeWithChecks( const TQSize& s, ForceGeometry_t force = NormalGeometrySet );
236  void keepInArea( TQRect area, bool partial = false );
237  void setActiveBorderMode( ActiveMaximizingMode mode );
238  void setActiveBorderPos( TQPoint pos );
239  void setActiveBorder( ActiveBorder border);
240  ActiveMaximizingMode activeBorderMode() const;
241  TQPoint activeBorderPos() const;
242  ActiveBorder activeBorder() const;
243  void setActiveBorderMaximizing(bool maximizing);
244  void cancelActiveBorderMaximizing();
245  bool isActiveBorderMaximizing() const;
246  TQRect activeBorderMaximizeGeometry();
247  void tileToBorder(ActiveBorder border);
248 
249  void growHorizontal();
250  void shrinkHorizontal();
251  void growVertical();
252  void shrinkVertical();
253 
254  bool providesContextHelp() const;
255  TDEShortcut shortcut() const;
256  void setShortcut( const TQString& cut );
257 
258  bool performMouseCommand( Options::MouseCommand, TQPoint globalPos, bool handled = false );
259 
260  TQCString windowRole() const;
261  TQCString sessionId();
262  TQCString resourceName() const;
263  TQCString resourceClass() const;
264  TQCString wmCommand();
265  TQCString wmClientMachine( bool use_localhost ) const;
266  Window wmClientLeader() const;
267  pid_t pid() const;
268 
269  TQRect adjustedClientArea( const TQRect& desktop, const TQRect& area ) const;
270 
271  Colormap colormap() const;
272 
273  // updates visibility depending on being shaded, virtual desktop, etc.
274  void updateVisibility();
275  // hides a client - basically like minimize, but without effects, it's simply hidden
276  void hideClient( bool hide );
277 
278  TQString caption( bool full = true ) const;
279  void updateCaption();
280 
281  void keyPressEvent( uint key_code ); // FRAME ??
282  void updateMouseGrab();
283  Window moveResizeGrabWindow() const;
284 
285  const TQPoint calculateGravitation( bool invert, int gravity = 0 ) const; // FRAME public?
286 
287  void NETMoveResize( int x_root, int y_root, NET::Direction direction );
288  void NETMoveResizeWindow( int flags, int x, int y, int width, int height );
289  void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp, bool send_event = false );
290 
291  void gotPing( Time timestamp );
292 
293  static TQCString staticWindowRole(WId);
294  static TQCString staticSessionId(WId);
295  static TQCString staticWmCommand(WId);
296  static TQCString staticWmClientMachine(WId);
297  static Window staticWmClientLeader(WId);
298 
299  void checkWorkspacePosition();
300  void updateUserTime( Time time = CurrentTime );
301  Time userTime() const;
302  bool hasUserTimeSupport() const;
303  bool ignoreFocusStealing() const;
304 
305  // does 'delete c;'
306  static void deleteClient( Client* c, allowed_t );
307 
308  static bool resourceMatch( const Client* c1, const Client* c2 );
309  static bool belongToSameApplication( const Client* c1, const Client* c2, bool active_hack = false );
310  static void readIcons( Window win, TQPixmap* icon, TQPixmap* miniicon );
311 
312  void minimize( bool avoid_animation = false );
313  void unminimize( bool avoid_animation = false );
314  void closeWindow();
315  void killWindow();
316  void suspendWindow();
317  void resumeWindow();
318  bool queryUserSuspendedResume();
319  void maximize( MaximizeMode );
320  void toggleShade();
321  void showContextHelp();
322  void cancelShadeHover();
323  void cancelAutoRaise();
324  void destroyClient();
325  void checkActiveModal();
326 
327  // some helpful constants for setOpacity() and related functions
328  struct Opacity { enum : uint {
329  Transparent = 0, //< Completely transparent window
330  MouseStep = 0xCCCCCCC, //< A single step when changing opacity with mouse wheel
331  Opaque = 0xFFFFFFFF //< Fully opaque window
332  }; };
333 
334  void setOpacity(uint opacity);
335  void setShadowSize(uint shadowSize);
336  uint defaultOpacity();
338  uint defaultOpacity(bool active);
339  void updateOpacity();
340  void updateShadowSize();
341  bool hasCustomOpacity(){return custom_opacity;}
342  void setCustomOpacityFlag(bool custom = true);
343  bool getWindowOpacity();
344  int opacityPercentage();
345  void checkAndSetInitialRuledOpacity();
346  uint ruleOpacityInactive();
347  uint ruleOpacityActive();
348  unsigned int opacity();
349  bool isBMP();
350  void setBMP(bool b);
351  bool touches(const Client* c);
352  void setShapable(bool b);
353  bool hasStrut() const;
354 
355  private slots:
356  void autoRaise();
357  void shadeHover();
358  void shortcutActivated();
359  void updateOpacityCache();
360 
361 
362  private:
363  friend class Bridge; // FRAME
364  virtual void processMousePressEvent( TQMouseEvent* e );
365 
366  private: // TODO cleanup the order of things in the .h file
367  // use Workspace::createClient()
368  virtual ~Client(); // use destroyClient() or releaseWindow()
369 
370  Position mousePosition( const TQPoint& ) const;
371  void setCursor( Position m );
372  void setCursor( const TQCursor& c );
373 
374  void animateMinimizeOrUnminimize( bool minimize );
375  TQPixmap animationPixmap( int w );
376  // transparent stuff
377  void drawbound( const TQRect& geom );
378  void clearbound();
379  void doDrawbound( const TQRect& geom, bool clear );
380 
381  // handlers for X11 events
382  bool mapRequestEvent( XMapRequestEvent* e );
383  void unmapNotifyEvent( XUnmapEvent*e );
384  void destroyNotifyEvent( XDestroyWindowEvent*e );
385  void configureRequestEvent( XConfigureRequestEvent* e );
386  void propertyNotifyEvent( XPropertyEvent* e );
387  void clientMessageEvent( XClientMessageEvent* e );
388  void enterNotifyEvent( XCrossingEvent* e );
389  void leaveNotifyEvent( XCrossingEvent* e );
390  void focusInEvent( XFocusInEvent* e );
391  void focusOutEvent( XFocusOutEvent* e );
392 
393  bool buttonPressEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
394  bool buttonReleaseEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
395  bool motionNotifyEvent( Window w, int state, int x, int y, int x_root, int y_root );
396 
397  // drop shadows
398  void drawIntersectingShadows();
399  void drawOverlappingShadows(bool waitForMe);
400  TQRegion getExposedRegion(TQRegion occludedRegion, int x, int y,
401  int w, int h, int thickness, int xOffset, int yOffset);
402  void imposeCachedShadow(TQPixmap &pixmap, TQRegion exposed);
403  void imposeRegionShadow(TQPixmap &pixmap, TQRegion occluded,
404  TQRegion exposed, int thickness, double maxOpacity = 0.75);
405 
406  void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
407 
408  private slots:
409  void pingTimeout();
410  void processKillerExited();
411  void processResumerExited();
412  void demandAttentionKNotify();
413  void drawShadow();
414  void drawShadowAfter(Client *after);
415  void drawDelayedShadow();
416  void removeShadow();
417 
418  signals:
419  void shadowDrawn();
420 
421 
422  private:
423  // ICCCM 4.1.3.1, 4.1.4 , NETWM 2.5.1
424  void setMappingState( int s );
425  int mappingState() const;
426  bool isIconicState() const;
427  bool isNormalState() const;
428  bool isManaged() const; // returns false if this client is not yet managed
429  void updateAllowedActions( bool force = false );
430  TQSize sizeForClientSize( const TQSize&, Sizemode mode = SizemodeAny, bool noframe = false ) const;
431  void changeMaximize( bool horizontal, bool vertical, bool adjust );
432  void checkMaximizeGeometry();
433  int checkFullScreenHack( const TQRect& geom ) const; // 0 - none, 1 - one xinerama screen, 2 - full area
434  void updateFullScreenHack( const TQRect& geom );
435  void getWmNormalHints();
436  void getMotifHints();
437  void getIcons();
438  void getWmClientLeader();
439  void getWmClientMachine();
440  void fetchName();
441  void fetchIconicName();
442  TQString readName() const;
443  void setCaption( const TQString& s, bool force = false );
444  bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
445  void finishWindowRules();
446  void setShortcutInternal( const TDEShortcut& cut );
447 
448  void updateWorkareaDiffs();
449  void checkDirection( int new_diff, int old_diff, TQRect& rect, const TQRect& area );
450  static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
451  void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
452  NETExtendedStrut strut() const;
453  int checkShadeGeometry( int w, int h );
454  void postponeGeometryUpdates( bool postpone );
455 
456  bool startMoveResize();
457  void finishMoveResize( bool cancel );
458  void leaveMoveResize();
459  void checkUnrestrictedMoveResize();
460  void handleMoveResize( int x, int y, int x_root, int y_root );
461  void positionGeometryTip();
462  void grabButton( int mod );
463  void ungrabButton( int mod );
464  void resetMaximize();
465  void resizeDecoration( const TQSize& s );
466 
467  void pingWindow();
468  void killProcess( bool ask, Time timestamp = CurrentTime );
469  void updateUrgency();
470  static void sendClientMessage( Window w, Atom a, Atom protocol,
471  long data1 = 0, long data2 = 0, long data3 = 0 );
472 
473  void embedClient( Window w, const XWindowAttributes &attr );
474  void detectNoBorder();
475  void detectShapable();
476  void destroyDecoration();
477  void updateFrameExtents();
478 
479  void rawShow(); // just shows it
480  void rawHide(); // just hides it
481 
482  Time readUserTimeMapTimestamp( const TDEStartupInfoId* asn_id, const TDEStartupInfoData* asn_data,
483  bool session ) const;
484  Time readUserCreationTime() const;
485  static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );
486  void startupIdChanged();
487 
488  Window client;
489  Window wrapper;
490  Window frame;
491  KDecoration* decoration;
492  Workspace* wspace;
493  Bridge* bridge;
494  int desk;
495  bool buttonDown;
496  bool moveResizeMode;
497  bool inhibitConfigureRequests; //< BCI: remove me
498  bool move_faked_activity;
499  Window move_resize_grab_window;
500  bool unrestrictedMoveResize;
501  bool isMove() const
502  {
503  return moveResizeMode && mode == PositionCenter;
504  }
505  bool isResize() const
506  {
507  return moveResizeMode && mode != PositionCenter;
508  }
509 
510  Position mode;
511  TQPoint moveOffset;
512  TQPoint invertedMoveOffset;
513  TQRect moveResizeGeom;
514  TQRect initialMoveResizeGeom;
515  XSizeHints xSizeHint;
516  void sendSyntheticConfigureNotify();
517  int mapping_state;
518  void readTransient();
519  Window verifyTransientFor( Window transient_for, bool set );
520  void addTransient( Client* cl );
521  void removeTransient( Client* cl );
522  void removeFromMainClients();
523  void cleanGrouping();
524  void checkGroupTransients();
525  void setTransient( Window new_transient_for_id );
526  Client* transient_for;
527  Window transient_for_id;
528  Window original_transient_for_id;
529  ClientList transients_list; // SELI make this ordered in stacking order?
530  ShadeMode shade_mode;
531  uint active :1;
532  uint deleting : 1; // true when doing cleanup and destroying the client
533  uint keep_above : 1; // NET::KeepAbove (was stays_on_top)
534  uint is_shape :1;
535  uint skip_taskbar :1;
536  uint original_skip_taskbar :1; // unaffected by KWin
537  uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
538  uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
539  uint Ptakeactivity : 1; // does it support _NET_WM_TAKE_ACTIVITY
540  uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol?
541  uint Pping : 1; // does it support _NET_WM_PING?
542  uint input :1; // does the window want input in its wm_hints
543  uint skip_pager : 1;
544  uint motif_noborder : 1;
545  uint motif_may_resize : 1;
546  uint motif_may_move :1;
547  uint motif_may_close : 1;
548  uint keep_below : 1; // NET::KeepBelow
549  uint minimized : 1;
550  uint hidden : 1; // forcibly hidden by calling hide()
551  uint modal : 1; // NET::Modal
552  uint noborder : 1;
553  uint user_noborder : 1;
554  uint urgency : 1; // XWMHints, UrgencyHint
555  uint ignore_focus_stealing : 1; // don't apply focus stealing prevention to this client
556  uint demands_attention : 1;
557  uint user_noborder_forced : 1; //< whether user_noborder should override motif_noborder
558  WindowRules client_rules;
559  void getWMHints();
560  void readIcons();
561  void getWindowProtocols();
562  TQPixmap icon_pix;
563  TQPixmap miniicon_pix;
564  TQCursor cursor;
565  // FullScreenHack - non-NETWM fullscreen (noborder,size of desktop)
566  // DON'T reorder - saved to config files !!!
567  enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
568  FullScreenMode fullscreen_mode;
569  MaximizeMode max_mode;
570  TQRect geom_restore;
571  TQRect geom_fs_restore;
572  MaximizeMode maxmode_restore;
573  int workarea_diff_x, workarea_diff_y;
574  WinInfo* info;
575  TQTimer* autoRaiseTimer;
576  TQTimer* shadeHoverTimer;
577  TQTimer* configureRequestTimer; //< BCI: remove me
578  Colormap cmap;
579  TQCString resource_name;
580  TQCString resource_class;
581  TQCString client_machine;
582  TQString cap_normal, cap_iconic, cap_suffix;
583  WId wmClientLeaderWin;
584  TQCString window_role;
585  Group* in_group;
586  Window window_group;
587  Layer in_layer;
588  TQTimer* ping_timer;
589  TDEProcess* process_killer;
590  TDEProcess* process_resumer;
591  Time ping_timestamp;
592  Time user_time;
593  unsigned long allowed_actions;
594  TQRect frame_geometry;
595  TQSize client_size;
596  int postpone_geometry_updates; // >0 - new geometry is remembered, but not actually set
597  bool pending_geometry_update;
598  bool shade_geometry_change;
599  int border_left, border_right, border_top, border_bottom;
600 
601  Client* shadowAfterClient;
602  TQWidget* shadowWidget;
603  TQMemArray<double> activeOpacityCache;
604  TQMemArray<double> inactiveOpacityCache;
605  TQMemArray<double>* opacityCache;
606  TQRegion shapeBoundingRegion;
607  TQTimer* shadowDelayTimer;
608  bool shadowMe;
609 
610  TQRegion _mask;
611  static bool check_active_modal; // see Client::checkActiveModal()
612  TDEShortcut _shortcut;
613  friend struct FetchNameInternalPredicate;
614  friend struct CheckIgnoreFocusStealingProcedure;
615  friend struct ResetupRulesProcedure;
616  friend class GeometryUpdatesPostponer;
617  void show() { assert( false ); } // SELI remove after Client is no longer TQWidget
618  void hide() { assert( false ); }
619  uint opacity_;
620  uint savedOpacity_;
621  bool custom_opacity;
622  uint rule_opacity_active; //translucency rules
623  uint rule_opacity_inactive; //dto.
624  //int shadeOriginalHeight;
625  bool isBMP_;
626  TQTimer* demandAttentionKNotifyTimer;
627 
628  bool activeMaximizing;
629  bool activeTiled;
630  ActiveMaximizingMode activeMode;
631  TQPoint activePos;
632  ActiveBorder currentActiveBorder;
633 
634  friend bool performTransiencyCheck();
635  bool minimized_before_suspend;
636  };
637 
638 // helper for Client::postponeGeometryUpdates() being called in pairs (true/false)
639 class GeometryUpdatesPostponer
640  {
641  public:
642  GeometryUpdatesPostponer( Client* c )
643  : cl( c ) { cl->postponeGeometryUpdates( true ); }
644  ~GeometryUpdatesPostponer()
645  { cl->postponeGeometryUpdates( false ); }
646  private:
647  Client* cl;
648  };
649 
650 
651 // NET WM Protocol handler class
652 class WinInfo : public NETWinInfo
653  {
654  private:
655  typedef KWinInternal::Client Client; // because of NET::Client
656  public:
657  WinInfo( Client* c, Display * display, Window window,
658  Window rwin, const unsigned long pr[], int pr_size );
659  virtual void changeDesktop(int desktop);
660  virtual void changeState( unsigned long state, unsigned long mask );
661  private:
662  Client * m_client;
663  };
664 
665 inline Window Client::window() const
666  {
667  return client;
668  }
669 
670 inline Window Client::frameId() const
671  {
672  return frame;
673  }
674 
675 inline Window Client::wrapperId() const
676  {
677  return wrapper;
678  }
679 
680 inline Window Client::decorationId() const
681  {
682  return decoration != NULL ? decoration->widget()->winId() : None;
683  }
684 
685 inline Workspace* Client::workspace() const
686  {
687  return wspace;
688  }
689 
690 inline const Client* Client::transientFor() const
691  {
692  return transient_for;
693  }
694 
695 inline Client* Client::transientFor()
696  {
697  return transient_for;
698  }
699 
700 inline bool Client::groupTransient() const
701  {
702  return transient_for_id == workspace()->rootWin();
703  }
704 
705 // needed because verifyTransientFor() may set transient_for_id to root window,
706 // if the original value has a problem (window doesn't exist, etc.)
707 inline bool Client::wasOriginallyGroupTransient() const
708  {
709  return original_transient_for_id == workspace()->rootWin();
710  }
711 
712 inline bool Client::isTransient() const
713  {
714  return transient_for_id != None;
715  }
716 
717 inline const ClientList& Client::transients() const
718  {
719  return transients_list;
720  }
721 
722 inline const Group* Client::group() const
723  {
724  return in_group;
725  }
726 
727 inline Group* Client::group()
728  {
729  return in_group;
730  }
731 
732 inline int Client::mappingState() const
733  {
734  return mapping_state;
735  }
736 
737 inline TQCString Client::resourceName() const
738  {
739  return resource_name; // it is always lowercase
740  }
741 
742 inline TQCString Client::resourceClass() const
743  {
744  return resource_class; // it is always lowercase
745  }
746 
747 inline
748 bool Client::isMinimized() const
749  {
750  return minimized;
751  }
752 
753 inline bool Client::isActive() const
754  {
755  return active;
756  }
757 
764 inline int Client::desktop() const
765  {
766  return desk;
767  }
768 
769 inline bool Client::isOnAllDesktops() const
770  {
771  return desk == NET::OnAllDesktops;
772  }
777 inline bool Client::isOnDesktop( int d ) const
778  {
779  return desk == d || /*desk == 0 ||*/ isOnAllDesktops();
780  }
781 
782 inline
783 bool Client::isShown( bool shaded_is_shown ) const
784  {
785  return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
786  }
787 
788 inline
789 bool Client::isShade() const
790  {
791  return shade_mode == ShadeNormal;
792  }
793 
794 inline
795 ShadeMode Client::shadeMode() const
796  {
797  return shade_mode;
798  }
799 
800 inline TQPixmap Client::icon() const
801  {
802  return icon_pix;
803  }
804 
805 inline TQPixmap Client::miniIcon() const
806  {
807  return miniicon_pix;
808  }
809 
810 inline TQRect Client::geometryRestore() const
811  {
812  return geom_restore;
813  }
814 
815 inline Client::MaximizeMode Client::maximizeModeRestore() const
816  {
817  return maxmode_restore;
818  }
819 
820 inline Client::MaximizeMode Client::maximizeMode() const
821  {
822  return max_mode;
823  }
824 
825 inline bool Client::skipTaskbar( bool from_outside ) const
826  {
827  return from_outside ? original_skip_taskbar : skip_taskbar;
828  }
829 
830 inline bool Client::skipPager() const
831  {
832  return skip_pager;
833  }
834 
835 inline bool Client::keepBelow() const
836  {
837  return keep_below;
838  }
839 
840 inline bool Client::shape() const
841  {
842  return is_shape;
843  }
844 
845 
846 inline bool Client::isFullScreen() const
847  {
848  return fullscreen_mode != FullScreenNone;
849  }
850 
851 inline bool Client::isModal() const
852  {
853  return modal;
854  }
855 
856 inline bool Client::hasNETSupport() const
857  {
858  return info->hasNETSupport();
859  }
860 
861 inline Colormap Client::colormap() const
862  {
863  return cmap;
864  }
865 
866 inline pid_t Client::pid() const
867  {
868  return info->pid();
869  }
870 
871 inline void Client::invalidateLayer()
872  {
873  in_layer = UnknownLayer;
874  }
875 
876 inline bool Client::isIconicState() const
877  {
878  return mapping_state == IconicState;
879  }
880 
881 inline bool Client::isNormalState() const
882  {
883  return mapping_state == NormalState;
884  }
885 
886 inline bool Client::isManaged() const
887  {
888  return mapping_state != WithdrawnState;
889  }
890 
891 inline TQCString Client::windowRole() const
892  {
893  return window_role;
894  }
895 
896 inline TQRect Client::geometry() const
897  {
898  return frame_geometry;
899  }
900 
901 inline TQSize Client::size() const
902  {
903  return frame_geometry.size();
904  }
905 
906 inline TQPoint Client::pos() const
907  {
908  return frame_geometry.topLeft();
909  }
910 
911 inline int Client::x() const
912  {
913  return frame_geometry.x();
914  }
915 
916 inline int Client::y() const
917  {
918  return frame_geometry.y();
919  }
920 
921 inline int Client::width() const
922  {
923  return frame_geometry.width();
924  }
925 
926 inline int Client::height() const
927  {
928  return frame_geometry.height();
929  }
930 
931 inline TQRect Client::rect() const
932  {
933  return TQRect( 0, 0, width(), height());
934  }
935 
936 inline TQPoint Client::clientPos() const
937  {
938  return TQPoint( border_left, border_top );
939  }
940 
941 inline TQSize Client::clientSize() const
942  {
943  return client_size;
944  }
945 
946 inline void Client::setGeometry( const TQRect& r, ForceGeometry_t force )
947  {
948  setGeometry( r.x(), r.y(), r.width(), r.height(), force );
949  }
950 
951 inline void Client::move( const TQPoint & p, ForceGeometry_t force )
952  {
953  move( p.x(), p.y(), force );
954  }
955 
956 inline void Client::plainResize( const TQSize& s, ForceGeometry_t force )
957  {
958  plainResize( s.width(), s.height(), force );
959  }
960 
961 inline bool Client::isShadowed() const
962  {
963  return shadowMe;
964  }
965 
966 inline Window Client::shadowId() const
967  {
968  return shadowWidget != NULL ? shadowWidget->winId() : None;
969  }
970 
971 inline void Client::resizeWithChecks( const TQSize& s, ForceGeometry_t force )
972  {
973  resizeWithChecks( s.width(), s.height(), force );
974  }
975 
976 inline bool Client::hasUserTimeSupport() const
977  {
978  return info->userTime() != -1U;
979  }
980 
981 inline bool Client::ignoreFocusStealing() const
982  {
983  return ignore_focus_stealing;
984  }
985 
986 inline const WindowRules* Client::rules() const
987  {
988  return &client_rules;
989  }
990 
991 KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
992 
993 inline Window Client::moveResizeGrabWindow() const
994  {
995  return move_resize_grab_window;
996  }
997 
998 inline TDEShortcut Client::shortcut() const
999  {
1000  return _shortcut;
1001  }
1002 
1003 inline bool Client::isBMP()
1004  {
1005  return isBMP_;
1006  }
1007 
1008 inline void Client::setBMP(bool b)
1009  {
1010  isBMP_ = b;
1011  }
1012 
1013 inline void Client::removeRule( Rules* rule )
1014  {
1015  client_rules.remove( rule );
1016  }
1017 
1018 #ifdef NDEBUG
1019 inline
1020 kndbgstream& operator<<( kndbgstream& stream, const Client* ) { return stream; }
1021 inline
1022 kndbgstream& operator<<( kndbgstream& stream, const ClientList& ) { return stream; }
1023 inline
1024 kndbgstream& operator<<( kndbgstream& stream, const ConstClientList& ) { return stream; }
1025 #else
1026 kdbgstream& operator<<( kdbgstream& stream, const Client* );
1027 kdbgstream& operator<<( kdbgstream& stream, const ClientList& );
1028 kdbgstream& operator<<( kdbgstream& stream, const ConstClientList& );
1029 #endif
1030 
1031 KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
1032 KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
1033 KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
1034 
1035 } // namespace
1036 
1037 #endif
KWinInternal::Client
The Client class encapsulates a window decoration frame.
Definition: client.h:47
KWinInternal::Client::desktop
int desktop() const
Definition: client.h:764
KWinInternal::Client::showContextHelp
void showContextHelp()
Definition: client.cpp:2272
KWinInternal::Client::staticWmClientLeader
static Window staticWmClientLeader(WId)
Definition: client.cpp:2519
KWinInternal::Client::sessionId
TQCString sessionId()
Definition: client.cpp:2551
KWinInternal::Client::providesContextHelp
bool providesContextHelp() const
Definition: client.cpp:2258
KWinInternal::Client::adjustedClientArea
TQRect adjustedClientArea(const TQRect &desktop, const TQRect &area) const
Definition: geometry.cpp:741
KWinInternal::Client::killWindow
void killWindow()
Definition: client.cpp:1764
KWinInternal::Client::setGeometry
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force=NormalGeometrySet)
Definition: geometry.cpp:1713
KWinInternal::Client::performMouseCommand
bool performMouseCommand(Options::MouseCommand, TQPoint globalPos, bool handled=false)
Definition: useractions.cpp:502
KWinInternal::Client::setActive
void setActive(bool, bool updateOpacity=true)
Definition: activation.cpp:856
KWinInternal::Client::isMovable
bool isMovable() const
Definition: geometry.cpp:1648
KWinInternal::Client::isMinimizable
bool isMinimizable() const
Definition: client.cpp:635
KWinInternal::Client::keepAbove
bool keepAbove() const
Definition: client.cpp:668
KWinInternal::Client::manage
bool manage(Window w, bool isMapped)
Definition: manage.cpp:36
KWinInternal::Client::Client
Client(Workspace *ws)
Definition: client.cpp:94
KWinInternal::Client::minimize
void minimize(bool avoid_animation=false)
Definition: client.cpp:678
KWinInternal::Client::staticSessionId
static TQCString staticSessionId(WId)
Definition: client.cpp:2503
KWinInternal::Client::windowEvent
bool windowEvent(XEvent *e)
Definition: events.cpp:507
KWinInternal::Client::wmClientMachine
TQCString wmClientMachine(bool use_localhost) const
Definition: client.cpp:2584
KWinInternal::Client::isResizable
bool isResizable() const
Definition: geometry.cpp:1664
KWinInternal::Client::adjustedSize
TQSize adjustedSize(const TQSize &, Sizemode mode=SizemodeAny) const
Definition: geometry.cpp:1071
KWinInternal::Client::staticWindowRole
static TQCString staticWindowRole(WId)
Definition: client.cpp:2495
KWinInternal::Client::staticWmCommand
static TQCString staticWmCommand(WId)
Definition: client.cpp:2511
KWinInternal::Client::updateUserTime
void updateUserTime(Time time=CurrentTime)
Definition: activation.cpp:674
KWinInternal::Client::isOnDesktop
bool isOnDesktop(int d) const
Definition: client.h:777
KWinInternal::Client::wmCommand
TQCString wmCommand()
Definition: client.cpp:2563
KWinInternal::Client::releaseWindow
void releaseWindow(bool on_shutdown=false)
Definition: client.cpp:218
KWinInternal::Client::setMaximize
void setMaximize(bool vertically, bool horizontally)
Definition: geometry.cpp:1881
KWinInternal::Client::closeWindow
void closeWindow()
Definition: client.cpp:1740
KWinInternal::Client::wmClientLeader
Window wmClientLeader() const
Definition: client.cpp:2599
KWinInternal::Client::caption
TQString caption(bool full=true) const
Definition: client.cpp:2371
KWinInternal::Client::move
void move(int x, int y, ForceGeometry_t force=NormalGeometrySet)
Definition: geometry.cpp:1830

twin

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

twin

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