diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-04 01:18:04 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-04 01:18:04 (GMT) |
commit | 0688816d11e1fbd5576197f39f949ead687101d9 (patch) | |
tree | 81d7b4f9c4a14e4fe9f976012fe0719f810d17f3 /src/WorkspaceCmd.cc | |
parent | 1be92e79eca2ef3b9c99655302ac5d1c0d91e14b (diff) | |
download | fluxbox-0688816d11e1fbd5576197f39f949ead687101d9.zip fluxbox-0688816d11e1fbd5576197f39f949ead687101d9.tar.bz2 |
add window pattern argument to ArrangeWindows
Diffstat (limited to 'src/WorkspaceCmd.cc')
-rw-r--r-- | src/WorkspaceCmd.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index aba5914..4bd9c7e 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -173,7 +173,8 @@ FbTk::Command<void> *parseWindowList(const string &command, | |||
173 | else if (command == "prevgroup") { | 173 | else if (command == "prevgroup") { |
174 | opts |= FocusableList::LIST_GROUPS; | 174 | opts |= FocusableList::LIST_GROUPS; |
175 | return new PrevWindowCmd(opts, pat); | 175 | return new PrevWindowCmd(opts, pat); |
176 | } | 176 | } else if (command == "arrangewindows") |
177 | return new ArrangeWindowsCmd(pat); | ||
177 | return 0; | 178 | return 0; |
178 | } | 179 | } |
179 | 180 | ||
@@ -182,6 +183,7 @@ REGISTER_COMMAND_PARSER(nextwindow, parseWindowList, void); | |||
182 | REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void); | 183 | REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void); |
183 | REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); | 184 | REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); |
184 | REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); | 185 | REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); |
186 | REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void); | ||
185 | 187 | ||
186 | }; // end anonymous namespace | 188 | }; // end anonymous namespace |
187 | 189 | ||
@@ -353,8 +355,6 @@ void JumpToWorkspaceCmd::execute() { | |||
353 | } | 355 | } |
354 | } | 356 | } |
355 | 357 | ||
356 | REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd, void); | ||
357 | |||
358 | /** | 358 | /** |
359 | try to arrange the windows on the current workspace in a 'clever' way. | 359 | try to arrange the windows on the current workspace in a 'clever' way. |
360 | we take the shaded-windows and put them ontop of the workspace and put the | 360 | we take the shaded-windows and put them ontop of the workspace and put the |
@@ -366,9 +366,8 @@ void ArrangeWindowsCmd::execute() { | |||
366 | return; | 366 | return; |
367 | 367 | ||
368 | Workspace *space = screen->currentWorkspace(); | 368 | Workspace *space = screen->currentWorkspace(); |
369 | size_t win_count = space->windowList().size(); | ||
370 | 369 | ||
371 | if (win_count == 0) | 370 | if (space->windowList().empty()) |
372 | return; | 371 | return; |
373 | 372 | ||
374 | // TODO: choice between | 373 | // TODO: choice between |
@@ -382,20 +381,19 @@ void ArrangeWindowsCmd::execute() { | |||
382 | Workspace::Windows shaded_windows; | 381 | Workspace::Windows shaded_windows; |
383 | for(win = space->windowList().begin(); win != space->windowList().end(); win++) { | 382 | for(win = space->windowList().begin(); win != space->windowList().end(); win++) { |
384 | int winhead = screen->getHead((*win)->fbWindow()); | 383 | int winhead = screen->getHead((*win)->fbWindow()); |
385 | if (winhead == head || winhead == 0) { | 384 | if ((winhead == head || winhead == 0) && m_pat.match(**win)) { |
386 | if (!(*win)->isShaded()) | 385 | if ((*win)->isShaded()) |
387 | normal_windows.push_back(*win); | ||
388 | else | ||
389 | shaded_windows.push_back(*win); | 386 | shaded_windows.push_back(*win); |
387 | else | ||
388 | normal_windows.push_back(*win); | ||
390 | } | 389 | } |
391 | } | 390 | } |
392 | 391 | ||
393 | // to arrange only shaded windows is a bit pointless imho (mathias) | 392 | // to arrange only shaded windows is a bit pointless imho (mathias) |
394 | if (normal_windows.size() == 0) | 393 | size_t win_count = normal_windows.size(); |
394 | if (win_count == 0) | ||
395 | return; | 395 | return; |
396 | 396 | ||
397 | win_count = normal_windows.size(); | ||
398 | |||
399 | const unsigned int max_width = screen->maxRight(head) - screen->maxLeft(head); | 397 | const unsigned int max_width = screen->maxRight(head) - screen->maxLeft(head); |
400 | unsigned int max_height = screen->maxBottom(head) - screen->maxTop(head); | 398 | unsigned int max_height = screen->maxBottom(head) - screen->maxTop(head); |
401 | 399 | ||