diff options
Diffstat (limited to 'src/Slit.hh')
-rw-r--r-- | src/Slit.hh | 216 |
1 files changed, 121 insertions, 95 deletions
diff --git a/src/Slit.hh b/src/Slit.hh index cce1d97..75111d0 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -1,3 +1,6 @@ | |||
1 | // Slit.hh for Fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
1 | // Slit.hh for Blackbox - an X11 Window manager | 4 | // Slit.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 | // |
@@ -18,9 +21,9 @@ | |||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
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 _SLIT_HH_ | 25 | #ifndef SLIT_HH |
23 | #define _SLIT_HH_ | 26 | #define SLIT_HH |
24 | 27 | ||
25 | #include <X11/Xlib.h> | 28 | #include <X11/Xlib.h> |
26 | #include <X11/Xutil.h> | 29 | #include <X11/Xutil.h> |
@@ -30,129 +33,152 @@ class Slit; | |||
30 | class Slitmenu; | 33 | class Slitmenu; |
31 | 34 | ||
32 | #include "Basemenu.hh" | 35 | #include "Basemenu.hh" |
33 | #include "LinkedList.hh" | ||
34 | 36 | ||
37 | #include <list> | ||
35 | 38 | ||
36 | class Slitmenu : public Basemenu { | 39 | class Slitmenu : public Basemenu { |
37 | private: | 40 | public: |
38 | class Directionmenu : public Basemenu { | 41 | explicit Slitmenu(Slit &theslist); |
39 | private: | 42 | virtual ~Slitmenu(void); |
40 | Slitmenu *slitmenu; | ||
41 | 43 | ||
42 | protected: | 44 | inline Basemenu *getDirectionmenu(void) { return directionmenu; } |
43 | virtual void itemSelected(int, int); | 45 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } |
46 | #ifdef XINERAMA | ||
47 | inline Basemenu *getHeadmenu(void) { return headmenu; } | ||
48 | #endif // XINERAMA | ||
44 | 49 | ||
45 | public: | 50 | void reconfigure(void); |
46 | Directionmenu(Slitmenu *); | ||
47 | }; | ||
48 | 51 | ||
49 | class Placementmenu : public Basemenu { | 52 | private: |
50 | private: | 53 | class Directionmenu : public Basemenu { |
51 | Slitmenu *slitmenu; | 54 | private: |
55 | Slitmenu *slitmenu; | ||
52 | 56 | ||
53 | protected: | 57 | protected: |
54 | virtual void itemSelected(int, int); | 58 | virtual void itemSelected(int button, unsigned int index); |
55 | 59 | ||
56 | public: | 60 | public: |
57 | Placementmenu(Slitmenu *); | 61 | Directionmenu(Slitmenu *); |
58 | }; | 62 | }; |
59 | 63 | ||
60 | Directionmenu *directionmenu; | 64 | class Placementmenu : public Basemenu { |
61 | Placementmenu *placementmenu; | 65 | private: |
66 | Slitmenu *slitmenu; | ||
62 | 67 | ||
63 | Slit *slit; | 68 | protected: |
69 | virtual void itemSelected(int button, unsigned int index); | ||
64 | 70 | ||
65 | friend class Directionmenu; | 71 | public: |
66 | friend class Placementmenu; | 72 | Placementmenu(Slitmenu *); |
67 | friend class Slit; | 73 | }; |
68 | 74 | ||
75 | #ifdef XINERAMA | ||
76 | class Headmenu : public Basemenu { | ||
77 | public: | ||
78 | Headmenu(Slitmenu *); | ||
79 | private: | ||
80 | Slitmenu *slitmenu; | ||
69 | 81 | ||
70 | protected: | 82 | protected: |
71 | virtual void itemSelected(int, int); | 83 | virtual void itemSelected(int button, unsigned int index); |
72 | virtual void internal_hide(void); | ||
73 | 84 | ||
85 | }; | ||
86 | #endif // XINERAMA | ||
74 | 87 | ||
75 | public: | 88 | Directionmenu *directionmenu; |
76 | Slitmenu(Slit *); | 89 | Placementmenu *placementmenu; |
77 | virtual ~Slitmenu(void); | 90 | #ifdef XINERAMA |
91 | Headmenu *headmenu; | ||
92 | #endif // XINERAMA | ||
93 | Slit &slit; | ||
94 | |||
95 | friend class Directionmenu; | ||
96 | friend class Placementmenu; | ||
97 | #ifdef XINERAMA | ||
98 | friend class Headmenu; | ||
99 | #endif // XINERAMA | ||
100 | friend class Slit; | ||
78 | 101 | ||
79 | inline Basemenu *getDirectionmenu(void) { return directionmenu; } | ||
80 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } | ||
81 | 102 | ||
82 | void reconfigure(void); | 103 | protected: |
104 | virtual void itemSelected(int button, unsigned int index); | ||
105 | virtual void internal_hide(void); | ||
83 | }; | 106 | }; |
84 | 107 | ||
85 | 108 | ||
86 | class Slit : public TimeoutHandler { | 109 | class Slit : public TimeoutHandler { |
87 | private: | ||
88 | class SlitClient { | ||
89 | public: | ||
90 | Window window, client_window, icon_window; | ||
91 | |||
92 | int x, y; | ||
93 | unsigned int width, height; | ||
94 | }; | ||
95 | |||
96 | Bool on_top, hidden, do_auto_hide; | ||
97 | Display *display; | ||
98 | |||
99 | Fluxbox *fluxbox; | ||
100 | BScreen *screen; | ||
101 | BTimer *timer; | ||
102 | |||
103 | LinkedList<SlitClient> *clientList; | ||
104 | Slitmenu *slitmenu; | ||
105 | |||
106 | struct frame { | ||
107 | Pixmap pixmap; | ||
108 | Window window; | ||
109 | |||
110 | int x, y, x_hidden, y_hidden; | ||
111 | unsigned int width, height; | ||
112 | } frame; | ||
113 | |||
114 | friend class Slitmenu; | ||
115 | friend class Slitmenu::Directionmenu; | ||
116 | friend class Slitmenu::Placementmenu; | ||
117 | |||
118 | |||
119 | public: | 110 | public: |
120 | Slit(BScreen *); | 111 | explicit Slit(BScreen *); |
121 | virtual ~Slit(); | 112 | virtual ~Slit(); |
122 | 113 | ||
123 | inline const Bool &isOnTop(void) const { return on_top; } | 114 | inline bool isOnTop(void) const { return on_top; } |
124 | inline const Bool &isHidden(void) const { return hidden; } | 115 | inline bool isHidden(void) const { return hidden; } |
125 | inline const Bool &doAutoHide(void) const { return do_auto_hide; } | 116 | inline bool doAutoHide(void) const { return do_auto_hide; } |
126 | 117 | ||
127 | inline Slitmenu *getMenu() { return slitmenu; } | 118 | Slitmenu &getMenu() { return slitmenu; } |
128 | 119 | ||
129 | inline const Window &getWindowID() const { return frame.window; } | 120 | inline const Window &getWindowID() const { return frame.window; } |
130 | 121 | ||
131 | inline const int &getX(void) const | 122 | inline int getX() const { return ((hidden) ? frame.x_hidden : frame.x); } |
132 | { return ((hidden) ? frame.x_hidden : frame.x); } | 123 | inline int getY() const { return ((hidden) ? frame.y_hidden : frame.y); } |
133 | inline const int &getY(void) const | ||
134 | { return ((hidden) ? frame.y_hidden : frame.y); } | ||
135 | 124 | ||
136 | inline const unsigned int &getWidth(void) const { return frame.width; } | 125 | inline unsigned int getWidth(void) const { return frame.width; } |
137 | inline const unsigned int &getHeight(void) const { return frame.height; } | 126 | inline unsigned int getHeight(void) const { return frame.height; } |
138 | 127 | ||
139 | void addClient(Window); | 128 | void addClient(Window); |
140 | void removeClient(SlitClient *, Bool = True); | 129 | void removeClient(Window, bool = true); |
141 | void removeClient(Window, Bool = True); | 130 | void reconfigure(void); |
142 | void reconfigure(void); | 131 | void reposition(void); |
143 | void reposition(void); | 132 | void shutdown(void); |
144 | void shutdown(void); | ||
145 | 133 | ||
146 | void buttonPressEvent(XButtonEvent *); | 134 | void buttonPressEvent(XButtonEvent *); |
147 | void enterNotifyEvent(XCrossingEvent *); | 135 | void enterNotifyEvent(XCrossingEvent *); |
148 | void leaveNotifyEvent(XCrossingEvent *); | 136 | void leaveNotifyEvent(XCrossingEvent *); |
149 | void configureRequestEvent(XConfigureRequestEvent *); | 137 | void configureRequestEvent(XConfigureRequestEvent *); |
150 | 138 | ||
151 | virtual void timeout(void); | 139 | virtual void timeout(void); |
152 | 140 | ||
153 | enum { Vertical = 1, Horizontal }; | 141 | enum { VERTICAL = 1, HORIZONTAL }; |
154 | enum { TopLeft = 1, CenterLeft, BottomLeft, TopCenter, BottomCenter, | 142 | enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, |
155 | TopRight, CenterRight, BottomRight }; | 143 | TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; |
144 | |||
145 | private: | ||
146 | class SlitClient { | ||
147 | public: | ||
148 | Window window, client_window, icon_window; | ||
149 | |||
150 | int x, y; | ||
151 | unsigned int width, height; | ||
152 | }; | ||
153 | |||
154 | void removeClient(SlitClient *, bool = true); | ||
155 | |||
156 | Bool on_top, hidden, do_auto_hide; | ||
157 | Display *display; | ||
158 | |||
159 | Fluxbox *fluxbox; | ||
160 | BScreen *screen; | ||
161 | BTimer timer; | ||
162 | |||
163 | typedef std::list<SlitClient *> SlitClients; | ||
164 | |||
165 | SlitClients clientList; | ||
166 | Slitmenu slitmenu; | ||
167 | |||
168 | struct frame { | ||
169 | Pixmap pixmap; | ||
170 | Window window; | ||
171 | |||
172 | int x, y, x_hidden, y_hidden; | ||
173 | unsigned int width, height; | ||
174 | } frame; | ||
175 | |||
176 | friend class Slitmenu; | ||
177 | friend class Slitmenu::Directionmenu; | ||
178 | friend class Slitmenu::Placementmenu; | ||
179 | #ifdef XINERAMA | ||
180 | friend class Slitmenu::Headmenu; | ||
181 | #endif // XINERAMA | ||
156 | }; | 182 | }; |
157 | 183 | ||
158 | 184 | ||