Nano-X API Reference Manual
<<< Previous Page | Home | Up |

# misc

## Name

misc —

## Synopsis

    void        GrReqShmCmds                    (long shmsize);
    void        GrInjectKeyboardEvent           (GR_WINDOW_ID wid,
                                                 GR_UNICODE uch,
                                                 GR_CHAR ch,
                                                 int modif,
                                                 int special,
                                                 unsigned char content);
    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);

## 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_UNICODE uch,
                                                 GR_CHAR ch,
                                                 int modif,
                                                 int special,
                                                 unsigned char content);

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
`uch` : | 32 bit Unicode keystroke value to inject
`ch` : | 8 bit ascii keystroke value to inject
`modif` : |
`special` : | special keys to inject
`content` : | mask specifying which arguments are valid

### 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

<<< Previous Page | Home | Up |
selections |