func ApplyStrut(rects []Rect, rootWidth, rootHeight uint, left, right, top, bottom, left_start_y, left_end_y, right_start_y, right_end_y, top_start_x, top_end_x, bottom_start_x, bottom_end_x uint)

ApplyStrut takes a list of Rects (typically the rectangles that represent each physical head in this case), the root window geometry, and a set of parameters representing a strut, and modifies the list of Rects to account for that strut. That is, it shrinks each rect. Note that if struts overlap, the *most restrictive* one is used. This seems like the most sensible response to a weird scenario. (If you don't have a partial strut, just use '0' for the extra fields.) See xgbutil/examples/workarea-struts for an example of how to use this to get accurate workarea for each physical head.

func IntersectArea(r1 Rect, r2 Rect) int

IntersectArea takes two rectangles satisfying the Rect interface and returns the area of their intersection. If there is no intersection, return 0 area.

func LargestOverlap(needle Rect, haystack []Rect) int

LargestOverlap returns the index of the rectangle in 'haystack' that has the largest overlap with the rectangle 'needle'. This is commonly used to find which monitor a window should belong on. (Since it can technically be partially displayed on more than one monitor at a time.) Be careful, the return value can be -1 if there is no overlap.

func Pieces(xr Rect) (int, int, int, int)

func RectPieces(xr Rect) (int, int, int, int)

RectPieces just returns a four-tuple of x, y, width and height

func Subtract(r1 Rect, r2 Rect) []Rect

Subtract subtracts r2 from r1 and returns the result as a new slice of Rects. Basically, rectangle subtraction works by cutting r2 out of r1, and returning the resulting rectangles. If r1 does not overlap r2, then only one rectangle is returned and is equivalent to r1. If r2 covers r1, then no rectangles are returned. If r1 covers r2, then four rectangles are returned. If r2 partially overlaps r1, then one, two or three rectangles are returned.

func Valid(r Rect) bool

Valid returns whether a rectangle is valid or not. i.e., a width AND height not equal to zero.

type Rect interface { X() int Y() int Width() int Height() int XSet(x int) YSet(y int) WidthSet(width int) HeightSet(height int) Pieces() (int, int, int, int) }

Define a base and simple Rect interface.

```
type XRect struct {
// contains filtered or unexported fields
}
```

Provide a simple implementation of a rect. Maybe this will be all we need?

func New(x, y, w, h int) *XRect

Provide the ability to construct an XRect.

func (r *XRect) Height() int

func (r *XRect) HeightSet(height int)

func (r *XRect) Pieces() (int, int, int, int)

Pieces just returns a four-tuple of x, y, width and height

func (r *XRect) String() string

func (r *XRect) Width() int

func (r *XRect) WidthSet(width int)

func (r *XRect) X() int

Satisfy the Rect interface

func (r *XRect) XSet(x int)

func (r *XRect) Y() int

func (r *XRect) YSet(y int)