• 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
5Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7
8You can Freely distribute this program under the GNU General Public
9License. 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
33class TQTimer;
34class TDEProcess;
35class TDEStartupInfoData;
36
37namespace KWinInternal
38{
39
40class Workspace;
41class Client;
42class WinInfo;
43class SessionInfo;
44class Bridge;
45
46class 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 configureRequestTimeout();
359 void shortcutActivated();
360 void updateOpacityCache();
361
362
363 private:
364 friend class Bridge; // FRAME
365 virtual void processMousePressEvent( TQMouseEvent* e );
366
367 private: // TODO cleanup the order of things in the .h file
368 // use Workspace::createClient()
369 virtual ~Client(); // use destroyClient() or releaseWindow()
370
371 Position mousePosition( const TQPoint& ) const;
372 void setCursor( Position m );
373 void setCursor( const TQCursor& c );
374
375 void animateMinimizeOrUnminimize( bool minimize );
376 TQPixmap animationPixmap( int w );
377 // transparent stuff
378 void drawbound( const TQRect& geom );
379 void clearbound();
380 void doDrawbound( const TQRect& geom, bool clear );
381
382 // handlers for X11 events
383 bool mapRequestEvent( XMapRequestEvent* e );
384 void unmapNotifyEvent( XUnmapEvent*e );
385 void destroyNotifyEvent( XDestroyWindowEvent*e );
386 void configureRequestEvent( XConfigureRequestEvent* e );
387 void propertyNotifyEvent( XPropertyEvent* e );
388 void clientMessageEvent( XClientMessageEvent* e );
389 void enterNotifyEvent( XCrossingEvent* e );
390 void leaveNotifyEvent( XCrossingEvent* e );
391 void focusInEvent( XFocusInEvent* e );
392 void focusOutEvent( XFocusOutEvent* e );
393
394 bool buttonPressEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
395 bool buttonReleaseEvent( Window w, int button, int state, int x, int y, int x_root, int y_root );
396 bool motionNotifyEvent( Window w, int state, int x, int y, int x_root, int y_root );
397
398 // drop shadows
399 void drawIntersectingShadows();
400 void drawOverlappingShadows(bool waitForMe);
401 TQRegion getExposedRegion(TQRegion occludedRegion, int x, int y,
402 int w, int h, int thickness, int xOffset, int yOffset);
403 void imposeCachedShadow(TQPixmap &pixmap, TQRegion exposed);
404 void imposeRegionShadow(TQPixmap &pixmap, TQRegion occluded,
405 TQRegion exposed, int thickness, double maxOpacity = 0.75);
406
407 void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
408
409 private slots:
410 void pingTimeout();
411 void processKillerExited();
412 void processResumerExited();
413 void demandAttentionKNotify();
414 void drawShadow();
415 void drawShadowAfter(Client *after);
416 void drawDelayedShadow();
417 void removeShadow();
418
419 signals:
420 void shadowDrawn();
421
422
423 private:
424 // ICCCM 4.1.3.1, 4.1.4 , NETWM 2.5.1
425 void setMappingState( int s );
426 int mappingState() const;
427 bool isIconicState() const;
428 bool isNormalState() const;
429 bool isManaged() const; // returns false if this client is not yet managed
430 void updateAllowedActions( bool force = false );
431 TQSize sizeForClientSize( const TQSize&, Sizemode mode = SizemodeAny, bool noframe = false ) const;
432 void changeMaximize( bool horizontal, bool vertical, bool adjust );
433 void checkMaximizeGeometry();
434 int checkFullScreenHack( const TQRect& geom ) const; // 0 - none, 1 - one xinerama screen, 2 - full area
435 void updateFullScreenHack( const TQRect& geom );
436 void getWmNormalHints();
437 void getMotifHints();
438 void getIcons();
439 void getWmClientLeader();
440 void getWmClientMachine();
441 void fetchName();
442 void fetchIconicName();
443 TQString readName() const;
444 void setCaption( const TQString& s, bool force = false );
445 bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
446 void finishWindowRules();
447 void setShortcutInternal( const TDEShortcut& cut );
448
449 void updateWorkareaDiffs();
450 void checkDirection( int new_diff, int old_diff, TQRect& rect, const TQRect& area );
451 static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
452 void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
453 NETExtendedStrut strut() const;
454 int checkShadeGeometry( int w, int h );
455 void postponeGeometryUpdates( bool postpone );
456
457 bool startMoveResize();
458 void finishMoveResize( bool cancel );
459 void leaveMoveResize();
460 void checkUnrestrictedMoveResize();
461 void handleMoveResize( int x, int y, int x_root, int y_root );
462 void positionGeometryTip();
463 void grabButton( int mod );
464 void ungrabButton( int mod );
465 void resetMaximize();
466 void resizeDecoration( const TQSize& s );
467
468 void pingWindow();
469 void killProcess( bool ask, Time timestamp = CurrentTime );
470 void updateUrgency();
471 static void sendClientMessage( Window w, Atom a, Atom protocol,
472 long data1 = 0, long data2 = 0, long data3 = 0 );
473
474 void embedClient( Window w, const XWindowAttributes &attr );
475 void detectNoBorder();
476 void detectShapable();
477 void destroyDecoration();
478 void updateFrameExtents();
479
480 void rawShow(); // just shows it
481 void rawHide(); // just hides it
482
483 Time readUserTimeMapTimestamp( const TDEStartupInfoId* asn_id, const TDEStartupInfoData* asn_data,
484 bool session ) const;
485 Time readUserCreationTime() const;
486 static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );
487 void startupIdChanged();
488
489 Window client;
490 Window wrapper;
491 Window frame;
492 KDecoration* decoration;
493 Workspace* wspace;
494 Bridge* bridge;
495 int desk;
496 bool buttonDown;
497 bool moveResizeMode;
498 bool inhibitConfigureRequests;
499 bool move_faked_activity;
500 Window move_resize_grab_window;
501 bool unrestrictedMoveResize;
502 bool isMove() const
503 {
504 return moveResizeMode && mode == PositionCenter;
505 }
506 bool isResize() const
507 {
508 return moveResizeMode && mode != PositionCenter;
509 }
510
511 Position mode;
512 TQPoint moveOffset;
513 TQPoint invertedMoveOffset;
514 TQRect moveResizeGeom;
515 TQRect initialMoveResizeGeom;
516 XSizeHints xSizeHint;
517 void sendSyntheticConfigureNotify();
518 int mapping_state;
519 void readTransient();
520 Window verifyTransientFor( Window transient_for, bool set );
521 void addTransient( Client* cl );
522 void removeTransient( Client* cl );
523 void removeFromMainClients();
524 void cleanGrouping();
525 void checkGroupTransients();
526 void setTransient( Window new_transient_for_id );
527 Client* transient_for;
528 Window transient_for_id;
529 Window original_transient_for_id;
530 ClientList transients_list; // SELI make this ordered in stacking order?
531 ShadeMode shade_mode;
532 uint active :1;
533 uint deleting : 1; // true when doing cleanup and destroying the client
534 uint keep_above : 1; // NET::KeepAbove (was stays_on_top)
535 uint is_shape :1;
536 uint skip_taskbar :1;
537 uint original_skip_taskbar :1; // unaffected by KWin
538 uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
539 uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
540 uint Ptakeactivity : 1; // does it support _NET_WM_TAKE_ACTIVITY
541 uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol?
542 uint Pping : 1; // does it support _NET_WM_PING?
543 uint input :1; // does the window want input in its wm_hints
544 uint skip_pager : 1;
545 uint motif_noborder : 1;
546 uint motif_may_resize : 1;
547 uint motif_may_move :1;
548 uint motif_may_close : 1;
549 uint keep_below : 1; // NET::KeepBelow
550 uint minimized : 1;
551 uint hidden : 1; // forcibly hidden by calling hide()
552 uint modal : 1; // NET::Modal
553 uint noborder : 1;
554 uint user_noborder : 1;
555 uint urgency : 1; // XWMHints, UrgencyHint
556 uint ignore_focus_stealing : 1; // don't apply focus stealing prevention to this client
557 uint demands_attention : 1;
558 uint user_noborder_forced : 1; //< whether user_noborder should override motif_noborder
559 WindowRules client_rules;
560 void getWMHints();
561 void readIcons();
562 void getWindowProtocols();
563 TQPixmap icon_pix;
564 TQPixmap miniicon_pix;
565 TQCursor cursor;
566 // FullScreenHack - non-NETWM fullscreen (noborder,size of desktop)
567 // DON'T reorder - saved to config files !!!
568 enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
569 FullScreenMode fullscreen_mode;
570 MaximizeMode max_mode;
571 TQRect geom_restore;
572 TQRect geom_fs_restore;
573 MaximizeMode maxmode_restore;
574 int workarea_diff_x, workarea_diff_y;
575 WinInfo* info;
576 TQTimer* autoRaiseTimer;
577 TQTimer* shadeHoverTimer;
578 TQTimer* configureRequestTimer;
579 Colormap cmap;
580 TQCString resource_name;
581 TQCString resource_class;
582 TQCString client_machine;
583 TQString cap_normal, cap_iconic, cap_suffix;
584 WId wmClientLeaderWin;
585 TQCString window_role;
586 Group* in_group;
587 Window window_group;
588 Layer in_layer;
589 TQTimer* ping_timer;
590 TDEProcess* process_killer;
591 TDEProcess* process_resumer;
592 Time ping_timestamp;
593 Time user_time;
594 unsigned long allowed_actions;
595 TQRect frame_geometry;
596 TQSize client_size;
597 int postpone_geometry_updates; // >0 - new geometry is remembered, but not actually set
598 bool pending_geometry_update;
599 bool shade_geometry_change;
600 int border_left, border_right, border_top, border_bottom;
601
602 Client* shadowAfterClient;
603 TQWidget* shadowWidget;
604 TQMemArray<double> activeOpacityCache;
605 TQMemArray<double> inactiveOpacityCache;
606 TQMemArray<double>* opacityCache;
607 TQRegion shapeBoundingRegion;
608 TQTimer* shadowDelayTimer;
609 bool shadowMe;
610
611 TQRegion _mask;
612 static bool check_active_modal; // see Client::checkActiveModal()
613 TDEShortcut _shortcut;
614 friend struct FetchNameInternalPredicate;
615 friend struct CheckIgnoreFocusStealingProcedure;
616 friend struct ResetupRulesProcedure;
617 friend class GeometryUpdatesPostponer;
618 void show() { assert( false ); } // SELI remove after Client is no longer TQWidget
619 void hide() { assert( false ); }
620 uint opacity_;
621 uint savedOpacity_;
622 bool custom_opacity;
623 uint rule_opacity_active; //translucency rules
624 uint rule_opacity_inactive; //dto.
625 //int shadeOriginalHeight;
626 bool isBMP_;
627 TQTimer* demandAttentionKNotifyTimer;
628
629 bool activeMaximizing;
630 bool activeTiled;
631 ActiveMaximizingMode activeMode;
632 TQPoint activePos;
633 ActiveBorder currentActiveBorder;
634
635 friend bool performTransiencyCheck();
636 bool minimized_before_suspend;
637 };
638
639// helper for Client::postponeGeometryUpdates() being called in pairs (true/false)
640class GeometryUpdatesPostponer
641 {
642 public:
643 GeometryUpdatesPostponer( Client* c )
644 : cl( c ) { cl->postponeGeometryUpdates( true ); }
645 ~GeometryUpdatesPostponer()
646 { cl->postponeGeometryUpdates( false ); }
647 private:
648 Client* cl;
649 };
650
651
652// NET WM Protocol handler class
653class WinInfo : public NETWinInfo
654 {
655 private:
656 typedef KWinInternal::Client Client; // because of NET::Client
657 public:
658 WinInfo( Client* c, Display * display, Window window,
659 Window rwin, const unsigned long pr[], int pr_size );
660 virtual void changeDesktop(int desktop);
661 virtual void changeState( unsigned long state, unsigned long mask );
662 private:
663 Client * m_client;
664 };
665
666inline Window Client::window() const
667 {
668 return client;
669 }
670
671inline Window Client::frameId() const
672 {
673 return frame;
674 }
675
676inline Window Client::wrapperId() const
677 {
678 return wrapper;
679 }
680
681inline Window Client::decorationId() const
682 {
683 return decoration != NULL ? decoration->widget()->winId() : None;
684 }
685
686inline Workspace* Client::workspace() const
687 {
688 return wspace;
689 }
690
691inline const Client* Client::transientFor() const
692 {
693 return transient_for;
694 }
695
696inline Client* Client::transientFor()
697 {
698 return transient_for;
699 }
700
701inline bool Client::groupTransient() const
702 {
703 return transient_for_id == workspace()->rootWin();
704 }
705
706// needed because verifyTransientFor() may set transient_for_id to root window,
707// if the original value has a problem (window doesn't exist, etc.)
708inline bool Client::wasOriginallyGroupTransient() const
709 {
710 return original_transient_for_id == workspace()->rootWin();
711 }
712
713inline bool Client::isTransient() const
714 {
715 return transient_for_id != None;
716 }
717
718inline const ClientList& Client::transients() const
719 {
720 return transients_list;
721 }
722
723inline const Group* Client::group() const
724 {
725 return in_group;
726 }
727
728inline Group* Client::group()
729 {
730 return in_group;
731 }
732
733inline int Client::mappingState() const
734 {
735 return mapping_state;
736 }
737
738inline TQCString Client::resourceName() const
739 {
740 return resource_name; // it is always lowercase
741 }
742
743inline TQCString Client::resourceClass() const
744 {
745 return resource_class; // it is always lowercase
746 }
747
748inline
749bool Client::isMinimized() const
750 {
751 return minimized;
752 }
753
754inline bool Client::isActive() const
755 {
756 return active;
757 }
758
765inline int Client::desktop() const
766 {
767 return desk;
768 }
769
770inline bool Client::isOnAllDesktops() const
771 {
772 return desk == NET::OnAllDesktops;
773 }
778inline bool Client::isOnDesktop( int d ) const
779 {
780 return desk == d || /*desk == 0 ||*/ isOnAllDesktops();
781 }
782
783inline
784bool Client::isShown( bool shaded_is_shown ) const
785 {
786 return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
787 }
788
789inline
790bool Client::isShade() const
791 {
792 return shade_mode == ShadeNormal;
793 }
794
795inline
796ShadeMode Client::shadeMode() const
797 {
798 return shade_mode;
799 }
800
801inline TQPixmap Client::icon() const
802 {
803 return icon_pix;
804 }
805
806inline TQPixmap Client::miniIcon() const
807 {
808 return miniicon_pix;
809 }
810
811inline TQRect Client::geometryRestore() const
812 {
813 return geom_restore;
814 }
815
816inline Client::MaximizeMode Client::maximizeModeRestore() const
817 {
818 return maxmode_restore;
819 }
820
821inline Client::MaximizeMode Client::maximizeMode() const
822 {
823 return max_mode;
824 }
825
826inline bool Client::skipTaskbar( bool from_outside ) const
827 {
828 return from_outside ? original_skip_taskbar : skip_taskbar;
829 }
830
831inline bool Client::skipPager() const
832 {
833 return skip_pager;
834 }
835
836inline bool Client::keepBelow() const
837 {
838 return keep_below;
839 }
840
841inline bool Client::shape() const
842 {
843 return is_shape;
844 }
845
846
847inline bool Client::isFullScreen() const
848 {
849 return fullscreen_mode != FullScreenNone;
850 }
851
852inline bool Client::isModal() const
853 {
854 return modal;
855 }
856
857inline bool Client::hasNETSupport() const
858 {
859 return info->hasNETSupport();
860 }
861
862inline Colormap Client::colormap() const
863 {
864 return cmap;
865 }
866
867inline pid_t Client::pid() const
868 {
869 return info->pid();
870 }
871
872inline void Client::invalidateLayer()
873 {
874 in_layer = UnknownLayer;
875 }
876
877inline bool Client::isIconicState() const
878 {
879 return mapping_state == IconicState;
880 }
881
882inline bool Client::isNormalState() const
883 {
884 return mapping_state == NormalState;
885 }
886
887inline bool Client::isManaged() const
888 {
889 return mapping_state != WithdrawnState;
890 }
891
892inline TQCString Client::windowRole() const
893 {
894 return window_role;
895 }
896
897inline TQRect Client::geometry() const
898 {
899 return frame_geometry;
900 }
901
902inline TQSize Client::size() const
903 {
904 return frame_geometry.size();
905 }
906
907inline TQPoint Client::pos() const
908 {
909 return frame_geometry.topLeft();
910 }
911
912inline int Client::x() const
913 {
914 return frame_geometry.x();
915 }
916
917inline int Client::y() const
918 {
919 return frame_geometry.y();
920 }
921
922inline int Client::width() const
923 {
924 return frame_geometry.width();
925 }
926
927inline int Client::height() const
928 {
929 return frame_geometry.height();
930 }
931
932inline TQRect Client::rect() const
933 {
934 return TQRect( 0, 0, width(), height());
935 }
936
937inline TQPoint Client::clientPos() const
938 {
939 return TQPoint( border_left, border_top );
940 }
941
942inline TQSize Client::clientSize() const
943 {
944 return client_size;
945 }
946
947inline void Client::setGeometry( const TQRect& r, ForceGeometry_t force )
948 {
949 setGeometry( r.x(), r.y(), r.width(), r.height(), force );
950 }
951
952inline void Client::move( const TQPoint & p, ForceGeometry_t force )
953 {
954 move( p.x(), p.y(), force );
955 }
956
957inline void Client::plainResize( const TQSize& s, ForceGeometry_t force )
958 {
959 plainResize( s.width(), s.height(), force );
960 }
961
962inline bool Client::isShadowed() const
963 {
964 return shadowMe;
965 }
966
967inline Window Client::shadowId() const
968 {
969 return shadowWidget != NULL ? shadowWidget->winId() : None;
970 }
971
972inline void Client::resizeWithChecks( const TQSize& s, ForceGeometry_t force )
973 {
974 resizeWithChecks( s.width(), s.height(), force );
975 }
976
977inline bool Client::hasUserTimeSupport() const
978 {
979 return info->userTime() != -1U;
980 }
981
982inline bool Client::ignoreFocusStealing() const
983 {
984 return ignore_focus_stealing;
985 }
986
987inline const WindowRules* Client::rules() const
988 {
989 return &client_rules;
990 }
991
992KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
993
994inline Window Client::moveResizeGrabWindow() const
995 {
996 return move_resize_grab_window;
997 }
998
999inline TDEShortcut Client::shortcut() const
1000 {
1001 return _shortcut;
1002 }
1003
1004inline bool Client::isBMP()
1005 {
1006 return isBMP_;
1007 }
1008
1009inline void Client::setBMP(bool b)
1010 {
1011 isBMP_ = b;
1012 }
1013
1014inline void Client::removeRule( Rules* rule )
1015 {
1016 client_rules.remove( rule );
1017 }
1018
1019#ifdef NDEBUG
1020inline
1021kndbgstream& operator<<( kndbgstream& stream, const Client* ) { return stream; }
1022inline
1023kndbgstream& operator<<( kndbgstream& stream, const ClientList& ) { return stream; }
1024inline
1025kndbgstream& operator<<( kndbgstream& stream, const ConstClientList& ) { return stream; }
1026#else
1027kdbgstream& operator<<( kdbgstream& stream, const Client* );
1028kdbgstream& operator<<( kdbgstream& stream, const ClientList& );
1029kdbgstream& operator<<( kdbgstream& stream, const ConstClientList& );
1030#endif
1031
1032KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
1033KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
1034KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
1035
1036} // namespace
1037
1038#endif
KWinInternal::Client
The Client class encapsulates a window decoration frame.
Definition: client.h:47
KWinInternal::Client::desktop
int desktop() const
Definition: client.h:765
KWinInternal::Client::showContextHelp
void showContextHelp()
Definition: client.cpp:2282
KWinInternal::Client::staticWmClientLeader
static Window staticWmClientLeader(WId)
Definition: client.cpp:2529
KWinInternal::Client::sessionId
TQCString sessionId()
Definition: client.cpp:2561
KWinInternal::Client::providesContextHelp
bool providesContextHelp() const
Definition: client.cpp:2268
KWinInternal::Client::adjustedClientArea
TQRect adjustedClientArea(const TQRect &desktop, const TQRect &area) const
Definition: geometry.cpp:741
KWinInternal::Client::killWindow
void killWindow()
Definition: client.cpp:1774
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:502
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:639
KWinInternal::Client::keepAbove
bool keepAbove() const
Definition: client.cpp:672
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:682
KWinInternal::Client::staticSessionId
static TQCString staticSessionId(WId)
Definition: client.cpp:2513
KWinInternal::Client::windowEvent
bool windowEvent(XEvent *e)
Definition: events.cpp:507
KWinInternal::Client::wmClientMachine
TQCString wmClientMachine(bool use_localhost) const
Definition: client.cpp:2594
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:2505
KWinInternal::Client::staticWmCommand
static TQCString staticWmCommand(WId)
Definition: client.cpp:2521
KWinInternal::Client::updateUserTime
void updateUserTime(Time time=CurrentTime)
Definition: activation.cpp:674
KWinInternal::Client::isOnDesktop
bool isOnDesktop(int d) const
Definition: client.h:778
KWinInternal::Client::wmCommand
TQCString wmCommand()
Definition: client.cpp:2573
KWinInternal::Client::releaseWindow
void releaseWindow(bool on_shutdown=false)
Definition: client.cpp:222
KWinInternal::Client::setMaximize
void setMaximize(bool vertically, bool horizontally)
Definition: geometry.cpp:1882
KWinInternal::Client::closeWindow
void closeWindow()
Definition: client.cpp:1750
KWinInternal::Client::wmClientLeader
Window wmClientLeader() const
Definition: client.cpp:2609
KWinInternal::Client::caption
TQString caption(bool full=true) const
Definition: client.cpp:2381
KWinInternal::Client::move
void move(int x, int y, ForceGeometry_t force=NormalGeometrySet)
Definition: geometry.cpp:1831

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