aboutsummaryrefslogtreecommitdiff
path: root/src/Window.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-18 01:33:58 (GMT)
committerfluxgen <fluxgen>2002-01-18 01:33:58 (GMT)
commita742d228c76206c511aa2f61d64bac85cced4a5a (patch)
treecb322525755c680cf96e170d2262889b42af3f9e /src/Window.hh
parent1817ff757929b9cfe06f3ff8d34d6be579f65e6e (diff)
downloadfluxbox-a742d228c76206c511aa2f61d64bac85cced4a5a.zip
fluxbox-a742d228c76206c511aa2f61d64bac85cced4a5a.tar.bz2
fixed indentation
Diffstat (limited to 'src/Window.hh')
-rw-r--r--src/Window.hh420
1 files changed, 211 insertions, 209 deletions
diff --git a/src/Window.hh b/src/Window.hh
index 2c705d8..c4b6538 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -16,22 +16,22 @@
16// 16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.hh,v 1.4 2002/01/11 10:40:59 fluxgen Exp $ 25// $Id: Window.hh,v 1.5 2002/01/18 01:33:58 fluxgen Exp $
26 26
27#ifndef _WINDOW_HH_ 27#ifndef _WINDOW_HH_
28#define _WINDOW_HH_ 28#define _WINDOW_HH_
29 29
30#include <X11/Xlib.h> 30#include <X11/Xlib.h>
31#include <X11/Xutil.h> 31#include <X11/Xutil.h>
32 32
33#ifdef SHAPE 33#ifdef SHAPE
34# include <X11/extensions/shape.h> 34# include <X11/extensions/shape.h>
35#endif // SHAPE 35#endif // SHAPE
36 36
37// forward declaration 37// forward declaration
@@ -52,154 +52,156 @@ class Tab;
52#include "Windowmenu.hh" 52#include "Windowmenu.hh"
53#endif 53#endif
54 54
55#define MwmHintsFunctions (1l << 0) 55#define MwmHintsFunctions (1l << 0)
56#define MwmHintsDecorations (1l << 1) 56#define MwmHintsDecorations (1l << 1)
57 57
58#define MwmFuncAll (1l << 0) 58#define MwmFuncAll (1l << 0)
59#define MwmFuncResize (1l << 1) 59#define MwmFuncResize (1l << 1)
60#define MwmFuncMove (1l << 2) 60#define MwmFuncMove (1l << 2)
61#define MwmFuncIconify (1l << 3) 61#define MwmFuncIconify (1l << 3)
62#define MwmFuncMaximize (1l << 4) 62#define MwmFuncMaximize (1l << 4)
63#define MwmFuncClose (1l << 5) 63#define MwmFuncClose (1l << 5)
64 64
65#define MwmDecorAll (1l << 0) 65#define MwmDecorAll (1l << 0)
66#define MwmDecorBorder (1l << 1) 66#define MwmDecorBorder (1l << 1)
67#define MwmDecorHandle (1l << 2) 67#define MwmDecorHandle (1l << 2)
68#define MwmDecorTitle (1l << 3) 68#define MwmDecorTitle (1l << 3)
69#define MwmDecorMenu (1l << 4) 69#define MwmDecorMenu (1l << 4)
70#define MwmDecorIconify (1l << 5) 70#define MwmDecorIconify (1l << 5)
71#define MwmDecorMaximize (1l << 6) 71#define MwmDecorMaximize (1l << 6)
72//names for buttons 72//names for buttons
73#define NAME_STICKY "sticky" 73#define NAME_STICKY "sticky"
74#define NAME_MAXIMIZE "maximize" 74#define NAME_MAXIMIZE "maximize"
75#define NAME_MINIMIZE "minimize" 75#define NAME_MINIMIZE "minimize"
76#define NAME_SHADE "shade" 76#define NAME_SHADE "shade"
77#define NAME_CLOSE "close" 77#define NAME_CLOSE "close"
78#define NAME_ICONIFY "iconify" 78#define NAME_ICONIFY "iconify"
79#define NAME_MENU "menu" 79#define NAME_MENU "menu"
80#define NAME_NONE "none" 80#define NAME_NONE "none"
81 81
82 82
83#define PropMwmHintsElements 3 83#define PropMwmHintsElements 3
84 84
85class FluxboxWindow : public TimeoutHandler { 85class FluxboxWindow : public TimeoutHandler {
86public: 86public:
87 FluxboxWindow(Window, BScreen * = (BScreen *) 0); 87 enum Error{NOERROR=0, XGETWINDOWATTRIB, CANTFINDSCREEN};
88 virtual ~FluxboxWindow(void);
89
90 inline const bool isTransient(void) const
91 { return ((transient) ? true : false); }
92 inline const bool hasTransient(void) const
93 { return ((client.transient) ? true : false); }
94 inline const bool &isFocused(void) const { return focused; }
95 inline const bool &isVisible(void) const { return visible; }
96 inline const bool &isIconic(void) const { return iconic; }
97 inline const bool &isShaded(void) const { return shaded; }
98 inline const bool &isMaximized(void) const { return maximized; }
99 inline const bool &isIconifiable(void) const { return functions.iconify; }
100 inline const bool &isMaximizable(void) const { return functions.maximize; }
101 inline const bool &isResizable(void) const { return functions.resize; }
102 inline const bool &isClosable(void) const { return functions.close; }
103 inline const bool &isStuck(void) const { return stuck; }
104 inline const bool &hasTitlebar(void) const { return decorations.titlebar; }
105 inline const bool hasTab(void) const { return (tab!=0 ? true : false); }
106 88
107 inline BScreen *getScreen(void) { return screen; } 89 FluxboxWindow(Window, BScreen * = (BScreen *) 0);
90 virtual ~FluxboxWindow(void);
91
92 inline const bool isTransient(void) const
93 { return ((transient) ? true : false); }
94 inline const bool hasTransient(void) const
95 { return ((client.transient) ? true : false); }
96 inline const bool &isFocused(void) const { return focused; }
97 inline const bool &isVisible(void) const { return visible; }
98 inline const bool &isIconic(void) const { return iconic; }
99 inline const bool &isShaded(void) const { return shaded; }
100 inline const bool &isMaximized(void) const { return maximized; }
101 inline const bool &isIconifiable(void) const { return functions.iconify; }
102 inline const bool &isMaximizable(void) const { return functions.maximize; }
103 inline const bool &isResizable(void) const { return functions.resize; }
104 inline const bool &isClosable(void) const { return functions.close; }
105 inline const bool &isStuck(void) const { return stuck; }
106 inline const bool &hasTitlebar(void) const { return decorations.titlebar; }
107 inline const bool hasTab(void) const { return (tab!=0 ? true : false); }
108 static void showError(FluxboxWindow::Error error);
109 inline BScreen *getScreen(void) { return screen; }
108 inline Tab *getTab(void) { return tab; } 110 inline Tab *getTab(void) { return tab; }
109 inline FluxboxWindow *getTransient(void) { return client.transient; } 111 inline FluxboxWindow *getTransient(void) { return client.transient; }
110 inline FluxboxWindow *getTransientFor(void) { return client.transient_for; } 112 inline FluxboxWindow *getTransientFor(void) { return client.transient_for; }
111 113
112 inline const Window &getFrameWindow(void) const { return frame.window; } 114 inline const Window &getFrameWindow(void) const { return frame.window; }
113 inline const Window &getClientWindow(void) const { return client.window; } 115 inline const Window &getClientWindow(void) const { return client.window; }
114 116
115 inline Windowmenu *getWindowmenu(void) { return windowmenu; } 117 inline Windowmenu *getWindowmenu(void) { return windowmenu; }
116 118
117 inline char **getTitle(void) { return &client.title; } 119 inline char **getTitle(void) { return &client.title; }
118 inline char **getIconTitle(void) { return &client.icon_title; } 120 inline char **getIconTitle(void) { return &client.icon_title; }
119 inline const int &getXFrame(void) const { return frame.x; } 121 inline const int &getXFrame(void) const { return frame.x; }
120 inline const int &getYFrame(void) const { return frame.y; } 122 inline const int &getYFrame(void) const { return frame.y; }
121 inline const int &getXClient(void) const { return client.x; } 123 inline const int &getXClient(void) const { return client.x; }
122 inline const int &getYClient(void) const { return client.y; } 124 inline const int &getYClient(void) const { return client.y; }
123 inline const int &getWorkspaceNumber(void) const { return workspace_number; } 125 inline const int &getWorkspaceNumber(void) const { return workspace_number; }
124 inline const int &getWindowNumber(void) const { return window_number; } 126 inline const int &getWindowNumber(void) const { return window_number; }
125 127
126 inline const unsigned int &getWidth(void) const { return frame.width; } 128 inline const unsigned int &getWidth(void) const { return frame.width; }
127 inline const unsigned int &getHeight(void) const { return frame.height; } 129 inline const unsigned int &getHeight(void) const { return frame.height; }
128 inline const unsigned int &getClientHeight(void) const 130 inline const unsigned int &getClientHeight(void) const
129 { return client.height; } 131 { return client.height; }
130 inline const unsigned int &getClientWidth(void) const 132 inline const unsigned int &getClientWidth(void) const
131 { return client.width; } 133 { return client.width; }
132 inline const unsigned int &getTitleHeight(void) const 134 inline const unsigned int &getTitleHeight(void) const
133 { return frame.title_h; } 135 { return frame.title_h; }
134 136
135 inline void setWindowNumber(int n) { window_number = n; } 137 inline void setWindowNumber(int n) { window_number = n; }
136 138
137 bool validateClient(void); 139 bool validateClient(void);
138 bool setInputFocus(void); 140 bool setInputFocus(void);
139 void setTab(bool flag); 141 void setTab(bool flag);
140 void setFocusFlag(bool); 142 void setFocusFlag(bool);
141 void iconify(void); 143 void iconify(void);
142 void deiconify(bool = true, bool = true); 144 void deiconify(bool = true, bool = true);
143 void close(void); 145 void close(void);
144 void withdraw(void); 146 void withdraw(void);
145 void maximize(unsigned int); 147 void maximize(unsigned int);
146 void shade(void); 148 void shade(void);
147 void stick(void); 149 void stick(void);
148 void unstick(void); 150 void unstick(void);
149 void reconfigure(void); 151 void reconfigure(void);
150 void installColormap(bool); 152 void installColormap(bool);
151 void restore(void); 153 void restore(void);
152 void configure(int dx, int dy, unsigned int dw, unsigned int dh); 154 void configure(int dx, int dy, unsigned int dw, unsigned int dh);
153 void setWorkspace(int n); 155 void setWorkspace(int n);
154 void changeBlackboxHints(BaseDisplay::BlackboxHints *); 156 void changeBlackboxHints(BaseDisplay::BlackboxHints *);
155 void restoreAttributes(void); 157 void restoreAttributes(void);
156 158
157 void buttonPressEvent(XButtonEvent *); 159 void buttonPressEvent(XButtonEvent *);
158 void buttonReleaseEvent(XButtonEvent *); 160 void buttonReleaseEvent(XButtonEvent *);
159 void motionNotifyEvent(XMotionEvent *); 161 void motionNotifyEvent(XMotionEvent *);
160 void destroyNotifyEvent(XDestroyWindowEvent *); 162 void destroyNotifyEvent(XDestroyWindowEvent *);
161 void mapRequestEvent(XMapRequestEvent *); 163 void mapRequestEvent(XMapRequestEvent *);
162 void mapNotifyEvent(XMapEvent *); 164 void mapNotifyEvent(XMapEvent *);
163 void unmapNotifyEvent(XUnmapEvent *); 165 void unmapNotifyEvent(XUnmapEvent *);
164 void propertyNotifyEvent(Atom); 166 void propertyNotifyEvent(Atom);
165 void exposeEvent(XExposeEvent *); 167 void exposeEvent(XExposeEvent *);
166 void configureRequestEvent(XConfigureRequestEvent *); 168 void configureRequestEvent(XConfigureRequestEvent *);
167 169
168#ifdef SHAPE 170#ifdef SHAPE
169 void shapeEvent(XShapeEvent *); 171 void shapeEvent(XShapeEvent *);
170#endif // SHAPE 172#endif // SHAPE
171 173
172 virtual void timeout(void); 174 virtual void timeout(void);
173 175
174 // this structure only contains 3 elements... the Motif 2.0 structure contains 176 // this structure only contains 3 elements... the Motif 2.0 structure contains
175 // 5... we only need the first 3... so that is all we will define 177 // 5... we only need the first 3... so that is all we will define
176 typedef struct MwmHints { 178 typedef struct MwmHints {
177 unsigned long flags, functions, decorations; 179 unsigned long flags, functions, decorations;
178 } MwmHints; 180 } MwmHints;
179 181
180private: 182private:
181 BImageControl *image_ctrl; 183 BImageControl *image_ctrl;
182 184
183 bool moving, resizing, shaded, maximized, visible, iconic, transient, 185 bool moving, resizing, shaded, maximized, visible, iconic, transient,
184 focused, stuck, modal, send_focus_message, managed; 186 focused, stuck, modal, send_focus_message, managed;
185 BScreen *screen; 187 BScreen *screen;
186 BTimer *timer; 188 BTimer *timer;
187 Display *display; 189 Display *display;
188 BaseDisplay::BlackboxAttributes blackbox_attrib; 190 BaseDisplay::BlackboxAttributes blackbox_attrib;
189 191
190 Time lastButtonPressTime; 192 Time lastButtonPressTime;
191 Windowmenu *windowmenu; 193 Windowmenu *windowmenu;
192 194
193 int focus_mode, window_number, workspace_number; 195 int focus_mode, window_number, workspace_number;
194 unsigned long current_state; 196 unsigned long current_state;
195 197
196 struct _client { 198 struct _client {
197 FluxboxWindow *transient_for, // which window are we a transient for? 199 FluxboxWindow *transient_for, // which window are we a transient for?
198 *transient; // which window is our transient? 200 *transient; // which window is our transient?
199 Window window, window_group; 201 Window window, window_group;
200 202
201 char *title, *icon_title; 203 char *title, *icon_title;
202 int x, y, old_bw, title_len; 204 int x, y, old_bw, title_len;
203 unsigned int width, height, title_text_w, 205 unsigned int width, height, title_text_w,
204 min_width, min_height, max_width, max_height, width_inc, height_inc, 206 min_width, min_height, max_width, max_height, width_inc, height_inc,
205 min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y, 207 min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y,
@@ -218,7 +220,7 @@ private:
218 struct _functions { 220 struct _functions {
219 bool resize, move, iconify, maximize, close; 221 bool resize, move, iconify, maximize, close;
220 } functions; 222 } functions;
221 223
222 bool usetab; 224 bool usetab;
223 Tab *tab; 225 Tab *tab;
224 friend class Tab; 226 friend class Tab;
@@ -226,92 +228,92 @@ private:
226 typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool); 228 typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool);
227 typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *); 229 typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *);
228 230
229 struct Button { 231 struct Button {
230 int type; 232 int type;
231 Window win; 233 Window win;
232 bool used; 234 bool used;
233 ButtonEventProc pressed; 235 ButtonEventProc pressed;
234 ButtonEventProc released; 236 ButtonEventProc released;
235 ButtonDrawProc draw; 237 ButtonDrawProc draw;
236 }; 238 };
237 239
238 std::vector<Button> buttonlist; 240 std::vector<Button> buttonlist;
239 241
240 struct _frame { 242 struct _frame {
241 //different bool because of XShapeQueryExtension 243 //different bool because of XShapeQueryExtension
242 Bool shaped; 244 Bool shaped;
243 unsigned long ulabel_pixel, flabel_pixel, utitle_pixel, 245 unsigned long ulabel_pixel, flabel_pixel, utitle_pixel,
244 ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel, 246 ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel,
245 fbutton_pixel, pbutton_pixel, uborder_pixel, fborder_pixel, 247 fbutton_pixel, pbutton_pixel, uborder_pixel, fborder_pixel,
246 ugrip_pixel, fgrip_pixel; 248 ugrip_pixel, fgrip_pixel;
247 Pixmap ulabel, flabel, utitle, ftitle, uhandle, fhandle, 249 Pixmap ulabel, flabel, utitle, ftitle, uhandle, fhandle,
248 ubutton, fbutton, pbutton, ugrip, fgrip; 250 ubutton, fbutton, pbutton, ugrip, fgrip;
249 251
250 Window window, plate, title, label, handle, 252 Window window, plate, title, label, handle,
251 right_grip, left_grip; 253 right_grip, left_grip;
252 254
253 int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y, 255 int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y,
254 y_border, y_handle; 256 y_border, y_handle;
255 unsigned int width, height, title_h, label_w, label_h, handle_h, 257 unsigned int width, height, title_h, label_w, label_h, handle_h,
256 button_w, button_h, grip_w, grip_h, mwm_border_w, border_h, 258 button_w, button_h, grip_w, grip_h, mwm_border_w, border_h,
257 bevel_w, resize_w, resize_h, snap_w, snap_h; 259 bevel_w, resize_w, resize_h, snap_w, snap_h;
258 } frame; 260 } frame;
259 261
260 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; 262 enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
261 263
262 void createButton(int type, ButtonEventProc, ButtonEventProc, ButtonDrawProc); 264 void createButton(int type, ButtonEventProc, ButtonEventProc, ButtonDrawProc);
263 Window findTitleButton(int type); 265 Window findTitleButton(int type);
264protected: 266protected:
265 //event callbacks 267 //event callbacks
266 static void stickyButton_cb(FluxboxWindow *, XButtonEvent *); 268 static void stickyButton_cb(FluxboxWindow *, XButtonEvent *);
267 static void stickyPressed_cb(FluxboxWindow *, XButtonEvent *); 269 static void stickyPressed_cb(FluxboxWindow *, XButtonEvent *);
268 static void iconifyButton_cb(FluxboxWindow *, XButtonEvent *); 270 static void iconifyButton_cb(FluxboxWindow *, XButtonEvent *);
269 static void iconifyPressed_cb(FluxboxWindow *, XButtonEvent *); 271 static void iconifyPressed_cb(FluxboxWindow *, XButtonEvent *);
270 static void maximizeButton_cb(FluxboxWindow *, XButtonEvent *); 272 static void maximizeButton_cb(FluxboxWindow *, XButtonEvent *);
271 static void maximizePressed_cb(FluxboxWindow *, XButtonEvent *); 273 static void maximizePressed_cb(FluxboxWindow *, XButtonEvent *);
272 static void closeButton_cb(FluxboxWindow *, XButtonEvent *); 274 static void closeButton_cb(FluxboxWindow *, XButtonEvent *);
273 static void closePressed_cb(FluxboxWindow *, XButtonEvent *); 275 static void closePressed_cb(FluxboxWindow *, XButtonEvent *);
274 static void shadeButton_cb(FluxboxWindow *, XButtonEvent *); 276 static void shadeButton_cb(FluxboxWindow *, XButtonEvent *);
275 //draw callbacks 277 //draw callbacks
276 static void stickyDraw_cb(FluxboxWindow *, Window, bool); 278 static void stickyDraw_cb(FluxboxWindow *, Window, bool);
277 static void iconifyDraw_cb(FluxboxWindow *, Window, bool); 279 static void iconifyDraw_cb(FluxboxWindow *, Window, bool);
278 static void maximizeDraw_cb(FluxboxWindow *, Window, bool); 280 static void maximizeDraw_cb(FluxboxWindow *, Window, bool);
279 static void closeDraw_cb(FluxboxWindow *, Window, bool); 281 static void closeDraw_cb(FluxboxWindow *, Window, bool);
280 static void shadeDraw_cb(FluxboxWindow *, Window, bool); 282 static void shadeDraw_cb(FluxboxWindow *, Window, bool);
281 283
282 static void grabButton(Display *display, unsigned int button, Window window, Cursor cursor); 284 static void grabButton(Display *display, unsigned int button, Window window, Cursor cursor);
283 //button base draw... background 285 //button base draw... background
284 void drawButtonBase(Window, bool); 286 void drawButtonBase(Window, bool);
285 287
286 bool getState(void); 288 bool getState(void);
287 Window createToplevelWindow(int, int, unsigned int, unsigned int, 289 Window createToplevelWindow(int, int, unsigned int, unsigned int,
288 unsigned int); 290 unsigned int);
289 Window createChildWindow(Window, Cursor = None); 291 Window createChildWindow(Window, Cursor = None);
290 292
291 void getWMName(void); 293 void getWMName(void);
292 void getWMIconName(void); 294 void getWMIconName(void);
293 void getWMNormalHints(void); 295 void getWMNormalHints(void);
294 void getWMProtocols(void); 296 void getWMProtocols(void);
295 void getWMHints(void); 297 void getWMHints(void);
296 void getMWMHints(void); 298 void getMWMHints(void);
297 void getBlackboxHints(void); 299 void getBlackboxHints(void);
298 void setNetWMAttributes(void); 300 void setNetWMAttributes(void);
299 void associateClientWindow(void); 301 void associateClientWindow(void);
300 void decorate(void); 302 void decorate(void);
301 void decorateLabel(void); 303 void decorateLabel(void);
302 void positionButtons(bool redecorate_label = false); 304 void positionButtons(bool redecorate_label = false);
303 void positionWindows(void); 305 void positionWindows(void);
304 306
305 void redrawLabel(void); 307 void redrawLabel(void);
306 void redrawAllButtons(void); 308 void redrawAllButtons(void);
307 309
308 void restoreGravity(void); 310 void restoreGravity(void);
309 void setGravityOffsets(void); 311 void setGravityOffsets(void);
310 void setState(unsigned long); 312 void setState(unsigned long);
311 void upsize(void); 313 void upsize(void);
312 void downsize(void); 314 void downsize(void);
313 void right_fixsize(int * = 0, int * = 0); 315 void right_fixsize(int * = 0, int * = 0);
314 void left_fixsize(int * = 0, int * = 0); 316 void left_fixsize(int * = 0, int * = 0);
315 317
316 318
317}; 319};