21 #include <tdeshortcut.h> 24 #include <X11/Xutil.h> 29 #include "workspace.h" 30 #include "kdecoration.h" 35 class TDEStartupInfoData;
46 class 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 setActiveBorder( ActiveBorder border);
237 ActiveMaximizingMode activeBorderMode()
const;
238 ActiveBorder activeBorder()
const;
239 void setActiveBorderMaximizing(
bool maximizing);
240 void cancelActiveBorderMaximizing();
241 bool isActiveBorderMaximizing()
const;
242 TQRect activeBorderMaximizeGeometry();
244 void growHorizontal();
245 void shrinkHorizontal();
247 void shrinkVertical();
250 TDEShortcut shortcut()
const;
251 void setShortcut(
const TQString& cut );
253 bool performMouseCommand( Options::MouseCommand, TQPoint globalPos,
bool handled =
false );
255 TQCString windowRole()
const;
257 TQCString resourceName()
const;
258 TQCString resourceClass()
const;
266 Colormap colormap()
const;
269 void updateVisibility();
271 void hideClient(
bool hide );
273 TQString
caption(
bool full =
true )
const;
274 void updateCaption();
276 void keyPressEvent( uint key_code );
277 void updateMouseGrab();
278 Window moveResizeGrabWindow()
const;
280 const TQPoint calculateGravitation(
bool invert,
int gravity = 0 )
const;
282 void NETMoveResize(
int x_root,
int y_root, NET::Direction direction );
283 void NETMoveResizeWindow(
int flags,
int x,
int y,
int width,
int height );
284 void restackWindow( Window above,
int detail, NET::RequestSource source, Time timestamp,
bool send_event =
false );
286 void gotPing( Time timestamp );
291 static TQCString staticWmClientMachine(WId);
294 void checkWorkspacePosition();
296 Time userTime()
const;
297 bool hasUserTimeSupport()
const;
298 bool ignoreFocusStealing()
const;
301 static void deleteClient(
Client* c, allowed_t );
303 static bool resourceMatch(
const Client* c1,
const Client* c2 );
304 static bool belongToSameApplication(
const Client* c1,
const Client* c2,
bool active_hack =
false );
305 static void readIcons( Window win, TQPixmap* icon, TQPixmap* miniicon );
307 void minimize(
bool avoid_animation =
false );
308 void unminimize(
bool avoid_animation =
false );
311 void suspendWindow();
313 bool queryUserSuspendedResume();
314 void maximize( MaximizeMode );
317 void cancelShadeHover();
318 void cancelAutoRaise();
319 void destroyClient();
320 void checkActiveModal();
321 void setOpacity(
bool translucent, uint opacity = 0);
322 void setShadowSize(uint shadowSize);
323 void updateOpacity();
324 void updateShadowSize();
325 bool hasCustomOpacity(){
return custom_opacity;}
326 void setCustomOpacityFlag(
bool custom =
true);
327 bool getWindowOpacity();
328 int opacityPercentage();
329 void checkAndSetInitialRuledOpacity();
330 uint ruleOpacityInactive();
331 uint ruleOpacityActive();
332 unsigned int opacity();
335 bool touches(
const Client* c);
336 void setShapable(
bool b);
337 bool hasStrut()
const;
342 void shortcutActivated();
343 void updateOpacityCache();
348 virtual void processMousePressEvent( TQMouseEvent* e );
354 Position mousePosition(
const TQPoint& )
const;
355 void setCursor( Position m );
356 void setCursor(
const TQCursor& c );
358 void animateMinimizeOrUnminimize(
bool minimize );
359 TQPixmap animationPixmap(
int w );
361 void drawbound(
const TQRect& geom );
363 void doDrawbound(
const TQRect& geom,
bool clear );
366 bool mapRequestEvent( XMapRequestEvent* e );
367 void unmapNotifyEvent( XUnmapEvent*e );
368 void destroyNotifyEvent( XDestroyWindowEvent*e );
369 void configureRequestEvent( XConfigureRequestEvent* e );
370 void propertyNotifyEvent( XPropertyEvent* e );
371 void clientMessageEvent( XClientMessageEvent* e );
372 void enterNotifyEvent( XCrossingEvent* e );
373 void leaveNotifyEvent( XCrossingEvent* e );
374 void focusInEvent( XFocusInEvent* e );
375 void focusOutEvent( XFocusOutEvent* e );
377 bool buttonPressEvent( Window w,
int button,
int state,
int x,
int y,
int x_root,
int y_root );
378 bool buttonReleaseEvent( Window w,
int button,
int state,
int x,
int y,
int x_root,
int y_root );
379 bool motionNotifyEvent( Window w,
int state,
int x,
int y,
int x_root,
int y_root );
382 void drawIntersectingShadows();
383 void drawOverlappingShadows(
bool waitForMe);
384 TQRegion getExposedRegion(TQRegion occludedRegion,
int x,
int y,
385 int w,
int h,
int thickness,
int xOffset,
int yOffset);
386 void imposeCachedShadow(TQPixmap &pixmap, TQRegion exposed);
387 void imposeRegionShadow(TQPixmap &pixmap, TQRegion occluded,
388 TQRegion exposed,
int thickness,
double maxOpacity = 0.75);
390 void processDecorationButtonPress(
int button,
int state,
int x,
int y,
int x_root,
int y_root );
394 void processKillerExited();
395 void processResumerExited();
396 void demandAttentionKNotify();
398 void drawShadowAfter(
Client *after);
399 void drawDelayedShadow();
408 void setMappingState(
int s );
409 int mappingState()
const;
410 bool isIconicState()
const;
411 bool isNormalState()
const;
412 bool isManaged()
const;
413 void updateAllowedActions(
bool force =
false );
414 TQSize sizeForClientSize(
const TQSize&, Sizemode mode = SizemodeAny,
bool noframe =
false )
const;
415 void changeMaximize(
bool horizontal,
bool vertical,
bool adjust );
416 void checkMaximizeGeometry();
417 int checkFullScreenHack(
const TQRect& geom )
const;
418 void updateFullScreenHack(
const TQRect& geom );
419 void getWmNormalHints();
420 void getMotifHints();
422 void getWmClientLeader();
423 void getWmClientMachine();
425 void fetchIconicName();
426 TQString readName()
const;
427 void setCaption(
const TQString& s,
bool force =
false );
428 bool hasTransientInternal(
const Client* c,
bool indirect, ConstClientList&
set )
const;
429 void finishWindowRules();
430 void setShortcutInternal(
const TDEShortcut& cut );
432 void updateWorkareaDiffs();
433 void checkDirection(
int new_diff,
int old_diff, TQRect& rect,
const TQRect& area );
434 static int computeWorkareaDiff(
int left,
int right,
int a_left,
int a_right );
435 void configureRequest(
int value_mask,
int rx,
int ry,
int rw,
int rh,
int gravity,
bool from_tool );
436 NETExtendedStrut strut()
const;
437 int checkShadeGeometry(
int w,
int h );
438 void postponeGeometryUpdates(
bool postpone );
440 bool startMoveResize();
441 void finishMoveResize(
bool cancel );
442 void leaveMoveResize();
443 void checkUnrestrictedMoveResize();
444 void handleMoveResize(
int x,
int y,
int x_root,
int y_root );
445 void positionGeometryTip();
446 void grabButton(
int mod );
447 void ungrabButton(
int mod );
448 void resetMaximize();
449 void resizeDecoration(
const TQSize& s );
450 void setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth);
451 void unsetDecoHashProperty();
454 void killProcess(
bool ask, Time timestamp = CurrentTime );
455 void updateUrgency();
456 static void sendClientMessage( Window w, Atom a, Atom protocol,
457 long data1 = 0,
long data2 = 0,
long data3 = 0 );
459 void embedClient( Window w,
const XWindowAttributes &attr );
460 void detectNoBorder();
461 void detectShapable();
462 void destroyDecoration();
463 void updateFrameExtents();
468 Time readUserTimeMapTimestamp(
const TDEStartupInfoId* asn_id,
const TDEStartupInfoData* asn_data,
469 bool session )
const;
470 Time readUserCreationTime()
const;
471 static bool sameAppWindowRoleMatch(
const Client* c1,
const Client* c2,
bool active_hack );
472 void startupIdChanged();
477 KDecoration* decoration;
483 bool move_faked_activity;
484 Window move_resize_grab_window;
485 bool unrestrictedMoveResize;
488 return moveResizeMode && mode == PositionCenter;
490 bool isResize()
const 492 return moveResizeMode && mode != PositionCenter;
497 TQPoint invertedMoveOffset;
498 TQRect moveResizeGeom;
499 TQRect initialMoveResizeGeom;
500 XSizeHints xSizeHint;
501 void sendSyntheticConfigureNotify();
503 void readTransient();
504 Window verifyTransientFor( Window transient_for,
bool set );
505 void addTransient(
Client* cl );
506 void removeTransient(
Client* cl );
507 void removeFromMainClients();
508 void cleanGrouping();
509 void checkGroupTransients();
510 void setTransient( Window new_transient_for_id );
512 Window transient_for_id;
513 Window original_transient_for_id;
514 ClientList transients_list;
515 ShadeMode shade_mode;
520 uint skip_taskbar :1;
521 uint original_skip_taskbar :1;
522 uint Pdeletewindow :1;
524 uint Ptakeactivity : 1;
525 uint Pcontexthelp : 1;
529 uint motif_noborder : 1;
530 uint motif_may_resize : 1;
531 uint motif_may_move :1;
532 uint motif_may_close : 1;
538 uint user_noborder : 1;
540 uint ignore_focus_stealing : 1;
541 uint demands_attention : 1;
542 WindowRules client_rules;
545 void getWindowProtocols();
547 TQPixmap miniicon_pix;
551 enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack };
552 FullScreenMode fullscreen_mode;
553 MaximizeMode max_mode;
555 TQRect geom_fs_restore;
556 MaximizeMode maxmode_restore;
557 int workarea_diff_x, workarea_diff_y;
559 TQTimer* autoRaiseTimer;
560 TQTimer* shadeHoverTimer;
562 TQCString resource_name;
563 TQCString resource_class;
564 TQCString client_machine;
565 TQString cap_normal, cap_iconic, cap_suffix;
566 WId wmClientLeaderWin;
567 TQCString window_role;
572 TDEProcess* process_killer;
573 TDEProcess* process_resumer;
576 unsigned long allowed_actions;
577 TQRect frame_geometry;
579 int postpone_geometry_updates;
580 bool pending_geometry_update;
581 bool shade_geometry_change;
582 int border_left, border_right, border_top, border_bottom;
584 Client* shadowAfterClient;
585 TQWidget* shadowWidget;
586 TQMemArray<double> activeOpacityCache;
587 TQMemArray<double> inactiveOpacityCache;
588 TQMemArray<double>* opacityCache;
589 TQRegion shapeBoundingRegion;
590 TQTimer* shadowDelayTimer;
594 static bool check_active_modal;
595 TDEShortcut _shortcut;
596 friend struct FetchNameInternalPredicate;
597 friend struct CheckIgnoreFocusStealingProcedure;
598 friend struct ResetupRulesProcedure;
599 friend class GeometryUpdatesPostponer;
600 void show() { assert(
false ); }
601 void hide() { assert(
false ); }
605 uint rule_opacity_active;
606 uint rule_opacity_inactive;
609 TQTimer* demandAttentionKNotifyTimer;
611 bool activeMaximizing;
613 TQRect activeTiledOrigGeom;
614 ActiveMaximizingMode activeMode;
615 ActiveBorder currentActiveBorder;
617 friend bool performTransiencyCheck();
618 bool minimized_before_suspend;
622 class GeometryUpdatesPostponer
625 GeometryUpdatesPostponer(
Client* c )
626 : cl( c ) { cl->postponeGeometryUpdates(
true ); }
627 ~GeometryUpdatesPostponer()
628 { cl->postponeGeometryUpdates(
false ); }
635 class WinInfo :
public NETWinInfo
640 WinInfo( Client* c, Display * display, Window window,
641 Window rwin,
const unsigned long pr[],
int pr_size );
642 virtual void changeDesktop(
int desktop);
643 virtual void changeState(
unsigned long state,
unsigned long mask );
648 inline Window Client::window()
const 653 inline Window Client::frameId()
const 658 inline Window Client::wrapperId()
const 663 inline Window Client::decorationId()
const 665 return decoration != NULL ? decoration->widget()->winId() : None;
668 inline Workspace* Client::workspace()
const 673 inline const Client* Client::transientFor()
const 675 return transient_for;
678 inline Client* Client::transientFor()
680 return transient_for;
683 inline bool Client::groupTransient()
const 685 return transient_for_id == workspace()->rootWin();
690 inline bool Client::wasOriginallyGroupTransient()
const 692 return original_transient_for_id == workspace()->rootWin();
695 inline bool Client::isTransient()
const 697 return transient_for_id != None;
700 inline const ClientList& Client::transients()
const 702 return transients_list;
705 inline const Group* Client::group()
const 710 inline Group* Client::group()
715 inline int Client::mappingState()
const 717 return mapping_state;
720 inline TQCString Client::resourceName()
const 722 return resource_name;
725 inline TQCString Client::resourceClass()
const 727 return resource_class;
731 bool Client::isMinimized()
const 736 inline bool Client::isActive()
const 752 inline bool Client::isOnAllDesktops()
const 754 return desk == NET::OnAllDesktops;
762 return desk == d || isOnAllDesktops();
766 bool Client::isShown(
bool shaded_is_shown )
const 768 return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
772 bool Client::isShade()
const 774 return shade_mode == ShadeNormal;
778 ShadeMode Client::shadeMode()
const 783 inline TQPixmap Client::icon()
const 788 inline TQPixmap Client::miniIcon()
const 793 inline TQRect Client::geometryRestore()
const 798 inline Client::MaximizeMode Client::maximizeModeRestore()
const 800 return maxmode_restore;
803 inline Client::MaximizeMode Client::maximizeMode()
const 808 inline bool Client::skipTaskbar(
bool from_outside )
const 810 return from_outside ? original_skip_taskbar : skip_taskbar;
813 inline bool Client::skipPager()
const 818 inline bool Client::keepBelow()
const 823 inline bool Client::shape()
const 829 inline bool Client::isFullScreen()
const 831 return fullscreen_mode != FullScreenNone;
834 inline bool Client::isModal()
const 839 inline bool Client::hasNETSupport()
const 841 return info->hasNETSupport();
844 inline Colormap Client::colormap()
const 849 inline pid_t Client::pid()
const 854 inline void Client::invalidateLayer()
856 in_layer = UnknownLayer;
859 inline bool Client::isIconicState()
const 861 return mapping_state == IconicState;
864 inline bool Client::isNormalState()
const 866 return mapping_state == NormalState;
869 inline bool Client::isManaged()
const 871 return mapping_state != WithdrawnState;
874 inline TQCString Client::windowRole()
const 879 inline TQRect Client::geometry()
const 881 return frame_geometry;
884 inline TQSize Client::size()
const 886 return frame_geometry.size();
889 inline TQPoint Client::pos()
const 891 return frame_geometry.topLeft();
894 inline int Client::x()
const 896 return frame_geometry.x();
899 inline int Client::y()
const 901 return frame_geometry.y();
904 inline int Client::width()
const 906 return frame_geometry.width();
909 inline int Client::height()
const 911 return frame_geometry.height();
914 inline TQRect Client::rect()
const 916 return TQRect( 0, 0, width(), height());
919 inline TQPoint Client::clientPos()
const 921 return TQPoint( border_left, border_top );
924 inline TQSize Client::clientSize()
const 931 setGeometry( r.x(), r.y(), r.width(), r.height(), force );
934 inline void Client::move(
const TQPoint & p, ForceGeometry_t force )
936 move( p.x(), p.y(), force );
939 inline void Client::plainResize(
const TQSize& s, ForceGeometry_t force )
941 plainResize( s.width(), s.height(), force );
944 inline bool Client::isShadowed()
const 949 inline Window Client::shadowId()
const 951 return shadowWidget != NULL ? shadowWidget->winId() : None;
954 inline void Client::resizeWithChecks(
const TQSize& s, ForceGeometry_t force )
956 resizeWithChecks( s.width(), s.height(), force );
959 inline bool Client::hasUserTimeSupport()
const 961 return info->userTime() != -1U;
964 inline bool Client::ignoreFocusStealing()
const 966 return ignore_focus_stealing;
969 inline const WindowRules* Client::rules()
const 971 return &client_rules;
974 KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
976 inline Window Client::moveResizeGrabWindow()
const 978 return move_resize_grab_window;
981 inline TDEShortcut Client::shortcut()
const 986 inline bool Client::isBMP()
991 inline void Client::setBMP(
bool b)
996 inline void Client::removeRule( Rules* rule )
998 client_rules.remove( rule );
1003 kndbgstream& operator<<( kndbgstream& stream,
const Client* ) {
return stream; }
1005 kndbgstream& operator<<( kndbgstream& stream,
const ClientList& ) {
return stream; }
1007 kndbgstream& operator<<( kndbgstream& stream,
const ConstClientList& ) {
return stream; }
1009 kdbgstream& operator<<( kdbgstream& stream,
const Client* );
1010 kdbgstream& operator<<( kdbgstream& stream,
const ClientList& );
1011 kdbgstream& operator<<( kdbgstream& stream,
const ConstClientList& );
1014 KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
1015 KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
1016 KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
TQString caption(bool full=true) const
void move(int x, int y, ForceGeometry_t force=NormalGeometrySet)
bool manage(Window w, bool isMapped)
TQSize adjustedSize(const TQSize &, Sizemode mode=SizemodeAny) const
void minimize(bool avoid_animation=false)
Window wmClientLeader() const
static Window staticWmClientLeader(WId)
bool isMinimizable() const
TQRect adjustedClientArea(const TQRect &desktop, const TQRect &area) const
bool windowEvent(XEvent *e)
bool providesContextHelp() const
static TQCString staticWindowRole(WId)
The Client class encapsulates a window decoration frame.
TQCString wmClientMachine(bool use_localhost) const
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force=NormalGeometrySet)
bool isOnDesktop(int d) const
void setActive(bool, bool updateOpacity=true)
void releaseWindow(bool on_shutdown=false)
bool performMouseCommand(Options::MouseCommand, TQPoint globalPos, bool handled=false)
void updateUserTime(Time time=CurrentTime)
void setMaximize(bool vertically, bool horizontally)
static TQCString staticSessionId(WId)
static TQCString staticWmCommand(WId)