textio: create callback typedef cb_textio_input_t
This commit is contained in:
parent
c8ca1d242e
commit
6ed8f17136
|
|
@ -175,10 +175,11 @@ NullTextSize(text, size, r)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @typedef cb_textio_input_t */
|
||||||
void
|
void
|
||||||
nullStdin(fd, cdata)
|
nullStdin(
|
||||||
int fd;
|
int fd,
|
||||||
ClientData cdata;
|
ClientData cdata) /* notused */
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
TxInputEvent *event;
|
TxInputEvent *event;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ extern void GrOGLClose(), GrOGLFlush();
|
||||||
extern void GrOGLDelete(), GrOGLConfigure(), GrOGLRaise(), GrOGLLower();
|
extern void GrOGLDelete(), GrOGLConfigure(), GrOGLRaise(), GrOGLLower();
|
||||||
extern void GrOGLLock(), GrOGLUnlock(), GrOGLIconUpdate();
|
extern void GrOGLLock(), GrOGLUnlock(), GrOGLIconUpdate();
|
||||||
extern bool GrOGLInit(), GrOGLCreate();
|
extern bool GrOGLInit(), GrOGLCreate();
|
||||||
extern void grOGLWStdin();
|
extern void grOGLWStdin(int fd, ClientData cdata); /* cb_textio_input_t (unused) */
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------
|
/*---------------------------------------------------------
|
||||||
|
|
@ -418,8 +418,11 @@ oglSetProjection(llx, lly, width, height)
|
||||||
/* is a macro and can be re-implemented using XNextEvent() calls. */
|
/* is a macro and can be re-implemented using XNextEvent() calls. */
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @typedef cb_textio_input_t */
|
||||||
void
|
void
|
||||||
pipehandler()
|
pipehandler(
|
||||||
|
int fd,
|
||||||
|
ClientData cdata) /* notused */
|
||||||
{
|
{
|
||||||
TxInputEvent *event;
|
TxInputEvent *event;
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
|
|
@ -757,12 +760,12 @@ oglSetDisplay (dispType, outFileName, mouseFileName)
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
/** @typedef cb_textio_input_t */
|
||||||
void
|
void
|
||||||
grOGLWStdin(fd, cdata)
|
grOGLWStdin(
|
||||||
int fd;
|
int fd,
|
||||||
ClientData cdata;
|
ClientData cdata) /* notused */
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
TxInputEvent *event;
|
TxInputEvent *event;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ extern void GrX11Close(), GrX11Flush();
|
||||||
extern bool GrX11Init(), GrX11Create();
|
extern bool GrX11Init(), GrX11Create();
|
||||||
extern void GrX11Delete(), GrX11Configure(), GrX11Raise(), GrX11Lower();
|
extern void GrX11Delete(), GrX11Configure(), GrX11Raise(), GrX11Lower();
|
||||||
extern void GrX11Lock(), GrX11Unlock(), GrX11IconUpdate();
|
extern void GrX11Lock(), GrX11Unlock(), GrX11IconUpdate();
|
||||||
extern void grXWStdin();
|
extern void grXWStdin(int fd, ClientData cdata); /* cb_textio_input_t (unused) */
|
||||||
extern bool grx11GetCursorPos();
|
extern bool grx11GetCursorPos();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -739,7 +739,7 @@ GrX11Flush ()
|
||||||
/*
|
/*
|
||||||
* ---------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* grXStdin --
|
* grX11Stdin --
|
||||||
*
|
*
|
||||||
* Handle the stdin device for the X driver.
|
* Handle the stdin device for the X driver.
|
||||||
*
|
*
|
||||||
|
|
@ -752,8 +752,12 @@ GrX11Flush ()
|
||||||
* ---------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
/** @typedef cb_textio_input_t */
|
||||||
void
|
void
|
||||||
grX11Stdin()
|
grX11Stdin(
|
||||||
|
int fd,
|
||||||
|
ClientData cdata) /* notused */
|
||||||
{
|
{
|
||||||
TxInputEvent *event;
|
TxInputEvent *event;
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
|
|
@ -1104,10 +1108,11 @@ x11SetDisplay (dispType, outFileName, mouseFileName)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @typedef cb_textio_input_t */
|
||||||
void
|
void
|
||||||
grXWStdin(fd, cdata)
|
grXWStdin(
|
||||||
int fd;
|
int fd,
|
||||||
ClientData cdata;
|
ClientData cdata) /* notused */
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
TxInputEvent *event;
|
TxInputEvent *event;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ typedef struct {
|
||||||
fd_set tx_fdmask; /* A mask of the file descriptors for this
|
fd_set tx_fdmask; /* A mask of the file descriptors for this
|
||||||
* device.
|
* device.
|
||||||
*/
|
*/
|
||||||
void (*tx_inputProc)(); /* A procedure that fetches events and stores
|
cb_textio_input_t tx_inputProc;
|
||||||
|
/* A procedure that fetches events and stores
|
||||||
* them in the input queue via TxAddEvent().
|
* them in the input queue via TxAddEvent().
|
||||||
*/
|
*/
|
||||||
ClientData tx_cdata; /* Data to be passed back to caller. */
|
ClientData tx_cdata; /* Data to be passed back to caller. */
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,8 @@ TxAddInputDevice(
|
||||||
const fd_set *fdmask, /* A mask of file descriptors that this
|
const fd_set *fdmask, /* A mask of file descriptors that this
|
||||||
* device will handle.
|
* device will handle.
|
||||||
*/
|
*/
|
||||||
void (*inputProc)(), /* A routine to call. This routine will
|
const cb_textio_input_t inputProc,
|
||||||
|
/* A routine to call. This routine will
|
||||||
* be passed a single file descriptor that
|
* be passed a single file descriptor that
|
||||||
* is ready, and should read that file and
|
* is ready, and should read that file and
|
||||||
* add events(s) by calling TxNewEvent()
|
* add events(s) by calling TxNewEvent()
|
||||||
|
|
@ -484,7 +485,7 @@ TxAddInputDevice(
|
||||||
void
|
void
|
||||||
TxAdd1InputDevice(
|
TxAdd1InputDevice(
|
||||||
int fd,
|
int fd,
|
||||||
void (*inputProc)(),
|
const cb_textio_input_t inputProc,
|
||||||
ClientData cdata)
|
ClientData cdata)
|
||||||
{
|
{
|
||||||
fd_set fs;
|
fd_set fs;
|
||||||
|
|
@ -975,7 +976,7 @@ TxGetInputEvent(
|
||||||
FD_ISSET(fd, &(txInputDevice[i].tx_fdmask))) {
|
FD_ISSET(fd, &(txInputDevice[i].tx_fdmask))) {
|
||||||
lastNum = txNumInputEvents;
|
lastNum = txNumInputEvents;
|
||||||
(*(txInputDevice[i].tx_inputProc))
|
(*(txInputDevice[i].tx_inputProc))
|
||||||
(fd, txInputDevice[i].tx_cdata);
|
(fd, txInputDevice[i].tx_cdata); /** @invoke cb_textio_input_t */
|
||||||
FD_CLR(fd, &inputs);
|
FD_CLR(fd, &inputs);
|
||||||
/* Did this driver choose to add an event? */
|
/* Did this driver choose to add an event? */
|
||||||
if (txNumInputEvents != lastNum) gotSome = TRUE;
|
if (txNumInputEvents != lastNum) gotSome = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,9 @@ extern TxCommand TxCurCommand;
|
||||||
#define TX_KEY_DOWN 2
|
#define TX_KEY_DOWN 2
|
||||||
|
|
||||||
/* procedures to help in making device command routines */
|
/* procedures to help in making device command routines */
|
||||||
|
typedef void (*cb_textio_input_t)(int fd, ClientData cdata);
|
||||||
extern void TxAddInputDevice(const fd_set *fdmask, void (*inputProc)(), ClientData cdata); /* Can read multiple file desc. */
|
extern void TxAddInputDevice(const fd_set *fdmask, const cb_textio_input_t inputProc, ClientData cdata); /* Can read multiple file desc. */
|
||||||
extern void TxAdd1InputDevice(int fd, void (*inputProc)(), ClientData cdata); /* Can read only 1 file desc. */
|
extern void TxAdd1InputDevice(int fd, const cb_textio_input_t inputProc, ClientData cdata); /* Can read only 1 file desc. */
|
||||||
extern void TxDeleteInputDevice(const fd_set *fdmask);
|
extern void TxDeleteInputDevice(const fd_set *fdmask);
|
||||||
extern void TxDelete1InputDevice(int fd);
|
extern void TxDelete1InputDevice(int fd);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue