aboutsummaryrefslogtreecommitdiff
path: root/src/Window.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-05-30 00:38:22 (GMT)
committerfluxgen <fluxgen>2002-05-30 00:38:22 (GMT)
commitb43aed40723d54ec9e247e538149421e27117441 (patch)
treea18409596ab7f510971b91a32875d625c322ba1e /src/Window.hh
parente4c8da3c33370028434fe8478b80ff0fcf6ecc66 (diff)
downloadfluxbox_pavel-b43aed40723d54ec9e247e538149421e27117441.zip
fluxbox_pavel-b43aed40723d54ec9e247e538149421e27117441.tar.bz2
cleaning, changed (void) to (), removed unused variable, added comments, moved MwmHints Decor and Func into class FluxboxWindow
Diffstat (limited to 'src/Window.hh')
-rw-r--r--src/Window.hh258
1 files changed, 129 insertions, 129 deletions
diff --git a/src/Window.hh b/src/Window.hh
index 7824372..aa9e6c5 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -22,7 +22,7 @@
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.21 2002/05/21 21:25:10 fluxgen Exp $ 25// $Id: Window.hh,v 1.22 2002/05/30 00:38:22 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -30,8 +30,8 @@
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#include "BaseDisplay.hh" 37#include "BaseDisplay.hh"
@@ -41,37 +41,8 @@
41#include <vector> 41#include <vector>
42#include <string> 42#include <string>
43 43
44//#define PropMwmHintsElements 3
44 45
45
46#define MwmHintsFunctions (1l << 0)
47#define MwmHintsDecorations (1l << 1)
48
49#define MwmFuncAll (1l << 0)
50#define MwmFuncResize (1l << 1)
51#define MwmFuncMove (1l << 2)
52#define MwmFuncIconify (1l << 3)
53#define MwmFuncMaximize (1l << 4)
54#define MwmFuncClose (1l << 5)
55
56#define MwmDecorAll (1l << 0)
57#define MwmDecorBorder (1l << 1)
58#define MwmDecorHandle (1l << 2)
59#define MwmDecorTitle (1l << 3)
60#define MwmDecorMenu (1l << 4)
61#define MwmDecorIconify (1l << 5)
62#define MwmDecorMaximize (1l << 6)
63//names for buttons
64#define NAME_STICKY "sticky"
65#define NAME_MAXIMIZE "maximize"
66#define NAME_MINIMIZE "minimize"
67#define NAME_SHADE "shade"
68#define NAME_CLOSE "close"
69#define NAME_ICONIFY "iconify"
70#define NAME_MENU "menu"
71#define NAME_NONE "none"
72
73
74#define PropMwmHintsElements 3
75class Tab; 46class Tab;
76 47
77class FluxboxWindow : public TimeoutHandler { 48class FluxboxWindow : public TimeoutHandler {
@@ -98,15 +69,15 @@ public:
98 WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop 69 WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop
99 WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden 70 WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden
100 WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even 71 WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even
101 WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging 72 WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging
102 }; 73 };
103 74
104 enum GnomeHints { 75 enum GnomeHints {
105 WIN_HINTS_SKIP_FOCUS = (1<<0), // "alt-tab" skips this win 76 WIN_HINTS_SKIP_FOCUS = (1<<0), // "alt-tab" skips this win
106 WIN_HINTS_SKIP_WINLIST = (1<<1), // do not show in window list 77 WIN_HINTS_SKIP_WINLIST = (1<<1), // do not show in window list
107 WIN_HINTS_SKIP_TASKBAR = (1<<2), // do not show on taskbar 78 WIN_HINTS_SKIP_TASKBAR = (1<<2), // do not show on taskbar
108 WIN_HINTS_GROUP_TRANSIENT = (1<<3), //Reserved - definition is unclear 79 WIN_HINTS_GROUP_TRANSIENT = (1<<3), // Reserved - definition is unclear
109 WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked 80 WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked
110 }; 81 };
111 #endif 82 #endif
112 83
@@ -119,87 +90,112 @@ public:
119 90
120 enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL}; 91 enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL};
121 92
93 //Motif wm Hints
94 enum {
95 MwmHintsFunctions = (1l << 0),
96 MwmHintsDecorations = (1l << 1)
97 };
122 98
123 FluxboxWindow(Window, BScreen * = 0); 99 //Motif wm functions
124 virtual ~FluxboxWindow(void); 100 enum MwmFunc{
101 MwmFuncAll = (1l << 0),
102 MwmFuncResize = (1l << 1),
103 MwmFuncMove = (1l << 2),
104 MwmFuncIconify = (1l << 3),
105 MwmFuncMaximize = (1l << 4),
106 MwmFuncClose = (1l << 5)
107 };
108 //Motif wm decorations
109 enum MwmDecor {
110 MwmDecorAll = (1l << 0),
111 MwmDecorBorder = (1l << 1),
112 MwmDecorHandle = (1l << 2),
113 MwmDecorTitle = (1l << 3),
114 MwmDecorMenu = (1l << 4),
115 MwmDecorIconify = (1l << 5),
116 MwmDecorMaximize = (1l << 6)
117 };
118
119 explicit FluxboxWindow(Window, BScreen *scr = 0);
120 virtual ~FluxboxWindow();
125 121
126 inline bool isTransient(void) const { return ((transient) ? true : false); } 122 inline bool isTransient() const { return ((transient) ? true : false); }
127 inline bool hasTransient(void) const { return ((client.transient) ? true : false); } 123 inline bool hasTransient() const { return ((client.transient) ? true : false); }
128 inline bool isManaged() const { return managed; } 124 inline bool isManaged() const { return managed; }
129 inline bool isFocused(void) const { return focused; } 125 inline bool isFocused() const { return focused; }
130 inline bool isVisible(void) const { return visible; } 126 inline bool isVisible() const { return visible; }
131 inline bool isIconic(void) const { return iconic; } 127 inline bool isIconic() const { return iconic; }
132 inline bool isShaded(void) const { return shaded; } 128 inline bool isShaded() const { return shaded; }
133 inline bool isMaximized(void) const { return maximized; } 129 inline bool isMaximized() const { return maximized; }
134 inline bool isIconifiable(void) const { return functions.iconify; } 130 inline bool isIconifiable() const { return functions.iconify; }
135 inline bool isMaximizable(void) const { return functions.maximize; } 131 inline bool isMaximizable() const { return functions.maximize; }
136 inline bool isResizable(void) const { return functions.resize; } 132 inline bool isResizable() const { return functions.resize; }
137 inline bool isClosable(void) const { return functions.close; } 133 inline bool isClosable() const { return functions.close; }
138 inline bool isStuck(void) const { return stuck; } 134 inline bool isStuck() const { return stuck; }
139 inline bool hasTitlebar(void) const { return decorations.titlebar; } 135 inline bool hasTitlebar() const { return decorations.titlebar; }
140 inline bool hasTab(void) const { return (tab!=0 ? true : false); } 136 inline bool hasTab() const { return (tab!=0 ? true : false); }
141 inline bool isMoving(void) const { return moving; } 137 inline bool isMoving() const { return moving; }
142 inline bool isResizing(void) const { return resizing; } 138 inline bool isResizing() const { return resizing; }
143 inline BScreen *getScreen(void) const { return screen; } 139 inline BScreen *getScreen() const { return screen; }
144 inline Tab *getTab(void) const { return tab; } 140 inline Tab *getTab() const { return tab; }
145 inline FluxboxWindow *getTransient(void) const { return client.transient; } 141 inline FluxboxWindow *getTransient() const { return client.transient; }
146 inline FluxboxWindow *getTransientFor(void) const { return client.transient_for; } 142 inline FluxboxWindow *getTransientFor() const { return client.transient_for; }
147 143
148 inline const Window &getFrameWindow(void) const { return frame.window; } 144 inline const Window &getFrameWindow() const { return frame.window; }
149 inline const Window &getClientWindow(void) const { return client.window; } 145 inline const Window &getClientWindow() const { return client.window; }
150 146
151 inline Windowmenu *getWindowmenu(void) { return windowmenu; } 147 inline Windowmenu *getWindowmenu() { return windowmenu; }
152 148
153 inline const std::string &getTitle(void) const { return client.title; } 149 inline const std::string &getTitle() const { return client.title; }
154 inline const std::string &getIconTitle(void) const { return client.icon_title; } 150 inline const std::string &getIconTitle() const { return client.icon_title; }
155 inline int getXFrame(void) const { return frame.x; } 151 inline int getXFrame() const { return frame.x; }
156 inline int getYFrame(void) const { return frame.y; } 152 inline int getYFrame() const { return frame.y; }
157 inline int getXClient(void) const { return client.x; } 153 inline int getXClient() const { return client.x; }
158 inline int getYClient(void) const { return client.y; } 154 inline int getYClient() const { return client.y; }
159 inline unsigned int getWorkspaceNumber(void) const { return workspace_number; } 155 inline unsigned int getWorkspaceNumber() const { return workspace_number; }
160 inline int getWindowNumber(void) const { return window_number; } 156 inline int getWindowNumber() const { return window_number; }
161 inline WinLayer getLayer(void) const { return m_layer; } 157 inline WinLayer getLayer() const { return m_layer; }
162 inline unsigned int getWidth(void) const { return frame.width; } 158 inline unsigned int getWidth() const { return frame.width; }
163 inline unsigned int getHeight(void) const { return frame.height; } 159 inline unsigned int getHeight() const { return frame.height; }
164 inline unsigned int getClientHeight(void) const { return client.height; } 160 inline unsigned int getClientHeight() const { return client.height; }
165 inline unsigned int getClientWidth(void) const { return client.width; } 161 inline unsigned int getClientWidth() const { return client.width; }
166 inline unsigned int getTitleHeight(void) const { return frame.title_h; } 162 inline unsigned int getTitleHeight() const { return frame.title_h; }
167 163
168 inline void setWindowNumber(int n) { window_number = n; } 164 inline void setWindowNumber(int n) { window_number = n; }
169 165
170 inline const timeval &getLastFocusTime() const {return lastFocusTime;} 166 inline const timeval &getLastFocusTime() const {return lastFocusTime;}
171 167
172 bool validateClient(void); 168 bool validateClient();
173 bool setInputFocus(void); 169 bool setInputFocus();
174 void setTab(bool flag); 170 void setTab(bool flag);
175 void setFocusFlag(bool); 171 void setFocusFlag(bool);
176 void iconify(void); 172 void iconify();
177 void deiconify(bool = true, bool = true); 173 void deiconify(bool = true, bool = true);
178 void close(void); 174 void close();
179 void withdraw(void); 175 void withdraw();
180 void maximize(unsigned int); 176 void maximize(unsigned int);
181 void shade(void); 177 void shade();
182 void stick(void); 178 void stick();
183 void unstick(void); 179 void unstick();
184 void reconfigure(void); 180 void reconfigure();
185 void installColormap(bool); 181 void installColormap(bool);
186 void restore(void); 182 void restore();
187 void configure(int dx, int dy, unsigned int dw, unsigned int dh); 183 void configure(int dx, int dy, unsigned int dw, unsigned int dh);
188 void setWorkspace(int n); 184 void setWorkspace(int n);
189 void changeBlackboxHints(BaseDisplay::BlackboxHints *); 185 void changeBlackboxHints(BaseDisplay::BlackboxHints *bh);
190 void restoreAttributes(void); 186 void restoreAttributes();
191 bool isLowerTab(void) const; 187 bool isLowerTab() const;
192 188
193 void buttonPressEvent(XButtonEvent *); 189 void buttonPressEvent(XButtonEvent *be);
194 void buttonReleaseEvent(XButtonEvent *); 190 void buttonReleaseEvent(XButtonEvent *be);
195 void motionNotifyEvent(XMotionEvent *); 191 void motionNotifyEvent(XMotionEvent *me);
196 bool destroyNotifyEvent(XDestroyWindowEvent *); 192 bool destroyNotifyEvent(XDestroyWindowEvent *dwe);
197 void mapRequestEvent(XMapRequestEvent *); 193 void mapRequestEvent(XMapRequestEvent *mre);
198 void mapNotifyEvent(XMapEvent *); 194 void mapNotifyEvent(XMapEvent *mapev);
199 bool unmapNotifyEvent(XUnmapEvent *); 195 bool unmapNotifyEvent(XUnmapEvent *unmapev);
200 void propertyNotifyEvent(Atom); 196 void propertyNotifyEvent(Atom a);
201 void exposeEvent(XExposeEvent *); 197 void exposeEvent(XExposeEvent *ee);
202 void configureRequestEvent(XConfigureRequestEvent *); 198 void configureRequestEvent(XConfigureRequestEvent *ce);
203 199
204 void setDecoration(Decoration decoration); 200 void setDecoration(Decoration decoration);
205 void toggleDecoration(); 201 void toggleDecoration();
@@ -210,23 +206,28 @@ public:
210 void shapeEvent(XShapeEvent *); 206 void shapeEvent(XShapeEvent *);
211 #endif // SHAPE 207 #endif // SHAPE
212 208
213 virtual void timeout(void); 209 virtual void timeout();
214 210
215 // this structure only contains 3 elements... the Motif 2.0 structure contains 211 // this structure only contains 3 elements... the Motif 2.0 structure contains
216 // 5... we only need the first 3... so that is all we will define 212 // 5... we only need the first 3... so that is all we will define
217 typedef struct MwmHints { 213 typedef struct MwmHints {
218 unsigned long flags, functions, decorations; 214 unsigned long flags; // Motif wm flags
215 unsigned long functions; // Motif wm functions
216 unsigned long decorations; // Motif wm decorations
219 } MwmHints; 217 } MwmHints;
220 #ifdef GNOME 218 #ifdef GNOME
221 void setGnomeState(int state); 219 void setGnomeState(int state);
222 inline int getGnomeHints() const { return gnome_hints; } 220 inline int getGnomeHints() const { return gnome_hints; }
223 #endif 221 #endif //GNOME
224 222
225private: 223private:
226 BImageControl *image_ctrl;
227 224
225 BImageControl *image_ctrl; //image control for rendering
226
227 //Window state
228 bool moving, resizing, shaded, maximized, visible, iconic, transient, 228 bool moving, resizing, shaded, maximized, visible, iconic, transient,
229 focused, stuck, modal, send_focus_message, managed; 229 focused, stuck, modal, send_focus_message, managed;
230
230 BScreen *screen; 231 BScreen *screen;
231 BTimer timer; 232 BTimer timer;
232 Display *display; 233 Display *display;
@@ -270,9 +271,9 @@ private:
270 bool resize, move, iconify, maximize, close; 271 bool resize, move, iconify, maximize, close;
271 } functions; 272 } functions;
272 273
273 bool usetab; 274
274 Tab *tab; 275 Tab *tab;
275 friend class Tab; 276 friend class Tab; //TODO: Don't like long distant friendship
276 277
277 typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool); 278 typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool);
278 typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *); 279 typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *);
@@ -289,7 +290,6 @@ private:
289 std::vector<Button> buttonlist; 290 std::vector<Button> buttonlist;
290 291
291 struct _frame { 292 struct _frame {
292 //different bool because of XShapeQueryExtension
293 Bool shaped; 293 Bool shaped;
294 unsigned long ulabel_pixel, flabel_pixel, utitle_pixel, 294 unsigned long ulabel_pixel, flabel_pixel, utitle_pixel,
295 ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel, 295 ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel,
@@ -319,7 +319,7 @@ private:
319 void stopResizing(Window win=0); 319 void stopResizing(Window win=0);
320 void updateIcon(); 320 void updateIcon();
321 321
322 //create decoration functions 322 // Decoration functions
323 void createTitlebar(); 323 void createTitlebar();
324 void destroyTitlebar(); 324 void destroyTitlebar();
325 void createHandle(); 325 void createHandle();
@@ -378,33 +378,33 @@ private:
378 //button base draw... background 378 //button base draw... background
379 void drawButtonBase(Window, bool); 379 void drawButtonBase(Window, bool);
380 380
381 bool getState(void); 381 bool getState();
382 Window createToplevelWindow(int, int, unsigned int, unsigned int, 382 Window createToplevelWindow(int, int, unsigned int, unsigned int,
383 unsigned int); 383 unsigned int);
384 Window createChildWindow(Window, Cursor = None); 384 Window createChildWindow(Window, Cursor = None);
385 385
386 void getWMName(void); 386 void getWMName();
387 void getWMIconName(void); 387 void getWMIconName();
388 void getWMNormalHints(void); 388 void getWMNormalHints();
389 void getWMProtocols(void); 389 void getWMProtocols();
390 void getWMHints(void); 390 void getWMHints();
391 void getMWMHints(void); 391 void getMWMHints();
392 void getBlackboxHints(void); 392 void getBlackboxHints();
393 void setNetWMAttributes(void); 393 void setNetWMAttributes();
394 void associateClientWindow(void); 394 void associateClientWindow();
395 void decorate(void); 395 void decorate();
396 void decorateLabel(void); 396 void decorateLabel();
397 void positionButtons(bool redecorate_label = false); 397 void positionButtons(bool redecorate_label = false);
398 void positionWindows(void); 398 void positionWindows();
399 399
400 void redrawLabel(void); 400 void redrawLabel();
401 void redrawAllButtons(void); 401 void redrawAllButtons();
402 402
403 void restoreGravity(void); 403 void restoreGravity();
404 void setGravityOffsets(void); 404 void setGravityOffsets();
405 void setState(unsigned long); 405 void setState(unsigned long);
406 void upsize(void); 406 void upsize();
407 void downsize(void); 407 void downsize();
408 void right_fixsize(int * = 0, int * = 0); 408 void right_fixsize(int * = 0, int * = 0);
409 void left_fixsize(int * = 0, int * = 0); 409 void left_fixsize(int * = 0, int * = 0);
410}; 410};