page Functions
The functions listed below have packaged common sequences of calls together to provide a slightly higher level of interface than the macros alone. They are still low level, and have no pretense of completeness. Except where noted, all of the functions return a value greater than zero on success, and a value less than zero upon failure. The functions fail only if they read an unexpected value from , for example if an event notification arrives just before the response to the query. Client programs may use the function m_lastline in an attempt to determine what input caused the failure. If such race conditions become a problem, one can either change the approach to one which uses m_dupkey or to one which integrates queries to the server with the event dispatching mechanism. Those functions which expect data from automatically flush any pending output before reading, and unless the flag is set, attempt to turn off character echoing to prevent data returned by from echoing back on the window. The three functions get_param , get_size , and get_font are deprecated in favor of alternatives listed below which return the same information in more manageably sized parameter lists. int get_all list
struct window_data list; The current position size and status of all windows on the display is returned in The number of in windows on the display is returned. should be large enough to hold a status entry for each window. The structure is defined in int get_client list
struct window_data list; The current position size and status of the client programs and windows is returned in The number of windows owned by the client program is returned. should be large enough to hold a status entry for each window. The structure is defined in int get_colrow columns rows
int columns, rows; The number of and in the current is returned in and respectively. For any argument, no value is returned. int get_cursor column row
int column, row; The current cursor position is placed in and For any argument, no value is returned. int get_eachclientwin windatap
struct window_data windatap; Get the window parameters for each window in the current window set, one window at a time. This function returns 1 if window_data structure has been filled, 0 otherwise. It is important to call get_eachclientwin in a tight loop that doesn't exit until it returns 0, so that all the data is picked up. This function is preferred to get_client because you don't need to know the maximum number of windows you are likely to see. int get_eachwin windatap
struct window_data windatap; Get the window parameters for all the windows, one window at a time. This function returns 1 if window_data structure has been filled, 0 otherwise. It is important to call get_eachwin() in a tight loop that doesn't exit until it returns 0, so that all the data is picked up. This function is preferred to get_all because you don't need to know the maximum number of windows you are likely to see. int get_font wide high
int wide, high; The character size of the current font, in pixels is placed in and For any argument, no value is returned. The function returns the current font number, as would be used in a call to m_font . int get_mouse x y
int x, y; The current mouse position, in coordinates, is placed in and For any argument, no value is returned. The function returns the current mouse button state, which is in the range of -2 to +2 upon success, a value less than -2 upon failure. See m_getinfo G_MOUSE for a discussion of the return values. int get_param host xmax ymax border
char host; int xmax, ymax, border; The display size (in pixels) and window border size (in pixels) is placed in the arguments and For any argument, no value is returned. This function exists only for backward compatibility and should not be used any longer. int get_size X Y Dwidth Dheight
int X, Y, Dwidth, Dheight; The position of the window on the display, in coordinates is placed into and For any argument, no value is returned. char get_termcap
A string containing a entry, suitable for placing into the environment variable is returned. The function get_termcap returns upon failure. void ckmgrterm text
char *text; This function checks the environment variable TERM. If it is present and does not contain the substring "mgr", then a message beginning with text is written to and is called. BITMAP bitmapread file_pointer
FILE file_pointer; The file pointed to by is read and converted into an bitmap. The return value of NULL indicates failure. This is the identical routine uses to read bitmap files, so use it. The external integer is set if the bitmap was compressed. int bitmapwrite file_pointer bitmap flag
FILE file_pointer;
BITMAP bitmap; This function is used by to write the bitmap pointed to by bitmap into the file pointed to by file_pointer . int is_active
The function is_active returns if the window is the window. void menu_load n count text
int n, count; struct menu_entry text; A menu is downloaded to at position The integer is the number of menu items to be down-loaded, and is an array of menu item/value pairs. The structure is defined in int m_bitfile to name widep highp depthp
int to; char *name; int *widep, *highp, *depthp; Given a bitmap id, and an icon have load that icon into that scratchpad bitmap, returning the icon width, height and depth, in pixels, via the given integer pointers. Return a positive number if successful. If the icon is not loaded, set the width, height and depth values to 0 and return 0. This function is identical to m_bitfromfile plus the needed interception of the line returned from . int m_getbordersize void
This function returns the width of the border of each window in pixels. int m_getdepth void
This function returns the depth of the screen bitmap in bits, usually one for monochrome, eight for color. int m_getfontid void The function returns as an int the current font number, or -1 to indicate a protocol error. char* m_getfontname The function returns a pointer to a static array containing the name of the current font or NULL to indicate a protocol error. int m_getfontsize width height
int width, height; The size of the current font is stored in and Return value is -1 for a protocol error or 0 otherwise. int m_gethostname name len
char *name;
int len; The hostname of the host machine running the server, with a terminating NUL, is returned in through possibly truncated if is too small. Return value is -1 for a protocol error or 0 otherwise. int m_getscreensize width height depth
int width, height, depth; The display size (in pixels) and depth (in bit) is placed in the arguments and Return value is -1 for a protocol error or 0 otherwise. int m_getwindowposition x y
int x, y; The position of the upper left corder of the window border is placed in the arguments and Return value is -1 for a protocol error or 0 otherwise. int m_getwindowsize width height
int width, height; The window size is placed in the arguments and Return value is -1 for a protocol error or 0 otherwise. char m_lastline
The last input from to a library function is returned. The data is kept in a static buffer which is overwritten at each request. int m_makewindow X Y Dwidth Dheight
int X, Y, Dwidth, Dheight; An alternate window is created as the window, at display coordinates X Y and of size by pixels. If the window is too big to fit on the display, its width and height are truncated. The alternate window's is returned if the window was created successfully. The macro m_selectwin is used to write on the newly created window. int m_setup mode
int mode; This function initializes the library. It must be called before any other function or macro. The argument is one or more of the flags or together. If is present, all macros and function flush output to after each macro call. This is slightly less efficient than letting the client program flush the data (see m_flush ) but prevent inadvertent buffering problems. The flag forces the macro package to read and write from and respectively. Normally is opened for reading and writing to permit standard input or output redirection while still maintaining a connection to . If can not be opened, as would be the case for clients invoked through the flag is turned on, and and are used instead. The flag instructs those functions which expect data from to assume the terminal modes are set appropriately. Otherwise, the functions attempt to turn off character echoing and turn on line mode before fetching data from . The functions m_ttyset and m_ttyreset can be used to set and reset the terminal modes. The function m_setup returns its argument, with the flag in if can not be opened. void m_ttyreset
The terminal modes are restored to their state just prior to the last call to m_ttyset . Calls to m_ttyset and m_ttyreset may be stacked up to ten levels. int m_ttyset
The terminal is set in a state suitable for data exchange with . All automatic conversions are switched off to get a completely transparent line. The function returns 0 if it successfully retrieves the terminal modes, -1 otherwise.