21#include <tdeshortcut.h>
30#include "kdecoration.h"
35class TDEStartupInfoData;
46class Client :
public TQObject,
public KDecorationDefines
51 Window window()
const;
52 Window frameId()
const;
53 Window wrapperId()
const;
54 Window decorationId()
const;
56 Workspace* workspace()
const;
57 const Client* transientFor()
const;
59 bool isTransient()
const;
60 bool isModalSystemNotification()
const;
61 bool groupTransient()
const;
62 bool wasOriginallyGroupTransient()
const;
63 ClientList mainClients()
const;
64 bool hasTransient(
const Client* c,
bool indirect )
const;
65 const ClientList& transients()
const;
66 void checkTransient( Window w );
68 const Group* group()
const;
70 void checkGroup( Group* gr = NULL,
bool force =
false );
71 void changeClientLeaderGroup( Group* gr );
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();
80 TQRect geometry()
const;
82 TQSize minSize()
const;
83 TQSize maxSize()
const;
90 TQPoint clientPos()
const;
91 TQSize clientSize()
const;
94 virtual bool eventFilter( TQObject* o, TQEvent* e );
96 bool manage( Window w,
bool isMapped );
107 TQSize
adjustedSize(
const TQSize&, Sizemode mode = SizemodeAny )
const;
108 TQSize adjustedSize()
const;
110 TQPixmap icon()
const;
111 TQPixmap miniIcon()
const;
113 bool isActive()
const;
114 void setActive(
bool,
bool updateOpacity =
true );
116 bool isSuspendable()
const;
117 bool isResumeable()
const;
120 void setDesktop(
int );
122 bool isOnCurrentDesktop()
const;
123 bool isOnAllDesktops()
const;
124 void setOnAllDesktops(
bool set );
126 bool isOnScreen(
int screen )
const;
130 bool isShown(
bool shaded_is_shown )
const;
132 bool isShade()
const;
133 ShadeMode shadeMode()
const;
134 void setShade( ShadeMode mode );
135 bool isShadeable()
const;
137 bool isMinimized()
const;
138 bool isMaximizable()
const;
139 TQRect geometryRestore()
const;
140 MaximizeMode maximizeModeRestore()
const;
141 MaximizeMode maximizeMode()
const;
143 void setMaximize(
bool vertically,
bool horizontally );
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; }
150 int fullScreenMode()
const {
return fullscreen_mode; }
152 bool isUserNoBorder()
const;
153 void setUserNoBorder(
bool set );
154 bool userCanSetNoBorder()
const;
155 bool noBorder()
const;
157 bool skipTaskbar(
bool from_outside =
false )
const;
158 void setSkipTaskbar(
bool set,
bool from_outside );
160 bool skipPager()
const;
161 void setSkipPager(
bool );
164 void setKeepAbove(
bool );
165 bool keepBelow()
const;
166 void setKeepBelow(
bool );
168 Layer belongsToLayer()
const;
169 void invalidateLayer();
171 void setModal(
bool modal );
172 bool isModal()
const;
175 bool wantsTabFocus()
const;
176 bool wantsInput()
const;
177 bool hasNETSupport()
const;
179 bool isDesktop()
const;
181 bool isToolbar()
const;
182 bool isTopMenu()
const;
184 bool isNormalWindow()
const;
185 bool isDialog()
const;
186 bool isSplash()
const;
187 bool isUtility()
const;
192 bool isSpecialWindow()
const;
195 bool isCloseable()
const;
197 void takeActivity(
int flags,
bool handled, allowed_t );
198 void takeFocus( allowed_t );
199 void demandAttention(
bool set =
true );
201 void setMask(
const TQRegion& r,
int mode = X::Unsorted );
202 TQRegion mask()
const;
204 void updateDecoration(
bool check_workspace_pos,
bool force =
false );
205 void checkBorderSizes();
208 bool isShadowed()
const;
209 void setShadowed(
bool shadowed);
210 Window shadowId()
const;
214 friend void Workspace::raiseClient(
Client *);
218 friend void Workspace::updateOverlappingShadows(WId);
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 );
229 void plainResize(
int w,
int h, ForceGeometry_t force = NormalGeometrySet );
230 void plainResize(
const TQSize& s, ForceGeometry_t force = NormalGeometrySet );
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);
247 void growHorizontal();
248 void shrinkHorizontal();
250 void shrinkVertical();
253 TDEShortcut shortcut()
const;
254 void setShortcut(
const TQString& cut );
256 bool performMouseCommand( Options::MouseCommand, TQPoint globalPos,
bool handled =
false );
258 TQCString windowRole()
const;
260 TQCString resourceName()
const;
261 TQCString resourceClass()
const;
269 Colormap colormap()
const;
272 void updateVisibility();
274 void hideClient(
bool hide );
276 TQString
caption(
bool full =
true )
const;
277 void updateCaption();
279 void keyPressEvent( uint key_code );
280 void updateMouseGrab();
281 Window moveResizeGrabWindow()
const;
283 const TQPoint calculateGravitation(
bool invert,
int gravity = 0 )
const;
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 );
289 void gotPing( Time timestamp );
294 static TQCString staticWmClientMachine(WId);
297 void checkWorkspacePosition();
299 Time userTime()
const;
300 bool hasUserTimeSupport()
const;
301 bool ignoreFocusStealing()
const;
304 static void deleteClient(
Client* c, allowed_t );
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 );
310 void minimize(
bool avoid_animation =
false );
311 void unminimize(
bool avoid_animation =
false );
314 void suspendWindow();
316 bool queryUserSuspendedResume();
317 void maximize( MaximizeMode );
320 void cancelShadeHover();
321 void cancelAutoRaise();
322 void destroyClient();
323 void checkActiveModal();
326 struct Opacity { enum : uint {
328 MouseStep = 0xCCCCCCC,
332 void setOpacity(uint opacity);
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();
349 bool touches(
const Client* c);
350 void setShapable(
bool b);
351 bool hasStrut()
const;
356 void configureRequestTimeout();
357 void shortcutActivated();
358 void updateOpacityCache();
363 virtual void processMousePressEvent( TQMouseEvent* e );
369 Position mousePosition(
const TQPoint& )
const;
370 void setCursor( Position m );
371 void setCursor(
const TQCursor& c );
373 void animateMinimizeOrUnminimize(
bool minimize );
374 TQPixmap animationPixmap(
int w );
376 void drawbound(
const TQRect& geom );
378 void doDrawbound(
const TQRect& geom,
bool clear );
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 );
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 );
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);
405 void processDecorationButtonPress(
int button,
int state,
int x,
int y,
int x_root,
int y_root );
409 void processKillerExited();
410 void processResumerExited();
411 void demandAttentionKNotify();
413 void drawShadowAfter(
Client *after);
414 void drawDelayedShadow();
423 void setMappingState(
int s );
424 int mappingState()
const;
425 bool isIconicState()
const;
426 bool isNormalState()
const;
427 bool isManaged()
const;
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;
433 void updateFullScreenHack(
const TQRect& geom );
434 void getWmNormalHints();
435 void getMotifHints();
437 void getWmClientLeader();
438 void getWmClientMachine();
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 );
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 );
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 );
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 );
472 void embedClient( Window w,
const XWindowAttributes &attr );
473 void detectNoBorder();
474 void detectShapable();
475 void destroyDecoration();
476 void updateFrameExtents();
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();
490 KDecoration* decoration;
496 bool inhibitConfigureRequests;
497 bool move_faked_activity;
498 Window move_resize_grab_window;
499 bool unrestrictedMoveResize;
502 return moveResizeMode && mode == PositionCenter;
504 bool isResize()
const
506 return moveResizeMode && mode != PositionCenter;
511 TQPoint invertedMoveOffset;
512 TQRect moveResizeGeom;
513 TQRect initialMoveResizeGeom;
514 XSizeHints xSizeHint;
515 void sendSyntheticConfigureNotify();
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 );
526 Window transient_for_id;
527 Window original_transient_for_id;
528 ClientList transients_list;
529 ShadeMode shade_mode;
534 uint skip_taskbar :1;
535 uint original_skip_taskbar :1;
536 uint Pdeletewindow :1;
538 uint Ptakeactivity : 1;
539 uint Pcontexthelp : 1;
543 uint motif_noborder : 1;
544 uint motif_may_resize : 1;
545 uint motif_may_move :1;
546 uint motif_may_close : 1;
552 uint user_noborder : 1;
554 uint ignore_focus_stealing : 1;
555 uint demands_attention : 1;
556 WindowRules client_rules;
559 void getWindowProtocols();
561 TQPixmap miniicon_pix;
565 enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
566 FullScreenMode fullscreen_mode;
567 MaximizeMode max_mode;
569 TQRect geom_fs_restore;
570 MaximizeMode maxmode_restore;
571 int workarea_diff_x, workarea_diff_y;
573 TQTimer* autoRaiseTimer;
574 TQTimer* shadeHoverTimer;
575 TQTimer* configureRequestTimer;
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;
587 TDEProcess* process_killer;
588 TDEProcess* process_resumer;
591 unsigned long allowed_actions;
592 TQRect frame_geometry;
594 int postpone_geometry_updates;
595 bool pending_geometry_update;
596 bool shade_geometry_change;
597 int border_left, border_right, border_top, border_bottom;
599 Client* shadowAfterClient;
600 TQWidget* shadowWidget;
601 TQMemArray<double> activeOpacityCache;
602 TQMemArray<double> inactiveOpacityCache;
603 TQMemArray<double>* opacityCache;
604 TQRegion shapeBoundingRegion;
605 TQTimer* shadowDelayTimer;
609 static bool check_active_modal;
610 TDEShortcut _shortcut;
611 friend struct FetchNameInternalPredicate;
612 friend struct CheckIgnoreFocusStealingProcedure;
613 friend struct ResetupRulesProcedure;
614 friend class GeometryUpdatesPostponer;
615 void show() { assert(
false ); }
616 void hide() { assert(
false ); }
620 uint rule_opacity_active;
621 uint rule_opacity_inactive;
624 TQTimer* demandAttentionKNotifyTimer;
626 bool activeMaximizing;
628 ActiveMaximizingMode activeMode;
630 ActiveBorder currentActiveBorder;
632 friend bool performTransiencyCheck();
633 bool minimized_before_suspend;
637class GeometryUpdatesPostponer
640 GeometryUpdatesPostponer(
Client* c )
641 : cl( c ) { cl->postponeGeometryUpdates(
true ); }
642 ~GeometryUpdatesPostponer()
643 { cl->postponeGeometryUpdates(
false ); }
650class WinInfo :
public NETWinInfo
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 );
663inline Window Client::window()
const
668inline Window Client::frameId()
const
673inline Window Client::wrapperId()
const
678inline Window Client::decorationId()
const
680 return decoration != NULL ? decoration->widget()->winId() : None;
683inline Workspace* Client::workspace()
const
688inline const Client* Client::transientFor()
const
690 return transient_for;
693inline Client* Client::transientFor()
695 return transient_for;
698inline bool Client::groupTransient()
const
700 return transient_for_id == workspace()->rootWin();
705inline bool Client::wasOriginallyGroupTransient()
const
707 return original_transient_for_id == workspace()->rootWin();
710inline bool Client::isTransient()
const
712 return transient_for_id != None;
715inline const ClientList& Client::transients()
const
717 return transients_list;
720inline const Group* Client::group()
const
725inline Group* Client::group()
730inline int Client::mappingState()
const
732 return mapping_state;
735inline TQCString Client::resourceName()
const
737 return resource_name;
740inline TQCString Client::resourceClass()
const
742 return resource_class;
746bool Client::isMinimized()
const
751inline bool Client::isActive()
const
767inline bool Client::isOnAllDesktops()
const
769 return desk == NET::OnAllDesktops;
777 return desk == d || isOnAllDesktops();
781bool Client::isShown(
bool shaded_is_shown )
const
783 return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
787bool Client::isShade()
const
789 return shade_mode == ShadeNormal;
793ShadeMode Client::shadeMode()
const
798inline TQPixmap Client::icon()
const
803inline TQPixmap Client::miniIcon()
const
808inline TQRect Client::geometryRestore()
const
813inline Client::MaximizeMode Client::maximizeModeRestore()
const
815 return maxmode_restore;
818inline Client::MaximizeMode Client::maximizeMode()
const
823inline bool Client::skipTaskbar(
bool from_outside )
const
825 return from_outside ? original_skip_taskbar : skip_taskbar;
828inline bool Client::skipPager()
const
833inline bool Client::keepBelow()
const
838inline bool Client::shape()
const
844inline bool Client::isFullScreen()
const
846 return fullscreen_mode != FullScreenNone;
849inline bool Client::isModal()
const
854inline bool Client::hasNETSupport()
const
856 return info->hasNETSupport();
859inline Colormap Client::colormap()
const
864inline pid_t Client::pid()
const
869inline void Client::invalidateLayer()
871 in_layer = UnknownLayer;
874inline bool Client::isIconicState()
const
876 return mapping_state == IconicState;
879inline bool Client::isNormalState()
const
881 return mapping_state == NormalState;
884inline bool Client::isManaged()
const
886 return mapping_state != WithdrawnState;
889inline TQCString Client::windowRole()
const
894inline TQRect Client::geometry()
const
896 return frame_geometry;
899inline TQSize Client::size()
const
901 return frame_geometry.size();
904inline TQPoint Client::pos()
const
906 return frame_geometry.topLeft();
909inline int Client::x()
const
911 return frame_geometry.x();
914inline int Client::y()
const
916 return frame_geometry.y();
919inline int Client::width()
const
921 return frame_geometry.width();
924inline int Client::height()
const
926 return frame_geometry.height();
929inline TQRect Client::rect()
const
931 return TQRect( 0, 0, width(), height());
934inline TQPoint Client::clientPos()
const
936 return TQPoint( border_left, border_top );
939inline TQSize Client::clientSize()
const
946 setGeometry( r.x(), r.y(), r.width(), r.height(), force );
949inline void Client::move(
const TQPoint & p, ForceGeometry_t force )
951 move( p.x(), p.y(), force );
954inline void Client::plainResize(
const TQSize& s, ForceGeometry_t force )
956 plainResize( s.width(), s.height(), force );
959inline bool Client::isShadowed()
const
964inline Window Client::shadowId()
const
966 return shadowWidget != NULL ? shadowWidget->winId() : None;
969inline void Client::resizeWithChecks(
const TQSize& s, ForceGeometry_t force )
971 resizeWithChecks( s.width(), s.height(), force );
974inline bool Client::hasUserTimeSupport()
const
976 return info->userTime() != -1U;
979inline bool Client::ignoreFocusStealing()
const
981 return ignore_focus_stealing;
984inline const WindowRules* Client::rules()
const
986 return &client_rules;
989KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
991inline Window Client::moveResizeGrabWindow()
const
993 return move_resize_grab_window;
996inline TDEShortcut Client::shortcut()
const
1001inline bool Client::isBMP()
1006inline void Client::setBMP(
bool b)
1011inline void Client::removeRule( Rules* rule )
1013 client_rules.remove( rule );
1018kndbgstream& operator<<( kndbgstream& stream,
const Client* ) {
return stream; }
1020kndbgstream& operator<<( kndbgstream& stream,
const ClientList& ) {
return stream; }
1022kndbgstream& operator<<( kndbgstream& stream,
const ConstClientList& ) {
return stream; }
1024kdbgstream& operator<<( kdbgstream& stream,
const Client* );
1025kdbgstream& operator<<( kdbgstream& stream,
const ClientList& );
1026kdbgstream& operator<<( kdbgstream& stream,
const ConstClientList& );
1029KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
1030KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
1031KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
The Client class encapsulates a window decoration frame.
static Window staticWmClientLeader(WId)
bool providesContextHelp() const
TQRect adjustedClientArea(const TQRect &desktop, const TQRect &area) const
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force=NormalGeometrySet)
bool performMouseCommand(Options::MouseCommand, TQPoint globalPos, bool handled=false)
void setActive(bool, bool updateOpacity=true)
bool isMinimizable() const
bool manage(Window w, bool isMapped)
void minimize(bool avoid_animation=false)
static TQCString staticSessionId(WId)
bool windowEvent(XEvent *e)
TQCString wmClientMachine(bool use_localhost) const
TQSize adjustedSize(const TQSize &, Sizemode mode=SizemodeAny) const
static TQCString staticWindowRole(WId)
static TQCString staticWmCommand(WId)
void updateUserTime(Time time=CurrentTime)
bool isOnDesktop(int d) const
void releaseWindow(bool on_shutdown=false)
void setMaximize(bool vertically, bool horizontally)
Window wmClientLeader() const
TQString caption(bool full=true) const
void move(int x, int y, ForceGeometry_t force=NormalGeometrySet)