diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-05 12:00:48 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-05 12:00:48 (GMT) |
commit | 22aa93c56de131b80dfb161615650c4fb6cf6832 (patch) | |
tree | d68fe96088759ea952ff8f4b7214411be9541f46 | |
parent | 24bea22035e79c17fa6b6fdcd60f88e4eac467d8 (diff) | |
download | fluxbox_paul-22aa93c56de131b80dfb161615650c4fb6cf6832.zip fluxbox_paul-22aa93c56de131b80dfb161615650c4fb6cf6832.tar.bz2 |
fix the Focus key command
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/asciidoc/fluxbox-keys.txt | 9 | ||||
-rw-r--r-- | doc/fluxbox-keys.5 | 14 | ||||
-rw-r--r-- | src/CurrentWindowCmd.cc | 16 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 10 | ||||
-rw-r--r-- | src/FocusableList.cc | 11 | ||||
-rw-r--r-- | src/FocusableList.hh | 2 |
7 files changed, 53 insertions, 11 deletions
@@ -1,6 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.1 | 2 | Changes for 1.1 |
3 | *08/08/05: | 3 | *08/08/05: |
4 | * Fixed Focus key command (Mark) | ||
5 | CurrentWindowCmd.cc/hh FocusableList.cc/hh | ||
4 | * Added new SetLayer key command (Mark) | 6 | * Added new SetLayer key command (Mark) |
5 | CurrentWindowCmd.cc/hh | 7 | CurrentWindowCmd.cc/hh |
6 | * Make ShowDesktop command toggle between showing windows and desktop (Mark) | 8 | * Make ShowDesktop command toggle between showing windows and desktop (Mark) |
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt index 70f3b66..e52ffa8 100644 --- a/doc/asciidoc/fluxbox-keys.txt +++ b/doc/asciidoc/fluxbox-keys.txt | |||
@@ -163,10 +163,13 @@ BottomRight* | |||
163 | 163 | ||
164 | Window Commands | 164 | Window Commands |
165 | ~~~~~~~~~~~~~~~ | 165 | ~~~~~~~~~~~~~~~ |
166 | These commands affect only the currently focused window. | 166 | These commands ordinarily affect only the currently focused window. The |
167 | *OnWindow* modifier and *ForEach* command may affect the window that is used. | ||
167 | 168 | ||
168 | *Activate* | *Focus*:: | 169 | *Activate* ['pattern'] | *Focus* ['pattern']:: |
169 | Set the focus to the window matching the argument, and raise it. | 170 | Set the focus to the window matching the argument. If 'pattern' is |
171 | omitted, this may be used with the *OnWindow* modifier to set the | ||
172 | focus. See *CLIENT PATTERNS* for more about the 'pattern' arguments. | ||
170 | 173 | ||
171 | *Minimize* | *MinimizeWindow* | *Iconify*:: | 174 | *Minimize* | *MinimizeWindow* | *Iconify*:: |
172 | Minimize the current window, equivalent to the window button. | 175 | Minimize the current window, equivalent to the window button. |
diff --git a/doc/fluxbox-keys.5 b/doc/fluxbox-keys.5 index aa0523a..75af5ab 100644 --- a/doc/fluxbox-keys.5 +++ b/doc/fluxbox-keys.5 | |||
@@ -165,11 +165,19 @@ By default \fIcorner\fR is \fBBottomRight\fR, but may be overridden with one of: | |||
165 | Start dragging to add this window to another\'s tabgroup\. | 165 | Start dragging to add this window to another\'s tabgroup\. |
166 | .RE | 166 | .RE |
167 | .SS "Window Commands" | 167 | .SS "Window Commands" |
168 | These commands affect only the currently focused window\. | 168 | These commands ordinarily affect only the currently focused window\. The \fBOnWindow\fR modifier and \fBForEach\fR command may affect the window that is used\. |
169 | .PP | 169 | .PP |
170 | \fBActivate\fR | \fBFocus\fR | 170 | \fBActivate\fR [\fIpattern\fR] | \fBFocus\fR [\fIpattern\fR] |
171 | .RS 4 | 171 | .RS 4 |
172 | Set the focus to the window matching the argument, and raise it\. | 172 | Set the focus to the window matching the argument\. If |
173 | \fIpattern\fR | ||
174 | is omitted, this may be used with the | ||
175 | \fBOnWindow\fR | ||
176 | modifier to set the focus\. See | ||
177 | \fBCLIENT PATTERNS\fR | ||
178 | for more about the | ||
179 | \fIpattern\fR | ||
180 | arguments\. | ||
173 | .RE | 181 | .RE |
174 | .PP | 182 | .PP |
175 | \fBMinimize\fR | \fBMinimizeWindow\fR | \fBIconify\fR | 183 | \fBMinimize\fR | \fBMinimizeWindow\fR | \fBIconify\fR |
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 42ee69c..9253058 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -56,8 +56,6 @@ FbTk::Command<void> *createCurrentWindowCmd(const std::string &command, | |||
56 | return new CurrentWindowCmd(&FluxboxWindow::lower); | 56 | return new CurrentWindowCmd(&FluxboxWindow::lower); |
57 | else if (command == "lowerlayer") | 57 | else if (command == "lowerlayer") |
58 | return new CurrentWindowCmd(&FluxboxWindow::lowerLayer); | 58 | return new CurrentWindowCmd(&FluxboxWindow::lowerLayer); |
59 | else if (command == "activate" || command == "focus") | ||
60 | return new CurrentWindowCmd((void (FluxboxWindow::*)())&FluxboxWindow::focus); | ||
61 | else if (command == "close") | 59 | else if (command == "close") |
62 | return new CurrentWindowCmd(&FluxboxWindow::close); | 60 | return new CurrentWindowCmd(&FluxboxWindow::close); |
63 | else if (command == "killwindow" || command == "kill") | 61 | else if (command == "killwindow" || command == "kill") |
@@ -98,8 +96,6 @@ REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void); | |||
98 | REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void); | 96 | REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void); |
99 | REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); | 97 | REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); |
100 | REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void); | 98 | REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void); |
101 | REGISTER_COMMAND_PARSER(activate, createCurrentWindowCmd, void); | ||
102 | REGISTER_COMMAND_PARSER(focus, createCurrentWindowCmd, void); | ||
103 | REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); | 99 | REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); |
104 | REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); | 100 | REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); |
105 | REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void); | 101 | REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void); |
@@ -252,6 +248,18 @@ void GoToTabCmd::real_execute() { | |||
252 | (*it)->focus(); | 248 | (*it)->focus(); |
253 | } | 249 | } |
254 | 250 | ||
251 | REGISTER_COMMAND_WITH_ARGS(activate, FocusCmd, void); | ||
252 | REGISTER_COMMAND_WITH_ARGS(focus, FocusCmd, void); | ||
253 | |||
254 | void FocusCmd::real_execute() { | ||
255 | Focusable *win = 0; | ||
256 | if (!m_pat.error()) | ||
257 | win = fbwindow().screen().focusControl().focusedOrderWinList().find(m_pat); | ||
258 | if (!win) | ||
259 | win = &fbwindow(); | ||
260 | win->focus(); | ||
261 | } | ||
262 | |||
255 | REGISTER_COMMAND(startmoving, StartMovingCmd, void); | 263 | REGISTER_COMMAND(startmoving, StartMovingCmd, void); |
256 | 264 | ||
257 | void StartMovingCmd::real_execute() { | 265 | void StartMovingCmd::real_execute() { |
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 5d381a2..d70e2fb 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh | |||
@@ -137,6 +137,16 @@ private: | |||
137 | const int m_tab_num; | 137 | const int m_tab_num; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | // focus the window | ||
141 | class FocusCmd: public WindowHelperCmd { | ||
142 | public: | ||
143 | explicit FocusCmd(const std::string &pat): m_pat(pat.c_str()) { } | ||
144 | protected: | ||
145 | void real_execute(); | ||
146 | private: | ||
147 | const ClientPattern m_pat; | ||
148 | }; | ||
149 | |||
140 | // begin moving with mouse | 150 | // begin moving with mouse |
141 | class StartMovingCmd: public WindowHelperCmd { | 151 | class StartMovingCmd: public WindowHelperCmd { |
142 | public: | 152 | public: |
diff --git a/src/FocusableList.cc b/src/FocusableList.cc index 70f415e..d15e10a 100644 --- a/src/FocusableList.cc +++ b/src/FocusableList.cc | |||
@@ -286,10 +286,19 @@ void FocusableList::reset() { | |||
286 | 286 | ||
287 | bool FocusableList::contains(const Focusable &win) const { | 287 | bool FocusableList::contains(const Focusable &win) const { |
288 | Focusables::const_iterator it = m_list.begin(), it_end = m_list.end(); | 288 | Focusables::const_iterator it = m_list.begin(), it_end = m_list.end(); |
289 | it = find(it, it_end, &win); | 289 | it = std::find(it, it_end, &win); |
290 | return (it != it_end); | 290 | return (it != it_end); |
291 | } | 291 | } |
292 | 292 | ||
293 | Focusable *FocusableList::find(const ClientPattern &pat) const { | ||
294 | Focusables::const_iterator it = m_list.begin(), it_end = m_list.end(); | ||
295 | for (; it != it_end; ++it) { | ||
296 | if (pat.match(**it)) | ||
297 | return *it; | ||
298 | } | ||
299 | return 0; | ||
300 | } | ||
301 | |||
293 | void FocusableList::attachChild(FocusableList &child) const { | 302 | void FocusableList::attachChild(FocusableList &child) const { |
294 | m_addsig.attach(&child); | 303 | m_addsig.attach(&child); |
295 | m_removesig.attach(&child); | 304 | m_removesig.attach(&child); |
diff --git a/src/FocusableList.hh b/src/FocusableList.hh index cdf6bec..a72e2f0 100644 --- a/src/FocusableList.hh +++ b/src/FocusableList.hh | |||
@@ -70,6 +70,8 @@ public: | |||
70 | bool empty() const { return m_list.empty(); } | 70 | bool empty() const { return m_list.empty(); } |
71 | /// does the list contain the given window? | 71 | /// does the list contain the given window? |
72 | bool contains(const Focusable &win) const; | 72 | bool contains(const Focusable &win) const; |
73 | /// find the first window matching the pattern | ||
74 | Focusable *find(const ClientPattern &pattern) const; | ||
73 | 75 | ||
74 | /** | 76 | /** |
75 | @name signals | 77 | @name signals |