aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2006-02-18 11:39:38 (GMT)
committerfluxgen <fluxgen>2006-02-18 11:39:38 (GMT)
commit4d52797b955b8e38b9e49802981e69fb34a734bc (patch)
treed541712bb9720c47fa58fda7476528649c32fbca /src/Screen.hh
parentd23eeeaa4e1ed5adb76d97eb47dd0b88b6dfed3f (diff)
downloadfluxbox-4d52797b955b8e38b9e49802981e69fb34a734bc.zip
fluxbox-4d52797b955b8e38b9e49802981e69fb34a734bc.tar.bz2
moved all focus handling to class FocusControl
Diffstat (limited to 'src/Screen.hh')
-rw-r--r--src/Screen.hh79
1 files changed, 31 insertions, 48 deletions
diff --git a/src/Screen.hh b/src/Screen.hh
index 40af21b..bb5db3a 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -62,6 +62,7 @@ class Workspace;
62class Strut; 62class Strut;
63class Slit; 63class Slit;
64class HeadArea; 64class HeadArea;
65class FocusControl;
65 66
66namespace FbTk { 67namespace FbTk {
67class Menu; 68class Menu;
@@ -77,25 +78,30 @@ class Subject;
77 */ 78 */
78class BScreen : public FbTk::Observer, private FbTk::NotCopyable { 79class BScreen : public FbTk::Observer, private FbTk::NotCopyable {
79public: 80public:
80 enum ResizeModel { BOTTOMRESIZE = 0, QUADRANTRESIZE, DEFAULTRESIZE = BOTTOMRESIZE }; 81 /// a window becomes active / focussed on a different workspace
81 enum FocusModel { MOUSEFOCUS = 0, CLICKFOCUS }; 82 enum FollowModel {
82 enum TabFocusModel { MOUSETABFOCUS = 0, CLICKTABFOCUS };
83 enum FollowModel { ///< a window becomes active / focussed on a different workspace
84 IGNORE_OTHER_WORKSPACES = 0, ///< who cares? 83 IGNORE_OTHER_WORKSPACES = 0, ///< who cares?
85 FOLLOW_ACTIVE_WINDOW, ///< go to that workspace 84 FOLLOW_ACTIVE_WINDOW, ///< go to that workspace
86 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace 85 FETCH_ACTIVE_WINDOW ///< put that window to the current workspace
87 }; 86 };
88 enum FocusDir { FOCUSUP, FOCUSDOWN, FOCUSLEFT, FOCUSRIGHT }; 87
89 enum PlacementPolicy { ROWSMARTPLACEMENT, COLSMARTPLACEMENT, 88 enum ResizeModel {
90 CASCADEPLACEMENT, UNDERMOUSEPLACEMENT}; 89 BOTTOMRESIZE = 0,
90 QUADRANTRESIZE,
91 DEFAULTRESIZE = BOTTOMRESIZE };
92
93 enum PlacementPolicy {
94 ROWSMARTPLACEMENT,
95 COLSMARTPLACEMENT,
96 CASCADEPLACEMENT,
97 UNDERMOUSEPLACEMENT
98 };
99
91 enum RowDirection { LEFTRIGHT, RIGHTLEFT}; 100 enum RowDirection { LEFTRIGHT, RIGHTLEFT};
92 enum ColumnDirection { TOPBOTTOM, BOTTOMTOP}; 101 enum ColumnDirection { TOPBOTTOM, BOTTOMTOP};
93 // prevFocus/nextFocus option bits
94 enum { CYCLEGROUPS = 0x01, CYCLESKIPSTUCK = 0x02, CYCLESKIPSHADED = 0x04,
95 CYCLELINEAR = 0x08, CYCLEDEFAULT = 0x00 };
96 102
97 typedef std::vector<FluxboxWindow *> Icons; 103 typedef std::vector<FluxboxWindow *> Icons;
98 typedef std::list<WinClient *> FocusedWindows; 104
99 typedef std::vector<Workspace *> Workspaces; 105 typedef std::vector<Workspace *> Workspaces;
100 typedef std::vector<std::string> WorkspaceNames; 106 typedef std::vector<std::string> WorkspaceNames;
101 typedef std::list<std::pair<const char *, FbTk::Menu *> > ExtraMenus; 107 typedef std::list<std::pair<const char *, FbTk::Menu *> > ExtraMenus;
@@ -107,8 +113,7 @@ public:
107 113
108 void initWindows(); 114 void initWindows();
109 void initMenus(); 115 void initMenus();
110 bool isMouseFocus() const { return (*resource.focus_model == MOUSEFOCUS); } 116
111 bool isMouseTabFocus() const { return (*resource.tabfocus_model == MOUSETABFOCUS); }
112 bool isRootColormapInstalled() const { return root_colormap_installed; } 117 bool isRootColormapInstalled() const { return root_colormap_installed; }
113 bool isScreenManaged() const { return managed; } 118 bool isScreenManaged() const { return managed; }
114 bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } 119 bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; }
@@ -118,8 +123,6 @@ public:
118 bool clickRaises() const { return *resource.click_raises; } 123 bool clickRaises() const { return *resource.click_raises; }
119 bool doOpaqueMove() const { return *resource.opaque_move; } 124 bool doOpaqueMove() const { return *resource.opaque_move; }
120 bool doFullMax() const { return *resource.full_max; } 125 bool doFullMax() const { return *resource.full_max; }
121 bool doFocusNew() const { return *resource.focus_new; }
122 bool doFocusLast() const { return *resource.focus_last; }
123 bool doShowWindowPos() const { return *resource.show_window_pos; } 126 bool doShowWindowPos() const { return *resource.show_window_pos; }
124 bool antialias() const { return *resource.antialias; } 127 bool antialias() const { return *resource.antialias; }
125 bool decorateTransient() const { return *resource.decorate_transient; } 128 bool decorateTransient() const { return *resource.decorate_transient; }
@@ -134,11 +137,9 @@ public:
134 FbTk::Menu &windowMenu() { return *m_windowmenu.get(); } 137 FbTk::Menu &windowMenu() { return *m_windowmenu.get(); }
135 ExtraMenus &extraWindowMenus() { return m_extramenus; } 138 ExtraMenus &extraWindowMenus() { return m_extramenus; }
136 const ExtraMenus &extraWindowMenus() const { return m_extramenus; } 139 const ExtraMenus &extraWindowMenus() const { return m_extramenus; }
137
138 ResizeModel getResizeModel() const { return *resource.resize_model; }
139 FocusModel getFocusModel() const { return *resource.focus_model; }
140 TabFocusModel getTabFocusModel() const { return *resource.tabfocus_model; }
141 140
141 ResizeModel getResizeModel() const { return *resource.resize_model; }
142
142 inline FollowModel getFollowModel() const { return *resource.follow_model; } 143 inline FollowModel getFollowModel() const { return *resource.follow_model; }
143 144
144 inline const std::string &getScrollAction() const { return *resource.scroll_action; } 145 inline const std::string &getScrollAction() const { return *resource.scroll_action; }
@@ -154,6 +155,8 @@ public:
154 const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); } 155 const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); }
155 FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); } 156 FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); }
156 157
158 const FocusControl &focusControl() const { return *m_focus_control; }
159 FocusControl &focusControl() { return *m_focus_control; }
157 160
158 unsigned int currentWorkspaceID() const; 161 unsigned int currentWorkspaceID() const;
159 /* 162 /*
@@ -177,10 +180,7 @@ public:
177 180
178 inline const Icons &iconList() const { return m_icon_list; } 181 inline const Icons &iconList() const { return m_icon_list; }
179 inline Icons &iconList() { return m_icon_list; } 182 inline Icons &iconList() { return m_icon_list; }
180 inline const FocusedWindows &getFocusedList() const { return focused_list; } 183
181 inline FocusedWindows &getFocusedList() { return focused_list; }
182 WinClient *getLastFocusedWindow(int workspace = -1);
183 WinClient *getLastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client = 0);
184 const Workspaces &getWorkspacesList() const { return m_workspaces_list; } 184 const Workspaces &getWorkspacesList() const { return m_workspaces_list; }
185 Workspaces &getWorkspacesList() { return m_workspaces_list; } 185 Workspaces &getWorkspacesList() { return m_workspaces_list; }
186 const WorkspaceNames &getWorkspaceNames() const { return m_workspace_names; } 186 const WorkspaceNames &getWorkspaceNames() const { return m_workspace_names; }
@@ -225,8 +225,6 @@ public:
225 225
226 void setRootColormapInstalled(bool r) { root_colormap_installed = r; } 226 void setRootColormapInstalled(bool r) { root_colormap_installed = r; }
227 void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } 227 void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; }
228 void saveFocusModel(FocusModel model) { resource.focus_model = model; }
229 void saveTabFocusModel(TabFocusModel model) { resource.tabfocus_model = model; }
230 228
231 void saveWorkspaces(int w) { *resource.workspaces = w; } 229 void saveWorkspaces(int w) { *resource.workspaces = w; }
232 230
@@ -280,16 +278,8 @@ public:
280 bool changeworkspace=true); 278 bool changeworkspace=true);
281 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, 279 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id,
282 bool ignore_sticky); 280 bool ignore_sticky);
283 void prevFocus() { prevFocus(0); }
284 void nextFocus() { nextFocus(0); }
285 void prevFocus(int options);
286 void nextFocus(int options);
287 void raiseFocus();
288 void setFocusedWindow(WinClient &winclient);
289 281
290 282
291 void dirFocus(FluxboxWindow &win, const FocusDir dir);
292
293 void reconfigure(); 283 void reconfigure();
294 void rereadMenu(); 284 void rereadMenu();
295 void shutdown(); 285 void shutdown();
@@ -382,7 +372,6 @@ public:
382private: 372private:
383 void setupConfigmenu(FbTk::Menu &menu); 373 void setupConfigmenu(FbTk::Menu &menu);
384 void initMenu(); 374 void initMenu();
385 bool doSkipWindow(const WinClient &winclient, int options);
386 void renderGeomWindow(); 375 void renderGeomWindow();
387 void renderPosWindow(); 376 void renderPosWindow();
388 377
@@ -400,7 +389,8 @@ private:
400 389
401 FbTk::MultLayers m_layermanager; 390 FbTk::MultLayers m_layermanager;
402 391
403 bool root_colormap_installed, managed, geom_visible, pos_visible, cycling_focus; 392 bool root_colormap_installed, managed, geom_visible, pos_visible;
393
404 GC opGC; 394 GC opGC;
405 Pixmap geom_pixmap, pos_pixmap; 395 Pixmap geom_pixmap, pos_pixmap;
406 396
@@ -421,12 +411,6 @@ private:
421 Configmenus m_configmenu_list; 411 Configmenus m_configmenu_list;
422 Icons m_icon_list; 412 Icons m_icon_list;
423 413
424 // This list keeps the order of window focusing for this screen
425 // Screen global so it works for sticky windows too.
426 FocusedWindows focused_list;
427 FocusedWindows::iterator cycling_window;
428 WinClient *cycling_last;
429
430 std::auto_ptr<Slit> m_slit; 414 std::auto_ptr<Slit> m_slit;
431 415
432 Workspace *m_current_workspace; 416 Workspace *m_current_workspace;
@@ -448,14 +432,11 @@ private:
448 432
449 FbTk::Resource<bool> image_dither, opaque_move, full_max, 433 FbTk::Resource<bool> image_dither, opaque_move, full_max,
450 sloppy_window_grouping, workspace_warping, 434 sloppy_window_grouping, workspace_warping,
451 desktop_wheeling, show_window_pos, 435 desktop_wheeling, show_window_pos,
452 focus_last, focus_new,
453 antialias, auto_raise, click_raises, decorate_transient; 436 antialias, auto_raise, click_raises, decorate_transient;
454 FbTk::Resource<std::string> rootcommand; 437 FbTk::Resource<std::string> rootcommand;
455 FbTk::Resource<ResizeModel> resize_model; 438 FbTk::Resource<ResizeModel> resize_model;
456 FbTk::Resource<std::string> windowmenufile; 439 FbTk::Resource<std::string> windowmenufile;
457 FbTk::Resource<FocusModel> focus_model;
458 FbTk::Resource<TabFocusModel> tabfocus_model;
459 FbTk::Resource<FollowModel> follow_model; 440 FbTk::Resource<FollowModel> follow_model;
460 bool ordered_dither; 441 bool ordered_dither;
461 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha, 442 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha,
@@ -473,14 +454,16 @@ private:
473 454
474 } resource; 455 } resource;
475 456
457 FbTk::ResourceManager &m_resource_manager;
458 const std::string m_name, m_altname;
459
460 FocusControl *m_focus_control;
461
476 // This is a map of windows to clients for clients that had a left 462 // This is a map of windows to clients for clients that had a left
477 // window set, but that window wasn't present at the time 463 // window set, but that window wasn't present at the time
478 typedef std::map<Window, WinClient *> Groupables; 464 typedef std::map<Window, WinClient *> Groupables;
479 Groupables m_expecting_groups; 465 Groupables m_expecting_groups;
480 466
481 const std::string m_name, m_altname;
482 FbTk::ResourceManager &m_resource_manager;
483
484 // Xinerama related private data 467 // Xinerama related private data
485 bool m_xinerama_avail; 468 bool m_xinerama_avail;
486 int m_xinerama_num_heads; 469 int m_xinerama_num_heads;