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();
324 void setOpacity(
bool translucent, uint opacity = 0);
325 void setShadowSize(uint shadowSize);
326 void updateOpacity();
327 void updateShadowSize();
328 bool hasCustomOpacity(){
return custom_opacity;}
329 void setCustomOpacityFlag(
bool custom =
true);
330 bool getWindowOpacity();
331 int opacityPercentage();
332 void checkAndSetInitialRuledOpacity();
333 uint ruleOpacityInactive();
334 uint ruleOpacityActive();
335 unsigned int opacity();
338 bool touches(
const Client* c);
339 void setShapable(
bool b);
340 bool hasStrut()
const;
345 void configureRequestTimeout();
346 void shortcutActivated();
347 void updateOpacityCache();
352 virtual void processMousePressEvent( TQMouseEvent* e );
358 Position mousePosition(
const TQPoint& )
const;
359 void setCursor( Position m );
360 void setCursor(
const TQCursor& c );
362 void animateMinimizeOrUnminimize(
bool minimize );
363 TQPixmap animationPixmap(
int w );
365 void drawbound(
const TQRect& geom );
367 void doDrawbound(
const TQRect& geom,
bool clear );
370 bool mapRequestEvent( XMapRequestEvent* e );
371 void unmapNotifyEvent( XUnmapEvent*e );
372 void destroyNotifyEvent( XDestroyWindowEvent*e );
373 void configureRequestEvent( XConfigureRequestEvent* e );
374 void propertyNotifyEvent( XPropertyEvent* e );
375 void clientMessageEvent( XClientMessageEvent* e );
376 void enterNotifyEvent( XCrossingEvent* e );
377 void leaveNotifyEvent( XCrossingEvent* e );
378 void focusInEvent( XFocusInEvent* e );
379 void focusOutEvent( XFocusOutEvent* e );
381 bool buttonPressEvent( Window w,
int button,
int state,
int x,
int y,
int x_root,
int y_root );
382 bool buttonReleaseEvent( Window w,
int button,
int state,
int x,
int y,
int x_root,
int y_root );
383 bool motionNotifyEvent( Window w,
int state,
int x,
int y,
int x_root,
int y_root );
386 void drawIntersectingShadows();
387 void drawOverlappingShadows(
bool waitForMe);
388 TQRegion getExposedRegion(TQRegion occludedRegion,
int x,
int y,
389 int w,
int h,
int thickness,
int xOffset,
int yOffset);
390 void imposeCachedShadow(TQPixmap &pixmap, TQRegion exposed);
391 void imposeRegionShadow(TQPixmap &pixmap, TQRegion occluded,
392 TQRegion exposed,
int thickness,
double maxOpacity = 0.75);
394 void processDecorationButtonPress(
int button,
int state,
int x,
int y,
int x_root,
int y_root );
398 void processKillerExited();
399 void processResumerExited();
400 void demandAttentionKNotify();
402 void drawShadowAfter(
Client *after);
403 void drawDelayedShadow();
412 void setMappingState(
int s );
413 int mappingState()
const;
414 bool isIconicState()
const;
415 bool isNormalState()
const;
416 bool isManaged()
const;
417 void updateAllowedActions(
bool force =
false );
418 TQSize sizeForClientSize(
const TQSize&, Sizemode mode = SizemodeAny,
bool noframe =
false )
const;
419 void changeMaximize(
bool horizontal,
bool vertical,
bool adjust );
420 void checkMaximizeGeometry();
421 int checkFullScreenHack(
const TQRect& geom )
const;
422 void updateFullScreenHack(
const TQRect& geom );
423 void getWmNormalHints();
424 void getMotifHints();
426 void getWmClientLeader();
427 void getWmClientMachine();
429 void fetchIconicName();
430 TQString readName()
const;
431 void setCaption(
const TQString& s,
bool force =
false );
432 bool hasTransientInternal(
const Client* c,
bool indirect, ConstClientList& set )
const;
433 void finishWindowRules();
434 void setShortcutInternal(
const TDEShortcut& cut );
436 void updateWorkareaDiffs();
437 void checkDirection(
int new_diff,
int old_diff, TQRect& rect,
const TQRect& area );
438 static int computeWorkareaDiff(
int left,
int right,
int a_left,
int a_right );
439 void configureRequest(
int value_mask,
int rx,
int ry,
int rw,
int rh,
int gravity,
bool from_tool );
440 NETExtendedStrut strut()
const;
441 int checkShadeGeometry(
int w,
int h );
442 void postponeGeometryUpdates(
bool postpone );
444 bool startMoveResize();
445 void finishMoveResize(
bool cancel );
446 void leaveMoveResize();
447 void checkUnrestrictedMoveResize();
448 void handleMoveResize(
int x,
int y,
int x_root,
int y_root );
449 void positionGeometryTip();
450 void grabButton(
int mod );
451 void ungrabButton(
int mod );
452 void resetMaximize();
453 void resizeDecoration(
const TQSize& s );
454 void setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth);
455 void unsetDecoHashProperty();
458 void killProcess(
bool ask, Time timestamp = CurrentTime );
459 void updateUrgency();
460 static void sendClientMessage( Window w, Atom a, Atom protocol,
461 long data1 = 0,
long data2 = 0,
long data3 = 0 );
463 void embedClient( Window w,
const XWindowAttributes &attr );
464 void detectNoBorder();
465 void detectShapable();
466 void destroyDecoration();
467 void updateFrameExtents();
472 Time readUserTimeMapTimestamp(
const TDEStartupInfoId* asn_id,
const TDEStartupInfoData* asn_data,
473 bool session )
const;
474 Time readUserCreationTime()
const;
475 static bool sameAppWindowRoleMatch(
const Client* c1,
const Client* c2,
bool active_hack );
476 void startupIdChanged();
481 KDecoration* decoration;
487 bool inhibitConfigureRequests;
488 bool move_faked_activity;
489 Window move_resize_grab_window;
490 bool unrestrictedMoveResize;
493 return moveResizeMode && mode == PositionCenter;
495 bool isResize()
const
497 return moveResizeMode && mode != PositionCenter;
502 TQPoint invertedMoveOffset;
503 TQRect moveResizeGeom;
504 TQRect initialMoveResizeGeom;
505 XSizeHints xSizeHint;
506 void sendSyntheticConfigureNotify();
508 void readTransient();
509 Window verifyTransientFor( Window transient_for,
bool set );
510 void addTransient(
Client* cl );
511 void removeTransient(
Client* cl );
512 void removeFromMainClients();
513 void cleanGrouping();
514 void checkGroupTransients();
515 void setTransient( Window new_transient_for_id );
517 Window transient_for_id;
518 Window original_transient_for_id;
519 ClientList transients_list;
520 ShadeMode shade_mode;
525 uint skip_taskbar :1;
526 uint original_skip_taskbar :1;
527 uint Pdeletewindow :1;
529 uint Ptakeactivity : 1;
530 uint Pcontexthelp : 1;
534 uint motif_noborder : 1;
535 uint motif_may_resize : 1;
536 uint motif_may_move :1;
537 uint motif_may_close : 1;
543 uint user_noborder : 1;
545 uint ignore_focus_stealing : 1;
546 uint demands_attention : 1;
547 WindowRules client_rules;
550 void getWindowProtocols();
552 TQPixmap miniicon_pix;
556 enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
557 FullScreenMode fullscreen_mode;
558 MaximizeMode max_mode;
560 TQRect geom_fs_restore;
561 MaximizeMode maxmode_restore;
562 int workarea_diff_x, workarea_diff_y;
564 TQTimer* autoRaiseTimer;
565 TQTimer* shadeHoverTimer;
566 TQTimer* configureRequestTimer;
568 TQCString resource_name;
569 TQCString resource_class;
570 TQCString client_machine;
571 TQString cap_normal, cap_iconic, cap_suffix;
572 WId wmClientLeaderWin;
573 TQCString window_role;
578 TDEProcess* process_killer;
579 TDEProcess* process_resumer;
582 unsigned long allowed_actions;
583 TQRect frame_geometry;
585 int postpone_geometry_updates;
586 bool pending_geometry_update;
587 bool shade_geometry_change;
588 int border_left, border_right, border_top, border_bottom;
590 Client* shadowAfterClient;
591 TQWidget* shadowWidget;
592 TQMemArray<double> activeOpacityCache;
593 TQMemArray<double> inactiveOpacityCache;
594 TQMemArray<double>* opacityCache;
595 TQRegion shapeBoundingRegion;
596 TQTimer* shadowDelayTimer;
600 static bool check_active_modal;
601 TDEShortcut _shortcut;
602 friend struct FetchNameInternalPredicate;
603 friend struct CheckIgnoreFocusStealingProcedure;
604 friend struct ResetupRulesProcedure;
605 friend class GeometryUpdatesPostponer;
606 void show() { assert(
false ); }
607 void hide() { assert(
false ); }
611 uint rule_opacity_active;
612 uint rule_opacity_inactive;
615 TQTimer* demandAttentionKNotifyTimer;
617 bool activeMaximizing;
619 ActiveMaximizingMode activeMode;
621 ActiveBorder currentActiveBorder;
623 friend bool performTransiencyCheck();
624 bool minimized_before_suspend;
628class GeometryUpdatesPostponer
631 GeometryUpdatesPostponer(
Client* c )
632 : cl( c ) { cl->postponeGeometryUpdates(
true ); }
633 ~GeometryUpdatesPostponer()
634 { cl->postponeGeometryUpdates(
false ); }
641class WinInfo :
public NETWinInfo
646 WinInfo( Client* c, Display * display, Window window,
647 Window rwin,
const unsigned long pr[],
int pr_size );
648 virtual void changeDesktop(
int desktop);
649 virtual void changeState(
unsigned long state,
unsigned long mask );
654inline Window Client::window()
const
659inline Window Client::frameId()
const
664inline Window Client::wrapperId()
const
669inline Window Client::decorationId()
const
671 return decoration != NULL ? decoration->widget()->winId() : None;
674inline Workspace* Client::workspace()
const
679inline const Client* Client::transientFor()
const
681 return transient_for;
684inline Client* Client::transientFor()
686 return transient_for;
689inline bool Client::groupTransient()
const
691 return transient_for_id == workspace()->rootWin();
696inline bool Client::wasOriginallyGroupTransient()
const
698 return original_transient_for_id == workspace()->rootWin();
701inline bool Client::isTransient()
const
703 return transient_for_id != None;
706inline const ClientList& Client::transients()
const
708 return transients_list;
711inline const Group* Client::group()
const
716inline Group* Client::group()
721inline int Client::mappingState()
const
723 return mapping_state;
726inline TQCString Client::resourceName()
const
728 return resource_name;
731inline TQCString Client::resourceClass()
const
733 return resource_class;
737bool Client::isMinimized()
const
742inline bool Client::isActive()
const
758inline bool Client::isOnAllDesktops()
const
760 return desk == NET::OnAllDesktops;
768 return desk == d || isOnAllDesktops();
772bool Client::isShown(
bool shaded_is_shown )
const
774 return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
778bool Client::isShade()
const
780 return shade_mode == ShadeNormal;
784ShadeMode Client::shadeMode()
const
789inline TQPixmap Client::icon()
const
794inline TQPixmap Client::miniIcon()
const
799inline TQRect Client::geometryRestore()
const
804inline Client::MaximizeMode Client::maximizeModeRestore()
const
806 return maxmode_restore;
809inline Client::MaximizeMode Client::maximizeMode()
const
814inline bool Client::skipTaskbar(
bool from_outside )
const
816 return from_outside ? original_skip_taskbar : skip_taskbar;
819inline bool Client::skipPager()
const
824inline bool Client::keepBelow()
const
829inline bool Client::shape()
const
835inline bool Client::isFullScreen()
const
837 return fullscreen_mode != FullScreenNone;
840inline bool Client::isModal()
const
845inline bool Client::hasNETSupport()
const
847 return info->hasNETSupport();
850inline Colormap Client::colormap()
const
855inline pid_t Client::pid()
const
860inline void Client::invalidateLayer()
862 in_layer = UnknownLayer;
865inline bool Client::isIconicState()
const
867 return mapping_state == IconicState;
870inline bool Client::isNormalState()
const
872 return mapping_state == NormalState;
875inline bool Client::isManaged()
const
877 return mapping_state != WithdrawnState;
880inline TQCString Client::windowRole()
const
885inline TQRect Client::geometry()
const
887 return frame_geometry;
890inline TQSize Client::size()
const
892 return frame_geometry.size();
895inline TQPoint Client::pos()
const
897 return frame_geometry.topLeft();
900inline int Client::x()
const
902 return frame_geometry.x();
905inline int Client::y()
const
907 return frame_geometry.y();
910inline int Client::width()
const
912 return frame_geometry.width();
915inline int Client::height()
const
917 return frame_geometry.height();
920inline TQRect Client::rect()
const
922 return TQRect( 0, 0, width(), height());
925inline TQPoint Client::clientPos()
const
927 return TQPoint( border_left, border_top );
930inline TQSize Client::clientSize()
const
937 setGeometry( r.x(), r.y(), r.width(), r.height(), force );
940inline void Client::move(
const TQPoint & p, ForceGeometry_t force )
942 move( p.x(), p.y(), force );
945inline void Client::plainResize(
const TQSize& s, ForceGeometry_t force )
947 plainResize( s.width(), s.height(), force );
950inline bool Client::isShadowed()
const
955inline Window Client::shadowId()
const
957 return shadowWidget != NULL ? shadowWidget->winId() : None;
960inline void Client::resizeWithChecks(
const TQSize& s, ForceGeometry_t force )
962 resizeWithChecks( s.width(), s.height(), force );
965inline bool Client::hasUserTimeSupport()
const
967 return info->userTime() != -1U;
970inline bool Client::ignoreFocusStealing()
const
972 return ignore_focus_stealing;
975inline const WindowRules* Client::rules()
const
977 return &client_rules;
980KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
982inline Window Client::moveResizeGrabWindow()
const
984 return move_resize_grab_window;
987inline TDEShortcut Client::shortcut()
const
992inline bool Client::isBMP()
997inline void Client::setBMP(
bool b)
1002inline void Client::removeRule( Rules* rule )
1004 client_rules.remove( rule );
1009kndbgstream& operator<<( kndbgstream& stream,
const Client* ) {
return stream; }
1011kndbgstream& operator<<( kndbgstream& stream,
const ClientList& ) {
return stream; }
1013kndbgstream& operator<<( kndbgstream& stream,
const ConstClientList& ) {
return stream; }
1015kdbgstream& operator<<( kdbgstream& stream,
const Client* );
1016kdbgstream& operator<<( kdbgstream& stream,
const ClientList& );
1017kdbgstream& operator<<( kdbgstream& stream,
const ConstClientList& );
1020KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
1021KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
1022KWIN_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)