Merge remote-tracking branch 'svn/trunk' into git_master

This commit is contained in:
Diederick C. Niehorster 2019-09-02 22:12:58 +02:00
commit 9e9347eebc
8 changed files with 59 additions and 59 deletions

View File

@ -45,8 +45,8 @@ typedef struct _serialport SERIALPORT;
void fgPlatformRegisterDialDevice ( const char *dial_device ) { void fgPlatformRegisterDialDevice ( const char *dial_device ) {
fgWarning("GLUT_HAS_DIAL_AND_BUTTON_BOX: not implemented"); fgWarning("GLUT_HAS_DIAL_AND_BUTTON_BOX: not implemented");
} }
SERIALPORT *serial_open ( const char *device ) { return NULL; } SERIALPORT *fg_serial_open ( const char *device ) { return NULL; }
void serial_close(SERIALPORT *port) {} void fg_serial_close(SERIALPORT *port) {}
int serial_getchar(SERIALPORT *port) { return EOF; } int fg_serial_getchar(SERIALPORT *port) { return EOF; }
int serial_putchar(SERIALPORT *port, unsigned char ch) { return 0; } int fg_serial_putchar(SERIALPORT *port, unsigned char ch) { return 0; }
void serial_flush ( SERIALPORT *port ) {} void fg_serial_flush ( SERIALPORT *port ) {}

View File

@ -71,11 +71,11 @@ typedef struct _serialport SERIALPORT;
/*****************************************************************/ /*****************************************************************/
extern SERIALPORT *serial_open ( const char *device ); extern SERIALPORT *fg_serial_open ( const char *device );
extern void serial_close ( SERIALPORT *port ); extern void fg_serial_close ( SERIALPORT *port );
extern int serial_getchar ( SERIALPORT *port ); extern int fg_serial_getchar ( SERIALPORT *port );
extern int serial_putchar ( SERIALPORT *port, unsigned char ch ); extern int fg_serial_putchar ( SERIALPORT *port, unsigned char ch );
extern void serial_flush ( SERIALPORT *port ); extern void fg_serial_flush ( SERIALPORT *port );
extern void fgPlatformRegisterDialDevice ( const char *dial_device ); extern void fgPlatformRegisterDialDevice ( const char *dial_device );
static void send_dial_event(int dial, int value); static void send_dial_event(int dial, int value);
@ -114,8 +114,8 @@ void fgInitialiseInputDevices ( void )
fgPlatformRegisterDialDevice ( dial_device ); fgPlatformRegisterDialDevice ( dial_device );
if ( !dial_device ) return; if ( !dial_device ) return;
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return; if ( !( dialbox_port = fg_serial_open ( dial_device ) ) ) return;
serial_putchar(dialbox_port,DIAL_INITIALIZE); fg_serial_putchar(dialbox_port,DIAL_INITIALIZE);
glutTimerFunc ( 10, poll_dials, 0 ); glutTimerFunc ( 10, poll_dials, 0 );
fgState.InputDevsInitialised = GL_TRUE; fgState.InputDevsInitialised = GL_TRUE;
} }
@ -128,7 +128,7 @@ void fgInputDeviceClose( void )
{ {
if ( fgState.InputDevsInitialised ) if ( fgState.InputDevsInitialised )
{ {
serial_close ( dialbox_port ); fg_serial_close ( dialbox_port );
dialbox_port = NULL; dialbox_port = NULL;
fgState.InputDevsInitialised = GL_FALSE; fgState.InputDevsInitialised = GL_FALSE;
} }
@ -165,7 +165,7 @@ static void poll_dials ( int id )
if ( !dialbox_port ) return; 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 ) ) if ( ( dial_state > DIAL_WHICH_DEVICE ) || IS_DIAL_EVENT ( data ) )
{ {
@ -194,12 +194,12 @@ static void poll_dials ( int id )
{ {
fgState.InputDevsInitialised = GL_TRUE; fgState.InputDevsInitialised = GL_TRUE;
dial_state = DIAL_WHICH_DEVICE; dial_state = DIAL_WHICH_DEVICE;
serial_putchar(dialbox_port,DIAL_SET_AUTO_DIALS); fg_serial_putchar(dialbox_port,DIAL_SET_AUTO_DIALS);
serial_putchar(dialbox_port,0xff); fg_serial_putchar(dialbox_port,0xff);
serial_putchar(dialbox_port,0xff); fg_serial_putchar(dialbox_port,0xff);
} }
else /* Unknown data; try flushing. */ else /* Unknown data; try flushing. */
serial_flush(dialbox_port); fg_serial_flush(dialbox_port);
} }
glutTimerFunc ( 2, poll_dials, 0 ); glutTimerFunc ( 2, poll_dials, 0 );

View File

@ -22,11 +22,11 @@ extern int fgPlatformSpaceballNumButtons(void);
extern void fgPlatformSpaceballSetWindow(SFG_Window *window); extern void fgPlatformSpaceballSetWindow(SFG_Window *window);
int sball_initialized = 0; int fg_sball_initialized = 0;
void fgInitialiseSpaceball(void) void fgInitialiseSpaceball(void)
{ {
if(sball_initialized != 0) { if(fg_sball_initialized != 0) {
return; return;
} }
@ -40,9 +40,9 @@ void fgSpaceballClose(void)
int fgHasSpaceball(void) int fgHasSpaceball(void)
{ {
if(sball_initialized == 0) { if(fg_sball_initialized == 0) {
fgInitialiseSpaceball(); fgInitialiseSpaceball();
if(sball_initialized != 1) { if(fg_sball_initialized != 1) {
fgWarning("fgInitialiseSpaceball failed\n"); fgWarning("fgInitialiseSpaceball failed\n");
return 0; return 0;
} }
@ -53,9 +53,9 @@ int fgHasSpaceball(void)
int fgSpaceballNumButtons(void) int fgSpaceballNumButtons(void)
{ {
if(sball_initialized == 0) { if(fg_sball_initialized == 0) {
fgInitialiseSpaceball(); fgInitialiseSpaceball();
if(sball_initialized != 1) { if(fg_sball_initialized != 1) {
fgWarning("fgInitialiseSpaceball failed\n"); fgWarning("fgInitialiseSpaceball failed\n");
return 0; return 0;
} }
@ -66,9 +66,9 @@ int fgSpaceballNumButtons(void)
void fgSpaceballSetWindow(SFG_Window *window) void fgSpaceballSetWindow(SFG_Window *window)
{ {
if(sball_initialized == 0) { if(fg_sball_initialized == 0) {
fgInitialiseSpaceball(); fgInitialiseSpaceball();
if(sball_initialized != 1) { if(fg_sball_initialized != 1) {
return; return;
} }
} }

View File

@ -38,11 +38,11 @@ typedef struct {
} SERIALPORT; } SERIALPORT;
/* Serial Port Prototypes */ /* Serial Port Prototypes */
SERIALPORT *serial_open ( const char *device ); SERIALPORT *fg_serial_open ( const char *device );
void serial_close ( SERIALPORT *port ); void fg_serial_close ( SERIALPORT *port );
int serial_getchar ( SERIALPORT *port ); int fg_serial_getchar ( SERIALPORT *port );
int serial_putchar ( SERIALPORT *port, unsigned char ch ); int fg_serial_putchar ( SERIALPORT *port, unsigned char ch );
void serial_flush ( SERIALPORT *port ); void fg_serial_flush ( SERIALPORT *port );
void fgPlatformRegisterDialDevice ( const char *dial_device ) void fgPlatformRegisterDialDevice ( const char *dial_device )
@ -63,7 +63,7 @@ void fgPlatformRegisterDialDevice ( const char *dial_device )
/* Serial Port Functions */ /* Serial Port Functions */
SERIALPORT *serial_open(const char *device){ SERIALPORT *fg_serial_open(const char *device){
HANDLE fh; HANDLE fh;
DCB dcb={sizeof(DCB)}; DCB dcb={sizeof(DCB)};
COMMTIMEOUTS timeouts; COMMTIMEOUTS timeouts;
@ -90,12 +90,12 @@ SERIALPORT *serial_open(const char *device){
timeouts.WriteTotalTimeoutConstant=1; timeouts.WriteTotalTimeoutConstant=1;
SetCommTimeouts(fh,&timeouts); SetCommTimeouts(fh,&timeouts);
serial_flush(port); fg_serial_flush(port);
return port; return port;
} }
void serial_close(SERIALPORT *port){ void fg_serial_close(SERIALPORT *port){
if (port){ if (port){
/* restore old port settings */ /* restore old port settings */
SetCommState(port->fh,&port->dcb_save); SetCommState(port->fh,&port->dcb_save);
@ -105,7 +105,7 @@ void serial_close(SERIALPORT *port){
} }
} }
int serial_getchar(SERIALPORT *port){ int fg_serial_getchar(SERIALPORT *port){
DWORD n; DWORD n;
unsigned char ch; unsigned char ch;
if (!port) return EOF; if (!port) return EOF;
@ -114,13 +114,13 @@ int serial_getchar(SERIALPORT *port){
return EOF; return EOF;
} }
int serial_putchar(SERIALPORT *port, unsigned char ch){ int fg_serial_putchar(SERIALPORT *port, unsigned char ch){
DWORD n; DWORD n;
if (!port) return 0; if (!port) return 0;
return WriteFile(port->fh,&ch,1,&n,NULL); return WriteFile(port->fh,&ch,1,&n,NULL);
} }
void serial_flush ( SERIALPORT *port ) void fg_serial_flush ( SERIALPORT *port )
{ {
FlushFileBuffers(port->fh); FlushFileBuffers(port->fh);
} }

View File

@ -49,17 +49,17 @@ enum {
SPNAV_EVENT_BUTTON /* includes both press and release */ SPNAV_EVENT_BUTTON /* includes both press and release */
}; };
extern int sball_initialized; extern int fg_sball_initialized;
unsigned int __fgSpaceKeystate = 0; unsigned int __fgSpaceKeystate = 0;
RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 }; RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
void fgPlatformInitializeSpaceball(void) void fgPlatformInitializeSpaceball(void)
{ {
HWND hwnd; HWND hwnd;
sball_initialized = 1; fg_sball_initialized = 1;
if (!fgStructure.CurrentWindow) if (!fgStructure.CurrentWindow)
{ {
sball_initialized = 0; fg_sball_initialized = 0;
return; return;
} }
hwnd = fgStructure.CurrentWindow->Window.Handle; hwnd = fgStructure.CurrentWindow->Window.Handle;
@ -72,7 +72,7 @@ void fgPlatformInitializeSpaceball(void)
if (!ok){ if (!ok){
__fgSpaceball.hwndTarget = NULL; __fgSpaceball.hwndTarget = NULL;
sball_initialized = 0; fg_sball_initialized = 0;
} }
} }
} }
@ -113,10 +113,10 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
UINT res; UINT res;
RID_DEVICE_INFO sRidDeviceInfo; RID_DEVICE_INFO sRidDeviceInfo;
if (!sball_initialized) if (!fg_sball_initialized)
{ {
fgPlatformInitializeSpaceball(); fgPlatformInitializeSpaceball();
if (!sball_initialized) if (!fg_sball_initialized)
{ {
return; return;
} }
@ -196,4 +196,4 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
#endif #endif

View File

@ -48,7 +48,7 @@ struct _serialport {
typedef struct _serialport SERIALPORT; typedef struct _serialport SERIALPORT;
void serial_flush ( SERIALPORT *port ); void fg_serial_flush ( SERIALPORT *port );
/*****************************************************************/ /*****************************************************************/
@ -59,7 +59,7 @@ void fgPlatformRegisterDialDevice ( const char *dial_device )
{ {
} }
SERIALPORT *serial_open ( const char *device ) SERIALPORT *fg_serial_open ( const char *device )
{ {
int fd; int fd;
struct termios termio; struct termios termio;
@ -88,11 +88,11 @@ SERIALPORT *serial_open ( const char *device )
cfsetospeed(&termio, B9600); cfsetospeed(&termio, B9600);
tcsetattr(fd,TCSANOW,&termio); tcsetattr(fd,TCSANOW,&termio);
serial_flush(port); fg_serial_flush(port);
return port; return port;
} }
void serial_close(SERIALPORT *port) void fg_serial_close(SERIALPORT *port)
{ {
if (port) if (port)
{ {
@ -103,7 +103,7 @@ void serial_close(SERIALPORT *port)
} }
} }
int serial_getchar(SERIALPORT *port) int fg_serial_getchar(SERIALPORT *port)
{ {
unsigned char ch; unsigned char ch;
if (!port) return EOF; if (!port) return EOF;
@ -111,13 +111,13 @@ int serial_getchar(SERIALPORT *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; if (!port) return 0;
return write(port->fd,&ch,1); return write(port->fd,&ch,1);
} }
void serial_flush ( SERIALPORT *port ) void fg_serial_flush ( SERIALPORT *port )
{ {
tcflush ( port->fd, TCIOFLUSH ); tcflush ( port->fd, TCIOFLUSH );
} }

View File

@ -14,7 +14,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
extern int sball_initialized; extern int fg_sball_initialized;
enum { enum {
SPNAV_EVENT_ANY, /* used by spnav_remove_events() */ SPNAV_EVENT_ANY, /* used by spnav_remove_events() */
@ -56,17 +56,17 @@ void fgPlatformInitializeSpaceball(void)
{ {
Window w; Window w;
sball_initialized = 1; fg_sball_initialized = 1;
if(!fgStructure.CurrentWindow) if(!fgStructure.CurrentWindow)
{ {
sball_initialized = -1; fg_sball_initialized = -1;
return; return;
} }
w = fgStructure.CurrentWindow->Window.Handle; w = fgStructure.CurrentWindow->Window.Handle;
if(spnav_x11_open(fgDisplay.pDisplay.Display, w) == -1) if(spnav_x11_open(fgDisplay.pDisplay.Display, w) == -1)
{ {
sball_initialized = -1; fg_sball_initialized = -1;
return; return;
} }
} }
@ -105,7 +105,7 @@ int fgIsSpaceballXEvent(const XEvent *xev)
fgSpaceballSetWindow(fgStructure.CurrentWindow); fgSpaceballSetWindow(fgStructure.CurrentWindow);
} }
if(sball_initialized != 1) { if(fg_sball_initialized != 1) {
return 0; return 0;
} }
@ -116,9 +116,9 @@ void fgSpaceballHandleXEvent(const XEvent *xev)
{ {
spnav_event sev; spnav_event sev;
if(sball_initialized == 0) { if(fg_sball_initialized == 0) {
fgInitialiseSpaceball(); fgInitialiseSpaceball();
if(sball_initialized != 1) { if(fg_sball_initialized != 1) {
return; return;
} }
} }

View File

@ -20,7 +20,7 @@
extern int fgPlatformGetModifiers( int state ); extern int fgPlatformGetModifiers( int state );
/* extension opcode for XInput */ /* extension opcode for XInput */
int xi_opcode = -1; static int xi_opcode = -1;
/** /**
* \brief Sets window up for XI2 events. * \brief Sets window up for XI2 events.