Next: , Previous: , Up: Miscellaneous Functions   [Contents][Index]

20.4 Rectangle Functions

Rectangles define a region of the display. A rectangle is a list of values: (left top right bottom [weight]). left and top are the x and y coordinates of the upper left corner, right and bottom are the coordinates for the lower right corner. weight is an integer. The bulk of the rectangle management functions are in sawfish.wm.util.rects.

Function: rect-left rect

The x-axis value of the left side of the rectangle. Equivalent to car

Function: rect-top rect

The y-axis value of the top of the rectangle. Equivalent to cadr

Function: rect-right rect

The x-axis value of the right side of the rectangle. Equivalent to caddr

Function: rect-bottom rect

The y-axis value of the bottom of the rectangle. Equivalent to cadddr

Function: rect-obscured r by

Check whether the rectangle r is wholly or partially contained in rectangle by. Returns one of the symbols unobscured, partially-obscured, or fully-obscured.

Function: rect-minus r s #!optional tail

Return a list of rectangles whose union is the part of rectangle r not contained in rectangle s. If tail is given, the result is prepended to it.

Function: rectangles-from-grid x-points y-poinst #!optional pred

The two lists of integers x-points and y-points define a rectangular grid. Return the complete list of rectangles formed by the intersections of the grid.

If pred is defined it is called for each rectangle and only those for which it returns t are added to the returned list.

Assumes that x-points and y-points are both sorted smallest->largest.

Function: rectangles-from-windows windows #!optional weight-fun

Returns a list of rectangle objects representing the list of window objects windows.

If weight-fun is defined, it is a function to call on each window to return the weight for that window. If not defined, the window’s weight property is used instead.

Function: grid-from-rectangles rects #!optional with-root

Given a list of rectangles rects return a cons cell (x-points . y-points) defining the grid they represent.

If with-root is non-nil, then add the root window boundaries to the grid.

Function: rectangle-area rect

Returns the area of the specified rectangle.

Function: rectangle-from-coords point dims

Return the rectangle object with origin point and dimensions dims.

Function: rectangle-corners

Return a list of four cons cells representing the coordinates of the corners of the rectangle rect.

Function: rectangle-center rect

Returns a cons cell of the (approximate, to the nearest integer) coordinates of the center of the rectangle rect.

Function: rectangle-center* point dims

The same as rectangle-center except that the rectangle is specified via the x,y coordinates point and the dimensions dims.

Function: rectangle-union rect1 rect2

Gives the smallest rectangle containing both rect1 and rect2. The weight of the resulting rectangle is the weight of rect1.

Function: rectangle-intersection rect1 rect2

Gives the intersection of the two rectangles rect1 and rect2. The weigth of the resultant rectangle is the weight of rect1. Returns nil if there the two rectangles do not intersect.

Function: rect-1d-overlap a-1 a-2 b-1 b-2

a-1 to a-2 indicates one line segment and b-1 to b-2 indicates another. Returns the overlap between the two line segments.

Function: rect-2d-overlap dims point rect

Returns the overlap between two rectangles, one with dimensions dims and upper-left corner at point; the other is defined by rect.

Function: rect-2d-overlap* rect1 rect2

Like rect-2d-overlap, except that the rectangles are rect1 and rect2.

Function: rect-total-overlap dims point rects

Returns the total area of the overlap between a rectangle defined by dims and point, and the list of rectangles rects when placed at point.

Function: rect-wholly-within-rect outer inner

Returns t if inner is completely within the boundaries of outer.

Function: rect-wholly-visible-p

Returns t if rect is completely inside the screen boundaries.

Function: rectangle-heads

Returns the number of screen heads that the rectangle rect appears on.

These functions are found in sawfish.wm.viewport:

Function: rect-within-viewport-p rect #!optional viewport

Return t if rect is entirely inside the screen boundaries for some viewport, regardless of whether it is the current viewport, or even if the viewport currently exists. If viewport is specified check only against that viewport.

Function: rect-within-head-p rect #!optional head

Return t if rect is entirely within some head on some viewport. If head is provided rect must be within that head on some viewport.

Next: , Previous: , Up: Miscellaneous Functions   [Contents][Index]