62 layout->monitors = monitors;
583 for(
int i = 0; i <
self->monitors->len
586 return self->monitors->areas[i];
1022 return self->monitors->len;
RArea RAreaInvalid(void)
Return a facially-invalid RArea.
RArea RAreaNew(int x, int y, int width, int height)
Construct an RArea from given components.
int RAreaArea(const RArea *self)
Return the area of an RArea.
bool RAreaIsIntersect(const RArea *self, const RArea *other)
Do two areas intersect?
int RAreaY2(const RArea *self)
Return the bottom edge of an RArea.
int RAreaX2(const RArea *self)
Return the right edge of an RArea.
bool RAreaContainsXY(const RArea *self, int x, int y)
Is a given coordinate inside a RArea?
RArea RAreaListBestTarget(const RAreaList *self, const RArea *area)
Find the RArea in an RAreaList that has the largest intersection with a given RArea.
int RAreaListMinY2(const RAreaList *self)
Find the y coordinate of the bottom edge of the top-most RArea in an RAreaList.
RAreaList * RAreaListVerticalUnion(const RAreaList *self)
Create an RAreaList whose RArea's are the vertical union of our RArea's.
void RAreaListFree(RAreaList *self)
Clean up and free an RAreaList.
RArea RAreaListBigArea(const RAreaList *self)
Create a maximal RArea describing the union of an RAreaList.
int RAreaListMaxY(const RAreaList *self)
Find the y coordinate of the bottom-most RArea in an RAreaList.
void RAreaListPrint(const RAreaList *self)
Pretty-print an RAreaList.
RAreaList * RAreaListIntersect(const RAreaList *self, const RArea *area)
Create an RAreaList of all the areas in an RAreaList that a given RArea intersects with.
int RAreaListMaxX(const RAreaList *self)
Find the x coordinate of the right-most RArea in an RAreaList.
RAreaList * RAreaListHorizontalUnion(const RAreaList *self)
Create an RAreaList whose RArea's are the horizontal union of our RArea's.
void RAreaListForeach(const RAreaList *self, bool(*func)(const RArea *cur_area, void *data), void *data)
Run a function over each RArea in an RAreaList until one returns true, allowing them a place to stash...
RAreaList * RAreaListCopyCropped(const RAreaList *self, int left_margin, int right_margin, int top_margin, int bottom_margin)
Create a copy of an RAreaList with given amounts cropped off the sides.
int RAreaListMinX2(const RAreaList *self)
Find the x coordinate of the right edge of the left-most RArea in an RAreaList.
int RLayoutNumMonitors(const RLayout *self)
How many monitors does a given RLayout contain?
void RLayoutFree(RLayout *self)
Clean up and free an RLayout.
RLayout * RLayoutSetMonitorsNames(RLayout *self, char **names)
Set the names for our monitors in an RLayout.
RArea RLayoutFullVert1(const RLayout *self, const RArea *area)
Figure the best way to stretch an area vertically without crossing monitors.
static bool _findMonitorTopEdge(const RArea *cur, void *vdata)
Callback util for RLayoutFindMonitorTopEdge()
static RAreaList * _RLayoutHorizontalIntersect(const RLayout *self, const RArea *area)
Find which horizontal regions of our monitor layout a given RArea (often a window) is in.
int RLayoutFindBottomEdge(const RLayout *self, const RArea *area)
Find the bottom of the top stripe of self that area fits into.
static RAreaList * _RLayoutRecenterHorizontally(const RLayout *self, const RArea *far_area)
Given an RArea that doesn't reside in any of the areas in our RLayout, create a list of maximally-wid...
RArea RLayoutGetAreaByName(const RLayout *self, const char *name, int len)
Return the RArea in self with the name given by the string of length len at name.
RArea RLayoutGetAreaAtXY(const RLayout *self, int x, int y)
Find the RArea in a RLayout that a given coordinate falls into.
void RLayoutFindTopBottomEdges(const RLayout *self, const RArea *area, int *top, int *bottom)
Figure the position (or nearest practical position) of an area in our screen layout,...
void RLayoutPrint(const RLayout *self)
Pretty-print an RLayout.
int RLayoutFindRightEdge(const RLayout *self, const RArea *area)
Find the right edge of the left-most stripe of self that area fits into.
RArea RLayoutFullHoriz1(const RLayout *self, const RArea *area)
Figure the best way to stretch an area horizontally without crossing monitors.
int RLayoutFindMonitorTopEdge(const RLayout *self, const RArea *area)
Find the top edge of the bottom-most monitor that contains the most of a given RArea.
int RLayoutFindMonitorRightEdge(const RLayout *self, const RArea *area)
Find the right edge of the left-most monitor that contains the most of a given RArea.
RArea RLayoutBigArea(const RLayout *self)
Generate maximal spanning RArea.
int RLayoutFindLeftEdge(const RLayout *self, const RArea *area)
Find the left edge of the right-most stripe of self that area fits into.
int RLayoutFindMonitorBottomEdge(const RLayout *self, const RArea *area)
Find the bottom edge of the top-most monitor that contains the most of a given RArea.
RArea RLayoutGetAreaIndex(const RLayout *self, int index)
Return the index'th RArea in an RLayout, or RAreaInvalid() with an out of range index.
RLayout * RLayoutNew(RAreaList *monitors)
Create an RLayout for a given set of monitors.
RArea RLayoutFull1(const RLayout *self, const RArea *area)
Figure the best way to resize an area to fill one monitor.
int RLayoutFindTopEdge(const RLayout *self, const RArea *area)
Find the top of the bottom stripe of self that area fits into.
static RAreaList * _RLayoutRecenterVertically(const RLayout *self, const RArea *far_area)
Given an RArea that doesn't reside in any of the areas in our RLayout, create a list of maximally-tal...
static void _RLayoutFreeNames(RLayout *self)
Clean up and free any RLayout.names there might be in an RLayout.
RArea RLayoutFull(const RLayout *self, const RArea *area)
Figure the best way to stretch an area across the largest horizontal and vertical space it can from i...
void RLayoutFindLeftRightEdges(const RLayout *self, const RArea *area, int *left, int *right)
Figure the position (or nearest practical position) of an area in our screen layout,...
static bool _findMonitorRightEdge(const RArea *cur, void *vdata)
Callback util for RLayoutFindMonitorRightEdge()
static bool _findMonitorByXY(const RArea *cur, void *vdata)
Callback util for RLayoutGetAreaAtXY().
RArea RLayoutFullHoriz(const RLayout *self, const RArea *area)
Figure the best way to stretch an area across the full horizontal width of an RLayout.
static bool _findMonitorBottomEdge(const RArea *cur, void *vdata)
Callback util for RLayoutFindMonitorBottomEdge()
static RAreaList * _RLayoutVerticalIntersect(const RLayout *self, const RArea *area)
Find which vertical regions of our monitor layout a given RArea (often a window) is in.
RArea RLayoutFullVert(const RLayout *self, const RArea *area)
Figure the best way to stretch an area across the full vertical height of an RLayout.
RLayout * RLayoutCopyCropped(const RLayout *self, int left_margin, int right_margin, int top_margin, int bottom_margin)
Create a copy of an RLayout with given amounts cropped off the sides.
int RLayoutFindMonitorLeftEdge(const RLayout *self, const RArea *area)
Find the left edge of the right-most monitor that contains the most of a given RArea.
static bool _findMonitorLeftEdge(const RArea *cur, void *vdata)
Callback util for RLayoutFindMonitorLeftEdge()
A particular extent of space.
The layout of our display.
Internal struct for use in FindMonitor*Edge() callbacks.
union monitor_edge_finder::@2 u
Internal structure for callback in RLayoutGetAreaAtXY().
static int min(int a, int b)
static int max(int a, int b)