aboutsummaryrefslogtreecommitdiff
path: root/src/WinClientUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WinClientUtil.cc')
-rw-r--r--src/WinClientUtil.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/WinClientUtil.cc b/src/WinClientUtil.cc
new file mode 100644
index 0000000..112360d
--- /dev/null
+++ b/src/WinClientUtil.cc
@@ -0,0 +1,32 @@
1#include "WinClientUtil.hh"
2#include "WinClient.hh"
3
4#include <algorithm>
5
6namespace WinClientUtil {
7
8void maxSize(const FluxboxWindow::ClientList &clients,
9 unsigned int &max_width, unsigned int &max_height) {
10 FluxboxWindow::ClientList::const_iterator it = clients.begin();
11 FluxboxWindow::ClientList::const_iterator it_end = clients.end();
12 max_width = ~0; // unlimited
13 max_height = ~0; // unlimited
14 for (; it != it_end; ++it) {
15 // special case for max height/width == 0
16 // 0 indicates unlimited size, so we skip them
17 // and set max size to 0 if max size == ~0 after the loop
18 if ((*it)->maxHeight() != 0)
19 max_height = std::min( (*it)->maxHeight(), max_height );
20 if ((*it)->maxWidth() != 0)
21 max_width = std::min( (*it)->maxWidth(), max_width );
22 }
23
24 if (max_width == ~0)
25 max_width = 0;
26 if (max_height == ~0)
27 max_height = 0;
28}
29
30}
31
32