📄 original_mini-x.txt
字号:
void
GrClose()
Close the connection to the graphics server, first flushing any graphics
calls that have been buffered. Currently, this sets the screen back into
text mode. This (currently) should be called before your program exits,
otherwise the screen will be left in graphics mode. If this occurs, you
can run the 'tm' program to reset the terminal to text mode.
GR_ERROR_FUNC
GrSetErrorHandler(func)
GR_ERROR_FUNC func; /* function to handle errors */
Set an error handling routine, which will be called on any errors from
the server (when events are asked for by the client). If zero is given,
then a default routine will be used which will describe the error and exit.
Returns the previous error handler (0 if none). When an error occurs,
the error handling function is called with the following parameters:
GR_ERROR, GR_FUNC_NAME, and GR_ID. These are the error code, the name
of the function which failed, and a resource id (0 if not meaningful).
The error routine can return if desired, but without corrective action
new errors will probably occur soon.
void
GrGetScreenInfo(sip)
GR_SCREEN_INFO *sip; /* location to return info into */
Return useful information about the screen. This information returned
has been documented above.
void
GrGetFontInfo(font, fip)
GR_FONT font; /* font number */
GR_FONT_INFO *fip; /* address of font info */
Return useful information about the specified font number. This information
is the font number, the height of the font, the maximum width of any
character in the font, the height of the baseline, a flag indicating whether
or not the font is fixed-width, and a table of the individual widths of each
character in the font. If the font is unknown, the returned font number is
set to zero and the remainder of the information is undefined. Refer to
graphics.h for a definition of the fields of GR_FONT_INFO.
void
GrGetGCInfo(gc, gcip)
GR_GC_ID gc; /* graphics context */
GR_GC_INFO *gcip; /* address of graphics context info */
Return useful information about the specified graphics context. This
information is the graphics context id, the current font, the foreground
and background colors, and so on. If the graphics context is unknown,
the returned id is 0, and the other information is undefined. Refer to
graphics.h for a definition of the fields of GR_GC_INFO.
void
GrGetGCTextSize(gc, cp, len, retwidth, retheight, retbase)
GR_GC_ID gc; /* graphics context containing font */
GR_CHAR *cp; /* address of text string */
GR_SIZE len; /* length of text string */
GR_SIZE *retwidth; /* returned width of string */
GR_SIZE *retheight; /* returned height of string */
GR_SIZE *retbase; /* returned height of baseline */
Return the size of a text string for the font in a graphics context.
This is the width of the string, the height of the string, and the height
above the bottom of the font of the baseline for the font. The returned
sizes are in pixels.
void
GrGetNextEvent(ep)
GR_EVENT *ep; /* address where event is returned */
Return the next event from the event queue, waiting for it if necessary.
If a graphics error had occurred, the error handler will be called at this
point. This routine first flushes any buffered graphics commands. The
GR_EVENT is a union of all the possible events. The type field of the union
indicates which of the possible events took place, and then the correct
element of the union can be used to access that particular event type's data.
void
GrCheckNextEvent(ep)
GR_EVENT *ep; /* address where event is returned */
Return the next event from the event queue if one is ready.
If one is not ready, then the event type GR_EVENT_TYPE_NONE is returned.
Therefore, this routine never blocks. This routine first flushes any
buffered graphics commands.
void
GrPeekEvent(ep)
GR_EVENT *ep; /* address where event is returned */
Return the next event from the event queue if one is ready, without removing
it from the queue. If one is not ready, then the type GR_EVENT_TYPE_NONE
is returned. This routine never blocks. This routine first flushes any
buffered graphics commands.
void
GrSelectEvents(wid, eventmask)
GR_WINDOW_ID wid; /* window id */
GR_EVENT_MASK eventmask; /* mask of events wanted */
Select events for a window for this client. The events are a bitmask
specifying the events desired for this window. This totally replaces
any previously selected event mask for the window.
GR_WINDOW_ID
GrNewWindow(parent, x, y, width, height, bordersize, background, bordercolor)
GR_WINDOW_ID parent; /* parent id */
GR_COORD x; /* x position relative to parent */
GR_COORD y; /* y position relative to parent */
GR_SIZE width; /* width */
GR_SIZE height; /* height */
GR_SIZE bordersize; /* size of border */
GR_COLOR background; /* background color */
GR_COLOR bordercolor; /* border color */
Allocate a new input-output window which is a child of the specified window.
A new top-level window is made by specifying a parent of GR_ROOT_WINDOW_ID.
The x and y position is the upper left corner of the window, relative to
the parent's upper left corner. These corners are only for the drawable
area of the windows, so that the border does not affect the position. An
input-output window cannot be made as a child of an input-only window. The
new window starts off unmapped, and must be mapped before it can be seen.
The new window inherits the cursor of the parent window, and initially is
set to select no events. This routine returns the window id of the window
which can be used in other calls.
GR_WINDOW_ID
GrNewInputWindow(parent, x, y, width, height)
GR_WINDOW_ID parent; /* parent id */
GR_COORD x; /* x position relative to parent */
GR_COORD y; /* y position relative to parent */
GR_SIZE width; /* width */
GR_SIZE height; /* height */
Allocate a new input-only window which is a child of the specified window.
An input-only window is invisible, and cannot be drawn into. It's only
purposes are that it can select events, and can have it's own cursor. The
new window starts off unmapped, and must be mapped before it is effective.
The new window inherits the cursor of the parent window, and initially is
set to select no events. This routine returns the window id of the window
which can be used in other calls.
void
GrDestroyWindow(wid)
GR_WINDOW_ID wid; /* window to destroy */
This unmaps and then destroys the specified window, and all of its children.
The root window cannot be destroyed. After destroying a window, you must be
careful about handling events which refer to the dead window, but which have
not been read yet.
void
GrGetWindowInfo(wid, wip)
GR_WINDOW_ID wid; /* window id to find out about */
GR_WINDOW_INFO *wip; /* location to return info into */
Return useful information about the specified window. Refer to the
graphics.h include file for the definition of GR_WINDOW_INFO to see
what data is returned. If the window id is not valid, an error is NOT
generated. Instead, the wid value in the returned structure is set to
zero, and the other fields are not defined.
GR_GC_ID
GrNewGC()
Allocate a new graphics context with default parameters. These defaults are:
background of black, foreground of white, font as font 0, and drawing mode
as setting. This routine returns the id for the graphics context which can
be used in other calls.
GR_GC_ID
GrCopyGC(gc)
GR_GC_ID gc; /* graphics context to copy */
Allocate a new graphics context which is a copy of another one. The new
graphics context has the same parameter values as the old one, but is then
independent. This routine returns the id for the graphics context which
can be used in other calls.
void
GrDestroyGC(gc)
GR_GC_ID gc; /* graphics context to destroy */
Destroy an existing graphics context.
void
GrMapWindow(wid)
GR_WINDOW_ID wid; /* window to be mapped */
Map the window to make it (and possibly its children) visible on the screen.
This paints the border and background of the window, and creates an
exposure event to tell the client to draw into it.
void
GrUnmapWindow(wid)
GR_WINDOW_ID wid; /* window to be unmapped */
Unmap the window to make it and its children invisible on the screen.
void
GrRaiseWindow(wid)
GR_WINDOW_ID wid; /* window to be raised */
Raise the window to the highest level among its siblings. This means that
this window will be visible in preference to those siblings. Siblings are
windows which have the same parent as this window.
void
GrLowerWindow(wid)
GR_WINDOW_ID wid; /* window to be lowered */
Lower the window to the lowest level among its siblings. This means that
this window will be covered by any siblings which overlap it.
void
GrMoveWindow(wid, x, y)
GR_WINDOW_ID wid; /* window to be lowered */
GR_COORD x; /* new relative x position */
GR_COORD y; /* new relative y position */
Move the window to the specified position relative to its parent.
void
GrResizeWindow(wid, width, height)
GR_WINDOW_ID wid; /* window to be lowered */
GR_SIZE width; /* new width of window */
GR_SIZE height; /* new height of window */
Resize the window to be the specified size. Resizing of a window can
generate exposure events.
void
GrClearWindow(wid, exposeflag)
GR_WINDOW_ID wid; /* window id */
GR_BOOL exposeflag; /* nonzero to cause an exposure */
Clear the specified window by setting it to its background color.
If the exposeflag is nonzero, then this also creates an exposure
event for the window.
void
GrSetFocus(wid)
GR_WINDOW_ID wid; /* window id */
Set the focus to a particular window. This makes keyboard events only
visible to that window or children of it, depending on the pointer location.
Setting the focus window to the root window makes the input focus track
the pointer (which is the default).
void
GrSetBorderColor(wid, color)
GR_WINDOW_ID wid; /* window id */
GR_COLOR color; /* color for border */
Set the border of a window to the specified color.
void
GrSetCursor(wid, width, height, hotx, hoty, foreground, background,
fgbitmap, bgbitmap)
GR_WINDOW_ID wid; /* window id to set cursor for */
GR_SIZE width; /* width of cursor */
GR_SIZE height; /* height of cursor */
GR_COORD hotx; /* relative x position of hot spot */
GR_COORD hoty; /* relative y position of hot spot */
GR_COLOR foreground; /* foreground color of cursor */
GR_COLOR background; /* background color of cursor */
GR_BITMAP *fgbitmap; /* foreground bitmap */
GR_BITMAP *bgbitmap; /* background bitmap */
Specify a new cursor for a window. This cursor will only be used within
that window, and by default for its new children. The cursor is defined
by giving its width and height, its foreground and background colors, its
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -