misc

Name

misc -- 

Synopsis



void        GrReqShmCmds                    (long shmsize);
void        GrInjectKeyboardEvent           (GR_WINDOW_ID wid,
                                             GR_KEY keyvalue,
                                             GR_KEYMOD modifier,
                                             GR_SCANCODE scancode,
                                             GR_BOOL pressed);
void        GrRegisterInput                 (int fd);
void        GrPrepareSelect                 (int *maxfd,
                                             void *rfdset);
void        GrServiceSelect                 (void *rfdset,
                                             GR_FNCALLBACKEVENT fncb);
void        GrBell                          (void);
void        GrSetScreenSaverTimeout         (GR_TIMEOUT timeout);
void        GrQueryTree                     (GR_WINDOW_ID wid,
                                             GR_WINDOW_ID *parentid,
                                             GR_WINDOW_ID **children,
                                             GR_COUNT *nchildren);
void        GrSetPortraitMode               (int portraitmode);
void        GrChangeProperty                (GR_WINDOW_ID wid,
                                             GR_CHAR *property,
                                             GR_PROP *data,
                                             GR_COUNT len);
GR_COUNT    GrGetWindowProperty             (GR_WINDOW_ID wid,
                                             GR_CHAR *property,
                                             GR_PROP **data);
GR_TIMER_ID GrCreateTimer                   (GR_WINDOW_ID wid,
                                             GR_TIMEOUT period,
                                             GR_BOOL periodic);
void        GrDestroyTimer                  (GR_TIMER_ID tid);

Description

Details

GrReqShmCmds ()

void        GrReqShmCmds                    (long shmsize);

Requests a shared memory area of the specified size to use for transferring command arguments. This is faster but less portable than the standard BSD sockets method of communication (and of course will only work if the client and server are on the same machine). Apart from the initial allocation of the area using this call, the use of shared memory is completely transparent. Additionally, if the allocation fails we silently and automatically fall back on socket communication. It is safe to call this function even if shared memory support is not compiled in; it will simply do nothing.

FIXME: how does the user decide what size of shared memory area to allocate?

shmsize : the size of the shared memory area to allocate


GrInjectKeyboardEvent ()

void        GrInjectKeyboardEvent           (GR_WINDOW_ID wid,
                                             GR_KEY keyvalue,
                                             GR_KEYMOD modifier,
                                             GR_SCANCODE scancode,
                                             GR_BOOL pressed);

Sends a keyboard event to the specified window, or to the window with the current keyboard focus if 0 is used as the ID. The other arguments correspond directly to the fields of the same names in the keyboard event structure.

wid : ID of the window to send the event to, or 0
keyvalue : the value of the key event to inject
modifier : modifiers (shift, ctrl, alt, etc.) to inject
scancode : the scancode of the key event to inject
pressed : whether to inject a key pressed or key released event


GrRegisterInput ()

void        GrRegisterInput                 (int fd);

Register an extra file descriptor to monitor in the main select() call. An event will be returned when the fd has data waiting to be read if that event has been selected for.

fd : the file descriptor to monitor


GrPrepareSelect ()

void        GrPrepareSelect                 (int *maxfd,
                                             void *rfdset);

Prepare for a GrServiceSelect function by asking the server to send the next event but not waiting around for it to arrive and initialising the specified fd_set structure with the client/server socket descriptor and any previously registered external file descriptors. Also compares the current contents of maxfd, the client/server socket descriptor, and the previously registered external file descriptors, and returns the highest of them in maxfd.

maxfd : pointer to a variable which the highest in use fd will be written to
rfdset : pointer to the file descriptor set structure to use


GrServiceSelect ()

void        GrServiceSelect                 (void *rfdset,
                                             GR_FNCALLBACKEVENT fncb);

Used by GrMainLoop() to call the specified callback function when an event arrives or there is data waiting on an external fd specified by GrRegisterInput().

rfdset : pointer to the file descriptor set to monitor
fncb : pointer to the function to call when an event needs handling


GrBell ()

void        GrBell                          (void);

Asks the server to ring the console bell on behalf of the client (intended for terminal apps to be able to ring the bell on the server even if they are running remotely).


GrSetScreenSaverTimeout ()

void        GrSetScreenSaverTimeout         (GR_TIMEOUT timeout);

Sets the number of seconds of inactivity before a screen saver activate event is sent to the root window ID. A value of 0 activates the screen saver immediately, and a value of -1 disables the screen saver function.

timeout : the number of seconds of inactivity before screen saver activates


GrQueryTree ()

void        GrQueryTree                     (GR_WINDOW_ID wid,
                                             GR_WINDOW_ID *parentid,
                                             GR_WINDOW_ID **children,
                                             GR_COUNT *nchildren);

Return the ID of the specified windows parent window and a list of the IDs of all its child windows. It is the callers responsibility to free the list of child windows when it is no longer required. On failure, the children pointer will be set to NULL.

wid : the window ID to start the tree from
parentid : pointer to a variable to return the parent ID in
children : pointer to a pointer to put the returned child window ID list in
nchildren : pointer to a variable to put the returned child window count in


GrSetPortraitMode ()

void        GrSetPortraitMode               (int portraitmode);

Changes the orientation of the screen. The four possible values are GR_PORTRAIT_NONE (no rotation), GR_PORTRAIT_LEFT (rotate left), GR_PORTRAIT_RIGHT (rotate right), and GR_PORTRAIT_DOWN (upside down). The window is automatically redrawn after changing the portrait mode. The current portrait mode can be discovered by retrieving the screeninfo structure using the GrGetScreenInfo() call, and looking at the value of the portrait member.

portraitmode : the value to set the portrait mode to


GrChangeProperty ()

void        GrChangeProperty                (GR_WINDOW_ID wid,
                                             GR_CHAR *property,
                                             GR_PROP *data,
                                             GR_COUNT len);

Changes the data stored in the specified property attached to the specified window. If the property does not already exist, it will be created. The property name should be a zero terminated string. To create a global property, attach it the root window (GR_ROOT_WINDOW_ID). If data is a null pointer but len is >= 1, the property is created with no data block attached to it. If len is 0, the property is deleted.

wid : the ID of the window the property is attached to
property : the name of the property
data : the data to be stored in the property
len : the length of the data to be stored in the property


GrGetWindowProperty ()

GR_COUNT    GrGetWindowProperty             (GR_WINDOW_ID wid,
                                             GR_CHAR *property,
                                             GR_PROP **data);

Searches for a property with the specified name in the list of properties attached to the specified window and returns the data block associated with the property. If no such property is found, the length is zero and the a null pointer is stored in the data pointer. If the property exists but no data block is associated with it, 1 is returned for the length and the data pointer is set to NULL. The data block is allocated with malloc() at call time, and it is the callers responsibility to free it when no longer needed. If the malloc() call fails the data pointer will be set to null.

wid : the ID of the window the property is attached to
property : the name of the property
data : pointer to a pointer to hold the address of the returned data
Returns : the length of the returned data block


GrCreateTimer ()

GR_TIMER_ID GrCreateTimer                   (GR_WINDOW_ID wid,
                                             GR_TIMEOUT period,
                                             GR_BOOL periodic);

Creates a new timer which will generate a GR_EVENT_TYPE_TIMER event after the specified period. The timer can be destroyed before it expires if required using the GrDestroyTimer() call. If you want to make a timer which will keep generating events every period ms instead of generating a single event, set periodic to GR_TRUE instead of GR_FALSE.

wid : the ID of the window the timeout event should be delivered to
period : the period in ms before the timer should expire
periodic : if true, make a periodic timer instead of a one shot
Returns : the ID of the timer


GrDestroyTimer ()

void        GrDestroyTimer                  (GR_TIMER_ID tid);

Destroys the specified timer. Note that it is possible for there to be one or more undelivered timer events already in the queue when GrDestroyTimer() is called, and they will still be delivered anyway.

tid : the ID of the timer to destroy