diff options
author | fluxgen <fluxgen> | 2003-01-05 22:20:46 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-01-05 22:20:46 (GMT) |
commit | cb7cfbf152bd7538abc41956409498a23857b560 (patch) | |
tree | 4401163eb6e1383c0d3dc3ba22eb58133c0f8e12 | |
parent | 4484d326807c6e1cf4ec6b6beeb099eab979723e (diff) | |
download | fluxbox-cb7cfbf152bd7538abc41956409498a23857b560.zip fluxbox-cb7cfbf152bd7538abc41956409498a23857b560.tar.bz2 |
huge commit, changed FluxboxWindow to a EventHandler and it now holds a FbWinFrame, added dieSig
-rw-r--r-- | src/Window.hh | 332 |
1 files changed, 156 insertions, 176 deletions
diff --git a/src/Window.hh b/src/Window.hh index 4c9829c..65cc2e6 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -1,5 +1,5 @@ | |||
1 | // Window.hh for Fluxbox Window Manager | 1 | // Window.hh for Fluxbox Window Manager |
2 | // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen at users.sourceforge.net) | 2 | // Copyright (c) 2001-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) |
3 | // | 3 | // |
4 | // Window.hh for Blackbox - an X11 Window manager | 4 | // Window.hh for Blackbox - an X11 Window manager |
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) |
@@ -16,13 +16,13 @@ | |||
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.39 2002/12/13 20:35:36 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.40 2003/01/05 22:20:46 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -31,6 +31,8 @@ | |||
31 | #include "Timer.hh" | 31 | #include "Timer.hh" |
32 | #include "Windowmenu.hh" | 32 | #include "Windowmenu.hh" |
33 | #include "Subject.hh" | 33 | #include "Subject.hh" |
34 | #include "FbWinFrame.hh" | ||
35 | #include "EventHandler.hh" | ||
34 | 36 | ||
35 | #include <X11/Xlib.h> | 37 | #include <X11/Xlib.h> |
36 | #include <X11/Xutil.h> | 38 | #include <X11/Xutil.h> |
@@ -46,10 +48,11 @@ | |||
46 | #define PropMwmHintsElements 3 | 48 | #define PropMwmHintsElements 3 |
47 | 49 | ||
48 | class Tab; | 50 | class Tab; |
51 | class FbWinFrameTheme; | ||
49 | 52 | ||
50 | 53 | ||
51 | /// Creates the window frame and handles any window event for it | 54 | /// Creates the window frame and handles any window event for it |
52 | class FluxboxWindow : public TimeoutHandler { | 55 | class FluxboxWindow : public TimeoutHandler, public FbTk::EventHandler { |
53 | public: | 56 | public: |
54 | /// layer bits | 57 | /// layer bits |
55 | enum WinLayer { | 58 | enum WinLayer { |
@@ -58,6 +61,7 @@ public: | |||
58 | LAYER_NORMAL = 0x04, ///< normal layer | 61 | LAYER_NORMAL = 0x04, ///< normal layer |
59 | LAYER_TOP = 0x08 ///< top layer | 62 | LAYER_TOP = 0x08 ///< top layer |
60 | }; | 63 | }; |
64 | |||
61 | /// decoration bit | 65 | /// decoration bit |
62 | enum Decoration { | 66 | enum Decoration { |
63 | DECOR_NONE=0, ///< no decor at all | 67 | DECOR_NONE=0, ///< no decor at all |
@@ -81,6 +85,7 @@ public: | |||
81 | MwmFuncMaximize = (1l << 4), ///< maximize | 85 | MwmFuncMaximize = (1l << 4), ///< maximize |
82 | MwmFuncClose = (1l << 5) ///< close | 86 | MwmFuncClose = (1l << 5) ///< close |
83 | }; | 87 | }; |
88 | |||
84 | /// Motif wm decorations | 89 | /// Motif wm decorations |
85 | enum MwmDecor { | 90 | enum MwmDecor { |
86 | MwmDecorAll = (1l << 0), /// all decorations | 91 | MwmDecorAll = (1l << 0), /// all decorations |
@@ -91,16 +96,86 @@ public: | |||
91 | MwmDecorIconify = (1l << 5), /// iconify | 96 | MwmDecorIconify = (1l << 5), /// iconify |
92 | MwmDecorMaximize = (1l << 6) /// maximize | 97 | MwmDecorMaximize = (1l << 6) /// maximize |
93 | }; | 98 | }; |
99 | |||
94 | /// create fluxbox window with parent win and screen connection | 100 | /// create fluxbox window with parent win and screen connection |
95 | explicit FluxboxWindow(Window win, BScreen *scr = 0); | 101 | FluxboxWindow(Window win, BScreen *scr, int screen_num, BImageControl &imgctrl, FbWinFrameTheme &tm); |
96 | virtual ~FluxboxWindow(); | 102 | virtual ~FluxboxWindow(); |
103 | |||
104 | |||
105 | void setWindowNumber(int n) { window_number = n; } | ||
106 | |||
107 | bool validateClient(); | ||
108 | bool setInputFocus(); | ||
109 | void setTab(bool flag); | ||
110 | void setFocusFlag(bool flag); | ||
111 | void iconify(); | ||
112 | void deiconify(bool = true, bool = true); | ||
113 | /// destroy this window | ||
114 | void close(); | ||
115 | /// set the window in withdrawn state | ||
116 | void withdraw(); | ||
117 | /// toggel maximize | ||
118 | void maximize(); | ||
119 | /// maximizes the window horizontal | ||
120 | void maximizeHorizontal(); | ||
121 | /// maximizes the window vertical | ||
122 | void maximizeVertical(); | ||
123 | /// toggles shade | ||
124 | void shade(); | ||
125 | /// toggles sticky | ||
126 | void stick(); | ||
127 | void lower(); | ||
128 | void raise(); | ||
129 | |||
130 | void reconfigure(); | ||
131 | void installColormap(bool); | ||
132 | void restore(bool remap); | ||
133 | /// move frame to x, y | ||
134 | void move(int x, int y); | ||
135 | /// resize frame to width, height | ||
136 | void resize(unsigned int width, unsigned int height); | ||
137 | /// move and resize frame to pox x,y and size width, height | ||
138 | void moveResize(int x, int y, unsigned int width, unsigned int height); | ||
139 | |||
140 | void setWorkspace(int n); | ||
141 | void changeBlackboxHints(const BaseDisplay::BlackboxHints &bh); | ||
142 | void restoreAttributes(); | ||
143 | void showMenu(int mx, int my); | ||
144 | void pauseMoving(); | ||
145 | void resumeMoving(); | ||
146 | /** | ||
147 | @name event handlers | ||
148 | */ | ||
149 | //@{ | ||
150 | void handleEvent(XEvent &event); | ||
151 | void buttonPressEvent(XButtonEvent &be); | ||
152 | void buttonReleaseEvent(XButtonEvent &be); | ||
153 | void motionNotifyEvent(XMotionEvent &me); | ||
154 | void destroyNotifyEvent(XDestroyWindowEvent &dwe); | ||
155 | void mapRequestEvent(XMapRequestEvent &mre); | ||
156 | void mapNotifyEvent(XMapEvent &mapev); | ||
157 | void unmapNotifyEvent(XUnmapEvent &unmapev); | ||
158 | void exposeEvent(XExposeEvent &ee); | ||
159 | void configureRequestEvent(XConfigureRequestEvent &ce); | ||
160 | void propertyNotifyEvent(Atom a); | ||
161 | //@} | ||
162 | |||
163 | void setDecoration(Decoration decoration); | ||
164 | void toggleDecoration(); | ||
165 | |||
166 | #ifdef SHAPE | ||
167 | void shapeEvent(XShapeEvent *event); | ||
168 | #endif // SHAPE | ||
169 | |||
170 | virtual void timeout(); | ||
171 | |||
97 | /** | 172 | /** |
98 | @name accessors | 173 | @name accessors |
99 | */ | 174 | */ |
100 | //@{ | 175 | //@{ |
101 | bool isTransient() const { return ((client.transient_for) ? true : false); } | 176 | bool isTransient() const { return ((client.transient_for) ? true : false); } |
102 | bool hasTransient() const { return ((client.transients.size()) ? true : false); } | 177 | bool hasTransient() const { return ((client.transients.size()) ? true : false); } |
103 | bool isManaged() const { return managed; } | 178 | bool isManaged() const { return m_managed; } |
104 | bool isFocused() const { return focused; } | 179 | bool isFocused() const { return focused; } |
105 | bool isVisible() const { return visible; } | 180 | bool isVisible() const { return visible; } |
106 | bool isIconic() const { return iconic; } | 181 | bool isIconic() const { return iconic; } |
@@ -116,41 +191,50 @@ public: | |||
116 | bool isMoving() const { return moving; } | 191 | bool isMoving() const { return moving; } |
117 | bool isResizing() const { return resizing; } | 192 | bool isResizing() const { return resizing; } |
118 | bool isGroupable() const; | 193 | bool isGroupable() const; |
194 | |||
119 | const BScreen *getScreen() const { return screen; } | 195 | const BScreen *getScreen() const { return screen; } |
120 | BScreen *getScreen() { return screen; } | 196 | BScreen *getScreen() { return screen; } |
197 | |||
121 | const Tab *getTab() const { return tab; } | 198 | const Tab *getTab() const { return tab; } |
122 | Tab *getTab() { return tab; } | 199 | Tab *getTab() { return tab; } |
200 | |||
123 | const std::list<FluxboxWindow *> &getTransients() const { return client.transients; } | 201 | const std::list<FluxboxWindow *> &getTransients() const { return client.transients; } |
124 | std::list<FluxboxWindow *> &getTransients() { return client.transients; } | 202 | std::list<FluxboxWindow *> &getTransients() { return client.transients; } |
203 | |||
125 | const FluxboxWindow *getTransientFor() const { return client.transient_for; } | 204 | const FluxboxWindow *getTransientFor() const { return client.transient_for; } |
126 | FluxboxWindow *getTransientFor() { return client.transient_for; } | 205 | FluxboxWindow *getTransientFor() { return client.transient_for; } |
127 | 206 | ||
128 | const Window &getFrameWindow() const { return frame.window; } | 207 | Window getFrameWindow() const { return m_frame.window().window(); } |
129 | const Window &getClientWindow() const { return client.window; } | 208 | Window getClientWindow() const { return client.window; } |
130 | 209 | ||
131 | Windowmenu *getWindowmenu() { return m_windowmenu.get(); } | 210 | Windowmenu *getWindowmenu() { return m_windowmenu.get(); } |
132 | const Windowmenu *getWindowmenu() const { return m_windowmenu.get(); } | 211 | const Windowmenu *getWindowmenu() const { return m_windowmenu.get(); } |
133 | 212 | ||
134 | const std::string &getTitle() const { return client.title; } | 213 | const std::string &getTitle() const { return client.title; } |
135 | const std::string &getIconTitle() const { return client.icon_title; } | 214 | const std::string &getIconTitle() const { return client.icon_title; } |
136 | int getXFrame() const { return frame.x; } | 215 | int getXFrame() const { return m_frame.x(); } |
137 | int getYFrame() const { return frame.y; } | 216 | int getYFrame() const { return m_frame.y(); } |
138 | int getXClient() const { return client.x; } | 217 | int getXClient() const { return client.x; } |
139 | int getYClient() const { return client.y; } | 218 | int getYClient() const { return client.y; } |
140 | unsigned int getWorkspaceNumber() const { return workspace_number; } | 219 | unsigned int getWorkspaceNumber() const { return workspace_number; } |
141 | int getWindowNumber() const { return window_number; } | 220 | int getWindowNumber() const { return window_number; } |
142 | WinLayer getLayer() const { return m_layer; } | 221 | WinLayer getLayer() const { return m_layer; } |
143 | unsigned int getWidth() const { return frame.width; } | 222 | unsigned int getWidth() const { return m_frame.width(); } |
144 | unsigned int getHeight() const { return frame.height; } | 223 | unsigned int getHeight() const { return m_frame.height(); } |
145 | unsigned int getClientHeight() const { return client.height; } | 224 | unsigned int getClientHeight() const { return client.height; } |
146 | unsigned int getClientWidth() const { return client.width; } | 225 | unsigned int getClientWidth() const { return client.width; } |
147 | unsigned int getTitleHeight() const { return frame.title_h; } | 226 | unsigned int getTitleHeight() const { return m_frame.titleHeight(); } |
148 | const std::string &className() const { return m_class_name; } | 227 | const std::string &className() const { return m_class_name; } |
149 | const std::string &instanceName() const { return m_instance_name; } | 228 | const std::string &instanceName() const { return m_instance_name; } |
150 | bool isLowerTab() const; | 229 | bool isLowerTab() const; |
230 | int initialState() const { return client.initial_state; } | ||
231 | |||
232 | FbWinFrame &frame() { return m_frame; } | ||
233 | const FbWinFrame &frame() const { return m_frame; } | ||
234 | |||
151 | /** | 235 | /** |
152 | @name signals | 236 | @name signals |
153 | @{ | 237 | @{ |
154 | */ | 238 | */ |
155 | FbTk::Subject &stateSig() { return m_statesig; } | 239 | FbTk::Subject &stateSig() { return m_statesig; } |
156 | const FbTk::Subject &stateSig() const { return m_statesig; } | 240 | const FbTk::Subject &stateSig() const { return m_statesig; } |
@@ -158,70 +242,14 @@ public: | |||
158 | const FbTk::Subject &hintSig() const { return m_hintsig; } | 242 | const FbTk::Subject &hintSig() const { return m_hintsig; } |
159 | FbTk::Subject &workspaceSig() { return m_workspacesig; } | 243 | FbTk::Subject &workspaceSig() { return m_workspacesig; } |
160 | const FbTk::Subject &workspaceSig() const { return m_workspacesig; } | 244 | const FbTk::Subject &workspaceSig() const { return m_workspacesig; } |
245 | FbTk::Subject &dieSig() { return m_diesig; } | ||
246 | const FbTk::Subject &dieSig() const { return m_diesig; } | ||
161 | /** @} */ // end group signals | 247 | /** @} */ // end group signals |
162 | 248 | ||
163 | //@} | ||
164 | |||
165 | void setWindowNumber(int n) { window_number = n; } | ||
166 | |||
167 | const timeval &getLastFocusTime() const {return lastFocusTime;} | 249 | const timeval &getLastFocusTime() const {return lastFocusTime;} |
168 | 250 | ||
169 | bool validateClient(); | ||
170 | bool setInputFocus(); | ||
171 | void setTab(bool flag); | ||
172 | void setFocusFlag(bool flag); | ||
173 | void iconify(); | ||
174 | void deiconify(bool = true, bool = true); | ||
175 | void close(); | ||
176 | void withdraw(); | ||
177 | void maximize(unsigned int); | ||
178 | /// toggles shade | ||
179 | void shade(); | ||
180 | /// toggles sticky | ||
181 | void stick(); | ||
182 | void reconfigure(); | ||
183 | void installColormap(bool); | ||
184 | void restore(bool remap); | ||
185 | void configure(int dx, int dy, unsigned int dw, unsigned int dh); | ||
186 | void setWorkspace(int n); | ||
187 | void changeBlackboxHints(BaseDisplay::BlackboxHints *bh); | ||
188 | void restoreAttributes(); | ||
189 | void showMenu(int mx, int my); | ||
190 | void pauseMoving(); | ||
191 | void resumeMoving(); | ||
192 | /** | ||
193 | @name event handlers | ||
194 | */ | ||
195 | //@{ | ||
196 | void buttonPressEvent(XButtonEvent *be); | ||
197 | void buttonReleaseEvent(XButtonEvent *be); | ||
198 | void motionNotifyEvent(XMotionEvent *me); | ||
199 | bool destroyNotifyEvent(XDestroyWindowEvent *dwe); | ||
200 | void mapRequestEvent(XMapRequestEvent *mre); | ||
201 | void mapNotifyEvent(XMapEvent *mapev); | ||
202 | bool unmapNotifyEvent(XUnmapEvent *unmapev); | ||
203 | void propertyNotifyEvent(Atom a); | ||
204 | void exposeEvent(XExposeEvent *ee); | ||
205 | void configureRequestEvent(XConfigureRequestEvent *ce); | ||
206 | //@} | 251 | //@} |
207 | |||
208 | void setDecoration(Decoration decoration); | ||
209 | void toggleDecoration(); | ||
210 | |||
211 | #ifdef SHAPE | ||
212 | void shapeEvent(XShapeEvent *); | ||
213 | #endif // SHAPE | ||
214 | |||
215 | virtual void timeout(); | ||
216 | 252 | ||
217 | // this structure only contains 3 elements... the Motif 2.0 structure contains | ||
218 | // 5... we only need the first 3... so that is all we will define | ||
219 | typedef struct MwmHints { | ||
220 | unsigned long flags; // Motif wm flags | ||
221 | unsigned long functions; // Motif wm functions | ||
222 | unsigned long decorations; // Motif wm decorations | ||
223 | } MwmHints; | ||
224 | |||
225 | class WinSubject: public FbTk::Subject { | 253 | class WinSubject: public FbTk::Subject { |
226 | public: | 254 | public: |
227 | WinSubject(FluxboxWindow &w):m_win(w) { } | 255 | WinSubject(FluxboxWindow &w):m_win(w) { } |
@@ -232,27 +260,73 @@ public: | |||
232 | }; | 260 | }; |
233 | 261 | ||
234 | private: | 262 | private: |
263 | // this structure only contains 3 elements... the Motif 2.0 structure contains | ||
264 | // 5... we only need the first 3... so that is all we will define | ||
265 | typedef struct MwmHints { | ||
266 | unsigned long flags; // Motif wm flags | ||
267 | unsigned long functions; // Motif wm functions | ||
268 | unsigned long decorations; // Motif wm decorations | ||
269 | } MwmHints; | ||
270 | |||
271 | void grabButtons(); | ||
272 | |||
273 | void startMoving(Window win); | ||
274 | void stopMoving(); | ||
275 | void startResizing(Window win, int x, int y, bool left); | ||
276 | void stopResizing(Window win=0); | ||
277 | void updateIcon(); | ||
278 | |||
279 | void updateTransientInfo(); | ||
280 | |||
281 | bool getState(); | ||
282 | /// gets title string from client window and updates frame's title | ||
283 | void updateTitleFromClient(); | ||
284 | /// gets icon name from client window | ||
285 | void updateIconNameFromClient(); | ||
286 | void getWMNormalHints(); | ||
287 | void getWMProtocols(); | ||
288 | void getWMHints(); | ||
289 | void getMWMHints(); | ||
290 | void getBlackboxHints(); | ||
291 | void setNetWMAttributes(); | ||
292 | void associateClientWindow(); | ||
293 | void createWinButtons(); | ||
294 | void decorateLabel(); | ||
295 | void positionWindows(); | ||
296 | |||
297 | void restoreGravity(); | ||
298 | void setGravityOffsets(); | ||
299 | void setState(unsigned long stateval); | ||
300 | void upsize(); | ||
301 | void downsize(); | ||
302 | void right_fixsize(int *x = 0, int *y = 0); | ||
303 | void left_fixsize(int *x = 0, int *y = 0); | ||
304 | |||
235 | // state and hint signals | 305 | // state and hint signals |
236 | WinSubject m_hintsig, m_statesig, m_workspacesig; | 306 | WinSubject m_hintsig, m_statesig, m_workspacesig, m_diesig; |
237 | 307 | ||
238 | BImageControl *image_ctrl; /// image control for rendering | 308 | // BImageControl &image_ctrl; /// image control for rendering |
239 | 309 | ||
240 | std::string m_instance_name; /// instance name from WM_CLASS | 310 | std::string m_instance_name; /// instance name from WM_CLASS |
241 | std::string m_class_name; /// class name from WM_CLASS | 311 | std::string m_class_name; /// class name from WM_CLASS |
242 | 312 | ||
243 | //Window state | 313 | //Window state |
244 | bool moving, resizing, shaded, maximized, visible, iconic, transient, | 314 | bool moving, resizing, shaded, maximized, visible, iconic, transient, |
245 | focused, stuck, modal, send_focus_message, managed; | 315 | focused, stuck, modal, send_focus_message, m_managed; |
246 | 316 | ||
247 | BScreen *screen; /// screen on which this window exist | 317 | BScreen *screen; /// screen on which this window exist |
248 | BTimer timer; | 318 | BTimer timer; |
249 | Display *display; /// display connection (obsolete by BaseDisplay singleton) | 319 | Display *display; /// display connection (obsolete by FbTk) |
250 | BaseDisplay::BlackboxAttributes blackbox_attrib; | 320 | BaseDisplay::BlackboxAttributes blackbox_attrib; |
251 | 321 | ||
252 | Time lastButtonPressTime; | 322 | Time lastButtonPressTime; |
253 | std::auto_ptr<Windowmenu> m_windowmenu; | 323 | std::auto_ptr<Windowmenu> m_windowmenu; |
254 | 324 | ||
255 | timeval lastFocusTime; | 325 | timeval lastFocusTime; |
326 | |||
327 | int button_grab_x, button_grab_y; // handles last button press event for move | ||
328 | int last_resize_x, last_resize_y; // handles last button press event for resize | ||
329 | unsigned int last_resize_h, last_resize_w; // handles height/width for resize "window" | ||
256 | 330 | ||
257 | int focus_mode, window_number; | 331 | int focus_mode, window_number; |
258 | unsigned int workspace_number; | 332 | unsigned int workspace_number; |
@@ -291,109 +365,15 @@ private: | |||
291 | Tab *tab; | 365 | Tab *tab; |
292 | friend class Tab; //TODO: Don't like long distant friendship | 366 | friend class Tab; //TODO: Don't like long distant friendship |
293 | 367 | ||
294 | typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool); | 368 | |
295 | typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *); | 369 | int frame_resize_x, frame_resize_w; |
296 | 370 | int frame_resize_y, frame_resize_h; | |
297 | struct Button { | 371 | int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized |
298 | int type; | 372 | unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state |
299 | Window win; | 373 | FbWinFrame m_frame; |
300 | bool used; | ||
301 | ButtonEventProc pressed; | ||
302 | ButtonEventProc released; | ||
303 | ButtonDrawProc draw; | ||
304 | }; | ||
305 | |||
306 | std::vector<Button> buttonlist; | ||
307 | |||
308 | struct _frame { | ||
309 | Bool shaped; | ||
310 | unsigned long ulabel_pixel, flabel_pixel, utitle_pixel, | ||
311 | ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel, | ||
312 | fbutton_pixel, pbutton_pixel, uborder_pixel, fborder_pixel, | ||
313 | ugrip_pixel, fgrip_pixel; | ||
314 | Pixmap ulabel, flabel, utitle, ftitle, uhandle, fhandle, | ||
315 | ubutton, fbutton, pbutton, ugrip, fgrip; | ||
316 | |||
317 | Window window, plate, title, label, handle, | ||
318 | right_grip, left_grip; | ||
319 | |||
320 | int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y, | ||
321 | y_border, y_handle, save_x, save_y; | ||
322 | unsigned int width, height, title_h, label_w, label_h, handle_h, | ||
323 | button_w, button_h, grip_w, grip_h, mwm_border_w, border_h, | ||
324 | bevel_w, resize_w, resize_h, snap_w, snap_h, move_ws; | ||
325 | } frame; | ||
326 | 374 | ||
327 | enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; | 375 | enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; |
328 | 376 | ||
329 | void grabButtons(); | ||
330 | |||
331 | void createButton(int type, ButtonEventProc, ButtonEventProc, ButtonDrawProc); | ||
332 | void startMoving(Window win); | ||
333 | void stopMoving(); | ||
334 | void startResizing(XMotionEvent *me, bool left); | ||
335 | void stopResizing(Window win=0); | ||
336 | void updateIcon(); | ||
337 | |||
338 | // Decoration functions | ||
339 | void createTitlebar(); | ||
340 | void destroyTitlebar(); | ||
341 | void createHandle(); | ||
342 | void destroyHandle(); | ||
343 | void checkTransient(); | ||
344 | |||
345 | Window findTitleButton(int type); | ||
346 | |||
347 | //event callbacks | ||
348 | static void stickyButton_cb(FluxboxWindow *, XButtonEvent *); | ||
349 | static void stickyPressed_cb(FluxboxWindow *, XButtonEvent *); | ||
350 | static void iconifyButton_cb(FluxboxWindow *, XButtonEvent *); | ||
351 | static void iconifyPressed_cb(FluxboxWindow *, XButtonEvent *); | ||
352 | static void maximizeButton_cb(FluxboxWindow *, XButtonEvent *); | ||
353 | static void maximizePressed_cb(FluxboxWindow *, XButtonEvent *); | ||
354 | static void closeButton_cb(FluxboxWindow *, XButtonEvent *); | ||
355 | static void closePressed_cb(FluxboxWindow *, XButtonEvent *); | ||
356 | static void shadeButton_cb(FluxboxWindow *, XButtonEvent *); | ||
357 | //draw callbacks | ||
358 | static void stickyDraw_cb(FluxboxWindow *, Window, bool); | ||
359 | static void iconifyDraw_cb(FluxboxWindow *, Window, bool); | ||
360 | static void maximizeDraw_cb(FluxboxWindow *, Window, bool); | ||
361 | static void closeDraw_cb(FluxboxWindow *, Window, bool); | ||
362 | static void shadeDraw_cb(FluxboxWindow *, Window, bool); | ||
363 | |||
364 | static void grabButton(Display *display, unsigned int button, Window window, Cursor cursor); | ||
365 | //button base draw... background | ||
366 | void drawButtonBase(Window, bool); | ||
367 | |||
368 | bool getState(); | ||
369 | Window createToplevelWindow(int, int, unsigned int, unsigned int, | ||
370 | unsigned int); | ||
371 | Window createChildWindow(Window, Cursor = None); | ||
372 | |||
373 | void getWMName(); | ||
374 | void getWMIconName(); | ||
375 | void getWMNormalHints(); | ||
376 | void getWMProtocols(); | ||
377 | void getWMHints(); | ||
378 | void getMWMHints(); | ||
379 | void getBlackboxHints(); | ||
380 | void setNetWMAttributes(); | ||
381 | void associateClientWindow(); | ||
382 | void decorate(); | ||
383 | void decorateLabel(); | ||
384 | void positionButtons(bool redecorate_label = false); | ||
385 | void positionWindows(); | ||
386 | |||
387 | void redrawLabel(); | ||
388 | void redrawAllButtons(); | ||
389 | |||
390 | void restoreGravity(); | ||
391 | void setGravityOffsets(); | ||
392 | void setState(unsigned long stateval); | ||
393 | void upsize(); | ||
394 | void downsize(); | ||
395 | void right_fixsize(int * = 0, int * = 0); | ||
396 | void left_fixsize(int * = 0, int * = 0); | ||
397 | }; | 377 | }; |
398 | 378 | ||
399 | 379 | ||