Next: , Previous: , Up: Viewports   [Contents][Index]

11.1 Viewport Functions

Each cell is labeled with the index (col, row), and the top-left cell is (0, 0). Indices are never negative.

Sawfish implements viewport as follows. On a cell change, windows in previous cells are removed, and windows in the current cell appear. Windows that span two or more cells will appear in each cell, appropriately displaced.

Function: screen-viewport

Returns the currently displayed viewport as a pair (x . y).

Function: set-screen-viewport col row

Change the viewport to visit cell (col, row).

Function: move-viewport right down

Move the viewport to see the cell right columns right and down rows down. Either argument may be zero or negative.

Customizable: viewport-boundary-mode

Decides how to act when you call set-screen-viewport and you try to go outside of the virtual desktop. (Its size is specified by viewport-dimensions.) Defaults to stop.

When set to stop, it stops at the boundary of the virtual desktop.

When set to wrap-around, it behaves as if the leftmost viewport and the rightmost are connected. Same for the top and bottom.

If it is set to dynamic, then the workspace size changes automatically. For details, see See Dynamic Viewport.

Function: viewport-honor-workspace-edges

Returns whether or not the display is permitted to move past the current workspace boundaries. It returns true if viewport-boundary-mode is not set to dynamic.

Function: viewport-at x y

Returns a cons cell consisting of (column . row) of the viewport containing the specified x and y coordinates. The coordinates are specified relative to the current viewport, so (viewport-at 0 0) is equivalent to (screen-viewport).

Function: viewport-offset-coord viewport

Returns the offset from the current viewport to viewport which is specified as (column . row). The return value is the cons cell (x . y). The values are in pixel, and are negative if it lies at left or above the current viewport.

viewport can be outside of the workspace. (The check is not done.) If viewport is nil it is understood as the current viewport, i.e., (0 . 0) will be returned.

There are lower-level functions which move viewport by pixel, not by multiples of the physical screen dimensions.

Note that use of these breaks the traditional behavior and user interface of Sawfish. Though they are useful, simultaneous use of these functions and other functions may cause weird results.

Function: set-viewport x y

Change the position of the viewport, such that location (x, y) is at the top-left of the display. So (set-viewport 0 -5) will shift the viewport up five pixels.

Customizable: scroll-viewport-steps

When you move the viewport, the bigger this value, the more smoothly the screen is scrolled. It is the number of steps for scrolling.

The default value 1 means the change is instantaneous, and no scroll is done. The upper limit for customization is 50.

This variable is used for set-viewport. All interactive commands defined by Sawfish call this function, so this variable is important for the user.

Next: , Previous: , Up: Viewports   [Contents][Index]