1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
11 #include "otk/strut.hh"
12 #include "otk/rect.hh"
23 enum WindowType { Type_Desktop,
32 enum MwmFlags { Functions = 1 << 0,
33 Decorations = 1 << 1 };
35 enum MwmFunctions { MwmFunc_All = 1 << 0,
36 MwmFunc_Resize = 1 << 1,
37 MwmFunc_Move = 1 << 2,
38 MwmFunc_Iconify = 1 << 3,
39 MwmFunc_Maximize = 1 << 4,
40 MwmFunc_Close = 1 << 5 };
42 enum MemDecorations { MemDecor_All = 1 << 0,
43 MemDecor_Border = 1 << 1,
44 MemDecor_Handle = 1 << 2,
45 MemDecor_Title = 1 << 3,
46 //MemDecor_Menu = 1 << 4,
47 MemDecor_Iconify = 1 << 5,
48 MemDecor_Maximize = 1 << 6 };
50 // this structure only contains 3 elements... the Motif 2.0 structure
51 // contains 5... we only need the first 3... so that is all we will define
52 typedef struct MwmHints {
53 static const int elements = 3;
55 unsigned long functions;
56 unsigned long decorations;
59 enum StateAction { State_Remove = 0, // _NET_WM_STATE_REMOVE
60 State_Add, // _NET_WM_STATE_ADD
61 State_Toggle // _NET_WM_STATE_TOGGLE
65 //! The actual window that this class is wrapping up
68 //! The id of the group the window belongs to
71 // XXX: transient_for, transients
73 //! The desktop on which the window resides (0xffffffff for all desktops)
74 unsigned long _desktop;
76 //! Normal window title
77 std::string _title; // XXX: Have to keep track if this string is Utf8 or not
78 //! Window title when iconifiged
79 std::string _icon_title;
81 //! The application that created the window
82 std::string _app_name;
83 //! The class of the window, can used for grouping
84 std::string _app_class;
86 //! The type of window (what its function is)
89 //! Position and size of the window (relative to the root window)
93 // if min > max, then the window is not resizable
94 int _min_x, _min_y; // minumum size
95 int _max_x, _max_y; // maximum size
96 int _inc_x, _inc_y; // resize increments
97 int _base_x, _base_y; // base size
99 //! Where to place the decorated window in relation to the undecorated window
102 //! The state of the window, one of WithdrawnState, IconicState, or
106 //! Can the window receive input focus?
110 //! Notify the window when it receives focus?
113 //! The window uses shape extension to be non-rectangular?
116 //! The window is modal, so it must be processed before any windows it is
117 //! related to can be focused
119 //! Only the window's titlebar is displayed
121 //! The window is iconified
123 //! The window is maximized to fill the screen vertically
125 //! The window is maximized to fill the screen horizontally
127 //! The window is a 'fullscreen' window, and should be on top of all others
129 //! The window should be on top of other windows of the same type
132 // XXX: motif decoration hints!
140 void setWMState(long state);
141 void setDesktop(long desktop);
142 void setState(StateAction action, long data1, long data2);
144 void updateNormalHints();
145 void updateWMHints();
146 // XXX: updateTransientFor();
151 OBClient(Window window);
154 inline Window window() const { return _window; }
156 inline WindowType type() const { return _type; }
157 inline unsigned long desktop() const { return _desktop; }
158 inline const std::string &title() const { return _title; }
159 inline const std::string &iconTitle() const { return _title; }
160 inline const std::string &appName() const { return _app_name; }
161 inline const std::string &appClass() const { return _app_class; }
162 inline bool canFocus() const { return _can_focus; }
163 inline bool urgent() const { return _urgent; }
164 inline bool focusNotify() const { return _focus_notify; }
165 inline bool shaped() const { return _shaped; }
166 inline int gravity() const { return _gravity; }
169 inline bool modal() const { return _modal; }
170 inline bool shaded() const { return _shaded; }
171 inline bool iconic() const { return _iconic; }
172 inline bool maxVert() const { return _max_vert; }
173 inline bool maxHorz() const { return _max_horz; }
174 inline bool fullscreen() const { return _fullscreen; }
175 inline bool floating() const { return _floating; }
177 inline int minX() const { return _min_x; }
178 inline int minY() const { return _min_y; }
179 inline int maxX() const { return _max_x; }
180 inline int maxY() const { return _max_y; }
181 inline int incrementX() const { return _inc_x; }
182 inline int incrementY() const { return _inc_y; }
183 inline int baseX() const { return _base_x; }
184 inline int baseY() const { return _base_y; }
186 inline const otk::Rect &area() const { return _area; }
188 void update(const XPropertyEvent &e);
189 void update(const XClientMessageEvent &e);
191 void setArea(const otk::Rect &area);
196 #endif // __client_hh