1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Workspace.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
4 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
6 // Permission is hereby granted, free of charge, to any person obtaining a
7 // copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following conditions:
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 // DEALINGS IN THE SOFTWARE.
24 #ifndef __Workspace_hh
25 #define __Workspace_hh
41 typedef std::list<BlackboxWindow*> BlackboxWindowList;
42 typedef std::vector<Window> StackVector;
47 BlackboxWindow *lastfocus;
50 BlackboxWindowList stackingList, windowList;
54 unsigned int cascade_x, cascade_y;
56 unsigned int cascade_region;
59 Workspace(const Workspace&);
60 Workspace& operator=(const Workspace&);
62 void raiseTransients(const BlackboxWindow * const win,
63 StackVector::iterator &stack);
64 void lowerTransients(const BlackboxWindow * const win,
65 StackVector::iterator &stack);
67 typedef std::vector<Rect> rectList;
68 rectList calcSpace(const Rect &win, const rectList &spaces) const;
70 void placeWindow(BlackboxWindow *win);
71 bool cascadePlacement(Rect& win, const int offset);
72 bool smartPlacement(Rect& win);
73 bool underMousePlacement(Rect& win);
76 Workspace(BScreen *scrn, unsigned int i = 0);
78 inline BScreen *getScreen(void) { return screen; }
80 inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
82 inline const std::string& getName(void) const { return name; }
84 inline unsigned int getID(void) const { return id; }
86 inline void setLastFocusedWindow(BlackboxWindow *w) { lastfocus = w; }
88 inline const BlackboxWindowList& getStackingList() const
89 { return stackingList; }
91 BlackboxWindow* getWindow(unsigned int index);
92 BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
93 BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
94 BlackboxWindow* getTopWindowOnStack(void) const;
95 void focusFallback(const BlackboxWindow *old_window);
97 bool isCurrent(void) const;
98 bool isLastWindow(const BlackboxWindow* w) const;
100 void addWindow(BlackboxWindow *w, bool place = False, bool sticky = False);
101 void removeWindow(BlackboxWindow *w, bool sticky = False);
102 unsigned int getCount(void) const;
103 void appendStackOrder(BlackboxWindowList &stack_order) const;
107 void removeAll(void);
108 void raiseWindow(BlackboxWindow *w);
109 void lowerWindow(BlackboxWindow *w);
110 void reconfigure(void);
111 void setCurrent(void);
113 void setName(const std::string& new_name);
117 #endif // __Workspace_hh