aboutsummaryrefslogtreecommitdiff
path: root/src/MinOverlapPlacement.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/MinOverlapPlacement.hh')
-rw-r--r--src/MinOverlapPlacement.hh44
1 files changed, 1 insertions, 43 deletions
diff --git a/src/MinOverlapPlacement.hh b/src/MinOverlapPlacement.hh
index daf49f2..1c741ca 100644
--- a/src/MinOverlapPlacement.hh
+++ b/src/MinOverlapPlacement.hh
@@ -26,54 +26,12 @@
26 26
27class MinOverlapPlacement: public PlacementStrategy { 27class MinOverlapPlacement: public PlacementStrategy {
28public: 28public:
29 MinOverlapPlacement(ScreenPlacement::PlacementPolicy policy); 29 MinOverlapPlacement() { };
30 30
31 bool placeWindow(const FluxboxWindow &win, int head, 31 bool placeWindow(const FluxboxWindow &win, int head,
32 int &place_x, int &place_y); 32 int &place_x, int &place_y);
33 33
34private: 34private:
35 class Region {
36 public:
37
38 enum Corner {
39 TOPLEFT,
40 TOPRIGHT,
41 BOTTOMLEFT,
42 BOTTOMRIGHT
43 } corner; // indicates the corner of the window that will be placed
44
45 Region(Corner _corner, int _x, int _y):
46 corner(_corner), x(_x), y(_y) { };
47
48 // do all STL set implementations use this for sorting?
49 bool operator <(const Region &o) const {
50 switch (MinOverlapPlacement::s_policy) {
51 case ScreenPlacement::ROWMINOVERLAPPLACEMENT:
52 // if we're making rows, y-value is most important
53 if (y != o.y)
54 return ((y < o.y) ^ (s_col_dir == ScreenPlacement::BOTTOMTOP));
55 if (x != o.x)
56 return ((x < o.x) ^ (s_row_dir == ScreenPlacement::RIGHTLEFT));
57 return (corner < o.corner);
58 case ScreenPlacement::COLMINOVERLAPPLACEMENT:
59 // if we're making columns, x-value is most important
60 if (x != o.x)
61 return ((x < o.x) ^ (s_row_dir == ScreenPlacement::RIGHTLEFT));
62 if (y != o.y)
63 return ((y < o.y) ^ (s_col_dir == ScreenPlacement::BOTTOMTOP));
64 return (corner < o.corner);
65 default:
66 return false;
67 }
68 }
69
70 // position where the top left corner of the window will be placed
71 int x, y;
72 };
73
74 static ScreenPlacement::PlacementPolicy s_policy;
75 static ScreenPlacement::RowDirection s_row_dir;
76 static ScreenPlacement::ColumnDirection s_col_dir;
77}; 35};
78 36
79#endif // MINOVERLAPPLACEMENT_HH 37#endif // MINOVERLAPPLACEMENT_HH