From 0688816d11e1fbd5576197f39f949ead687101d9 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sun, 3 Aug 2008 18:18:04 -0700 Subject: add window pattern argument to ArrangeWindows --- ChangeLog | 3 +++ src/WorkspaceCmd.cc | 22 ++++++++++------------ src/WorkspaceCmd.hh | 3 +++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b69240..cdd5390 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 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 *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); diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index d50c0bf..ad63d04 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -170,7 +170,10 @@ private: /// arranges windows in current workspace to rows and columns class ArrangeWindowsCmd: public FbTk::Command { public: + ArrangeWindowsCmd(std::string &pat): m_pat(pat.c_str()) { } void execute(); +private: + const ClientPattern m_pat; }; class ShowDesktopCmd: public FbTk::Command { -- cgit v0.11.2