diff options
Diffstat (limited to 'src/Workspace.hh')
-rw-r--r-- | src/Workspace.hh | 133 |
1 files changed, 79 insertions, 54 deletions
diff --git a/src/Workspace.hh b/src/Workspace.hh index 17de03c..c2b02f3 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh | |||
@@ -1,3 +1,6 @@ | |||
1 | // Workspace.hh for Fluxbox | ||
2 | // Copyright (c) 2002 - 2004 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | ||
3 | // | ||
1 | // Workspace.hh for Blackbox - an X11 Window manager | 4 | // Workspace.hh for Blackbox - an X11 Window manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
@@ -19,72 +22,94 @@ | |||
19 | // 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 |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
22 | #ifndef _WORKSPACE_HH_ | 25 | #ifndef WORKSPACE_HH |
23 | #define _WORKSPACE_HH_ | 26 | #define WORKSPACE_HH |
24 | 27 | ||
25 | #include <X11/Xlib.h> | ||
26 | 28 | ||
27 | class BScreen; | ||
28 | class Clientmenu; | ||
29 | class Workspace; | ||
30 | class FluxboxWindow; | ||
31 | 29 | ||
32 | #include "LinkedList.hh" | 30 | #include "FbMenu.hh" |
33 | 31 | ||
32 | #include "FbTk/MultLayers.hh" | ||
33 | #include "FbTk/Observer.hh" | ||
34 | #include "FbTk/NotCopyable.hh" | ||
34 | 35 | ||
35 | class Workspace { | 36 | #include <string> |
36 | private: | 37 | #include <vector> |
37 | BScreen *screen; | 38 | #include <list> |
38 | FluxboxWindow *lastfocus; | 39 | |
39 | Clientmenu *clientmenu; | 40 | class BScreen; |
41 | class FluxboxWindow; | ||
42 | class WinClient; | ||
40 | 43 | ||
41 | LinkedList<FluxboxWindow> *stackingList, *windowList; | 44 | /** |
45 | Handles a single workspace | ||
46 | */ | ||
47 | class Workspace:private FbTk::NotCopyable, private FbTk::Observer { | ||
48 | public: | ||
49 | typedef std::vector<FluxboxWindow *> Windows; | ||
50 | |||
51 | Workspace(BScreen &screen, FbTk::MultLayers &layermanager, const std::string &name, | ||
52 | unsigned int workspaceid = 0); | ||
53 | ~Workspace(); | ||
54 | |||
55 | void setLastFocusedWindow(FluxboxWindow *w); | ||
56 | |||
57 | /// Set workspace name | ||
58 | void setName(const std::string &name); | ||
59 | void showAll(); | ||
60 | void hideAll(); | ||
61 | void removeAll(); | ||
62 | void reconfigure(); | ||
63 | void shutdown(); | ||
64 | void addWindow(FluxboxWindow &win, bool place = false); | ||
65 | int removeWindow(FluxboxWindow *win, bool still_alive); | ||
66 | void updateClientmenu(); | ||
67 | |||
68 | BScreen &screen() { return m_screen; } | ||
69 | const BScreen &screen() const { return m_screen; } | ||
70 | |||
71 | FluxboxWindow *lastFocusedWindow() { return m_lastfocus; } | ||
72 | const FluxboxWindow *lastFocusedWindow() const { return m_lastfocus; } | ||
73 | |||
74 | inline FbTk::Menu &menu() { return m_clientmenu; } | ||
75 | inline const FbTk::Menu &menu() const { return m_clientmenu; } | ||
76 | /// name of this workspace | ||
77 | inline const std::string &name() const { return m_name; } | ||
78 | /** | ||
79 | @return the number of this workspace, note: obsolete, should be in BScreen | ||
80 | */ | ||
81 | inline unsigned int workspaceID() const { return m_id; } | ||
82 | |||
83 | const Windows &windowList() const { return m_windowlist; } | ||
84 | Windows &windowList() { return m_windowlist; } | ||
85 | |||
86 | int numberOfWindows() const; | ||
87 | bool checkGrouping(FluxboxWindow &win); | ||
88 | |||
89 | static bool loadGroups(const std::string &filename); | ||
42 | 90 | ||
43 | char *name; | 91 | private: |
44 | int id, cascade_x, cascade_y; | 92 | void update(FbTk::Subject *subj); |
93 | void placeWindow(FluxboxWindow &win); | ||
45 | 94 | ||
95 | BScreen &m_screen; | ||
96 | FluxboxWindow *m_lastfocus; | ||
97 | FbMenu m_clientmenu; | ||
46 | 98 | ||
47 | protected: | 99 | typedef std::vector<std::string> Group; |
48 | void placeWindow(FluxboxWindow *); | 100 | typedef std::vector<Group> GroupList; |
101 | |||
102 | static GroupList m_groups; ///< handle auto groupings | ||
49 | 103 | ||
104 | FbTk::MultLayers &m_layermanager; | ||
105 | Windows m_windowlist; | ||
50 | 106 | ||
51 | public: | 107 | std::string m_name; ///< name of this workspace |
52 | Workspace(BScreen *, int = 0); | 108 | unsigned int m_id; ///< id, obsolete, this should be in BScreen |
53 | ~Workspace(void); | 109 | int *m_cascade_x; ///< need a cascade for each head (Xinerama) |
54 | 110 | int *m_cascade_y; ///< need a cascade for each head (Xinerama) | |
55 | inline BScreen *getScreen(void) { return screen; } | ||
56 | |||
57 | inline FluxboxWindow *getLastFocusedWindow(void) { return lastfocus; } | ||
58 | |||
59 | inline Clientmenu *getMenu(void) { return clientmenu; } | ||
60 | |||
61 | inline const char *getName(void) const { return name; } | ||
62 | |||
63 | inline const int &getWorkspaceID(void) const { return id; } | ||
64 | |||
65 | inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } | ||
66 | |||
67 | FluxboxWindow *getWindow(int); | ||
68 | |||
69 | Bool isCurrent(void); | ||
70 | Bool isLastWindow(FluxboxWindow *); | ||
71 | |||
72 | const int addWindow(FluxboxWindow *, Bool = False); | ||
73 | const int removeWindow(FluxboxWindow *); | ||
74 | const int getCount(void); | ||
75 | |||
76 | void showAll(void); | ||
77 | void hideAll(void); | ||
78 | void removeAll(void); | ||
79 | void raiseWindow(FluxboxWindow *); | ||
80 | void lowerWindow(FluxboxWindow *); | ||
81 | void reconfigure(); | ||
82 | void update(); | ||
83 | void setCurrent(void); | ||
84 | void setName(char *); | ||
85 | void shutdown(void); | ||
86 | }; | 111 | }; |
87 | 112 | ||
88 | 113 | ||
89 | #endif // _WORKSPACE_HH_ | 114 | #endif // WORKSPACE_HH |
90 | 115 | ||