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

Go to the source code of this file.

Functions

RArea RAreaNew (int x, int y, int width, int height)
 Construct an RArea from given components.
 
RAreaRAreaNewStatic (int x, int y, int width, int height)
 Return a pointer to a static newly constructed RArea.
 
RArea RAreaInvalid (void)
 Return a facially-invalid RArea.
 
bool RAreaIsValid (const RArea *self)
 Is an RArea facially valid?
 
int RAreaX2 (const RArea *self)
 Return the right edge of an RArea.
 
int RAreaY2 (const RArea *self)
 Return the bottom edge of an RArea.
 
int RAreaArea (const RArea *self)
 Return the area of an RArea.
 
RArea RAreaIntersect (const RArea *self, const RArea *other)
 Return an RArea describing the intersection of two RArea's.
 
bool RAreaIsIntersect (const RArea *self, const RArea *other)
 Do two areas intersect?
 
bool RAreaContainsXY (const RArea *self, int x, int y)
 Is a given coordinate inside a RArea?
 
RAreaListRAreaHorizontalUnion (const RArea *self, const RArea *other)
 Create a list of maximal horizontal stripes of two RArea's.
 
RAreaListRAreaVerticalUnion (const RArea *self, const RArea *other)
 Create a list of maximal vertical stripes of two RArea's.
 
void RAreaPrint (const RArea *self)
 Pretty-print an RArea.
 

Function Documentation

◆ RAreaArea()

int RAreaArea ( const RArea * self)

Return the area of an RArea.

Definition at line 93 of file r_area.c.

References PlaceX.

Referenced by RAreaListBestTarget(), and RLayoutFull().

◆ RAreaContainsXY()

bool RAreaContainsXY ( const RArea * self,
int x,
int y )

Is a given coordinate inside a RArea?

Definition at line 159 of file r_area.c.

References PlaceX, RAreaX2(), RAreaY2(), x, and y.

Referenced by _findMonitorByXY().

◆ RAreaHorizontalUnion()

RAreaList * RAreaHorizontalUnion ( const RArea * self,
const RArea * other )

Create a list of maximal horizontal stripes of two RArea's.

This yields a set of RArea's that completely cover (without overlap) the pair of input RArea's (or NULL if the inputs are disjoint). That could be just a single RArea if e.g. they're the same height and touch/overlap horizontally, or they're the same width and touch/overlap vertically. Otherwise it will wind up being multiple rows (2 or 3).

Only used in startup to populate the RLayout.horiz list.

Definition at line 179 of file r_area.c.

References max(), min(), PlaceX, RAreaListAdd(), RAreaListNew(), RAreaNewStatic(), RAreaX2(), RAreaY2(), RArea::width, RArea::x, and RArea::y.

Referenced by RAreaListHorizontalUnion().

◆ RAreaIntersect()

RArea RAreaIntersect ( const RArea * self,
const RArea * other )

Return an RArea describing the intersection of two RArea's.

Definition at line 103 of file r_area.c.

References max(), min(), PlaceX, RAreaInvalid(), RAreaIsIntersect(), RAreaNew(), RAreaX2(), and RAreaY2().

Referenced by RAreaListBestTarget(), and RAreaListIntersectCrop().

◆ RAreaInvalid()

RArea RAreaInvalid ( void )

Return a facially-invalid RArea.

This is used in places that need a sentinel value.

Definition at line 49 of file r_area.c.

Referenced by fullzoom(), RAreaIntersect(), RAreaListBestTarget(), RAreaListBigArea(), RLayoutGetAreaByName(), and RLayoutGetAreaIndex().

◆ RAreaIsIntersect()

bool RAreaIsIntersect ( const RArea * self,
const RArea * other )

◆ RAreaIsValid()

bool RAreaIsValid ( const RArea * self)

Is an RArea facially valid?

Mostly used to check against sentinel values in places that may or may not have a real value to work with.

Definition at line 63 of file r_area.c.

References PlaceX, and RArea::width.

Referenced by fullzoom(), RAreaListBestTarget(), RAreaListIntersectCrop(), and RLayoutXParseGeometry().

◆ RAreaNew()

RArea RAreaNew ( int x,
int y,
int width,
int height )

◆ RAreaNewStatic()

RArea * RAreaNewStatic ( int x,
int y,
int width,
int height )

Return a pointer to a static newly constructed RArea.

This is a thin wrapper around RAreaNew() that returns a static pointer. This is used in places that need to take RArea pointers, but we don't want to futz with making local intermediate vars. Currently exclusively used inline in RAreaListNew() calls.

Definition at line 35 of file r_area.c.

References RAreaNew(), x, and y.

Referenced by add_layout_override_entry(), ctwm_main(), RAreaHorizontalUnion(), and RAreaVerticalUnion().

◆ RAreaPrint()

void RAreaPrint ( const RArea * self)

Pretty-print an RArea.

Used for dev/debug.

Definition at line 411 of file r_area.c.

References PlaceX.

Referenced by RAreaListPrint(), and XrandrNewLayout().

◆ RAreaVerticalUnion()

RAreaList * RAreaVerticalUnion ( const RArea * self,
const RArea * other )

Create a list of maximal vertical stripes of two RArea's.

This yields a set of RArea's that completely cover (without overlap) the pair of input RArea's (or NULL if the inputs are disjoint). This is the equivalent of RAreaHorizontalUnion(), except with vertical stripes.

Only used in startup to populate the RLayout.vert list.

Definition at line 304 of file r_area.c.

References RArea::height, max(), min(), PlaceX, RAreaListAdd(), RAreaListNew(), RAreaNewStatic(), RAreaX2(), RAreaY2(), RArea::x, and RArea::y.

Referenced by RAreaListVerticalUnion().

◆ RAreaX2()

int RAreaX2 ( const RArea * self)

◆ RAreaY2()

int RAreaY2 ( const RArea * self)