From af76c04767f3e5d1cc6f39ba907a7d4afdb43200 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 16 Aug 2015 22:05:32 +1000 Subject: [PATCH] Compile fixes --- demos/modules/gwin/textedit/main.c | 6 +++--- src/gwin/gwin_textedit.c | 20 +++++++++----------- src/gwin/gwin_widget.c | 9 +++++---- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/demos/modules/gwin/textedit/main.c b/demos/modules/gwin/textedit/main.c index 950475b5..ed52ccb2 100644 --- a/demos/modules/gwin/textedit/main.c +++ b/demos/modules/gwin/textedit/main.c @@ -35,7 +35,7 @@ static GHandle ghTextedit2; static GHandle ghTextedit3; static GListener gl; -static void guiCreate() +static void guiCreate(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); @@ -69,7 +69,7 @@ static void guiCreate() wi.g.height = 35; wi.text = "to switch between"; ghTextedit2 = gwinTexteditCreate(0, &wi, 20); - gwinTexteditSetBorder(ghTextedit2, FALSE); + //gwinTexteditSetBorder(ghTextedit2, FALSE); // TextEdit3 wi.g.show = TRUE; @@ -79,7 +79,7 @@ static void guiCreate() wi.g.height = 35; wi.text = "the different widgets"; ghTextedit3 = gwinTexteditCreate(0, &wi, 100); - gwinTexteditSetBorder(ghTextedit3, TRUE); + //gwinTexteditSetBorder(ghTextedit3, TRUE); } int main(void) { diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c index 5ea8936a..70a5f8f0 100644 --- a/src/gwin/gwin_textedit.c +++ b/src/gwin/gwin_textedit.c @@ -30,11 +30,11 @@ const int CURSOR_EXTRA_HEIGHT = 1; // cursorPos is the position of the next character // textBuffer[cursorPos++] = readKey(); -static void _shiftTextLeft(char* buffer, size_t bufferSize, size_t index) +static void _shiftTextLeft(char* buffer, size_t maxSize, size_t index) { // Find the end of the string size_t indexTerminator = index; - while (buffer[indexTerminator] != '\0' && indexTerminator < bufferSize-1) { + while (buffer[indexTerminator] != '\0' && indexTerminator < maxSize-1) { indexTerminator++; } @@ -45,11 +45,11 @@ static void _shiftTextLeft(char* buffer, size_t bufferSize, size_t index) buffer[indexTerminator-1] = '\0'; } -static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char fillChar) +static void _shiftTextRight(char* buffer, size_t maxSize, size_t index, char fillChar) { // Find the end of the string size_t indexTerminator = index; - while (buffer[indexTerminator] != '\0' && indexTerminator < bufferSize-1) { + while (buffer[indexTerminator] != '\0' && indexTerminator < maxSize-1) { indexTerminator++; } @@ -98,7 +98,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char if (gw2obj->cursorPos == 0) { return; } - _shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos--); + _shiftTextLeft(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos--); } // Is it delete? @@ -107,7 +107,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char if (gw2obj->textBuffer[gw2obj->cursorPos] == '\0') { return; } - _shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos+1); + _shiftTextLeft(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos+1); } // Add a new character @@ -117,7 +117,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char return; // Shift everything right from the cursor by one character. This includes the '\0'. Then inser the new character. - _shiftTextRight(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos++, pke->c[0]); + _shiftTextRight(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos++, pke->c[0]); } // Set the new text @@ -172,21 +172,19 @@ static const gwidgetVMT texteditVMT = { GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, size_t maxSize) { - uint16_t flags = 0; - // Create the underlying widget if (!(wt = (GTexteditObject*)_gwidgetCreate(g, &wt->w, pInit, &texteditVMT))) return 0; // Allocate the text buffer wt->maxSize = maxSize; - wt->textBuffer = gfxAlloc(widget->maxSize); + wt->textBuffer = gfxAlloc(wt->maxSize); if (wt->textBuffer == 0) return 0; // Initialize the text buffer size_t i = 0; - for (i = 0; i < bufSize; i++) { + for (i = 0; i < wt->maxSize; i++) { wt->textBuffer[i] = '\0'; } diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c index 6ef148a6..fceb65c8 100644 --- a/src/gwin/gwin_widget.c +++ b/src/gwin/gwin_widget.c @@ -223,6 +223,7 @@ static void gwidgetEvent(void *param, GEvent *pe) { #undef pme #undef pte + #undef pke #undef pde } @@ -296,7 +297,7 @@ static void gwidgetEvent(void *param, GEvent *pe) { // This new window still needs to be marked for redraw (but don't actually do it yet). gh->flags |= GWIN_FLG_NEEDREDRAW; - RedrawPending |= DOREDRAW_VISIBLES; + // RedrawPending |= DOREDRAW_VISIBLES; - FIX LATER return; } } @@ -305,13 +306,13 @@ static void gwidgetEvent(void *param, GEvent *pe) { _widgetInFocus = 0; } - void _gwidgetDrawFocusRect(GWidgetObject *gw, coord_t x, coord_t y, coord_t cx, coord_t cy) { + void _gwidgetDrawFocusRect(GWidgetObject *gx, coord_t x, coord_t y, coord_t cx, coord_t cy) { // Don't do anything if we don't have the focus - if (&gw->g != _widgetInFocus) + if (&gx->g != _widgetInFocus) return; // Use the very simplest possible focus rectangle for now. - gdispGDrawBox(gw->g.display, gw->g.x+x, gw->g.y+y, cx, cy, gw->pstyle.focus); + gdispGDrawBox(gx->g.display, gx->g.x+x, gx->g.y+y, cx, cy, gx->pstyle->focus); } #endif