aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.hpp')
-rw-r--r--src/util.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util.hpp b/src/util.hpp
index f4e6e5f..6c6d0b9 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -103,4 +103,22 @@ struct unique_fd {
}
};
+class rectangle
+{
+public:
+ explicit rectangle(int wd, int ht) : w(wd), h(ht) {};
+ void scale(int to_w, int to_h, bool keep_aspect);
+ void center(int outer_w, int outer_h);
+ int left() { return x; };
+ int top() { return y; };
+ int width() { return w; };
+ int height() { return h; };
+
+private:
+ int x = 0;
+ int y = 0;
+ int w;
+ int h;
+};
+
#endif // !WM_UTIL_HPP