diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FocusControl.hh | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index ee66b9e..c55aa6a 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -39,66 +39,96 @@ class BScreen; | |||
39 | class FocusControl { | 39 | class FocusControl { |
40 | public: | 40 | public: |
41 | typedef std::list<WinClient *> FocusedWindows; | 41 | typedef std::list<WinClient *> FocusedWindows; |
42 | 42 | /// main focus model | |
43 | enum FocusModel { | 43 | enum FocusModel { |
44 | MOUSEFOCUS = 0, ///< focus follows | 44 | MOUSEFOCUS = 0, ///< focus follows mouse |
45 | CLICKFOCUS ///< focus on click | 45 | CLICKFOCUS ///< focus on click |
46 | }; | 46 | }; |
47 | |||
48 | /// focus model for tabs | ||
47 | enum TabFocusModel { | 49 | enum TabFocusModel { |
48 | MOUSETABFOCUS = 0, ///< tab focus follows mouse | 50 | MOUSETABFOCUS = 0, ///< tab focus follows mouse |
49 | CLICKTABFOCUS ///< tab focus on click | 51 | CLICKTABFOCUS ///< tab focus on click |
50 | }; | 52 | }; |
51 | 53 | ||
54 | /// focus direction for windows | ||
52 | enum FocusDir { | 55 | enum FocusDir { |
53 | FOCUSUP, | 56 | FOCUSUP, ///< window is above |
54 | FOCUSDOWN, | 57 | FOCUSDOWN, ///< window is down |
55 | FOCUSLEFT, | 58 | FOCUSLEFT, ///< window is left |
56 | FOCUSRIGHT | 59 | FOCUSRIGHT ///< window is right |
57 | }; | 60 | }; |
58 | 61 | ||
59 | // prevFocus/nextFocus option bits | 62 | /// prevFocus/nextFocus option bits |
60 | enum { | 63 | enum FocusOption { |
61 | CYCLEGROUPS = 0x01, | 64 | CYCLEGROUPS = 0x01, ///< cycle groups |
62 | CYCLESKIPSTUCK = 0x02, | 65 | CYCLESKIPSTUCK = 0x02, ///< skip stuck windows |
63 | CYCLESKIPSHADED = 0x04, | 66 | CYCLESKIPSHADED = 0x04, ///< skip shaded windows |
64 | CYCLELINEAR = 0x08, | 67 | CYCLELINEAR = 0x08, ///< linear cycle |
65 | CYCLESKIPICONIC = 0x10, | 68 | CYCLESKIPICONIC = 0x10, ///< skip iconified windows |
66 | CYCLEDEFAULT = 0x00 | 69 | CYCLEDEFAULT = 0x00 ///< default |
67 | }; | 70 | }; |
68 | 71 | ||
72 | /// @param screen the screen to control focus for | ||
69 | explicit FocusControl(BScreen &screen); | 73 | explicit FocusControl(BScreen &screen); |
70 | 74 | ||
75 | /// cycle previous focuable | ||
71 | void prevFocus() { cycleFocus(&m_focused_list, 0, true); } | 76 | void prevFocus() { cycleFocus(&m_focused_list, 0, true); } |
77 | /// cycle next focusable | ||
72 | void nextFocus() { cycleFocus(&m_focused_list, 0, false); } | 78 | void nextFocus() { cycleFocus(&m_focused_list, 0, false); } |
79 | /** | ||
80 | * Cycle focus for a set of windows. | ||
81 | * @param winlist the windowlist to cycle through | ||
82 | * @param options cycle options @see FocusOption | ||
83 | * @param reverse reverse the cycle order | ||
84 | */ | ||
73 | void cycleFocus(FocusedWindows *winlist, int options, bool reverse = false); | 85 | void cycleFocus(FocusedWindows *winlist, int options, bool reverse = false); |
74 | 86 | /// sets the focused window on a screen | |
75 | void setScreenFocusedWindow(WinClient &win_client); | 87 | void setScreenFocusedWindow(WinClient &win_client); |
88 | /// sets the main focus model | ||
76 | void setFocusModel(FocusModel model); | 89 | void setFocusModel(FocusModel model); |
77 | void setTabFocusModel(TabFocusModel model); | 90 | /// sets tab focus model |
91 | void setTabFocusModel(TabFocusModel model); | ||
78 | 92 | ||
93 | /// stop cycling mode | ||
79 | void stopCyclingFocus(); | 94 | void stopCyclingFocus(); |
80 | 95 | /** | |
96 | * Do directional focus mode. | ||
97 | * @param win current window | ||
98 | * @param dir direction from current window to focus. | ||
99 | */ | ||
81 | void dirFocus(FluxboxWindow &win, FocusDir dir); | 100 | void dirFocus(FluxboxWindow &win, FocusDir dir); |
101 | /// @return true if focus mode is mouse focus | ||
82 | bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; } | 102 | bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; } |
103 | /// @return true if tab focus mode is mouse tab focus | ||
83 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } | 104 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } |
105 | /// @return true if cycling is in progress | ||
84 | bool isCycling() const { return m_cycling_list != 0; } | 106 | bool isCycling() const { return m_cycling_list != 0; } |
107 | /// Appends a client to the back of the focus list | ||
85 | void addFocusBack(WinClient &client); | 108 | void addFocusBack(WinClient &client); |
109 | /// Appends a client to the front of the focus list | ||
86 | void addFocusFront(WinClient &client); | 110 | void addFocusFront(WinClient &client); |
87 | void setFocusBack(FluxboxWindow *fbwin); | 111 | void setFocusBack(FluxboxWindow *fbwin); |
88 | 112 | /// @return main focus model | |
89 | FocusModel focusModel() const { return *m_focus_model; } | 113 | FocusModel focusModel() const { return *m_focus_model; } |
114 | /// @return tab focus model | ||
90 | 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 | ||
91 | bool focusNew() const { return *m_focus_new; } | 117 | bool focusNew() const { return *m_focus_new; } |
92 | 118 | /// @return last focused client in a specific workspace, or NULL. | |
93 | WinClient *lastFocusedWindow(int workspace); | 119 | WinClient *lastFocusedWindow(int workspace); |
120 | |||
94 | WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); | 121 | WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); |
95 | 122 | ||
123 | /// @return focus list in creation order | ||
96 | FocusedWindows &creationOrderList() { return m_creation_order_list; } | 124 | FocusedWindows &creationOrderList() { return m_creation_order_list; } |
125 | /// @return the focus list | ||
97 | FocusedWindows &focusedOrderList() { return m_focused_list; } | 126 | FocusedWindows &focusedOrderList() { return m_focused_list; } |
98 | 127 | /// removes a client from the focus list | |
99 | void removeClient(WinClient &client); | 128 | void removeClient(WinClient &client); |
129 | /// starts terminating this control | ||
100 | void shutdown(); | 130 | void shutdown(); |
101 | 131 | /// do fallback focus for screen if normal focus control failed. | |
102 | static void revertFocus(BScreen &screen); | 132 | static void revertFocus(BScreen &screen); |
103 | // like revertFocus, but specifically related to this window (transients etc) | 133 | // like revertFocus, but specifically related to this window (transients etc) |
104 | static void unfocusWindow(WinClient &client, bool full_revert = true, bool unfocus_frame = false); | 134 | static void unfocusWindow(WinClient &client, bool full_revert = true, bool unfocus_frame = false); |