]> icculus.org git repositories - dana/openbox.git/blob - src/client.hh
display icons in the frame titlebar!
[dana/openbox.git] / src / client.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __client_hh
3 #define   __client_hh
4
5 /*! @file client.hh
6   @brief The Client class maintains the state of a client window by handling
7   property changes on the window and some client messages
8 */
9
10 #include "screen.hh"
11 #include "otk/strut.hh"
12 #include "otk/rect.hh"
13 #include "otk/eventhandler.hh"
14 #include "otk/ustring.hh"
15
16 extern "C" {
17 #include <X11/Xlib.h>
18
19 #ifdef    SHAPE
20 #include <X11/extensions/shape.h>
21 #endif // SHAPE
22 }
23
24 #include <string>
25 #include <list>
26
27 namespace ob {
28
29 class Frame;
30 class Screen;
31
32 struct Icon {
33   unsigned long w, h;
34   unsigned long *data;
35 };
36
37 //! The MWM Hints as retrieved from the window property
38 /*!
39   This structure only contains 3 elements, even though the Motif 2.0
40   structure contains 5. We only use the first 3, so that is all gets defined.
41 */
42 struct MwmHints {
43   unsigned long flags;      //!< A bitmask of Client::MwmFlags values
44   unsigned long functions;  //!< A bitmask of Client::MwmFunctions values
45   unsigned long decorations;//!< A bitmask of Client::MwmDecorations values
46   //! The number of elements in the Client::MwmHints struct
47   static const unsigned int elements = 3;
48 };
49
50 //! Maintains the state of a client window.
51 /*!
52   Client maintains the state of a client window. The state consists of the
53   hints that the application sets on the window, such as the title, or window
54   gravity.
55   <p>
56   Client also manages client messages for the client window. When the
57   application (or any application) requests something to be changed for the
58   client, it will call the ActionHandler (for client messages) or update the
59   class' member variables and call whatever is nessary to complete the
60   change (such as causing a redraw of the titlebar after the title is changed).
61 */
62 class Client : public otk::EventHandler {
63 public:
64
65   //! The frame window which decorates around the client window
66   /*!
67     NOTE: This should NEVER be used inside the client class's constructor!
68   */
69   Frame *frame;
70
71   //! Holds a list of Clients
72   typedef std::list<Client*> List;
73
74   //! The possible stacking layers a client window can be a part of
75   enum StackLayer {
76     Layer_Icon,       //!< 0 - iconified windows, in any order at all
77     Layer_Desktop,    //!< 1 - desktop windows
78     Layer_Below,      //!< 2 - normal windows w/ below
79     Layer_Normal,     //!< 3 - normal windows
80     Layer_Above,      //!< 4 - normal windows w/ above
81     Layer_Top,        //!< 5 - always-on-top-windows (docks?)
82     Layer_Fullscreen, //!< 6 - fullscreeen windows
83     Layer_Internal,   //!< 7 - openbox windows/menus
84     NUM_LAYERS
85   };
86
87   //! Corners of the client window, used for anchor positions
88   enum Corner { TopLeft,
89                 TopRight,
90                 BottomLeft,
91                 BottomRight };
92
93   //! Possible window types
94   enum WindowType { Type_Desktop, //!< A desktop (bottom-most window)
95                     Type_Dock,    //!< A dock bar/panel window
96                     Type_Toolbar, //!< A toolbar window, pulled off an app
97                     Type_Menu,    //!< An unpinned menu from an app
98                     Type_Utility, //!< A small utility window such as a palette
99                     Type_Splash,  //!< A splash screen window
100                     Type_Dialog,  //!< A dialog window
101                     Type_Normal   //!< A normal application window
102   };
103
104   //! Possible flags for MWM Hints (defined by Motif 2.0)
105   enum MwmFlags { MwmFlag_Functions   = 1 << 0, //!< The MMW Hints define funcs
106                   MwmFlag_Decorations = 1 << 1  //!< The MWM Hints define decor
107   };
108
109   //! Possible functions for MWM Hints (defined by Motif 2.0)
110   enum MwmFunctions { MwmFunc_All      = 1 << 0, //!< All functions
111                       MwmFunc_Resize   = 1 << 1, //!< Allow resizing
112                       MwmFunc_Move     = 1 << 2, //!< Allow moving
113                       MwmFunc_Iconify  = 1 << 3, //!< Allow to be iconfied
114                       MwmFunc_Maximize = 1 << 4  //!< Allow to be maximized
115                       //MwmFunc_Close    = 1 << 5 //!< Allow to be closed
116   };
117
118   //! Possible decorations for MWM Hints (defined by Motif 2.0)
119   enum MemDecorations { MwmDecor_All      = 1 << 0, //!< All decorations
120                         MwmDecor_Border   = 1 << 1, //!< Show a border
121                         MwmDecor_Handle   = 1 << 2, //!< Show a handle (bottom)
122                         MwmDecor_Title    = 1 << 3, //!< Show a titlebar
123                         //MwmDecor_Menu     = 1 << 4, //!< Show a menu
124                         MwmDecor_Iconify  = 1 << 5, //!< Show an iconify button
125                         MwmDecor_Maximize = 1 << 6  //!< Show a maximize button
126   };
127
128   //! The things the user can do to the client window
129   enum Function { Func_Resize     = 1 << 0, //!< Allow resizing
130                   Func_Move       = 1 << 1, //!< Allow moving
131                   Func_Iconify    = 1 << 2, //!< Allow to be iconified
132                   Func_Maximize   = 1 << 3, //!< Allow to be maximized
133                   Func_Shade      = 1 << 4, //!< Allow to be shaded
134                   Func_Fullscreen = 1 << 5, //!< Allow to be made fullscreen
135                   Func_Close      = 1 << 6  //!< Allow to be closed
136   };
137   //! Holds a bitmask of Client::Function values
138   typedef unsigned char FunctionFlags;
139
140   //! The decorations the client window wants to be displayed on it
141   enum Decoration { Decor_Titlebar    = 1 << 0, //!< Display a titlebar
142                     Decor_Handle      = 1 << 1, //!< Display a handle (bottom)
143                     Decor_Border      = 1 << 2, //!< Display a border
144                     Decor_Icon        = 1 << 3, //!< Display the window's icon
145                     Decor_Iconify     = 1 << 4, //!< Display an iconify button
146                     Decor_Maximize    = 1 << 5, //!< Display a maximize button
147                     //! Display a button to toggle the window's placement on
148                     //! all desktops
149                     Decor_AllDesktops = 1 << 6,
150                     Decor_Close       = 1 << 7  //!< Display a close button
151   };
152   //! Holds a bitmask of Client::Decoration values
153   typedef unsigned char DecorationFlags;
154
155   //! Possible actions that can be made with the _NET_WM_STATE client message
156   enum StateAction { State_Remove = 0, //!< _NET_WM_STATE_REMOVE
157                      State_Add,        //!< _NET_WM_STATE_ADD
158                      State_Toggle      //!< _NET_WM_STATE_TOGGLE
159   };
160
161   //! The event mask to grab on client windows
162   static const long event_mask = PropertyChangeMask | FocusChangeMask |
163                                  StructureNotifyMask;
164
165   //! The mask of events to not let propogate past the client
166   /*!
167     This makes things like xprop work on the client window, but means we have
168     to explicitly grab clicks that we want.
169   */
170   static const long no_propagate_mask = ButtonPressMask | ButtonReleaseMask |
171                                         ButtonMotionMask;
172
173   //! The number of unmap events to ignore on the window
174   int ignore_unmaps;
175   
176 private:
177   //! The screen number on which the client resides
178   int      _screen;
179   
180   //! The actual window that this class is wrapping up
181   Window   _window;
182
183   //! The id of the group the window belongs to
184   Window   _group;
185
186   //! The client which this client is a transient (child) for
187   Client *_transient_for;
188
189   //! The clients which are transients (children) of this client
190   Client::List _transients;
191
192   //! The desktop on which the window resides (0xffffffff for all desktops)
193   unsigned int _desktop;
194
195   //! Normal window title
196   otk::ustring  _title;
197   //! Window title when iconifiged
198   otk::ustring  _icon_title;
199
200   //! The application that created the window
201   std::string  _app_name;
202   //! The class of the window, can used for grouping
203   std::string  _app_class;
204   //! The specified role of the window, used for identification
205   std::string  _role;
206
207   //! The type of window (what its function is)
208   WindowType   _type;
209
210   //! Position and size of the window
211   /*!
212     This will not always be the actual position of the window on screen, it is
213     rather, the position requested by the client, to which the window's gravity
214     is applied.
215   */
216   otk::Rect    _area;
217
218   //! The window's strut
219   /*!
220     The strut defines areas of the screen that are marked off-bounds for window
221     placement. In theory, where this window exists.
222   */
223   otk::Strut   _strut;
224
225   //! The logical size of the window
226   /*!
227     The "logical" size of the window is refers to the user's perception of the
228     size of the window, and is the value that should be displayed to the user.
229     For example, with xterms, this value it the number of characters being
230     displayed in the terminal, instead of the number of pixels.
231   */
232   otk::Size   _logical_size;
233
234   //! Width of the border on the window.
235   /*!
236     The window manager will set this to 0 while the window is being managed,
237     but needs to restore it afterwards, so it is saved here.
238   */
239   int _border_width;
240
241   //! The minimum aspect ratio the client window can be sized to.
242   /*!
243     A value of 0 means this is ignored.
244   */
245   float _min_ratio;
246   //! The maximum aspect ratio the client window can be sized to.
247   /*!
248     A value of 0 means this is ignored.
249   */
250   float _max_ratio;
251   
252   //! The minimum size of the client window
253   /*!
254     If the min is > the max, then the window is not resizable
255   */
256   otk::Size _min_size;
257   //! The maximum size of the client window
258   /*!
259     If the min is > the max, then the window is not resizable
260   */
261   otk::Size _max_size;
262   //! The size of increments to resize the client window by
263   otk::Size _size_inc;
264   //! The base size of the client window
265   /*!
266     This value should be subtracted from the window's actual size when
267     displaying its size to the user, or working with its min/max size
268   */
269   otk::Size _base_size;
270
271   //! Window decoration and functionality hints
272   MwmHints _mwmhints;
273   
274   //! Where to place the decorated window in relation to the undecorated window
275   int _gravity;
276
277   //! The state of the window, one of WithdrawnState, IconicState, or
278   //! NormalState
279   long _wmstate;
280
281   //! True if the client supports the delete_window protocol
282   bool _delete_window;
283   
284   //! Was the window's position requested by the application? if not, we should
285   //! place the window ourselves when it first appears
286   bool _positioned;
287   
288   //! Can the window receive input focus?
289   bool _can_focus;
290   //! Urgency flag
291   bool _urgent;
292   //! Notify the window when it receives focus?
293   bool _focus_notify;
294   //! Does the client window have the input focus?
295   bool _focused;
296
297   //! The window uses shape extension to be non-rectangular?
298   bool _shaped;
299
300   //! The window is modal, so it must be processed before any windows it is
301   //! related to can be focused
302   bool _modal;
303   //! Only the window's titlebar is displayed
304   bool _shaded;
305   //! The window is iconified
306   bool _iconic;
307   //! The window is maximized to fill the screen vertically
308   bool _max_vert;
309   //! The window is maximized to fill the screen horizontally
310   bool _max_horz;
311   //! The window should not be displayed by pagers
312   bool _skip_pager;
313   //! The window should not be displayed by taskbars
314   bool _skip_taskbar;
315   //! The window is a 'fullscreen' window, and should be on top of all others
316   bool _fullscreen;
317   //! The window should be on top of other windows of the same type
318   bool _above;
319   //! The window should be underneath other windows of the same type
320   bool _below;
321
322   //! The layer in which the window will be stacked, windows in lower layers
323   //! are always below windows in higher layers.
324   StackLayer _layer;
325
326   //! A bitmask of values in the Client::Decoration enum
327   /*!
328     The values in the variable are the decorations that the client wants to be
329     displayed around it.
330   */
331   DecorationFlags _decorations;
332
333   //! A bitmask of values in the Client::Decoration enum.
334   /*!
335     Specifies the decorations that should NOT be displayed on the client.
336   */
337   DecorationFlags _disabled_decorations;
338
339   //! A bitmask of values in the Client::Function enum
340   /*!
341     The values in the variable specify the ways in which the user is allowed to
342     modify this window.
343   */
344   FunctionFlags _functions;
345
346   //! Icons for the client as specified on the client window
347   Icon *_icons;
348   //! The number of icons in _icons
349   int _nicons;
350
351   //! Retrieves the window's initial gravity
352   void getGravity();
353   //! Retrieves the desktop hint's value and sets Client::_desktop
354   void getDesktop();
355   //! Retrieves the window's type and sets Client::_type
356   void getType();
357   //! Gets the MWM Hints and adjusts Client::_functions and
358   //! Client::_decorations
359   void getMwmHints();
360   //! Gets the position and size of the window and sets Client::_area
361   void getArea();
362   //! Gets the net_state hint and sets the boolean flags for any states set in
363   //! the hint
364   void getState();
365   //! Determines if the window uses the Shape extension and sets
366   //! Client::_shaped
367   void getShaped();
368
369   //! Set up what decor should be shown on the window and what functions should
370   //! be allowed (Client::_decorations and Client::_functions).
371   /*!
372     This also updates the NET_WM_ALLOWED_ACTIONS hint.
373   */
374   void setupDecorAndFunctions();
375   
376   //! Sets the wm_state to the specified value
377   void setWMState(long state);
378   //! Adjusts the window's net_state
379   /*!
380     This should not be called as part of the window mapping process! It is for
381     use when updating the state post-mapping.<br>
382     Client::applyStartupState is used to do the same things during the mapping
383     process.
384   */
385   void setState(StateAction action, long data1, long data2);
386
387   //! Sends the window to the specified desktop
388   void setDesktop(unsigned int desktop);
389   
390   //! Calculates the stacking layer for the client window
391   void calcLayer();
392
393   //! Update the protocols that the window supports and adjusts things if they
394   //! change
395   void updateProtocols();
396   //! Updates the WMNormalHints and adjusts things if they change
397   void updateNormalHints();
398   //! Updates the WMHints and adjusts things if they change
399   /*!
400     @param initstate Whether to read the initial_state property from the
401                      WMHints. This should only be used during the mapping
402                      process.
403   */
404   void updateWMHints(bool initstate = false);
405   //! Updates the window's title
406   void updateTitle();
407   //! Updates the window's icon title
408   void updateIconTitle();
409   //! Updates the window's application name and class
410   void updateClass();
411   //! Updates the strut for the client
412   void updateStrut();
413   //! Updates the window's transient status, and any parents of it
414   void updateTransientFor();
415   //! Updates the window's icons
416   void updateIcons();
417
418   //! Change the client's state hints to match the class' data
419   void changeState();
420   //! Change the allowed actions set on the client
421   void changeAllowedActions();
422
423   //! Request the client to close its window.
424   void close();
425
426   //! Shades or unshades the client window
427   /*!
428     @param shade true if the window should be shaded; false if it should be
429                  unshaded.
430   */
431   void shade(bool shade);
432
433   //! Recursively searches the client 'tree' for a modal client, always skips
434   //! the topmost node (the window you're starting with).
435   Client *Client::searchModalTree(Client *node, Client *skip);
436
437   //! Fires the urgent callbacks which lets the user do what they want with
438   //! urgent windows
439   void fireUrgent();
440   
441   //! Fullscreen's or unfullscreen's the client window
442   /*!
443     @param fs true if the window should be made fullscreen; false if it should
444               be returned to normal state.
445     @param savearea true to have the client's current size and position saved;
446                     otherwise, they are not. You should not save when mapping a
447                     new window that is set to fullscreen. This has no effect
448                     when restoring a window from fullscreen.
449   */
450   void fullscreen(bool fs, bool savearea = true);
451
452   //! Iconifies or uniconifies the client window
453   /*!
454     @param iconic true if the window should be iconified; false if it should be
455                   restored.
456     @param curdesk If iconic is false, then this determines if the window will
457                    be uniconified to the current viewable desktop (true) or to
458                    its previous desktop (false)
459   */
460   void iconify(bool iconic, bool curdesk = true);
461
462   //! Maximize or unmaximize the client window
463   /*!
464     @param max true if the window should be maximized; false if it should be
465                returned to normal size.
466     @param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
467     @param savearea true to have the client's current size and position saved;
468                     otherwise, they are not. You should not save when mapping a
469                     new window that is set to fullscreen. This has no effect
470                     when unmaximizing a window.
471   */
472   void maximize(bool max, int dir, bool savearea = true);
473
474   //! Internal version of the Client::move function
475   /*!
476     @param x The X coordinate to move to.
477     @param y The Y coordinate to move to.
478   */
479   void internal_move(int x, int y);
480   //! Internal version of the Client::resize function
481   /*!
482     This also maintains things like the client's minsize, and size increments.
483     @param anchor The corner to keep in the same position when resizing.
484     @param w The width component of the new size for the client.
485     @param h The height component of the new size for the client.
486     @param user Specifies whether this is a user-requested change or a
487                 program requested change.
488     @param x An optional X coordinate to which the window will be moved
489              after resizing.
490     @param y An optional Y coordinate to which the window will be moved
491              after resizing.
492     The x and y coordinates must both be sepcified together, or they will have
493     no effect. When they are specified, the anchor is ignored.
494   */
495   void internal_resize(Corner anchor, int w, int h,
496                        bool user = true, int x = INT_MIN, int y = INT_MIN);
497
498   //! Removes or reapplies the client's border to its window
499   /*!
500     Used when managing and unmanaging a window.
501     @param addborder true if adding the border to the client; false if removing
502                      from the client
503   */
504   void toggleClientBorder(bool addborder);
505
506   //! Applies the states requested when the window mapped
507   /*!
508     This should be called only once, during the window mapping process. It
509     applies things like maximized, and fullscreen.
510   */
511   void applyStartupState();
512   
513 public:
514 #ifndef SWIG
515   //! Constructs a new Client object around a specified window id
516   /*!
517 BB    @param window The window id that the Client class should handle
518     @param screen The screen on which the window resides
519   */
520   Client(int screen, Window window);
521   //! Destroys the Client object
522   virtual ~Client();
523 #endif
524
525   //! Returns the screen on which the clien resides
526   inline int screen() const { return _screen; }
527   
528   //! Returns the window id that the Client object is handling
529   inline Window window() const { return _window; }
530
531   //! Returns the type of the window, one of the Client::WindowType values
532   inline WindowType type() const { return _type; }
533   //! Returns if the window should be treated as a normal window.
534   /*!
535     Some windows (desktops, docks, splash screens) have special rules applied
536     to them in a number of places regarding focus or user interaction.
537   */
538   inline bool normal() const {
539     return ! (_type == Type_Desktop || _type == Type_Dock ||
540               _type == Type_Splash);
541   }
542   
543   //! Returns the desktop on which the window resides
544   /*!
545     This value is a 0-based index.<br>
546     A value of 0xffffffff indicates that the window exists on all desktops.
547   */
548   inline unsigned int desktop() const { return _desktop; }
549   //! Returns the window's title
550   inline const otk::ustring &title() const { return _title; }
551   //! Returns the window's title when it is iconified
552   inline const otk::ustring &iconTitle() const { return _title; }
553   //! Returns the application's name to whom the window belongs
554   inline const std::string &appName() const { return _app_name; }
555   //! Returns the class of the window
556   inline const std::string &appClass() const { return _app_class; }
557   //! Returns the program-specified role of the window
558   inline const std::string &role() const { return _role; }
559   //! Returns if the window can be focused
560   /*!
561     @return true if the window can receive focus; otherwise, false
562   */
563   inline bool canFocus() const { return _can_focus; }
564   //! Returns if the window has indicated that it needs urgent attention
565   inline bool urgent() const { return _urgent; }
566   //! Returns if the window wants to be notified when it receives focus
567   inline bool focusNotify() const { return _focus_notify; }
568   //! Returns if the window is the focused window
569   inline bool focused() const { return _focused; }
570   //! Returns if the window uses the Shape extension
571   inline bool shaped() const { return _shaped; }
572   //! Returns the window's gravity
573   /*!
574     This value determines where to place the decorated window in relation to
575     its position without decorations.<br>
576     One of: NorthWestGravity, SouthWestGravity, EastGravity, ...,
577     SouthGravity, StaticGravity, ForgetGravity
578   */
579   inline int gravity() const { return _gravity; }
580   //! Returns if the application requested the initial position for the window
581   /*!
582     If the application did not request a position (this function returns false)
583     then the window should be placed intelligently by the window manager
584     initially
585   */
586   inline bool positionRequested() const { return _positioned; }
587   //! Returns the decorations that the client window wishes to be displayed on
588   //! it
589   inline DecorationFlags decorations() const { return _decorations; }
590   //! Returns the decorations that the user has requested to be disabled on the
591   //! client
592   inline DecorationFlags disabledDecorations() const
593     { return _disabled_decorations; }
594   //! Returns the functions that the user can perform on the window
595   inline FunctionFlags funtions() const { return _functions; }
596
597   //! Return the client this window is transient for
598   inline Client *transientFor() const { return _transient_for; }
599
600   //! Returns if the window is modal
601   /*!
602     If the window is modal, then no other windows that it is related to can get
603     focus while it exists/remains modal.
604   */
605   inline bool modal() const { return _modal; }
606   //! The window should not be displayed by pagers
607   inline bool skipPager() const { return _skip_pager; }
608   //! The window should not be displayed by taskbars
609   inline bool skipTaskbar() const { return _skip_taskbar; } 
610  //! Returns if the window is shaded
611   /*!
612     When the window is shaded, only its titlebar is visible.
613   */
614   inline bool shaded() const { return _shaded; }
615   //! Returns if the window is in fullscreen mode
616   inline bool fullscreen() const { return _fullscreen; }
617   //! Returns if the window is iconified
618   /*!
619     When the window is iconified, it is not visible at all (except in iconbars/
620     panels/etc that want to show lists of iconified windows
621   */
622   inline bool iconic() const { return _iconic; }
623   //! Returns if the window is maximized vertically
624   inline bool maxVert() const { return _max_vert; }
625   //! Returns if the window is maximized horizontally
626   inline bool maxHorz() const { return _max_horz; }
627   //! Returns the window's stacking layer
628   inline StackLayer layer() const { return _layer; }
629
630   //! Returns the logical size of the window
631   /*!
632     The "logical" size of the window is refers to the user's perception of the
633     size of the window, and is the value that should be displayed to the user.
634     For example, with xterms, this value it the number of characters being
635     displayed in the terminal, instead of the number of pixels.
636   */
637   const otk::Size &logicalSize() const { return _logical_size; }
638
639   //! Returns the position and size of the client relative to the root window
640   /*!
641     Note that this value is *not* the size and position of the window's
642     frame, though the position will often line up.<br>
643     If you want the frame's area, use Frame::area() instead.
644   */
645   inline const otk::Rect &area() const { return _area; }
646
647   //! Returns the client's strut definition
648   inline const otk::Strut &strut() const { return _strut; }
649
650   //! Returns an icon for the window
651   /*!
652     The icon chosen will be the smallest icon available that is still bigger or
653     equal to the specified Size.<br>
654     If none that meet the requirements is found, the largest icon that is
655     smaller than the specified size will be returned.
656   */
657   const Icon *icon(const otk::Size &s) const;
658   
659   //! Move the window (actually, its frame) to a position.
660   /*!
661     This moves the window so that the top-left corner of its frame will be at
662     the position specified.
663     @param x The X coordinate to move to.
664     @param y The Y coordinate to move to.
665   */
666   void move(int x, int y);
667   
668   //! Resizes the client window, anchoring it in a given corner
669   /*!
670     This also maintains things like the client's minsize, and size increments.
671     @param anchor The corner to keep in the same position when resizing.
672     @param w The width component of the new size for the client.
673     @param h The height component of the new size for the client.
674   */
675   void resize(Corner anchor, int w, int h);
676
677   //! Reapplies the maximized state to the window
678   /*!
679     Use this to make the window readjust its maximized size to new
680     surroundings (struts, etc).
681   */
682   void remaximize();
683
684   //! Shows the window if it should be shown, or hides it
685   /*!
686     Used when changing desktops, the window's state, etc.
687   */
688   void showhide();
689   
690   //! Choose a mask of decorations to not display on the client
691   /*!
692     Pass a value of 0 to the function to turn all decorations back on. Note
693     that you cannot add decorations to a window with this, you can only remove
694     decorations that would otherwise have been displayed.
695     @param flags The mask of values from Client::Decoration to specify which
696                  decorations should not be displayed.
697   */
698   void disableDecorations(DecorationFlags flags);
699   
700   //! Return a modal child of the client window
701   /*!
702     @return A modal child of the client window, or 0 if none was found.
703   */
704   Client *findModalChild();
705
706   //! Attempt to focus the client window
707   bool focus();
708
709   //! Remove focus from the client window
710   void unfocus() const;
711
712   //! Validate client, by making sure no Destroy or Unmap events exist in
713   //! the event queue for the window.
714   /*!
715     @return true if the client is valid; false if the client has already
716             been unmapped/destroyed, and so is invalid.
717   */
718   bool validate() const;
719
720   void installColormap(bool install) const;
721   
722   virtual void focusHandler(const XFocusChangeEvent &e);
723   virtual void unfocusHandler(const XFocusChangeEvent &e);
724   virtual void propertyHandler(const XPropertyEvent &e);
725   virtual void clientMessageHandler(const XClientMessageEvent &e);
726   virtual void configureRequestHandler(const XConfigureRequestEvent &e);
727   virtual void unmapHandler(const XUnmapEvent &e);
728   virtual void destroyHandler(const XDestroyWindowEvent &e);
729   virtual void reparentHandler(const XReparentEvent &e);
730   virtual void mapRequestHandler(const XMapRequestEvent &e);
731 #if defined(SHAPE)
732   virtual void shapeHandler(const XShapeEvent &e);
733 #endif // SHAPE
734
735   friend void Screen::manageWindow(Window);
736   friend void Screen::unmanageWindow(Client *);
737 };
738
739 }
740
741 #endif // __client_hh