aboutsummaryrefslogtreecommitdiff
path: root/src/Window.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-14 15:01:55 (GMT)
committerfluxgen <fluxgen>2003-04-14 15:01:55 (GMT)
commit2928b32f3a399527113325de3db39cd75db4ee8e (patch)
tree53c9d8e3676e35a200314df700344ef2711fb7b4 /src/Window.hh
parentb6ca956c821e1e968dda10ee7852c6933b549b08 (diff)
downloadfluxbox_pavel-2928b32f3a399527113325de3db39cd75db4ee8e.zip
fluxbox_pavel-2928b32f3a399527113325de3db39cd75db4ee8e.tar.bz2
merged with embedded-tab-branch
Diffstat (limited to 'src/Window.hh')
-rw-r--r--src/Window.hh156
1 files changed, 78 insertions, 78 deletions
diff --git a/src/Window.hh b/src/Window.hh
index 37dad15..e8e4641 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.53 2003/03/22 05:13:08 rathnor Exp $ 25// $Id: Window.hh,v 1.54 2003/04/14 14:45:14 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -46,12 +46,14 @@
46#include <vector> 46#include <vector>
47#include <string> 47#include <string>
48#include <memory> 48#include <memory>
49#include <map>
49 50
50#define PropMwmHintsElements 3 51#define PropMwmHintsElements 3
51 52
52class Tab; 53class WinClient;
53class FbWinFrameTheme; 54class FbWinFrameTheme;
54class BScreen; 55class BScreen;
56class TextButton;
55 57
56namespace FbTk { 58namespace FbTk {
57class MenuTheme; 59class MenuTheme;
@@ -98,20 +100,38 @@ public:
98 MwmDecorMaximize = (1l << 6) /// maximize 100 MwmDecorMaximize = (1l << 6) /// maximize
99 }; 101 };
100 102
103 typedef std::list<WinClient *> ClientList;
104
105 /// create a window from a client
106 FluxboxWindow(WinClient &client, BScreen &scr,
107 FbWinFrameTheme &tm,
108 FbTk::MenuTheme &menutheme,
109 FbTk::XLayer &layer);
110
101 /// create fluxbox window with parent win and screen connection 111 /// create fluxbox window with parent win and screen connection
102 FluxboxWindow(Window win, BScreen *scr, 112 FluxboxWindow(Window win, BScreen &scr,
103 int screen_num, FbTk::ImageControl &imgctrl, FbWinFrameTheme &tm, 113 FbWinFrameTheme &tm,
104 FbTk::MenuTheme &menutheme, 114 FbTk::MenuTheme &menutheme,
105 FbTk::XLayer &layer); 115 FbTk::XLayer &layer);
106 virtual ~FluxboxWindow(); 116 virtual ~FluxboxWindow();
107 117
118 /// attach client to our client list and remove it from old window
119 void attachClient(WinClient &client);
120 /// detach client (remove it from list) and create a new window for it
121 bool detachClient(WinClient &client);
122 /// remove client from client list
123 bool removeClient(WinClient &client);
124 /// set new current client and raise it
125 void setCurrentClient(WinClient &client);
126 WinClient *findClient(Window win);
127 void nextClient();
128 void prevClient();
108 129
109 void setWindowNumber(int n) { window_number = n; } 130 void setWindowNumber(int n) { window_number = n; }
110 131
111 bool validateClient(); 132 bool validateClient();
112 bool setInputFocus(); 133 bool setInputFocus();
113 void raiseAndFocus() { raise(); setInputFocus(); } 134 void raiseAndFocus() { raise(); setInputFocus(); }
114 void setTab(bool flag);
115 void setFocusFlag(bool flag); 135 void setFocusFlag(bool flag);
116 // map this window 136 // map this window
117 void show(); 137 void show();
@@ -141,6 +161,7 @@ public:
141 161
142 void reconfigure(); 162 void reconfigure();
143 void installColormap(bool); 163 void installColormap(bool);
164 void restore(WinClient *client, bool remap);
144 void restore(bool remap); 165 void restore(bool remap);
145 /// move frame to x, y 166 /// move frame to x, y
146 void move(int x, int y); 167 void move(int x, int y);
@@ -190,41 +211,41 @@ public:
190 @name accessors 211 @name accessors
191 */ 212 */
192 //@{ 213 //@{
193 bool isTransient() const { return ((client.transient_for) ? true : false); } 214 inline bool isTransient() const;
194 bool hasTransient() const { return ((client.transients.size()) ? true : false); } 215 inline bool hasTransient() const;
195 bool isManaged() const { return m_managed; } 216 inline bool isManaged() const { return m_managed; }
196 bool isFocused() const { return focused; } 217 inline bool isFocused() const { return focused; }
197 bool isVisible() const { return visible; } 218 inline bool isVisible() const { return visible; }
198 bool isIconic() const { return iconic; } 219 inline bool isIconic() const { return iconic; }
199 bool isShaded() const { return shaded; } 220 inline bool isShaded() const { return shaded; }
200 bool isMaximized() const { return maximized; } 221 inline bool isMaximized() const { return maximized; }
201 bool isIconifiable() const { return functions.iconify; } 222 inline bool isIconifiable() const { return functions.iconify; }
202 bool isMaximizable() const { return functions.maximize; } 223 inline bool isMaximizable() const { return functions.maximize; }
203 bool isResizable() const { return functions.resize; } 224 inline bool isResizable() const { return functions.resize; }
204 bool isClosable() const { return functions.close; } 225 inline bool isClosable() const { return functions.close; }
205 bool isStuck() const { return stuck; } 226 inline bool isStuck() const { return stuck; }
206 bool hasTitlebar() const { return decorations.titlebar; } 227 inline bool hasTitlebar() const { return decorations.titlebar; }
207 bool hasTab() const { return (tab!=0 ? true : false); } 228 inline bool isMoving() const { return moving; }
208 bool isMoving() const { return moving; } 229 inline bool isResizing() const { return resizing; }
209 bool isResizing() const { return resizing; }
210 bool isGroupable() const; 230 bool isGroupable() const;
211 231 inline int numClients() const { return m_clientlist.size(); }
212 const BScreen *getScreen() const { return screen; } 232 inline ClientList &clientList() { return m_clientlist; }
213 BScreen *getScreen() { return screen; } 233 inline const ClientList &clientList() const { return m_clientlist; }
214 234 inline WinClient &winClient() { return *m_client; }
215 const FbTk::XLayerItem &getLayerItem() const { return m_layeritem; } 235 inline const WinClient &winClient() const { return *m_client; }
216 FbTk::XLayerItem &getLayerItem() { return m_layeritem; } 236
217 237 inline const BScreen &getScreen() const { return screen; }
218 const Tab *getTab() const { return tab; } 238 inline BScreen &getScreen() { return screen; }
219 Tab *getTab() { return tab; } 239
220 240 inline const FbTk::XLayerItem &getLayerItem() const { return m_layeritem; }
221 const std::list<FluxboxWindow *> &getTransients() const { return client.transients; } 241 inline FbTk::XLayerItem &getLayerItem() { return m_layeritem; }
222 std::list<FluxboxWindow *> &getTransients() { return client.transients; } 242
223 243 const std::list<FluxboxWindow *> &getTransients() const;
224 const FluxboxWindow *getTransientFor() const { return client.transient_for; } 244 std::list<FluxboxWindow *> &getTransients();
225 FluxboxWindow *getTransientFor() { return client.transient_for; } 245 const FluxboxWindow *getTransientFor() const;
246 FluxboxWindow *getTransientFor();
226 247
227 Window getClientWindow() const { return client.window; } 248 Window getClientWindow() const;
228 249
229 FbTk::FbWindow &getFbWindow() { return m_frame.window(); } 250 FbTk::FbWindow &getFbWindow() { return m_frame.window(); }
230 const FbTk::FbWindow &getFbWindow() const { return m_frame.window(); } 251 const FbTk::FbWindow &getFbWindow() const { return m_frame.window(); }
@@ -232,28 +253,28 @@ public:
232 FbTk::Menu &getWindowmenu() { return m_windowmenu; } 253 FbTk::Menu &getWindowmenu() { return m_windowmenu; }
233 const FbTk::Menu &getWindowmenu() const { return m_windowmenu; } 254 const FbTk::Menu &getWindowmenu() const { return m_windowmenu; }
234 255
235 FbTk::Menu *getLayermenu() { return m_layermenu; } 256 FbTk::Menu &getLayermenu() { return m_layermenu; }
236 const FbTk::Menu *getLayermenu() const { return m_layermenu; } 257 const FbTk::Menu &getLayermenu() const { return m_layermenu; }
237 258
238 const std::string &getTitle() const { return client.title; } 259 const std::string &getTitle() const;
239 const std::string &getIconTitle() const { return client.icon_title; } 260 const std::string &getIconTitle() const;
240 int getXFrame() const { return m_frame.x(); } 261 int getXFrame() const { return m_frame.x(); }
241 int getYFrame() const { return m_frame.y(); } 262 int getYFrame() const { return m_frame.y(); }
242 int getXClient() const { return client.x; } 263 int getXClient() const;
243 int getYClient() const { return client.y; } 264 int getYClient() const;
244 unsigned int getWorkspaceNumber() const { return workspace_number; } 265 unsigned int getWorkspaceNumber() const { return workspace_number; }
245 int getWindowNumber() const { return window_number; } 266 int getWindowNumber() const { return window_number; }
246 int getLayerNum() const { return m_layernum; } 267 int getLayerNum() const { return m_layernum; }
247 void setLayerNum(int layernum); 268 void setLayerNum(int layernum);
248 unsigned int getWidth() const { return m_frame.width(); } 269 unsigned int getWidth() const { return m_frame.width(); }
249 unsigned int getHeight() const { return m_frame.height(); } 270 unsigned int getHeight() const { return m_frame.height(); }
250 unsigned int getClientHeight() const { return client.height; } 271 unsigned int getClientHeight() const;
251 unsigned int getClientWidth() const { return client.width; } 272 unsigned int getClientWidth() const;
252 unsigned int getTitleHeight() const { return m_frame.titleHeight(); } 273 unsigned int getTitleHeight() const { return m_frame.titleHeight(); }
253 const std::string &className() const { return m_class_name; } 274 const std::string &className() const { return m_class_name; }
254 const std::string &instanceName() const { return m_instance_name; } 275 const std::string &instanceName() const { return m_instance_name; }
255 bool isLowerTab() const; 276 bool isLowerTab() const;
256 int initialState() const { return client.initial_state; } 277 int initialState() const;
257 278
258 FbWinFrame &frame() { return m_frame; } 279 FbWinFrame &frame() { return m_frame; }
259 const FbWinFrame &frame() const { return m_frame; } 280 const FbWinFrame &frame() const { return m_frame; }
@@ -288,13 +309,7 @@ public:
288 }; 309 };
289 310
290private: 311private:
291 // this structure only contains 3 elements... the Motif 2.0 structure contains 312 void init();
292 // 5... we only need the first 3... so that is all we will define
293 typedef struct MwmHints {
294 unsigned long flags; // Motif wm flags
295 unsigned long functions; // Motif wm functions
296 unsigned long decorations; // Motif wm decorations
297 } MwmHints;
298 313
299 void grabButtons(); 314 void grabButtons();
300 315
@@ -341,14 +356,14 @@ private:
341 bool moving, resizing, shaded, maximized, visible, iconic, transient, 356 bool moving, resizing, shaded, maximized, visible, iconic, transient,
342 focused, stuck, modal, send_focus_message, m_managed; 357 focused, stuck, modal, send_focus_message, m_managed;
343 358
344 BScreen *screen; /// screen on which this window exist 359 BScreen &screen; /// screen on which this window exist
345 FbTk::Timer timer; 360 FbTk::Timer timer;
346 Display *display; /// display connection (obsolete by FbTk) 361 Display *display; /// display connection
347 BaseDisplay::BlackboxAttributes blackbox_attrib; 362 BaseDisplay::BlackboxAttributes blackbox_attrib;
348 363
349 Time lastButtonPressTime; 364 Time lastButtonPressTime;
350 FbTk::Menu m_windowmenu; 365 FbTk::Menu m_windowmenu;
351 LayerMenu<FluxboxWindow> *m_layermenu; 366 LayerMenu<FluxboxWindow> m_layermenu;
352 367
353 timeval lastFocusTime; 368 timeval lastFocusTime;
354 369
@@ -364,23 +379,13 @@ private:
364 379
365 Decoration old_decoration; 380 Decoration old_decoration;
366 381
367 struct _client { 382 ClientList m_clientlist;
368 FluxboxWindow *transient_for; // which window are we a transient for? 383 WinClient *m_client;
369 std::list<FluxboxWindow *> transients; // which windows are our transients? 384 typedef std::map<WinClient *, TextButton *> Client2ButtonMap;
370 Window window, window_group; 385 Client2ButtonMap m_labelbuttons;
371
372 std::string title, icon_title;
373 int x, y, old_bw;
374 unsigned int width, height, title_text_w,
375 min_width, min_height, max_width, max_height, width_inc, height_inc,
376 min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y,
377 base_width, base_height, win_gravity;
378 unsigned long initial_state, normal_hint_flags, wm_hint_flags;
379 386
380 MwmHints *mwm_hint; 387 // just temporary solution
381 BaseDisplay::BlackboxHints *blackbox_hint; 388 friend class WinClient;
382
383 } client;
384 389
385 struct _decorations { 390 struct _decorations {
386 bool titlebar, handle, border, iconify, 391 bool titlebar, handle, border, iconify,
@@ -391,11 +396,6 @@ private:
391 bool resize, move, iconify, maximize, close; 396 bool resize, move, iconify, maximize, close;
392 } functions; 397 } functions;
393 398
394
395 Tab *tab;
396 friend class Tab; //TODO: Don't like long distant friendship
397
398
399 int frame_resize_x, frame_resize_w; 399 int frame_resize_x, frame_resize_w;
400 int frame_resize_y, frame_resize_h; 400 int frame_resize_y, frame_resize_h;
401 int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized 401 int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized