Fix multiple display/keyboard/mouse problem with some compilers.

ugfx_release_2.6
inmarket 2015-01-27 13:42:11 +10:00
parent b9f53aa793
commit adebde7a99
3 changed files with 15 additions and 17 deletions

View File

@ -554,26 +554,26 @@ static void line_clip(GDisplay *g) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
typedef const GDISPVMT const GDISPVMTLIST[];
void _gdispInit(void) void _gdispInit(void)
{ {
// GDISP_DRIVER_LIST is defined - create each driver instance // GDISP_DRIVER_LIST is defined - create each driver instance
#if defined(GDISP_DRIVER_LIST) #if defined(GDISP_DRIVER_LIST)
{ {
unsigned i; unsigned i;
typedef const GDISPVMT const GDISPVMTLIST[1];
extern GDISPVMTLIST GDISP_DRIVER_LIST; extern GDISPVMTLIST GDISP_DRIVER_LIST;
static GDISPVMTLIST dclist[] = {GDISP_DRIVER_LIST}; static const GDISPVMT * const dclist[] = {GDISP_DRIVER_LIST};
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
if (!(dclist[i]->d.flags & GDISP_VFLG_DYNAMICONLY)) if (!(dclist[i]->d.flags & GDISP_VFLG_DYNAMICONLY))
gdriverRegister(&dclist[i]->d, 0); gdriverRegister(&dclist[i]->d, 0);
}
} }
#elif GDISP_TOTAL_DISPLAYS > 1 #elif GDISP_TOTAL_DISPLAYS > 1
{ {
unsigned i; unsigned i;
extern GDISPVMTLIST GDISPVMT_OnlyOne; extern const GDISPVMT const GDISPVMT_OnlyOne[1];
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) { if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) {
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++) for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
@ -582,7 +582,7 @@ void _gdispInit(void)
} }
#else #else
{ {
extern GDISPVMTLIST GDISPVMT_OnlyOne; extern const GDISPVMT const GDISPVMT_OnlyOne[1];
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY))
gdriverRegister(&GDISPVMT_OnlyOne->d, 0); gdriverRegister(&GDISPVMT_OnlyOne->d, 0);

View File

@ -457,16 +457,15 @@ static void KeyboardPoll(void *param) {
} }
} }
typedef const GKeyboardVMT const GKEYBOARDVMTLIST[];
void _gkeyboardInit(void) { void _gkeyboardInit(void) {
// GINPUT_KEYBOARD_DRIVER_LIST is defined - create each driver instance // GINPUT_KEYBOARD_DRIVER_LIST is defined - create each driver instance
#if defined(GINPUT_KEYBOARD_DRIVER_LIST) #if defined(GINPUT_KEYBOARD_DRIVER_LIST)
{ {
int i; int i;
typedef const GKeyboardVMT const GKEYBOARDVMTLIST[1];
extern GKEYBOARDVMTLIST GINPUT_KEYBOARD_DRIVER_LIST; extern GKEYBOARDVMTLIST GINPUT_KEYBOARD_DRIVER_LIST;
static GKEYBOARDVMTLIST dclist[] = {GINPUT_KEYBOARD_DRIVER_LIST}; static const GKeyboardVMT * const dclist[] = {GINPUT_KEYBOARD_DRIVER_LIST};
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) { for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
if (!(dclist[i]->d.flags & GKEYBOARD_VFLG_DYNAMICONLY)) if (!(dclist[i]->d.flags & GKEYBOARD_VFLG_DYNAMICONLY))
@ -477,7 +476,7 @@ void _gkeyboardInit(void) {
// One and only one mouse // One and only one mouse
#else #else
{ {
extern GKEYBOARDVMTLIST GKEYBOARDVMT_OnlyOne; extern const GKeyboardVMT const GKEYBOARDVMT_OnlyOne[1];
if (!(GKEYBOARDVMT_OnlyOne->d.flags & GKEYBOARD_VFLG_DYNAMICONLY)) if (!(GKEYBOARDVMT_OnlyOne->d.flags & GKEYBOARD_VFLG_DYNAMICONLY))
gdriverRegister(&GKEYBOARDVMT_OnlyOne->d, 0); gdriverRegister(&GKEYBOARDVMT_OnlyOne->d, 0);

View File

@ -623,16 +623,15 @@ static void MousePoll(void *param) {
} }
#endif #endif
typedef const GMouseVMT const GMOUSEVMTLIST[];
void _gmouseInit(void) { void _gmouseInit(void) {
// GINPUT_MOUSE_DRIVER_LIST is defined - create each driver instance // GINPUT_MOUSE_DRIVER_LIST is defined - create each driver instance
#if defined(GINPUT_MOUSE_DRIVER_LIST) #if defined(GINPUT_MOUSE_DRIVER_LIST)
{ {
int i; int i;
typedef const GMouseVMT const GMOUSEVMTLIST[1];
extern GMOUSEVMTLIST GINPUT_MOUSE_DRIVER_LIST; extern GMOUSEVMTLIST GINPUT_MOUSE_DRIVER_LIST;
static GMOUSEVMTLIST dclist[] = {GINPUT_MOUSE_DRIVER_LIST}; static const GMouseVMT * const dclist[] = {GINPUT_MOUSE_DRIVER_LIST};
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) { for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
if (!(dclist[i]->d.flags & GMOUSE_VFLG_DYNAMICONLY)) if (!(dclist[i]->d.flags & GMOUSE_VFLG_DYNAMICONLY))
@ -643,7 +642,7 @@ void _gmouseInit(void) {
// One and only one mouse // One and only one mouse
#else #else
{ {
extern GMOUSEVMTLIST GMOUSEVMT_OnlyOne; extern const GMouseVMT const GMOUSEVMT_OnlyOne[1];
if (!(GMOUSEVMT_OnlyOne->d.flags & GMOUSE_VFLG_DYNAMICONLY)) if (!(GMOUSEVMT_OnlyOne->d.flags & GMOUSE_VFLG_DYNAMICONLY))
gdriverRegister(&GMOUSEVMT_OnlyOne->d, GDISP); gdriverRegister(&GMOUSEVMT_OnlyOne->d, GDISP);