diff options
Diffstat (limited to 'src/Slit.hh')
-rw-r--r-- | src/Slit.hh | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/src/Slit.hh b/src/Slit.hh index 154d345..335e921 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -39,163 +39,163 @@ class Slit; | |||
39 | 39 | ||
40 | class Slitmenu : public Basemenu { | 40 | class Slitmenu : public Basemenu { |
41 | public: | 41 | public: |
42 | explicit Slitmenu(Slit &theslist); | 42 | explicit Slitmenu(Slit &theslist); |
43 | virtual ~Slitmenu(); | 43 | virtual ~Slitmenu(); |
44 | 44 | ||
45 | const Basemenu &getDirectionmenu() const { return m_directionmenu; } | 45 | const Basemenu &getDirectionmenu() const { return m_directionmenu; } |
46 | const Basemenu &getPlacementmenu() const { return m_placementmenu; } | 46 | const Basemenu &getPlacementmenu() const { return m_placementmenu; } |
47 | 47 | ||
48 | #ifdef XINERAMA | 48 | #ifdef XINERAMA |
49 | const Basemenu *getHeadmenu() const { return m_headmenu.get(); } | 49 | const Basemenu *getHeadmenu() const { return m_headmenu.get(); } |
50 | #endif // XINERAMA | 50 | #endif // XINERAMA |
51 | 51 | ||
52 | void reconfigure(); | 52 | void reconfigure(); |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | virtual void itemSelected(int button, unsigned int index); | 55 | virtual void itemSelected(int button, unsigned int index); |
56 | virtual void internal_hide(); | 56 | virtual void internal_hide(); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | class Directionmenu : public Basemenu { | 59 | class Directionmenu : public Basemenu { |
60 | public: | 60 | public: |
61 | Directionmenu(Slitmenu &sm); | 61 | Directionmenu(Slitmenu &sm); |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | virtual void itemSelected(int button, unsigned int index); | 64 | virtual void itemSelected(int button, unsigned int index); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | Slitmenu &slitmenu; | 67 | Slitmenu &slitmenu; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | class Placementmenu : public Basemenu { | 70 | class Placementmenu : public Basemenu { |
71 | public: | 71 | public: |
72 | Placementmenu(Slitmenu &sm); | 72 | Placementmenu(Slitmenu &sm); |
73 | 73 | ||
74 | protected: | 74 | protected: |
75 | virtual void itemSelected(int button, unsigned int index); | 75 | virtual void itemSelected(int button, unsigned int index); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | Slitmenu &slitmenu; | 78 | Slitmenu &slitmenu; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | Slit &slit; | 81 | Slit &slit; |
82 | 82 | ||
83 | #ifdef XINERAMA | 83 | #ifdef XINERAMA |
84 | class Headmenu : public Basemenu { | 84 | class Headmenu : public Basemenu { |
85 | public: | 85 | public: |
86 | Headmenu(Slitmenu &sm); | 86 | Headmenu(Slitmenu &sm); |
87 | protected: | 87 | protected: |
88 | virtual void itemSelected(int button, unsigned int index); | 88 | virtual void itemSelected(int button, unsigned int index); |
89 | private: | 89 | private: |
90 | Slitmenu &slitmenu; | 90 | Slitmenu &slitmenu; |
91 | }; | 91 | }; |
92 | friend class Headmenu; | 92 | friend class Headmenu; |
93 | std::auto_ptr<Headmenu> m_headmenu; | 93 | std::auto_ptr<Headmenu> m_headmenu; |
94 | #endif // XINERAMA | 94 | #endif // XINERAMA |
95 | 95 | ||
96 | Placementmenu m_placementmenu; | 96 | Placementmenu m_placementmenu; |
97 | Directionmenu m_directionmenu; | 97 | Directionmenu m_directionmenu; |
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | friend class Directionmenu; | 101 | friend class Directionmenu; |
102 | friend class Placementmenu; | 102 | friend class Placementmenu; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | 105 | ||
106 | class Slit : public TimeoutHandler { | 106 | class Slit : public TimeoutHandler { |
107 | public: | 107 | public: |
108 | explicit Slit(BScreen *screen); | 108 | explicit Slit(BScreen *screen); |
109 | virtual ~Slit(); | 109 | virtual ~Slit(); |
110 | 110 | ||
111 | inline bool isOnTop() const { return on_top; } | 111 | inline bool isOnTop() const { return on_top; } |
112 | inline bool isHidden() const { return hidden; } | 112 | inline bool isHidden() const { return hidden; } |
113 | inline bool doAutoHide() const { return do_auto_hide; } | 113 | inline bool doAutoHide() const { return do_auto_hide; } |
114 | 114 | ||
115 | Slitmenu &menu() { return slitmenu; } | 115 | Slitmenu &menu() { return slitmenu; } |
116 | 116 | ||
117 | inline const Window &getWindowID() const { return frame.window; } | 117 | inline const Window &getWindowID() const { return frame.window; } |
118 | 118 | ||
119 | inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } | 119 | inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } |
120 | inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } | 120 | inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } |
121 | 121 | ||
122 | inline unsigned int width() const { return frame.width; } | 122 | inline unsigned int width() const { return frame.width; } |
123 | inline unsigned int height() const { return frame.height; } | 123 | inline unsigned int height() const { return frame.height; } |
124 | void setOnTop(bool val); | 124 | void setOnTop(bool val); |
125 | void setAutoHide(bool val); | 125 | void setAutoHide(bool val); |
126 | void addClient(Window clientwin); | 126 | void addClient(Window clientwin); |
127 | void removeClient(Window clientwin, bool = true); | 127 | void removeClient(Window clientwin, bool = true); |
128 | void reconfigure(); | 128 | void reconfigure(); |
129 | void reposition(); | 129 | void reposition(); |
130 | void shutdown(); | 130 | void shutdown(); |
131 | void saveClientList(); | 131 | void saveClientList(); |
132 | BScreen *screen() { return m_screen; } | 132 | BScreen *screen() { return m_screen; } |
133 | const BScreen *screen() const { return m_screen; } | 133 | const BScreen *screen() const { return m_screen; } |
134 | /** | 134 | /** |
135 | @name eventhandlers | 135 | @name eventhandlers |
136 | */ | 136 | */ |
137 | //@{ | 137 | //@{ |
138 | void buttonPressEvent(XButtonEvent *bp); | 138 | void buttonPressEvent(XButtonEvent *bp); |
139 | void enterNotifyEvent(XCrossingEvent *en); | 139 | void enterNotifyEvent(XCrossingEvent *en); |
140 | void leaveNotifyEvent(XCrossingEvent *ln); | 140 | void leaveNotifyEvent(XCrossingEvent *ln); |
141 | void configureRequestEvent(XConfigureRequestEvent *cr); | 141 | void configureRequestEvent(XConfigureRequestEvent *cr); |
142 | //@} | 142 | //@} |
143 | 143 | ||
144 | virtual void timeout(); | 144 | virtual void timeout(); |
145 | 145 | ||
146 | /** | 146 | /** |
147 | Client alignment | 147 | Client alignment |
148 | */ | 148 | */ |
149 | enum { VERTICAL = 1, HORIZONTAL }; | 149 | enum { VERTICAL = 1, HORIZONTAL }; |
150 | /** | 150 | /** |
151 | Screen placement | 151 | Screen placement |
152 | */ | 152 | */ |
153 | enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, | 153 | enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, |
154 | TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; | 154 | TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; |
155 | 155 | ||
156 | private: | 156 | private: |
157 | class SlitClient { | 157 | class SlitClient { |
158 | public: | 158 | public: |
159 | SlitClient(BScreen *screen, Window client_window); // For adding an actual window | 159 | SlitClient(BScreen *screen, Window client_window); // For adding an actual window |
160 | SlitClient(const char *name); // For adding a placeholder | 160 | SlitClient(const char *name); // For adding a placeholder |
161 | 161 | ||
162 | // Now we pre-initialize a list of slit clients with names for | 162 | // Now we pre-initialize a list of slit clients with names for |
163 | // comparison with incoming client windows. This allows the slit | 163 | // comparison with incoming client windows. This allows the slit |
164 | // to maintain a sorted order based on a saved window name list. | 164 | // to maintain a sorted order based on a saved window name list. |
165 | // Incoming windows not found in the list are appended. Matching | 165 | // Incoming windows not found in the list are appended. Matching |
166 | // duplicates are inserted after the last found instance of the | 166 | // duplicates are inserted after the last found instance of the |
167 | // matching name. | 167 | // matching name. |
168 | std::string match_name; | 168 | std::string match_name; |
169 | 169 | ||
170 | Window window, client_window, icon_window; | 170 | Window window, client_window, icon_window; |
171 | 171 | ||
172 | int x, y; | 172 | int x, y; |
173 | unsigned int width, height; | 173 | unsigned int width, height; |
174 | 174 | ||
175 | void initialize(BScreen *screen = 0, Window client_window= None); | 175 | void initialize(BScreen *screen = 0, Window client_window= None); |
176 | }; | 176 | }; |
177 | 177 | ||
178 | void removeClient(SlitClient *client, bool remap, bool destroy); | 178 | void removeClient(SlitClient *client, bool remap, bool destroy); |
179 | void loadClientList(); | 179 | void loadClientList(); |
180 | 180 | ||
181 | bool on_top, hidden, do_auto_hide; | 181 | bool on_top, hidden, do_auto_hide; |
182 | 182 | ||
183 | BScreen *m_screen; | 183 | BScreen *m_screen; |
184 | BTimer timer; | 184 | BTimer timer; |
185 | 185 | ||
186 | typedef std::list<SlitClient *> SlitClients; | 186 | typedef std::list<SlitClient *> SlitClients; |
187 | 187 | ||
188 | SlitClients clientList; | 188 | SlitClients clientList; |
189 | Slitmenu slitmenu; | 189 | Slitmenu slitmenu; |
190 | std::string clientListPath; | 190 | std::string clientListPath; |
191 | 191 | ||
192 | struct frame { | 192 | struct frame { |
193 | Pixmap pixmap; | 193 | Pixmap pixmap; |
194 | Window window; | 194 | Window window; |
195 | 195 | ||
196 | int x, y, x_hidden, y_hidden; | 196 | int x, y, x_hidden, y_hidden; |
197 | unsigned int width, height; | 197 | unsigned int width, height; |
198 | } frame; | 198 | } frame; |
199 | 199 | ||
200 | }; | 200 | }; |
201 | 201 | ||