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

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.9.1
This website is maintained by Timothy Pearson.