summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2007-03-31 19:10:16 (GMT)
committerfluxgen <fluxgen>2007-03-31 19:10:16 (GMT)
commit9b84090f4ad3dea4c07a4e174fa4b46a2386de82 (patch)
treed30bb8cef11b8ed4cfe351e387c189526936abdf
parent311cb38f295ae3f389a65cdfea664750e822cb3e (diff)
downloadfluxbox_lack-9b84090f4ad3dea4c07a4e174fa4b46a2386de82.zip
fluxbox_lack-9b84090f4ad3dea4c07a4e174fa4b46a2386de82.tar.bz2
added document
-rw-r--r--src/Screen.hh174
1 files changed, 148 insertions, 26 deletions
diff --git a/src/Screen.hh b/src/Screen.hh
index bf03ac6..ab6ce7d 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -55,6 +55,8 @@
55#include <memory> 55#include <memory>
56#include <map> 56#include <map>
57 57
58class ClientPattern;
59class Focusable;
58class FluxboxWindow; 60class FluxboxWindow;
59class Netizen; 61class Netizen;
60class FbWinFrameTheme; 62class FbWinFrameTheme;
@@ -91,14 +93,16 @@ public:
91 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace 93 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace
92 }; 94 };
93 95
96 /// Different resize modes when resizing a window
94 enum ResizeModel { 97 enum ResizeModel {
95 BOTTOMRESIZE = 0, 98 BOTTOMRESIZE = 0, //< resizes from the bottom right corner
96 QUADRANTRESIZE, 99 QUADRANTRESIZE, //< resizes from one quadrant
97 CENTERRESIZE, 100 CENTERRESIZE, //< resizes from center
98 DEFAULTRESIZE = BOTTOMRESIZE }; 101 DEFAULTRESIZE = BOTTOMRESIZE //< default resize mode is bottom
102 };
99 103
100 104
101 typedef std::vector<FluxboxWindow *> Icons; 105 typedef std::list<FluxboxWindow *> Icons;
102 106
103 typedef std::vector<Workspace *> Workspaces; 107 typedef std::vector<Workspace *> Workspaces;
104 typedef std::vector<std::string> WorkspaceNames; 108 typedef std::vector<std::string> WorkspaceNames;
@@ -145,39 +149,62 @@ public:
145 149
146 inline const std::string &getScrollAction() const { return *resource.scroll_action; } 150 inline const std::string &getScrollAction() const { return *resource.scroll_action; }
147 inline const bool getScrollReverse() const { return *resource.scroll_reverse; } 151 inline const bool getScrollReverse() const { return *resource.scroll_reverse; }
152 inline const bool clientMenuUsePixmap() const { return *resource.clientmenu_use_pixmap; }
148 inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; } 153 inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; }
154 inline const bool getTabsUsePixmap() const { return *resource.tabs_use_pixmap; }
149 inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; } 155 inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; }
150 156
151 inline unsigned int getTabWidth() const { return *resource.tab_width; } 157 inline unsigned int getTabWidth() const { return *resource.tab_width; }
152 158 /// @return the slit, @see Slit
153 inline Slit *slit() { return m_slit.get(); } 159 inline Slit *slit() { return m_slit.get(); }
160 /// @return the slit, @see Slit
154 inline const Slit *slit() const { return m_slit.get(); } 161 inline const Slit *slit() const { return m_slit.get(); }
155 162 /**
163 * @param w the workspace number
164 * @return workspace for the given workspace number
165 */
156 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 */
171 inline const Workspace *getWorkspace(unsigned int w) const {
172 return (w < m_workspaces_list.size() ? m_workspaces_list[w] : 0);
173 }
174 /// @return the current workspace
157 inline Workspace *currentWorkspace() { return m_current_workspace; } 175 inline Workspace *currentWorkspace() { return m_current_workspace; }
158 inline const Workspace *currentWorkspace() const { return m_current_workspace; } 176 inline const Workspace *currentWorkspace() const { return m_current_workspace; }
159 177 /// @return the workspace menu
160 const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); } 178 const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); }
179 /// @return the workspace menu
161 FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); } 180 FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); }
162 181 /// @return focus control handler
163 const FocusControl &focusControl() const { return *m_focus_control; } 182 const FocusControl &focusControl() const { return *m_focus_control; }
183 /// @return focus control handler
164 FocusControl &focusControl() { return *m_focus_control; } 184 FocusControl &focusControl() { return *m_focus_control; }
165 185 /// @return the current workspace id
166 unsigned int currentWorkspaceID() const; 186 unsigned int currentWorkspaceID() const;
167 /* 187 /**
168 maximum screen bounds for given window 188
189 *
169 */ 190 */
191 /// @return maximum screen bound to the left for a specific xinerama head
170 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
171 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
172 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
173 unsigned int maxBottom(int head) const; 198 unsigned int maxBottom(int head) const;
174 /// @return true if window is kde dock app 199 /// @return true if window is kde dock app
175 bool isKdeDockapp(Window win) const; 200 bool isKdeDockapp(Window win) const;
176 /// @return true if dock app was added, else false 201 /// @return true if dock app was added, else false
177 bool addKdeDockapp(Window win); 202 bool addKdeDockapp(Window win);
178 203 /// @return screen width, @see rootWindow()
179 unsigned int width() const { return rootWindow().width(); } 204 unsigned int width() const { return rootWindow().width(); }
205 /// @return screen height, @see rootWindow()
180 unsigned int height() const { return rootWindow().height(); } 206 unsigned int height() const { return rootWindow().height(); }
207 /// @return number of the screen, @see rootWindow()
181 int screenNumber() const { return rootWindow().screenNumber(); } 208 int screenNumber() const { return rootWindow().screenNumber(); }
182 209
183 /// @return number of workspaces 210 /// @return number of workspaces
@@ -210,6 +237,7 @@ public:
210 FbTk::Subject &resizeSig() { return m_resize_sig; } 237 FbTk::Subject &resizeSig() { return m_resize_sig; }
211 //@} 238 //@}
212 239
240 /// called when the screen receives a signal from a subject
213 void update(FbTk::Subject *subj); 241 void update(FbTk::Subject *subj);
214 242
215 void keyPressEvent(XKeyEvent &ke); 243 void keyPressEvent(XKeyEvent &ke);
@@ -217,14 +245,42 @@ public:
217 void buttonPressEvent(XButtonEvent &be); 245 void buttonPressEvent(XButtonEvent &be);
218 void notifyUngrabKeyboard(); 246 void notifyUngrabKeyboard();
219 247
220 void cycleFocus(int opts, bool reverse); 248 /**
249 * Prepares type a head focus
250 * @param winlist a list of focusables
251 * @param pat pattern to match windows with
252 */
253 void startTypeAheadFocus(std::list<Focusable *> &winlist,
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 */
261 void cycleFocus(int opts = 0, const ClientPattern *pat = 0, bool reverse = false);
221 262
263 /**
264 * Creates an empty menu with specified label
265 * @param label for the menu
266 * @return create menu
267 */
222 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 */
223 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
224 void hideMenus(); 277 void hideMenus();
225 // for extras to add menus. 278
226 // These menus will be marked internal, 279 /**
227 // 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 */
228 void addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu); 284 void addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu);
229 285
230 /// hide all windowmenus except the given one (if given) 286 /// hide all windowmenus except the given one (if given)
@@ -266,29 +322,71 @@ public:
266 int addWorkspace(); 322 int addWorkspace();
267 int removeLastWorkspace(); 323 int removeLastWorkspace();
268 // scroll workspaces 324 // scroll workspaces
325 /// go to next workspace ( right )
269 void nextWorkspace() { nextWorkspace(1); } 326 void nextWorkspace() { nextWorkspace(1); }
327 /// go to previous workspace
270 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 */
271 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 */
272 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 */
273 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 */
274 void leftWorkspace(int delta); 348 void leftWorkspace(int delta);
275 349
350 /// remove all workspace names
276 void removeWorkspaceNames(); 351 void removeWorkspaceNames();
352 /// update the workspace name atom
277 void updateWorkspaceNamesAtom(); 353 void updateWorkspaceNamesAtom();
278 354 /// add a workspace name to the end of the workspace name list
279 void addWorkspaceName(const char *name); 355 void addWorkspaceName(const char *name);
356 /// add a Netizen window
280 void addNetizen(Window win); 357 void addNetizen(Window win);
358 /// remove a netizen
281 void removeNetizen(Window win); 359 void removeNetizen(Window win);
360 /// add a window to the icon list
282 void addIcon(FluxboxWindow *win); 361 void addIcon(FluxboxWindow *win);
362 /// remove a window from the icon list
283 void removeIcon(FluxboxWindow *win); 363 void removeIcon(FluxboxWindow *win);
284 // remove window 364 /// remove a window
285 void removeWindow(FluxboxWindow *win); 365 void removeWindow(FluxboxWindow *win);
366 /// remove a client
286 void removeClient(WinClient &client); 367 void removeClient(WinClient &client);
287 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 */
288 std::string getNameOfWorkspace(unsigned int workspace) const; 373 std::string getNameOfWorkspace(unsigned int workspace) const;
374 /// changes workspace to specified id
289 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 */
290 void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, 382 void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0,
291 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 */
292 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, 390 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id,
293 bool ignore_sticky); 391 bool ignore_sticky);
294 392
@@ -303,7 +401,7 @@ public:
303 /// show geomentry with "width x height"-text, not size of window 401 /// show geomentry with "width x height"-text, not size of window
304 void showGeometry(int width, int height); 402 void showGeometry(int width, int height);
305 void hideGeometry(); 403 void hideGeometry();
306 404
307 void setLayer(FbTk::XLayerItem &item, int layernum); 405 void setLayer(FbTk::XLayerItem &item, int layernum);
308 // 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
309 407
@@ -313,26 +411,40 @@ public:
313 void updateSize(); 411 void updateSize();
314 412
315 // Xinerama-related functions 413 // Xinerama-related functions
414
415 /// @return true if xinerama is available
316 bool hasXinerama() const { return m_xinerama_avail; } 416 bool hasXinerama() const { return m_xinerama_avail; }
417 /// @return umber of xinerama heads
317 int numHeads() const { return m_xinerama_num_heads; } 418 int numHeads() const { return m_xinerama_num_heads; }
318 419
319 void initXinerama(); 420 void initXinerama();
320 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 */
321 int getHead(int x, int y) const; 427 int getHead(int x, int y) const;
322 int getHead(FbTk::FbWindow &win) const; 428 /// @return head number of window
429 int getHead(const FbTk::FbWindow &win) const;
430 /// @return the current head number
323 int getCurrHead() const; 431 int getCurrHead() const;
432 /// @return head x position
324 int getHeadX(int head) const; 433 int getHeadX(int head) const;
434 /// @return head y position
325 int getHeadY(int head) const; 435 int getHeadY(int head) const;
436 /// @return width of the head
326 int getHeadWidth(int head) const; 437 int getHeadWidth(int head) const;
438 /// @return height of the head
327 int getHeadHeight(int head) const; 439 int getHeadHeight(int head) const;
328 440
329 // 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
330 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;
331 443
332 // magic to allow us to have "on head" placement (menu) without 444 // magic to allow us to have "on head" placement (menu) without
333 // the object really knowing about it. 445 // the object really knowing about it.
334 template <typename OnHeadObject> 446 template <typename OnHeadObject>
335 int getOnHead(OnHeadObject &obj); 447 int getOnHead(OnHeadObject &obj) const;
336 448
337 template <typename OnHeadObject> 449 template <typename OnHeadObject>
338 void setOnHead(OnHeadObject &obj, int head); 450 void setOnHead(OnHeadObject &obj, int head);
@@ -355,6 +467,7 @@ public:
355 467
356 /// create window frame for client window and attach it 468 /// create window frame for client window and attach it
357 FluxboxWindow *createWindow(Window clientwin); 469 FluxboxWindow *createWindow(Window clientwin);
470 /// creates a window frame for a winclient. The client is attached to the window
358 FluxboxWindow *createWindow(WinClient &client); 471 FluxboxWindow *createWindow(WinClient &client);
359 /// request workspace space, i.e "don't maximize over this area" 472 /// request workspace space, i.e "don't maximize over this area"
360 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);
@@ -375,6 +488,9 @@ public:
375 /// when screen dies 488 /// when screen dies
376 void addManagedResource(FbTk::Resource_base *resource); 489 void addManagedResource(FbTk::Resource_base *resource);
377 490
491 /**
492 * Used to emit different signals for the screen
493 */
378 class ScreenSubject:public FbTk::Subject { 494 class ScreenSubject:public FbTk::Subject {
379 public: 495 public:
380 ScreenSubject(BScreen &scr):m_scr(scr) { } 496 ScreenSubject(BScreen &scr):m_scr(scr) { }
@@ -466,9 +582,12 @@ private:
466 FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style; 582 FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style;
467 FbTk::Resource<std::string> scroll_action; 583 FbTk::Resource<std::string> scroll_action;
468 FbTk::Resource<bool> scroll_reverse; 584 FbTk::Resource<bool> scroll_reverse;
585 FbTk::Resource<bool> clientmenu_use_pixmap;
586 FbTk::Resource<bool> tabs_use_pixmap;
469 FbTk::Resource<bool> max_over_tabs; 587 FbTk::Resource<bool> max_over_tabs;
470 FbTk::Resource<bool> default_internal_tabs; 588 FbTk::Resource<bool> default_internal_tabs;
471 589
590
472 } resource; 591 } resource;
473 592
474 /// Holds manage resources that screen destroys 593 /// Holds manage resources that screen destroys
@@ -485,7 +604,10 @@ private:
485 typedef std::map<Window, WinClient *> Groupables; 604 typedef std::map<Window, WinClient *> Groupables;
486 Groupables m_expecting_groups; 605 Groupables m_expecting_groups;
487 606
488 bool m_cycling; 607 bool m_cycling, m_typing_ahead;
608 const ClientPattern *m_cycle_opts;
609 FbTk::TypeAhead<std::list<Focusable *>, Focusable *> m_type_ahead;
610 std::list<Focusable *> m_matches;
489 611
490 // Xinerama related private data 612 // Xinerama related private data
491 bool m_xinerama_avail; 613 bool m_xinerama_avail;