void fgPlatformRegisterDialDevice ( const char *dial_device ) {
fgWarning("GLUT_HAS_DIAL_AND_BUTTON_BOX: not implemented");
}
-SERIALPORT *serial_open ( const char *device ) { return NULL; }
-void serial_close(SERIALPORT *port) {}
-int serial_getchar(SERIALPORT *port) { return EOF; }
-int serial_putchar(SERIALPORT *port, unsigned char ch) { return 0; }
-void serial_flush ( SERIALPORT *port ) {}
+SERIALPORT *fg_serial_open ( const char *device ) { return NULL; }
+void fg_serial_close(SERIALPORT *port) {}
+int fg_serial_getchar(SERIALPORT *port) { return EOF; }
+int fg_serial_putchar(SERIALPORT *port, unsigned char ch) { return 0; }
+void fg_serial_flush ( SERIALPORT *port ) {}
/*****************************************************************/
-extern SERIALPORT *serial_open ( const char *device );
-extern void serial_close ( SERIALPORT *port );
-extern int serial_getchar ( SERIALPORT *port );
-extern int serial_putchar ( SERIALPORT *port, unsigned char ch );
-extern void serial_flush ( SERIALPORT *port );
+extern SERIALPORT *fg_serial_open ( const char *device );
+extern void fg_serial_close ( SERIALPORT *port );
+extern int fg_serial_getchar ( SERIALPORT *port );
+extern int fg_serial_putchar ( SERIALPORT *port, unsigned char ch );
+extern void fg_serial_flush ( SERIALPORT *port );
extern void fgPlatformRegisterDialDevice ( const char *dial_device );
static void send_dial_event(int dial, int value);
fgPlatformRegisterDialDevice ( dial_device );
if ( !dial_device ) return;
- if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;
- serial_putchar(dialbox_port,DIAL_INITIALIZE);
+ if ( !( dialbox_port = fg_serial_open ( dial_device ) ) ) return;
+ fg_serial_putchar(dialbox_port,DIAL_INITIALIZE);
glutTimerFunc ( 10, poll_dials, 0 );
fgState.InputDevsInitialised = GL_TRUE;
}
{
if ( fgState.InputDevsInitialised )
{
- serial_close ( dialbox_port );
+ fg_serial_close ( dialbox_port );
dialbox_port = NULL;
fgState.InputDevsInitialised = GL_FALSE;
}
if ( !dialbox_port ) return;
- while ( (data=serial_getchar(dialbox_port)) != EOF )
+ while ( (data=fg_serial_getchar(dialbox_port)) != EOF )
{
if ( ( dial_state > DIAL_WHICH_DEVICE ) || IS_DIAL_EVENT ( data ) )
{
{
fgState.InputDevsInitialised = GL_TRUE;
dial_state = DIAL_WHICH_DEVICE;
- serial_putchar(dialbox_port,DIAL_SET_AUTO_DIALS);
- serial_putchar(dialbox_port,0xff);
- serial_putchar(dialbox_port,0xff);
+ fg_serial_putchar(dialbox_port,DIAL_SET_AUTO_DIALS);
+ fg_serial_putchar(dialbox_port,0xff);
+ fg_serial_putchar(dialbox_port,0xff);
}
else /* Unknown data; try flushing. */
- serial_flush(dialbox_port);
+ fg_serial_flush(dialbox_port);
}
glutTimerFunc ( 2, poll_dials, 0 );
extern void fgPlatformSpaceballSetWindow(SFG_Window *window);
-int sball_initialized = 0;
+int fg_sball_initialized = 0;
void fgInitialiseSpaceball(void)
{
- if(sball_initialized != 0) {
+ if(fg_sball_initialized != 0) {
return;
}
int fgHasSpaceball(void)
{
- if(sball_initialized == 0) {
+ if(fg_sball_initialized == 0) {
fgInitialiseSpaceball();
- if(sball_initialized != 1) {
+ if(fg_sball_initialized != 1) {
fgWarning("fgInitialiseSpaceball failed\n");
return 0;
}
int fgSpaceballNumButtons(void)
{
- if(sball_initialized == 0) {
+ if(fg_sball_initialized == 0) {
fgInitialiseSpaceball();
- if(sball_initialized != 1) {
+ if(fg_sball_initialized != 1) {
fgWarning("fgInitialiseSpaceball failed\n");
return 0;
}
void fgSpaceballSetWindow(SFG_Window *window)
{
- if(sball_initialized == 0) {
+ if(fg_sball_initialized == 0) {
fgInitialiseSpaceball();
- if(sball_initialized != 1) {
+ if(fg_sball_initialized != 1) {
return;
}
}
} SERIALPORT;
/* Serial Port Prototypes */
-SERIALPORT *serial_open ( const char *device );
-void serial_close ( SERIALPORT *port );
-int serial_getchar ( SERIALPORT *port );
-int serial_putchar ( SERIALPORT *port, unsigned char ch );
-void serial_flush ( SERIALPORT *port );
+SERIALPORT *fg_serial_open ( const char *device );
+void fg_serial_close ( SERIALPORT *port );
+int fg_serial_getchar ( SERIALPORT *port );
+int fg_serial_putchar ( SERIALPORT *port, unsigned char ch );
+void fg_serial_flush ( SERIALPORT *port );
void fgPlatformRegisterDialDevice ( const char *dial_device )
/* Serial Port Functions */
-SERIALPORT *serial_open(const char *device){
+SERIALPORT *fg_serial_open(const char *device){
HANDLE fh;
DCB dcb={sizeof(DCB)};
COMMTIMEOUTS timeouts;
timeouts.WriteTotalTimeoutConstant=1;
SetCommTimeouts(fh,&timeouts);
- serial_flush(port);
+ fg_serial_flush(port);
return port;
}
-void serial_close(SERIALPORT *port){
+void fg_serial_close(SERIALPORT *port){
if (port){
/* restore old port settings */
SetCommState(port->fh,&port->dcb_save);
}
}
-int serial_getchar(SERIALPORT *port){
+int fg_serial_getchar(SERIALPORT *port){
DWORD n;
unsigned char ch;
if (!port) return EOF;
return EOF;
}
-int serial_putchar(SERIALPORT *port, unsigned char ch){
+int fg_serial_putchar(SERIALPORT *port, unsigned char ch){
DWORD n;
if (!port) return 0;
return WriteFile(port->fh,&ch,1,&n,NULL);
}
-void serial_flush ( SERIALPORT *port )
+void fg_serial_flush ( SERIALPORT *port )
{
FlushFileBuffers(port->fh);
}
SPNAV_EVENT_BUTTON /* includes both press and release */
};
-extern int sball_initialized;
+extern int fg_sball_initialized;
unsigned int __fgSpaceKeystate = 0;
RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
void fgPlatformInitializeSpaceball(void)
{
HWND hwnd;
- sball_initialized = 1;
+ fg_sball_initialized = 1;
if (!fgStructure.CurrentWindow)
{
- sball_initialized = 0;
+ fg_sball_initialized = 0;
return;
}
hwnd = fgStructure.CurrentWindow->Window.Handle;
if (!ok){
__fgSpaceball.hwndTarget = NULL;
- sball_initialized = 0;
+ fg_sball_initialized = 0;
}
}
}
UINT res;
RID_DEVICE_INFO sRidDeviceInfo;
- if (!sball_initialized)
+ if (!fg_sball_initialized)
{
fgPlatformInitializeSpaceball();
- if (!sball_initialized)
+ if (!fg_sball_initialized)
{
return;
}
}
}
-#endif
\ No newline at end of file
+#endif
typedef struct _serialport SERIALPORT;
-void serial_flush ( SERIALPORT *port );
+void fg_serial_flush ( SERIALPORT *port );
/*****************************************************************/
{
}
-SERIALPORT *serial_open ( const char *device )
+SERIALPORT *fg_serial_open ( const char *device )
{
int fd;
struct termios termio;
cfsetospeed(&termio, B9600);
tcsetattr(fd,TCSANOW,&termio);
- serial_flush(port);
+ fg_serial_flush(port);
return port;
}
-void serial_close(SERIALPORT *port)
+void fg_serial_close(SERIALPORT *port)
{
if (port)
{
}
}
-int serial_getchar(SERIALPORT *port)
+int fg_serial_getchar(SERIALPORT *port)
{
unsigned char ch;
if (!port) return EOF;
return EOF;
}
-int serial_putchar(SERIALPORT *port, unsigned char ch)
+int fg_serial_putchar(SERIALPORT *port, unsigned char ch)
{
if (!port) return 0;
return write(port->fd,&ch,1);
}
-void serial_flush ( SERIALPORT *port )
+void fg_serial_flush ( SERIALPORT *port )
{
tcflush ( port->fd, TCIOFLUSH );
}
#include <X11/Xlib.h>
-extern int sball_initialized;
+extern int fg_sball_initialized;
enum {
SPNAV_EVENT_ANY, /* used by spnav_remove_events() */
{
Window w;
- sball_initialized = 1;
+ fg_sball_initialized = 1;
if(!fgStructure.CurrentWindow)
{
- sball_initialized = -1;
+ fg_sball_initialized = -1;
return;
}
w = fgStructure.CurrentWindow->Window.Handle;
if(spnav_x11_open(fgDisplay.pDisplay.Display, w) == -1)
{
- sball_initialized = -1;
+ fg_sball_initialized = -1;
return;
}
}
fgSpaceballSetWindow(fgStructure.CurrentWindow);
}
- if(sball_initialized != 1) {
+ if(fg_sball_initialized != 1) {
return 0;
}
{
spnav_event sev;
- if(sball_initialized == 0) {
+ if(fg_sball_initialized == 0) {
fgInitialiseSpaceball();
- if(sball_initialized != 1) {
+ if(fg_sball_initialized != 1) {
return;
}
}
extern int fgPlatformGetModifiers( int state );
/* extension opcode for XInput */
-int xi_opcode = -1;
+static int xi_opcode = -1;
/**
* \brief Sets window up for XI2 events.