+
+/*
+ * Returns a "relative" Rect which contains the amount of pixels that need to
+ * be added to the original Rect to get the final position (obviously the
+ * amount of pixels for normal, 1pixel and borderless are different).
+ *
+ */
+Rect con_border_style_rect(Con *con) {
+ switch (con_border_style(con)) {
+ case BS_NORMAL:
+ return (Rect){2, 0, -(2 * 2), -2};
+
+ case BS_1PIXEL:
+ return (Rect){1, 1, -2, -2};
+
+ case BS_NONE:
+ return (Rect){0, 0, 0, 0};
+
+ default:
+ assert(false);
+ }
+}
+
+/*
+ * Use this function to get a container’s border style. This is important
+ * because when inside a stack, the border style is always BS_NORMAL.
+ * For tabbed mode, the same applies, with one exception: when the container is
+ * borderless and the only element in the tabbed container, the border is not
+ * rendered.
+ *
+ */
+int con_border_style(Con *con) {
+ if (con->parent->layout == L_STACKED)
+ return BS_NORMAL;
+
+ return con->border_style;
+}