aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn K Pate <j.k.pate at sms.ed.ac.uk>2010-09-13 21:58:59 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-17 14:22:33 (GMT)
commitf1f7bebf3722a24f0386424cb773e647bc6f5826 (patch)
tree6e154a9c5a60293993b0e6fbc71e1a6c70f89e18 /src
parentd3eabeb805fdbd162c0743ed86a67e014e37c097 (diff)
downloadfluxbox-f1f7bebf3722a24f0386424cb773e647bc6f5826.zip
fluxbox-f1f7bebf3722a24f0386424cb773e647bc6f5826.tar.bz2
added 'ArrangeWindowsVertical' to actions
Diffstat (limited to 'src')
-rw-r--r--src/WorkspaceCmd.cc17
-rw-r--r--src/WorkspaceCmd.hh9
2 files changed, 22 insertions, 4 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 6267671..168a56d 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -177,8 +177,16 @@ FbTk::Command<void> *parseWindowList(const string &command,
177 else if (command == "prevgroup") { 177 else if (command == "prevgroup") {
178 opts |= FocusableList::LIST_GROUPS; 178 opts |= FocusableList::LIST_GROUPS;
179 return new PrevWindowCmd(opts, pat); 179 return new PrevWindowCmd(opts, pat);
180 } else if (command == "arrangewindows") 180 } else if (command == "arrangewindows") {
181 return new ArrangeWindowsCmd(pat); 181 int method = ArrangeWindowsCmd::UNSPECIFIED;
182 return new ArrangeWindowsCmd(method,pat);
183 } else if (command == "arrangewindowsvertical") {
184 int method = ArrangeWindowsCmd::VERTICAL;
185 return new ArrangeWindowsCmd(method,pat);
186 } else if (command == "arrangewindowshorizontal") {
187 int method = ArrangeWindowsCmd::HORIZONTAL;
188 return new ArrangeWindowsCmd(method,pat);
189 }
182 return 0; 190 return 0;
183} 191}
184 192
@@ -188,6 +196,8 @@ REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void);
188REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); 196REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void);
189REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); 197REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void);
190REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void); 198REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void);
199REGISTER_COMMAND_PARSER(arrangewindowsvertical, parseWindowList, void);
200REGISTER_COMMAND_PARSER(arrangewindowshorizontal, parseWindowList, void);
191 201
192} // end anonymous namespace 202} // end anonymous namespace
193 203
@@ -404,7 +414,8 @@ void ArrangeWindowsCmd::execute() {
404 // try to get the same number of rows as columns. 414 // try to get the same number of rows as columns.
405 unsigned int cols = int(sqrt((float)win_count)); // truncate to lower 415 unsigned int cols = int(sqrt((float)win_count)); // truncate to lower
406 unsigned int rows = int(0.99 + float(win_count) / float(cols)); 416 unsigned int rows = int(0.99 + float(win_count) / float(cols));
407 if (max_width<max_height) { // rotate 417 if ( (m_tile_method == VERTICAL) || // rotate if the user has asked for it or automagically
418 ( (m_tile_method == UNSPECIFIED) && (max_width<max_height)) ) {
408 std::swap(cols, rows); 419 std::swap(cols, rows);
409 } 420 }
410 421
diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh
index ad63d04..f4f90a6 100644
--- a/src/WorkspaceCmd.hh
+++ b/src/WorkspaceCmd.hh
@@ -170,9 +170,16 @@ private:
170/// arranges windows in current workspace to rows and columns 170/// arranges windows in current workspace to rows and columns
171class ArrangeWindowsCmd: public FbTk::Command<void> { 171class ArrangeWindowsCmd: public FbTk::Command<void> {
172public: 172public:
173 ArrangeWindowsCmd(std::string &pat): m_pat(pat.c_str()) { } 173 enum {
174 UNSPECIFIED,
175 VERTICAL,
176 HORIZONTAL
177 };
178 explicit ArrangeWindowsCmd(int tile_method, std::string &pat):
179 m_tile_method( tile_method ), m_pat(pat.c_str()) { }
174 void execute(); 180 void execute();
175private: 181private:
182 const int m_tile_method;
176 const ClientPattern m_pat; 183 const ClientPattern m_pat;
177}; 184};
178 185