#include "clientlib.h"#include <ctype.h>#include <stdlib.h>#include <errno.h>Functions | |
| int | _pg_send (void *data, u32 datasize) |
| int | _pg_recv (void *data, u32 datasize) |
| int | _pg_recvtimeout (s16 *rsptype) |
| void * | _pg_malloc (size_t size) |
| void | _pg_defaulterr (u16 errortype, const char *msg) |
| void | _pgsig (int sig) |
| void | _pg_add_request (s16 reqtype, void *data, u32 datasize) |
| void | _pg_getresponse (int eventwait) |
| void | _pg_free_memdata (struct pgmemdata memdat) |
| char * | _pg_dynformat (const char *fmt, va_list ap) |
| void | _pg_idle (void) |
| void | pgInit (int argc, char **argv) |
| Initialize PicoGUI. | |
| void | pgSetErrorHandler (void(*handler)(u16 errortype, const char *msg)) |
| Replace the default error handler. | |
| const char * | pgErrortypeString (u16 errortype) |
| Convert a numerical errortype to a string. | |
| pgidlehandler | pgSetIdle (s32 t, pgidlehandler handler) |
| Set a handler to be called periodically. | |
| void | pgFlushRequests (void) |
| Flush all unsent request packets to the server. | |
| void | pgEventLoop (void) |
| Event processing and dispatching loop. | |
| void | pgDispatchEvent (struct pgEvent *evt) |
| Dispatch an event to registered handlers. | |
| void | pgExitEventLoop (void) |
| Exit the current event loop. | |
| pgEvent * | pgGetEvent (void) |
| Wait for a single event. | |
| void | pgBind (pghandle widgetkey, s16 eventkey, pgevthandler handler, void *extra) |
| Attatch an event handler to a widget and/or event. | |
| void | pgCustomizeSelect (pgselecthandler handler, pgselectbh bottomhalf) |
Variables | |
| int | _pgsockfd |
| s16 | _pgrequestid |
| s16 | _pgdefault_rship |
| pghandle | _pgdefault_widget |
| unsigned char | _pgeventloop_on |
| unsigned char | _pgreqbuffer [PG_REQBUFSIZE] |
| s16 | _pgreqbuffer_size |
| s16 | _pgreqbuffer_count |
| s16 | _pgreqbuffer_lasttype |
| void(* | _pgerrhandler )(u16 errortype, const char *msg) |
| _pghandlernode * | _pghandlerlist |
| timeval | _pgidle_period |
| pgidlehandler | _pgidle_handler |
| unsigned char | _pgidle_lock |
| char * | _pg_appname |
| pgselecthandler | _pgselect_handler |
| pgselectbh | _pgselect_bottomhalf |
| _pg_return_type | _pg_return |
| pghandle | _pg_appletbox |
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||||||||||
|
Attatch an event handler to a widget and/or event.
|
|
||||||||||||
|
|
|
|
Dispatch an event to registered handlers.
|
|
|
Convert a numerical errortype to a string.
|
|
|
Event processing and dispatching loop. pgEventLoop waits for events from the PicoGUI server and dispatches them according to bindings set up with pgBind. The handler set with pgSetIdle is also called if applicable. pgEventLoop can be called more than once throughout the life of the program, but it is not re-entrant. If the app recieves an event while it is not waiting in an EventLoop, the server will queue them until the client is ready.
|
|
|
Exit the current event loop. If the client is currently inside an event loop, this function sets a flag to exit it at the next possible opportunity
|
|
|
Flush all unsent request packets to the server. Usually this is handled automatically, but it is needed in some situations. For example, a remote input driver that has no real event loop, but needs to send keyboard or mouse events. The events would not actually be sent to the server until pgFlushRequests is called.
|
|
|
Wait for a single event.
You can also use this in combination with pgCheckEvent to passively check for new events while performing some other operation, such as animation. Important! Note that the returned pointer is only valid until the next PicoGUI call! It's usually a good idea to use something like this:
struct pgEvent evt; evt = *pgGetEvent(); If the relevant values from the pgEvent structure will be copied elsewhere before the next PicoGUI call, that is alright too. Thus, the following code is perfectly fine:
i = pgGetPayload( pgGetEvent()->from );
|
|
||||||||||||
|
Initialize PicoGUI. See if there are any command line args relevant to PicoGUI (such as for setting the PicoGUI server) and establish a connection to the server. This must be the first PicoGUI call in the client, and it should almost certainly be called before and command line processing. pgInit processes command line arguments beginning with "--pg" and removes them from the argument list and terminates argv[] with a NULL. This is compatible with optarg and probably other argument-processing systems. Currently the following arguments are handled:
Unrecognized commands beginning with "--pg" display a list of available commands. If it is unable to contact the server, a client error is triggered. The client does not need to explicitly disconnect from the PicoGUI server
|
|
|
Replace the default error handler.
The default error handler displays a message dialog allowing the user to optionally terminate the program. If it is unable to display the message dialog, the error is printed to stderr and the program is terminated.
|
|
||||||||||||
|
Set a handler to be called periodically.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.3-rc3