diff options
author | markt <markt> | 2007-10-13 21:51:37 (GMT) |
---|---|---|
committer | markt <markt> | 2007-10-13 21:51:37 (GMT) |
commit | a59428d67a95a9df16554962f0a6257d6378328a (patch) | |
tree | f856ed9300c34f7a17d499f22d895610cfbc08e5 /src/FocusControl.hh | |
parent | 41b5c6dadb1f474675660cef18b812d4c2338ed2 (diff) | |
download | fluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.zip fluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.tar.bz2 |
merged changes from pre-devel
Diffstat (limited to 'src/FocusControl.hh')
-rw-r--r-- | src/FocusControl.hh | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index 79d16d4..0790110 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -28,8 +28,10 @@ | |||
28 | 28 | ||
29 | #include "FbTk/Resource.hh" | 29 | #include "FbTk/Resource.hh" |
30 | 30 | ||
31 | class ClientPattern; | ||
31 | class WinClient; | 32 | class WinClient; |
32 | class FluxboxWindow; | 33 | class FluxboxWindow; |
34 | class Focusable; | ||
33 | class BScreen; | 35 | class BScreen; |
34 | 36 | ||
35 | /** | 37 | /** |
@@ -38,13 +40,12 @@ class BScreen; | |||
38 | */ | 40 | */ |
39 | class FocusControl { | 41 | class FocusControl { |
40 | public: | 42 | public: |
41 | typedef std::list<WinClient *> FocusedWindows; | 43 | typedef std::list<Focusable *> Focusables; |
42 | /// main focus model | 44 | /// main focus model |
43 | enum FocusModel { | 45 | enum FocusModel { |
44 | MOUSEFOCUS = 0, ///< focus follows mouse | 46 | MOUSEFOCUS = 0, ///< focus follows mouse |
45 | CLICKFOCUS ///< focus on click | 47 | CLICKFOCUS ///< focus on click |
46 | }; | 48 | }; |
47 | |||
48 | /// focus model for tabs | 49 | /// focus model for tabs |
49 | enum TabFocusModel { | 50 | enum TabFocusModel { |
50 | MOUSETABFOCUS = 0, ///< tab focus follows mouse | 51 | MOUSETABFOCUS = 0, ///< tab focus follows mouse |
@@ -60,18 +61,12 @@ public: | |||
60 | }; | 61 | }; |
61 | 62 | ||
62 | /// prevFocus/nextFocus option bits | 63 | /// prevFocus/nextFocus option bits |
63 | enum FocusOption { | 64 | enum { |
64 | CYCLEGROUPS = 0x01, ///< cycle groups | 65 | CYCLEGROUPS = 0x01, //< cycle through groups |
65 | CYCLESKIPSTUCK = 0x02, ///< skip stuck windows | 66 | CYCLELINEAR = 0x08, ///< linear cycle |
66 | CYCLESKIPSHADED = 0x04, ///< skip shaded windows | ||
67 | CYCLELINEAR = 0x08, ///< linear cycle | ||
68 | CYCLESKIPICONIC = 0x10, ///< skip iconified windows | ||
69 | CYCLEDEFAULT = 0x00 ///< default | ||
70 | }; | 67 | }; |
71 | 68 | ||
72 | /// @param screen the screen to control focus for | ||
73 | explicit FocusControl(BScreen &screen); | 69 | explicit FocusControl(BScreen &screen); |
74 | |||
75 | /// cycle previous focuable | 70 | /// cycle previous focuable |
76 | void prevFocus() { cycleFocus(m_focused_list, 0, true); } | 71 | void prevFocus() { cycleFocus(m_focused_list, 0, true); } |
77 | /// cycle next focusable | 72 | /// cycle next focusable |
@@ -79,17 +74,20 @@ public: | |||
79 | /** | 74 | /** |
80 | * Cycle focus for a set of windows. | 75 | * Cycle focus for a set of windows. |
81 | * @param winlist the windowlist to cycle through | 76 | * @param winlist the windowlist to cycle through |
82 | * @param options cycle options @see FocusOption | 77 | * @param pat pattern for matching focusables |
83 | * @param reverse reverse the cycle order | 78 | * @param reverse reverse the cycle order |
84 | */ | 79 | */ |
85 | void cycleFocus(FocusedWindows &winlist, int options, bool reverse = false); | 80 | void cycleFocus(Focusables &winlist, const ClientPattern *pat = 0, |
81 | bool reverse = false); | ||
82 | |||
83 | void goToWindowNumber(Focusables &winlist, int num, | ||
84 | const ClientPattern *pat = 0); | ||
86 | /// sets the focused window on a screen | 85 | /// sets the focused window on a screen |
87 | void setScreenFocusedWindow(WinClient &win_client); | 86 | void setScreenFocusedWindow(WinClient &win_client); |
88 | /// sets the main focus model | 87 | /// sets the main focus model |
89 | void setFocusModel(FocusModel model); | 88 | void setFocusModel(FocusModel model); |
90 | /// sets tab focus model | 89 | /// sets tab focus model |
91 | void setTabFocusModel(TabFocusModel model); | 90 | void setTabFocusModel(TabFocusModel model); |
92 | |||
93 | /// stop cycling mode | 91 | /// stop cycling mode |
94 | void stopCyclingFocus(); | 92 | void stopCyclingFocus(); |
95 | /** | 93 | /** |
@@ -104,10 +102,12 @@ public: | |||
104 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } | 102 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } |
105 | /// @return true if cycling is in progress | 103 | /// @return true if cycling is in progress |
106 | bool isCycling() const { return m_cycling_list != 0; } | 104 | bool isCycling() const { return m_cycling_list != 0; } |
107 | /// Appends a client to the back of the focus list | 105 | /// Appends a client to the front of the focus list |
108 | void addFocusBack(WinClient &client); | 106 | void addFocusBack(WinClient &client); |
109 | /// Appends a client to the front of the focus list | 107 | /// Appends a client to the front of the focus list |
110 | void addFocusFront(WinClient &client); | 108 | void addFocusFront(WinClient &client); |
109 | void addFocusWinBack(Focusable &win); | ||
110 | void addFocusWinFront(Focusable &win); | ||
111 | void setFocusBack(FluxboxWindow *fbwin); | 111 | void setFocusBack(FluxboxWindow *fbwin); |
112 | /// @return main focus model | 112 | /// @return main focus model |
113 | FocusModel focusModel() const { return *m_focus_model; } | 113 | FocusModel focusModel() const { return *m_focus_model; } |
@@ -115,19 +115,26 @@ public: | |||
115 | TabFocusModel tabFocusModel() const { return *m_tab_focus_model; } | 115 | TabFocusModel tabFocusModel() const { return *m_tab_focus_model; } |
116 | /// @return true if newly created windows are focused | 116 | /// @return true if newly created windows are focused |
117 | bool focusNew() const { return *m_focus_new; } | 117 | bool focusNew() const { return *m_focus_new; } |
118 | |||
118 | /// @return last focused client in a specific workspace, or NULL. | 119 | /// @return last focused client in a specific workspace, or NULL. |
119 | WinClient *lastFocusedWindow(int workspace); | 120 | Focusable *lastFocusedWindow(int workspace); |
120 | 121 | ||
121 | WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); | 122 | WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client = 0); |
122 | 123 | ||
123 | /// @return focus list in creation order | 124 | /// @return focus list in creation order |
124 | FocusedWindows &creationOrderList() { return m_creation_order_list; } | 125 | Focusables &creationOrderList() { return m_creation_order_list; } |
125 | /// @return the focus list | 126 | /// @return the focus list in focused order |
126 | FocusedWindows &focusedOrderList() { return m_focused_list; } | 127 | Focusables &focusedOrderList() { return m_focused_list; } |
127 | /// removes a client from the focus list | 128 | Focusables &creationOrderWinList() { return m_creation_order_win_list; } |
129 | Focusables &focusedOrderWinList() { return m_focused_win_list; } | ||
130 | |||
131 | /// remove client from focus list | ||
128 | void removeClient(WinClient &client); | 132 | void removeClient(WinClient &client); |
133 | /// remove window from focus list | ||
134 | void removeWindow(Focusable &win); | ||
129 | /// starts terminating this control | 135 | /// starts terminating this control |
130 | void shutdown(); | 136 | void shutdown(); |
137 | |||
131 | /// do fallback focus for screen if normal focus control failed. | 138 | /// do fallback focus for screen if normal focus control failed. |
132 | static void revertFocus(BScreen &screen); | 139 | static void revertFocus(BScreen &screen); |
133 | // like revertFocus, but specifically related to this window (transients etc) | 140 | // like revertFocus, but specifically related to this window (transients etc) |
@@ -146,12 +153,14 @@ private: | |||
146 | 153 | ||
147 | // This list keeps the order of window focusing for this screen | 154 | // This list keeps the order of window focusing for this screen |
148 | // Screen global so it works for sticky windows too. | 155 | // Screen global so it works for sticky windows too. |
149 | FocusedWindows m_focused_list; | 156 | Focusables m_focused_list; |
150 | FocusedWindows m_creation_order_list; | 157 | Focusables m_creation_order_list; |
151 | 158 | Focusables m_focused_win_list; | |
152 | FocusedWindows::iterator m_cycling_window; | 159 | Focusables m_creation_order_win_list; |
153 | FocusedWindows *m_cycling_list; | 160 | |
154 | WinClient *m_was_iconic; | 161 | Focusables::iterator m_cycling_window; |
162 | Focusables *m_cycling_list; | ||
163 | Focusable *m_was_iconic; | ||
155 | WinClient *m_cycling_last; | 164 | WinClient *m_cycling_last; |
156 | 165 | ||
157 | static WinClient *s_focused_window; | 166 | static WinClient *s_focused_window; |