]> icculus.org git repositories - dana/openbox.git/blob - src/workspace.hh
libtool stuff
[dana/openbox.git] / src / workspace.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __Workspace_hh
3 #define   __Workspace_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 #include <list>
10 #include <string>
11 #include <vector>
12
13 #include "xatom.hh"
14
15 class BScreen;
16 class Workspace;
17 class BlackboxWindow;
18
19 typedef std::list<BlackboxWindow*> BlackboxWindowList;
20 typedef std::vector<Window> StackVector;
21
22 class Workspace {
23 private:
24   BScreen *screen;
25   BlackboxWindow *lastfocus;
26   XAtom *xatom;
27
28   BlackboxWindowList stackingList, windowList;
29
30   std::string name;
31   unsigned int id;
32   unsigned int cascade_x, cascade_y;
33 #ifdef    XINERAMA
34   unsigned int cascade_region;
35 #endif // XINERAMA
36
37   Workspace(const Workspace&);
38   Workspace& operator=(const Workspace&);
39
40   void raiseTransients(const BlackboxWindow * const win,
41                        StackVector::iterator &stack);
42   void lowerTransients(const BlackboxWindow * const win,
43                        StackVector::iterator &stack);
44
45   typedef std::vector<Rect> rectList;
46   rectList calcSpace(const Rect &win, const rectList &spaces) const;
47
48   void placeWindow(BlackboxWindow *win);
49   bool cascadePlacement(Rect& win, const int offset);
50   bool smartPlacement(Rect& win);
51   bool underMousePlacement(Rect& win);
52
53 public:
54   Workspace(BScreen *scrn, unsigned int i = 0);
55
56   inline BScreen *getScreen(void) { return screen; }
57
58   inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
59
60   inline const std::string& getName(void) const { return name; }
61
62   inline unsigned int getID(void) const { return id; }
63
64   inline void setLastFocusedWindow(BlackboxWindow *w) { lastfocus = w; }
65
66   inline const BlackboxWindowList& getStackingList() const
67   { return stackingList; }
68
69   BlackboxWindow* getWindow(unsigned int index);
70   BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
71   BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
72   BlackboxWindow* getTopWindowOnStack(void) const;
73   void focusFallback(const BlackboxWindow *old_window);
74
75   bool isCurrent(void) const;
76   bool isLastWindow(const BlackboxWindow* w) const;
77
78   void addWindow(BlackboxWindow *w, bool place = False, bool sticky = False);
79   void removeWindow(BlackboxWindow *w, bool sticky = False);
80   unsigned int getCount(void) const;
81   void appendStackOrder(BlackboxWindowList &stack_order) const;
82
83   void showAll(void);
84   void hideAll(void);
85   void removeAll(void);
86   void raiseWindow(BlackboxWindow *w);
87   void lowerWindow(BlackboxWindow *w);
88   void reconfigure(void);
89   void setCurrent(void);
90   void readName();
91   void setName(const std::string& new_name);
92 };
93
94
95 #endif // __Workspace_hh
96