Coding style, comments, duplicate symbols and other minor fixes
This commit is contained in:
parent
c451880d80
commit
377fe644d1
@ -316,10 +316,8 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g)
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
// Don't do anything if it is the same power mode
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr) {
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
default:
|
||||
return;
|
||||
@ -329,11 +327,8 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g)
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
// Don't do anything if it is the same power mode
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr) {
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
|
@ -3325,9 +3325,8 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
|
||||
}
|
||||
|
||||
coord_t gdispGetStringWidthCount(const char* str, font_t font, uint16_t count) {
|
||||
if (!str) {
|
||||
if (!str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// No mutex required as we only read static data
|
||||
#if GDISP_NEED_TEXT_KERNING
|
||||
@ -3338,11 +3337,6 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
|
||||
}
|
||||
|
||||
coord_t gdispGetStringWidth(const char* str, font_t font) {
|
||||
if (!str) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// No mutex required as we only read static data
|
||||
return gdispGetStringWidthCount(str, font, 0);
|
||||
}
|
||||
#endif
|
||||
|
@ -978,7 +978,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
|
||||
coord_t gdispGetCharWidth(char c, font_t font);
|
||||
|
||||
/**
|
||||
* @brief Get the pixel width of a string of a given length.
|
||||
* @brief Get the pixel width of a string of a given character length.
|
||||
* @return The width of the string in pixels.
|
||||
* @pre GDISP_NEED_TEXT must be TRUE in your gfxconf.h
|
||||
*
|
||||
|
@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
#if GINPUT_NEED_KEYBOARD
|
||||
static void _keyboardEvent(GWidgetObject* gw, GEventKeyboard* pke)
|
||||
static void ButtonKeyboard(GWidgetObject* gw, GEventKeyboard* pke)
|
||||
{
|
||||
// ENTER and SPACE keys to press the button
|
||||
if (pke->c[0] == GKEY_ENTER || pke->c[0] == GKEY_SPACE) {
|
||||
@ -115,7 +115,7 @@ static const gwidgetVMT buttonVMT = {
|
||||
#endif
|
||||
#if GINPUT_NEED_KEYBOARD
|
||||
{
|
||||
_keyboardEvent // Process keyboard events
|
||||
ButtonKeyboard // Process keyboard events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
|
@ -56,7 +56,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) {
|
||||
#endif
|
||||
|
||||
#if GINPUT_NEED_KEYBOARD
|
||||
static void _keyboardEvent(GWidgetObject* gw, GEventKeyboard* pke)
|
||||
static void CheckboxKeyboard(GWidgetObject* gw, GEventKeyboard* pke)
|
||||
{
|
||||
// Only react on KEYDOWN events. Ignore KEYUP events.
|
||||
if (pke->keystate & GKEYSTATE_KEYUP) {
|
||||
@ -110,7 +110,7 @@ static const gwidgetVMT checkboxVMT = {
|
||||
#endif
|
||||
#if GINPUT_NEED_KEYBOARD
|
||||
{
|
||||
_keyboardEvent // Process keyboard events
|
||||
CheckboxKeyboard // Process keyboard events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
|
@ -171,7 +171,7 @@ typedef struct gwinVMT {
|
||||
/**
|
||||
* @brief The current window manager
|
||||
*/
|
||||
extern GWindowManager* _GWINwm;
|
||||
extern GWindowManager *_GWINwm;
|
||||
extern bool_t _gwinFlashState;
|
||||
|
||||
#endif
|
||||
|
@ -152,9 +152,8 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
if (pke->bytecount == 1 && pke->c[0] == GKEY_TAB) {
|
||||
|
||||
// Only react on KEYDOWN events. Ignore KEYUP events.
|
||||
if (pke->keystate & GKEYSTATE_KEYUP) {
|
||||
if (pke->keystate & GKEYSTATE_KEYUP)
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the next widget
|
||||
bool_t foundWidget = FALSE;
|
||||
@ -169,9 +168,8 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
if (nextWidget == 0) {
|
||||
foundWidget = FALSE;
|
||||
// We go through the list twice - just to be sure
|
||||
if (endOfListDetected) {
|
||||
if (endOfListDetected)
|
||||
break;
|
||||
}
|
||||
endOfListDetected = TRUE;
|
||||
continue;
|
||||
}
|
||||
@ -199,12 +197,10 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
|
||||
// Redraw the new and the previous focused widget because they usually render differently when
|
||||
// they are not focused anymore (eg. no blinking cursor)
|
||||
if (prevWidget != 0) {
|
||||
if (prevWidget != 0)
|
||||
gwinRedraw(prevWidget);
|
||||
}
|
||||
if (nextWidget != 0) {
|
||||
if (nextWidget != 0)
|
||||
gwinRedraw(nextWidget);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -213,19 +209,16 @@ static void gwidgetEvent(void *param, GEvent *pe) {
|
||||
GHandle widgetInFocus = gwinGetFocus();
|
||||
if (widgetInFocus != 0) {
|
||||
// Make sure that it is a widget
|
||||
if (!gwinIsWidget(widgetInFocus)) {
|
||||
if (!gwinIsWidget(widgetInFocus))
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure that the widget is enabled and visible
|
||||
if (!(widgetInFocus->flags & GWIN_FLG_SYSVISIBLE) || !(widgetInFocus->flags & GWIN_FLG_ENABLED)) {
|
||||
if (!(widgetInFocus->flags & GWIN_FLG_SYSVISIBLE) || !(widgetInFocus->flags & GWIN_FLG_ENABLED))
|
||||
break;
|
||||
}
|
||||
|
||||
// Check whether this widget provides a method for handling keyboard events
|
||||
if (((gwidgetVMT*)widgetInFocus->vmt)->KeyboardEvent == 0) {
|
||||
if (((gwidgetVMT*)widgetInFocus->vmt)->KeyboardEvent == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// If we got this far we can finally pass the event
|
||||
((gwidgetVMT*)widgetInFocus->vmt)->KeyboardEvent((GWidgetObject*)widgetInFocus, pke);
|
||||
@ -457,9 +450,8 @@ const GWidgetStyle *gwinGetDefaultStyle(void) {
|
||||
}
|
||||
|
||||
void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||
if (!(gh->flags & GWIN_FLG_WIDGET)) {
|
||||
if (!(gh->flags & GWIN_FLG_WIDGET))
|
||||
return;
|
||||
}
|
||||
|
||||
// Dispose of the old string
|
||||
if ((gh->flags & GWIN_FLG_ALLOCTXT)) {
|
||||
@ -471,9 +463,9 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||
}
|
||||
|
||||
// Alloc the new text if required
|
||||
if (!text || !*text) {
|
||||
if (!text || !*text)
|
||||
gw->text = "";
|
||||
} else if (useAlloc) {
|
||||
else if (useAlloc) {
|
||||
char *str;
|
||||
|
||||
if ((str = gfxAlloc(strlen(text)+1))) {
|
||||
@ -481,10 +473,8 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||
strcpy(str, text);
|
||||
}
|
||||
gw->text = (const char *)str;
|
||||
} else {
|
||||
} else
|
||||
gw->text = text;
|
||||
}
|
||||
|
||||
_gwinUpdate(gh);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user