diff options
author | fluxgen <fluxgen> | 2007-03-31 19:09:19 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2007-03-31 19:09:19 (GMT) |
commit | dd7a7ad8864c53193822cd0cf302af364b1eed9d (patch) | |
tree | b1122f1926936f6163b8862762877ac409dac688 /src | |
parent | 8964cbdaa8c21c96e1fc0d5297f2bda93b4555e9 (diff) | |
download | fluxbox-dd7a7ad8864c53193822cd0cf302af364b1eed9d.zip fluxbox-dd7a7ad8864c53193822cd0cf302af364b1eed9d.tar.bz2 |
added document
Diffstat (limited to 'src')
-rw-r--r-- | src/Screen.hh | 149 |
1 files changed, 128 insertions, 21 deletions
diff --git a/src/Screen.hh b/src/Screen.hh index 066ec74..ab6ce7d 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -93,11 +93,13 @@ public: | |||
93 | FETCH_ACTIVE_WINDOW ///< put that window to the current workspace | 93 | FETCH_ACTIVE_WINDOW ///< put that window to the current workspace |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /// Different resize modes when resizing a window | ||
96 | enum ResizeModel { | 97 | enum ResizeModel { |
97 | BOTTOMRESIZE = 0, | 98 | BOTTOMRESIZE = 0, //< resizes from the bottom right corner |
98 | QUADRANTRESIZE, | 99 | QUADRANTRESIZE, //< resizes from one quadrant |
99 | CENTERRESIZE, | 100 | CENTERRESIZE, //< resizes from center |
100 | DEFAULTRESIZE = BOTTOMRESIZE }; | 101 | DEFAULTRESIZE = BOTTOMRESIZE //< default resize mode is bottom |
102 | }; | ||
101 | 103 | ||
102 | 104 | ||
103 | typedef std::list<FluxboxWindow *> Icons; | 105 | typedef std::list<FluxboxWindow *> Icons; |
@@ -153,38 +155,56 @@ public: | |||
153 | inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; } | 155 | inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; } |
154 | 156 | ||
155 | inline unsigned int getTabWidth() const { return *resource.tab_width; } | 157 | inline unsigned int getTabWidth() const { return *resource.tab_width; } |
156 | 158 | /// @return the slit, @see Slit | |
157 | inline Slit *slit() { return m_slit.get(); } | 159 | inline Slit *slit() { return m_slit.get(); } |
160 | /// @return the slit, @see Slit | ||
158 | inline const Slit *slit() const { return m_slit.get(); } | 161 | inline const Slit *slit() const { return m_slit.get(); } |
159 | 162 | /** | |
163 | * @param w the workspace number | ||
164 | * @return workspace for the given workspace number | ||
165 | */ | ||
160 | inline Workspace *getWorkspace(unsigned int w) { return ( w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); } | 166 | inline Workspace *getWorkspace(unsigned int w) { return ( w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); } |
167 | /** | ||
168 | * @param w the workspace number | ||
169 | * @return workspace for the given workspace number | ||
170 | */ | ||
161 | inline const Workspace *getWorkspace(unsigned int w) const { | 171 | inline const Workspace *getWorkspace(unsigned int w) const { |
162 | return (w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); | 172 | return (w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); |
163 | } | 173 | } |
174 | /// @return the current workspace | ||
164 | inline Workspace *currentWorkspace() { return m_current_workspace; } | 175 | inline Workspace *currentWorkspace() { return m_current_workspace; } |
165 | inline const Workspace *currentWorkspace() const { return m_current_workspace; } | 176 | inline const Workspace *currentWorkspace() const { return m_current_workspace; } |
166 | 177 | /// @return the workspace menu | |
167 | const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); } | 178 | const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); } |
179 | /// @return the workspace menu | ||
168 | FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); } | 180 | FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); } |
169 | 181 | /// @return focus control handler | |
170 | const FocusControl &focusControl() const { return *m_focus_control; } | 182 | const FocusControl &focusControl() const { return *m_focus_control; } |
183 | /// @return focus control handler | ||
171 | FocusControl &focusControl() { return *m_focus_control; } | 184 | FocusControl &focusControl() { return *m_focus_control; } |
172 | 185 | /// @return the current workspace id | |
173 | unsigned int currentWorkspaceID() const; | 186 | unsigned int currentWorkspaceID() const; |
174 | /* | 187 | /** |
175 | maximum screen bounds for given window | 188 | |
189 | * | ||
176 | */ | 190 | */ |
191 | /// @return maximum screen bound to the left for a specific xinerama head | ||
177 | unsigned int maxLeft(int head) const; | 192 | unsigned int maxLeft(int head) const; |
193 | /// @return maximum screen bound to the right for a specific xinerama head | ||
178 | unsigned int maxRight(int head) const; | 194 | unsigned int maxRight(int head) const; |
195 | /// @return maximum screen bound at the top for the specified xinerama head | ||
179 | unsigned int maxTop(int head) const; | 196 | unsigned int maxTop(int head) const; |
197 | /// @return maximum screen bound at bottom for the specified xinerama head | ||
180 | unsigned int maxBottom(int head) const; | 198 | unsigned int maxBottom(int head) const; |
181 | /// @return true if window is kde dock app | 199 | /// @return true if window is kde dock app |
182 | bool isKdeDockapp(Window win) const; | 200 | bool isKdeDockapp(Window win) const; |
183 | /// @return true if dock app was added, else false | 201 | /// @return true if dock app was added, else false |
184 | bool addKdeDockapp(Window win); | 202 | bool addKdeDockapp(Window win); |
185 | 203 | /// @return screen width, @see rootWindow() | |
186 | unsigned int width() const { return rootWindow().width(); } | 204 | unsigned int width() const { return rootWindow().width(); } |
205 | /// @return screen height, @see rootWindow() | ||
187 | unsigned int height() const { return rootWindow().height(); } | 206 | unsigned int height() const { return rootWindow().height(); } |
207 | /// @return number of the screen, @see rootWindow() | ||
188 | int screenNumber() const { return rootWindow().screenNumber(); } | 208 | int screenNumber() const { return rootWindow().screenNumber(); } |
189 | 209 | ||
190 | /// @return number of workspaces | 210 | /// @return number of workspaces |
@@ -217,6 +237,7 @@ public: | |||
217 | FbTk::Subject &resizeSig() { return m_resize_sig; } | 237 | FbTk::Subject &resizeSig() { return m_resize_sig; } |
218 | //@} | 238 | //@} |
219 | 239 | ||
240 | /// called when the screen receives a signal from a subject | ||
220 | void update(FbTk::Subject *subj); | 241 | void update(FbTk::Subject *subj); |
221 | 242 | ||
222 | void keyPressEvent(XKeyEvent &ke); | 243 | void keyPressEvent(XKeyEvent &ke); |
@@ -224,16 +245,42 @@ public: | |||
224 | void buttonPressEvent(XButtonEvent &be); | 245 | void buttonPressEvent(XButtonEvent &be); |
225 | void notifyUngrabKeyboard(); | 246 | void notifyUngrabKeyboard(); |
226 | 247 | ||
248 | /** | ||
249 | * Prepares type a head focus | ||
250 | * @param winlist a list of focusables | ||
251 | * @param pat pattern to match windows with | ||
252 | */ | ||
227 | void startTypeAheadFocus(std::list<Focusable *> &winlist, | 253 | void startTypeAheadFocus(std::list<Focusable *> &winlist, |
228 | const ClientPattern *pat = 0); | 254 | const ClientPattern *pat = 0); |
255 | /** | ||
256 | * Cycles focus of windows | ||
257 | * @param opts focus options | ||
258 | * @param pat specific pattern to match windows with | ||
259 | * @param reverse the order of cycling | ||
260 | */ | ||
229 | void cycleFocus(int opts = 0, const ClientPattern *pat = 0, bool reverse = false); | 261 | void cycleFocus(int opts = 0, const ClientPattern *pat = 0, bool reverse = false); |
230 | 262 | ||
263 | /** | ||
264 | * Creates an empty menu with specified label | ||
265 | * @param label for the menu | ||
266 | * @return create menu | ||
267 | */ | ||
231 | FbTk::Menu *createMenu(const std::string &label); | 268 | FbTk::Menu *createMenu(const std::string &label); |
269 | /** | ||
270 | * Creates an empty toggle menu with a specific label | ||
271 | * @param label | ||
272 | * @return created menu | ||
273 | */ | ||
232 | FbTk::Menu *createToggleMenu(const std::string &label); | 274 | FbTk::Menu *createToggleMenu(const std::string &label); |
275 | |||
276 | /// hides all menus that are visible on this screen | ||
233 | void hideMenus(); | 277 | void hideMenus(); |
234 | // for extras to add menus. | 278 | |
235 | // These menus will be marked internal, | 279 | /** |
236 | // and deleted when the window dies (as opposed to Screen | 280 | * For extras to add menus. |
281 | * These menus will be marked internal, | ||
282 | * and deleted when the window dies (as opposed to Screen | ||
283 | */ | ||
237 | void addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu); | 284 | void addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu); |
238 | 285 | ||
239 | /// hide all windowmenus except the given one (if given) | 286 | /// hide all windowmenus except the given one (if given) |
@@ -275,29 +322,71 @@ public: | |||
275 | int addWorkspace(); | 322 | int addWorkspace(); |
276 | int removeLastWorkspace(); | 323 | int removeLastWorkspace(); |
277 | // scroll workspaces | 324 | // scroll workspaces |
325 | /// go to next workspace ( right ) | ||
278 | void nextWorkspace() { nextWorkspace(1); } | 326 | void nextWorkspace() { nextWorkspace(1); } |
327 | /// go to previous workspace | ||
279 | void prevWorkspace() { prevWorkspace(1); } | 328 | void prevWorkspace() { prevWorkspace(1); } |
329 | /** | ||
330 | * Jump forward to a workspace | ||
331 | * @param delta number of steps to jump | ||
332 | */ | ||
280 | void nextWorkspace(int delta); | 333 | void nextWorkspace(int delta); |
334 | /** | ||
335 | * Jump backwards to a workspace | ||
336 | * @param delta number of steps to jump | ||
337 | */ | ||
281 | void prevWorkspace(int delta); | 338 | void prevWorkspace(int delta); |
339 | /** | ||
340 | * Jump right to a workspace. | ||
341 | * @param delta number of steps to jump | ||
342 | */ | ||
282 | void rightWorkspace(int delta); | 343 | void rightWorkspace(int delta); |
344 | /** | ||
345 | * Jump left to a workspace | ||
346 | * @param delta number of steps to jump | ||
347 | */ | ||
283 | void leftWorkspace(int delta); | 348 | void leftWorkspace(int delta); |
284 | 349 | ||
350 | /// remove all workspace names | ||
285 | void removeWorkspaceNames(); | 351 | void removeWorkspaceNames(); |
352 | /// update the workspace name atom | ||
286 | void updateWorkspaceNamesAtom(); | 353 | void updateWorkspaceNamesAtom(); |
287 | 354 | /// add a workspace name to the end of the workspace name list | |
288 | void addWorkspaceName(const char *name); | 355 | void addWorkspaceName(const char *name); |
356 | /// add a Netizen window | ||
289 | void addNetizen(Window win); | 357 | void addNetizen(Window win); |
358 | /// remove a netizen | ||
290 | void removeNetizen(Window win); | 359 | void removeNetizen(Window win); |
360 | /// add a window to the icon list | ||
291 | void addIcon(FluxboxWindow *win); | 361 | void addIcon(FluxboxWindow *win); |
362 | /// remove a window from the icon list | ||
292 | void removeIcon(FluxboxWindow *win); | 363 | void removeIcon(FluxboxWindow *win); |
293 | // remove window | 364 | /// remove a window |
294 | void removeWindow(FluxboxWindow *win); | 365 | void removeWindow(FluxboxWindow *win); |
366 | /// remove a client | ||
295 | void removeClient(WinClient &client); | 367 | void removeClient(WinClient &client); |
296 | 368 | /** | |
369 | * Gets name of a specific workspace | ||
370 | * @param workspace the workspace number to get the name of | ||
371 | * @return name of the workspace | ||
372 | */ | ||
297 | std::string getNameOfWorkspace(unsigned int workspace) const; | 373 | std::string getNameOfWorkspace(unsigned int workspace) const; |
374 | /// changes workspace to specified id | ||
298 | void changeWorkspaceID(unsigned int); | 375 | void changeWorkspaceID(unsigned int); |
376 | /** | ||
377 | * Sends a window to a workspace | ||
378 | * @param workspace the workspace id | ||
379 | * @param win the window to send | ||
380 | * @param changeworkspace whether current workspace should change | ||
381 | */ | ||
299 | void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, | 382 | void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, |
300 | bool changeworkspace=true); | 383 | bool changeworkspace=true); |
384 | /** | ||
385 | * Reassociate a window to another workspace | ||
386 | * @param window the window to reassociate | ||
387 | * @param workspace_id id of the workspace | ||
388 | * @param ignore_sticky ignores any sticky windows | ||
389 | */ | ||
301 | void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, | 390 | void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, |
302 | bool ignore_sticky); | 391 | bool ignore_sticky); |
303 | 392 | ||
@@ -312,7 +401,7 @@ public: | |||
312 | /// show geomentry with "width x height"-text, not size of window | 401 | /// show geomentry with "width x height"-text, not size of window |
313 | void showGeometry(int width, int height); | 402 | void showGeometry(int width, int height); |
314 | void hideGeometry(); | 403 | void hideGeometry(); |
315 | 404 | ||
316 | void setLayer(FbTk::XLayerItem &item, int layernum); | 405 | void setLayer(FbTk::XLayerItem &item, int layernum); |
317 | // remove? no, items are never removed from their layer until they die | 406 | // remove? no, items are never removed from their layer until they die |
318 | 407 | ||
@@ -322,20 +411,34 @@ public: | |||
322 | void updateSize(); | 411 | void updateSize(); |
323 | 412 | ||
324 | // Xinerama-related functions | 413 | // Xinerama-related functions |
414 | |||
415 | /// @return true if xinerama is available | ||
325 | bool hasXinerama() const { return m_xinerama_avail; } | 416 | bool hasXinerama() const { return m_xinerama_avail; } |
417 | /// @return umber of xinerama heads | ||
326 | int numHeads() const { return m_xinerama_num_heads; } | 418 | int numHeads() const { return m_xinerama_num_heads; } |
327 | 419 | ||
328 | void initXinerama(); | 420 | void initXinerama(); |
329 | 421 | /** | |
422 | * Determines head number for a position | ||
423 | * @param x position in pixels on the screen | ||
424 | * @param y position in pixels on the screen | ||
425 | * @return head number at this position | ||
426 | */ | ||
330 | int getHead(int x, int y) const; | 427 | int getHead(int x, int y) const; |
428 | /// @return head number of window | ||
331 | int getHead(const FbTk::FbWindow &win) const; | 429 | int getHead(const FbTk::FbWindow &win) const; |
430 | /// @return the current head number | ||
332 | int getCurrHead() const; | 431 | int getCurrHead() const; |
432 | /// @return head x position | ||
333 | int getHeadX(int head) const; | 433 | int getHeadX(int head) const; |
434 | /// @return head y position | ||
334 | int getHeadY(int head) const; | 435 | int getHeadY(int head) const; |
436 | /// @return width of the head | ||
335 | int getHeadWidth(int head) const; | 437 | int getHeadWidth(int head) const; |
438 | /// @return height of the head | ||
336 | int getHeadHeight(int head) const; | 439 | int getHeadHeight(int head) const; |
337 | 440 | ||
338 | // returns the new (x,y) for a rectangle fitted on a head | 441 | /// @return the new (x,y) for a rectangle fitted on a head |
339 | std::pair<int,int> clampToHead(int head, int x, int y, int w, int h) const; | 442 | std::pair<int,int> clampToHead(int head, int x, int y, int w, int h) const; |
340 | 443 | ||
341 | // magic to allow us to have "on head" placement (menu) without | 444 | // magic to allow us to have "on head" placement (menu) without |
@@ -364,6 +467,7 @@ public: | |||
364 | 467 | ||
365 | /// create window frame for client window and attach it | 468 | /// create window frame for client window and attach it |
366 | FluxboxWindow *createWindow(Window clientwin); | 469 | FluxboxWindow *createWindow(Window clientwin); |
470 | /// creates a window frame for a winclient. The client is attached to the window | ||
367 | FluxboxWindow *createWindow(WinClient &client); | 471 | FluxboxWindow *createWindow(WinClient &client); |
368 | /// request workspace space, i.e "don't maximize over this area" | 472 | /// request workspace space, i.e "don't maximize over this area" |
369 | Strut *requestStrut(int head, int left, int right, int top, int bottom); | 473 | Strut *requestStrut(int head, int left, int right, int top, int bottom); |
@@ -384,6 +488,9 @@ public: | |||
384 | /// when screen dies | 488 | /// when screen dies |
385 | void addManagedResource(FbTk::Resource_base *resource); | 489 | void addManagedResource(FbTk::Resource_base *resource); |
386 | 490 | ||
491 | /** | ||
492 | * Used to emit different signals for the screen | ||
493 | */ | ||
387 | class ScreenSubject:public FbTk::Subject { | 494 | class ScreenSubject:public FbTk::Subject { |
388 | public: | 495 | public: |
389 | ScreenSubject(BScreen &scr):m_scr(scr) { } | 496 | ScreenSubject(BScreen &scr):m_scr(scr) { } |