Screen, allocscreen, publicscreen, freescreen, allocwindow, bottomwindow, bottomnwindows, topwindow, topnwindows, originwindow – window management
Display *display; /* display holding data */
int id; /* id of system-held Screen */
Image *image; /* unused; for reference only */
Image *fill; /* color to paint behind windows */
Screen* allocscreen(Image *image, Image *fill, int public)
Screen* publicscreen(Display *d, int id, ulong chan)
int freescreen(Screen *s)
Image* allocwindow(Screen *s, Rectangle r, int ref, ulong col)
void bottomwindow(Image *w)
void bottomnwindows(Image **wp, int nw)
void topwindow(Image *w)
void topnwindows(Image **wp, int nw)
int originwindow(Image *w, Point log, Point scr)
/* refresh methods */
Refbackup = 0,
Refnone = 1,
Refmesg = 2
Windows are represented as
and may be treated as regular images for all drawing operations.
The routines discussed here permit the creation, deletion, and shuffling
of windows, facilities that do not apply to regular images.
To create windows, it is first necessary to allocate a
data structure to gather them together.
turns an arbitrary image into something that may have windows upon it.
It is created by
which takes an
upon which to place the windows (typically
image to paint the background behind all the windows on the image,
and a flag specifying whether the result should be publicly visible.
If it is public, an arbitrary other program connected to the same
display may acquire a pointer to the same screen by calling
pointer and the
of the published
as well as the expected channel descriptor, as a safety check.
It will usually require some out-of-band coordination for programs to share a screen profitably.
although it may not actually disappear from view until all the windows upon it have also been deallocated.
initialize the appearance of the
Windows are created by
which takes a pointer to the
upon which to create the window, a rectangle
defining its geometry, an integer pixel value
to color the window initially, and a refresh method
The refresh methods are
which provides backing store and is the method used by
for its clients;
which provides no refresh and is designed for temporary uses
such as sweeping a display rectangle, for windows that are
completely covered by other windows, and for windows that
are already protected by backing store; and
which causes messages to be delivered to the owner of the window
when it needs to be repainted.
is not fully implemented.
The result of
pointer that may be treated like any other image.
In particular, it is freed by calling
The following functions, however, apply only to windows, not regular images.
to the bottom of the stack of windows on its
perhaps obscuring it.
to the top, making it fully visible on its
may itself be within a window that is not fully visible;
will not affect the stacking of this parent window.)
are analogous, but push or pull a group of
windows listed in the array
The order within
Each window is created as an
corresponds to the rectangle given to
when it was created. Thus, a newly created window
resides on its
and has internal coordinates
Both these may be changed by a call to
define the upper left corner of the logical coordinate system
and screen position
Their usage is shown in the Examples section.
creates its client windows with backing store,
The graphics initialization routine,
upon this, and then allocates upon that another window indented
to protect the border. That window is created
since the backing store created by
protects its contents. That window is the one known in the
library by the global name
(a historic but confusing choice).
To move a window to the upper left corner of the display,
originwindow(w, w->r.min, Pt(0, 0));
To leave a window where it is on the screen but change its internal
coordinate system so (0, 0) is the upper left corner of the window,
originwindow(w, Pt(0, 0), w->r.min);
After this is done,
is translated to the origin and there will be no way to discover the
actual screen position of the window unless it is recorded separately.
The refresh method
should be finished.