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

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