]> icculus.org git repositories - mikachu/openbox.git/blob - src/workspace.hh
gets transients! woot. tested and such.. no groups still tho
[mikachu/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 "otk/property.hh"
14
15 namespace ob {
16
17 class BScreen;
18 class Workspace;
19 class BlackboxWindow;
20
21 typedef std::list<BlackboxWindow*> BlackboxWindowList;
22 typedef std::vector<Window> StackVector;
23
24 class Workspace {
25 private:
26   BScreen *screen;
27   BlackboxWindow *lastfocus;
28   otk::OBProperty *xatom;
29
30   BlackboxWindowList stackingList, windowList;
31
32   std::string name;
33   unsigned int id;
34   unsigned int cascade_x, cascade_y;
35 #ifdef    XINERAMA
36   unsigned int cascade_region;
37 #endif // XINERAMA
38
39   Workspace(const Workspace&);
40   Workspace& operator=(const Workspace&);
41
42   void raiseTransients(const BlackboxWindow * const win,
43                        StackVector::iterator &stack);
44   void lowerTransients(const BlackboxWindow * const win,
45                        StackVector::iterator &stack);
46
47   typedef std::vector<otk::Rect> rectList;
48   rectList calcSpace(const otk::Rect &win, const rectList &spaces) const;
49
50   void placeWindow(BlackboxWindow *win);
51   bool cascadePlacement(otk::Rect& win, const int offset);
52   bool smartPlacement(otk::Rect& win);
53   bool underMousePlacement(otk::Rect& win);
54
55 public:
56   Workspace(BScreen *scrn, unsigned int i = 0);
57
58   inline BScreen *getScreen(void) { return screen; }
59
60   inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
61
62   inline const std::string& getName(void) const { return name; }
63
64   inline unsigned int getID(void) const { return id; }
65
66   inline void setLastFocusedWindow(BlackboxWindow *w) { lastfocus = w; }
67
68   inline const BlackboxWindowList& getStackingList() const
69   { return stackingList; }
70
71   BlackboxWindow* getWindow(unsigned int index);
72   BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
73   BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
74   BlackboxWindow* getTopWindowOnStack(void) const;
75   void focusFallback(const BlackboxWindow *old_window);
76
77   bool isCurrent(void) const;
78   bool isLastWindow(const BlackboxWindow* w) const;
79
80   void addWindow(BlackboxWindow *w, bool place = False, bool sticky = False);
81   void removeWindow(BlackboxWindow *w, bool sticky = False);
82   unsigned int getCount(void) const;
83   void appendStackOrder(BlackboxWindowList &stack_order) const;
84
85   void showAll(void);
86   void hideAll(void);
87   void removeAll(void);
88   void raiseWindow(BlackboxWindow *w);
89   void lowerWindow(BlackboxWindow *w);
90   void reconfigure(void);
91   void setCurrent(void);
92   void readName();
93   void setName(const std::string& new_name);
94 };
95
96 }
97
98 #endif // __Workspace_hh
99