add window pattern argument to ArrangeWindows

This commit is contained in:
Mark Tiefenbruck 2008-08-03 18:18:04 -07:00
parent 1be92e79ec
commit 0688816d11
3 changed files with 16 additions and 12 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.1
*08/08/04:
* Add window list argument to ArrangeWindows (Mark)
WorkspaceCmd.cc/hh
*08/06/26:
* Remove antiquated dithering code (Mark)
FbTk/ImageControl.cc/hh FbTk/TextureRender.cc Screen.cc/hh

View file

@ -173,7 +173,8 @@ FbTk::Command<void> *parseWindowList(const string &command,
else if (command == "prevgroup") {
opts |= FocusableList::LIST_GROUPS;
return new PrevWindowCmd(opts, pat);
}
} else if (command == "arrangewindows")
return new ArrangeWindowsCmd(pat);
return 0;
}
@ -182,6 +183,7 @@ REGISTER_COMMAND_PARSER(nextwindow, parseWindowList, void);
REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void);
REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void);
REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void);
REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void);
}; // end anonymous namespace
@ -353,8 +355,6 @@ void JumpToWorkspaceCmd::execute() {
}
}
REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd, void);
/**
try to arrange the windows on the current workspace in a 'clever' way.
we take the shaded-windows and put them ontop of the workspace and put the
@ -366,9 +366,8 @@ void ArrangeWindowsCmd::execute() {
return;
Workspace *space = screen->currentWorkspace();
size_t win_count = space->windowList().size();
if (win_count == 0)
if (space->windowList().empty())
return;
// TODO: choice between
@ -382,20 +381,19 @@ void ArrangeWindowsCmd::execute() {
Workspace::Windows shaded_windows;
for(win = space->windowList().begin(); win != space->windowList().end(); win++) {
int winhead = screen->getHead((*win)->fbWindow());
if (winhead == head || winhead == 0) {
if (!(*win)->isShaded())
normal_windows.push_back(*win);
else
if ((winhead == head || winhead == 0) && m_pat.match(**win)) {
if ((*win)->isShaded())
shaded_windows.push_back(*win);
else
normal_windows.push_back(*win);
}
}
// to arrange only shaded windows is a bit pointless imho (mathias)
if (normal_windows.size() == 0)
size_t win_count = normal_windows.size();
if (win_count == 0)
return;
win_count = normal_windows.size();
const unsigned int max_width = screen->maxRight(head) - screen->maxLeft(head);
unsigned int max_height = screen->maxBottom(head) - screen->maxTop(head);

View file

@ -170,7 +170,10 @@ private:
/// arranges windows in current workspace to rows and columns
class ArrangeWindowsCmd: public FbTk::Command<void> {
public:
ArrangeWindowsCmd(std::string &pat): m_pat(pat.c_str()) { }
void execute();
private:
const ClientPattern m_pat;
};
class ShowDesktopCmd: public FbTk::Command<void> {