CTWM
Loading...
Searching...
No Matches
Functions
/usr/src/RPM/BUILD/ctwm-4.1.0/r_area_list.c File Reference
#include "ctwm.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "r_area_list.h"
#include "r_area.h"
Include dependency graph for r_area_list.c:

Go to the source code of this file.

Functions

static RAreaListRAreaListCopy (const RAreaList *self)
 Create a copy of a given RAreaList.
 
static void RAreaListDelete (RAreaList *self, int index)
 Delete an RArea from inside an RAreaList.
 
static void RAreaListAddList (RAreaList *self, const RAreaList *other)
 Add the RArea's from one RAreaList onto another.
 
static RAreaListRAreaListIntersectCrop (const RAreaList *self, const RArea *area)
 Create an RAreaList from another, cropped to a certain area defined by an RArea.
 
static int _cmpX (const void *av, const void *bv)
 qsort comparison function to sort by RArea.x
 
static void RAreaListSortX (const RAreaList *self)
 Sort the RArea's in an RAreaList by their x coordinate.
 
static int _cmpY (const void *av, const void *bv)
 qsort comparison function to sort by RArea.t
 
static void RAreaListSortY (const RAreaList *self)
 Sort the RArea's in an RAreaList by their y coordinate.
 
RAreaListRAreaListNew (int cap,...)
 Create an RAreaList from a set of RArea's.
 
RAreaListRAreaListCopyCropped (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.
 
void RAreaListFree (RAreaList *self)
 Clean up and free an RAreaList.
 
void RAreaListAdd (RAreaList *self, const RArea *area)
 Add an RArea onto an RAreaList.
 
RAreaListRAreaListHorizontalUnion (const RAreaList *self)
 Create an RAreaList whose RArea's are the horizontal union of our RArea's.
 
RAreaListRAreaListVerticalUnion (const RAreaList *self)
 Create an RAreaList whose RArea's are the vertical union of our RArea's.
 
RAreaListRAreaListIntersect (const RAreaList *self, const RArea *area)
 Create an RAreaList of all the areas in an RAreaList that a given RArea intersects with.
 
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 other internal data.
 
RArea RAreaListBigArea (const RAreaList *self)
 Create a maximal RArea describing the union of an RAreaList.
 
RArea RAreaListBestTarget (const RAreaList *self, const RArea *area)
 Find the RArea in an RAreaList that has the largest intersection with a given RArea.
 
int RAreaListMaxX (const RAreaList *self)
 Find the x coordinate of the right-most RArea in an RAreaList.
 
int RAreaListMaxY (const RAreaList *self)
 Find the y coordinate of the bottom-most RArea in an RAreaList.
 
int RAreaListMinX2 (const RAreaList *self)
 Find the x coordinate of the right edge of the left-most RArea in an RAreaList.
 
int RAreaListMinY2 (const RAreaList *self)
 Find the y coordinate of the bottom edge of the top-most RArea in an RAreaList.
 
void RAreaListPrint (const RAreaList *self)
 Pretty-print an RAreaList.
 

Function Documentation

◆ _cmpX()

static int _cmpX ( const void * av,
const void * bv )
static

qsort comparison function to sort by RArea.x

Definition at line 219 of file r_area_list.c.

References PlaceX.

Referenced by RAreaListSortX().

◆ _cmpY()

static int _cmpY ( const void * av,
const void * bv )
static

qsort comparison function to sort by RArea.t

Definition at line 253 of file r_area_list.c.

References PlaceX.

Referenced by RAreaListSortY().

◆ RAreaListAdd()

void RAreaListAdd ( RAreaList * self,
const RArea * area )

◆ RAreaListAddList()

static void RAreaListAddList ( RAreaList * self,
const RAreaList * other )
static

Add the RArea's from one RAreaList onto another.

Definition at line 196 of file r_area_list.c.

References PlaceX.

Referenced by RAreaListCopy(), RAreaListHorizontalUnion(), and RAreaListVerticalUnion().

◆ RAreaListBestTarget()

RArea RAreaListBestTarget ( const RAreaList * self,
const RArea * area )

Find the RArea in an RAreaList that has the largest intersection with a given RArea.

Colloquially, which area in an RAreaList does our RArea mostly fit into? This is used to resize a window to fill one monitor, by finding which monitor it's on.

Definition at line 460 of file r_area_list.c.

References PlaceX, RAreaArea(), RAreaIntersect(), RAreaInvalid(), and RAreaIsValid().

Referenced by RLayoutFull1().

◆ RAreaListBigArea()

RArea RAreaListBigArea ( const RAreaList * self)

Create a maximal RArea describing the union of an RAreaList.

This is used to construct a giant square that contains all our monitors (and the dead area necessary to cover them). It winds up being the equivalent of a spanning pseudo-Root window, and is used when we need to figure some sort of "overall" positioning, like when figuring "real" x/y coordinates.

Definition at line 421 of file r_area_list.c.

References PlaceX, RAreaInvalid(), RAreaNew(), RAreaX2(), RAreaY2(), x, RArea::x, y, and RArea::y.

Referenced by _RLayoutRecenterHorizontally(), _RLayoutRecenterVertically(), RAreaListCopyCropped(), and RLayoutBigArea().

◆ RAreaListCopy()

static RAreaList * RAreaListCopy ( const RAreaList * self)
static

Create a copy of a given RAreaList.

Definition at line 77 of file r_area_list.c.

References PlaceX, RAreaListAddList(), and RAreaListNew().

Referenced by RAreaListHorizontalUnion(), and RAreaListVerticalUnion().

◆ RAreaListCopyCropped()

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.

This is used principally during startup, to handle the BorderBottom/Top/Left/Right config params.

Definition at line 93 of file r_area_list.c.

References PlaceX, RAreaListBigArea(), RAreaListIntersectCrop(), and RAreaListNew().

Referenced by RLayoutCopyCropped().

◆ RAreaListDelete()

static void RAreaListDelete ( RAreaList * self,
int index )
static

Delete an RArea from inside an RAreaList.

Definition at line 155 of file r_area_list.c.

References PlaceX.

Referenced by RAreaListHorizontalUnion(), and RAreaListVerticalUnion().

◆ RAreaListForeach()

void RAreaListForeach ( const RAreaList * self,
bool(*)(const RArea *cur_area, void *data) func,
void * data )

Run a function over each RArea in an RAreaList until one returns true, allowing them a place to stash other internal data.

Definition at line 378 of file r_area_list.c.

References PlaceX.

Referenced by RLayoutFindMonitorBottomEdge(), RLayoutFindMonitorLeftEdge(), RLayoutFindMonitorRightEdge(), RLayoutFindMonitorTopEdge(), RLayoutGetAreaAtXY(), and TryToPack().

◆ RAreaListFree()

void RAreaListFree ( RAreaList * self)

◆ RAreaListHorizontalUnion()

RAreaList * RAreaListHorizontalUnion ( const RAreaList * self)

Create an RAreaList whose RArea's are the horizontal union of our RArea's.

Definition at line 288 of file r_area_list.c.

References PlaceX, RAreaHorizontalUnion(), RAreaListAddList(), RAreaListCopy(), RAreaListDelete(), RAreaListFree(), and RAreaListSortX().

Referenced by RLayoutNew().

◆ RAreaListIntersect()

RAreaList * RAreaListIntersect ( const RAreaList * self,
const RArea * area )

Create an RAreaList of all the areas in an RAreaList that a given RArea intersects with.

Definition at line 359 of file r_area_list.c.

References PlaceX, RAreaIsIntersect(), RAreaListAdd(), and RAreaListNew().

Referenced by _RLayoutHorizontalIntersect(), _RLayoutRecenterHorizontally(), _RLayoutRecenterVertically(), _RLayoutVerticalIntersect(), and RLayoutFull1().

◆ RAreaListIntersectCrop()

static RAreaList * RAreaListIntersectCrop ( const RAreaList * self,
const RArea * area )
static

Create an RAreaList from another, cropped to a certain area defined by an RArea.

Definition at line 396 of file r_area_list.c.

References PlaceX, RAreaIntersect(), RAreaIsValid(), RAreaListAdd(), and RAreaListNew().

Referenced by RAreaListCopyCropped().

◆ RAreaListMaxX()

int RAreaListMaxX ( const RAreaList * self)

Find the x coordinate of the right-most RArea in an RAreaList.

Definition at line 481 of file r_area_list.c.

References PlaceX, and RArea::x.

Referenced by RLayoutFindLeftRightEdges().

◆ RAreaListMaxY()

int RAreaListMaxY ( const RAreaList * self)

Find the y coordinate of the bottom-most RArea in an RAreaList.

Definition at line 503 of file r_area_list.c.

References PlaceX, and RArea::y.

Referenced by RLayoutFindTopBottomEdges().

◆ RAreaListMinX2()

int RAreaListMinX2 ( const RAreaList * self)

Find the x coordinate of the right edge of the left-most RArea in an RAreaList.

Definition at line 523 of file r_area_list.c.

References PlaceX, and RAreaX2().

Referenced by RLayoutFindLeftRightEdges().

◆ RAreaListMinY2()

int RAreaListMinY2 ( const RAreaList * self)

Find the y coordinate of the bottom edge of the top-most RArea in an RAreaList.

Definition at line 543 of file r_area_list.c.

References PlaceX, and RAreaY2().

Referenced by RLayoutFindTopBottomEdges().

◆ RAreaListNew()

RAreaList * RAreaListNew ( int cap,
... )

Create an RAreaList from a set of RArea's.

Parameters
capHint as to the number of RArea's being passed
...Sequence of RArea * to put in it. Don't forget a trailing NULL.

Definition at line 40 of file r_area_list.c.

References cap, PlaceX, and RAreaListAdd().

Referenced by ctwm_main(), fullzoom(), init_layout_override(), RAreaHorizontalUnion(), RAreaListCopy(), RAreaListCopyCropped(), RAreaListIntersect(), RAreaListIntersectCrop(), RAreaVerticalUnion(), and XrandrNewLayout().

◆ RAreaListPrint()

void RAreaListPrint ( const RAreaList * self)

Pretty-print an RAreaList.

Used for dev/debug.

Definition at line 564 of file r_area_list.c.

References PlaceX, and RAreaPrint().

Referenced by RLayoutPrint().

◆ RAreaListSortX()

static void RAreaListSortX ( const RAreaList * self)
static

Sort the RArea's in an RAreaList by their x coordinate.

Definition at line 239 of file r_area_list.c.

References _cmpX(), and PlaceX.

Referenced by RAreaListHorizontalUnion().

◆ RAreaListSortY()

static void RAreaListSortY ( const RAreaList * self)
static

Sort the RArea's in an RAreaList by their y coordinate.

Definition at line 273 of file r_area_list.c.

References _cmpY(), and PlaceX.

Referenced by RAreaListVerticalUnion().

◆ RAreaListVerticalUnion()

RAreaList * RAreaListVerticalUnion ( const RAreaList * self)

Create an RAreaList whose RArea's are the vertical union of our RArea's.

Definition at line 326 of file r_area_list.c.

References PlaceX, RAreaListAddList(), RAreaListCopy(), RAreaListDelete(), RAreaListFree(), RAreaListSortY(), and RAreaVerticalUnion().

Referenced by RLayoutNew().