aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-02-03 18:23:53 +1000
committerinmarket <andrewh@inmarket.com.au>2014-02-03 18:23:53 +1000
commitf26581dc7e85f77393143a44c0c3eb3eef0da8b4 (patch)
tree9a83c5eaf1abe2cc61b216012f997e6891840a19 /src/gwin
parentb6daaabf32bf2092689e0732ca4486f25e80317f (diff)
parentd869d9b3b80cb9ab2314840b2fa274e89e5342db (diff)
downloaduGFX-f26581dc7e85f77393143a44c0c3eb3eef0da8b4.tar.gz
uGFX-f26581dc7e85f77393143a44c0c3eb3eef0da8b4.tar.bz2
uGFX-f26581dc7e85f77393143a44c0c3eb3eef0da8b4.zip
Merge branch 'master' into freertos
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/console.c2
-rw-r--r--src/gwin/gwidget.c10
-rw-r--r--src/gwin/gwin.c21
-rw-r--r--src/gwin/gwm.c8
-rw-r--r--src/gwin/list.c7
5 files changed, 39 insertions, 9 deletions
diff --git a/src/gwin/console.c b/src/gwin/console.c
index ef374220..623404be 100644
--- a/src/gwin/console.c
+++ b/src/gwin/console.c
@@ -285,7 +285,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p
gcw->bufsize *= gh->height / gdispGetFontMetric(gh->font, fontHeight);
// Allocate the buffer
- if (!(gcw->buffer = (char*)gfxAlloc(gcw->bufsize)))
+ if (!(gcw->buffer = gfxAlloc(gcw->bufsize)))
return FALSE;
// All good!
diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c
index db9dc9fa..75a69667 100644
--- a/src/gwin/gwidget.c
+++ b/src/gwin/gwidget.c
@@ -224,11 +224,17 @@ static void gwidgetEvent(void *param, GEvent *pe) {
}
#endif
-void _gwidgetInit(void) {
+void _gwidgetInit(void)
+{
geventListenerInit(&gl);
geventRegisterCallback(&gl, gwidgetEvent, 0);
}
+void _gwidgetDeinit(void)
+{
+ /* ToDo */
+}
+
GHandle _gwidgetCreate(GDisplay *g, GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt) {
if (!(pgw = (GWidgetObject *)_gwindowCreate(g, &pgw->g, &pInit->g, &vmt->g, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED)))
return 0;
@@ -338,7 +344,7 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
else if (useAlloc) {
char *str;
- if ((str = (char *)gfxAlloc(strlen(text)+1))) {
+ if ((str = gfxAlloc(strlen(text)+1))) {
gh->flags |= GWIN_FLG_ALLOCTXT;
strcpy(str, text);
}
diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c
index 6b9cb81e..485ccaaa 100644
--- a/src/gwin/gwin.c
+++ b/src/gwin/gwin.c
@@ -84,7 +84,8 @@ static color_t defaultBgColor = Black;
* Class Routines
*-----------------------------------------------*/
-void _gwinInit(void) {
+void _gwinInit(void)
+{
#if GWIN_NEED_WIDGET
extern void _gwidgetInit(void);
@@ -97,12 +98,26 @@ void _gwinInit(void) {
#endif
}
+void _gwinDeinit(void)
+{
+ #if GWIN_NEED_WIDGET
+ extern void _gwidgetDeinit(void);
+
+ _gwidgetDeinit();
+ #endif
+ #if GWIN_NEED_WINDOWMANAGER
+ extern void _gwmDeinit(void);
+
+ _gwmDeinit();
+ #endif
+}
+
// Internal routine for use by GWIN components only
// Initialise a window creating it dynamically if required.
GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) {
// Allocate the structure if necessary
if (!pgw) {
- if (!(pgw = (GWindowObject *)gfxAlloc(vmt->size)))
+ if (!(pgw = gfxAlloc(vmt->size)))
return 0;
pgw->flags = flags|GWIN_FLG_DYNAMIC;
} else
@@ -167,7 +182,9 @@ color_t gwinGetDefaultBgColor(void) {
GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit) {
if (!(pgw = _gwindowCreate(g, pgw, pInit, &basegwinVMT, 0)))
return 0;
+
gwinSetVisible(pgw, pInit->show);
+
return pgw;
}
diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c
index f4dd8090..e7a71737 100644
--- a/src/gwin/gwm.c
+++ b/src/gwin/gwm.c
@@ -60,7 +60,8 @@ GWindowManager * _GWINwm;
* Window Routines
*-----------------------------------------------*/
-void _gwmInit(void) {
+void _gwmInit(void)
+{
gfxQueueASyncInit(&_GWINList);
_GWINwm = (GWindowManager *)&GNullWindowManager;
_GWINwm->vmt->Init();
@@ -70,6 +71,11 @@ void _gwmInit(void) {
#endif
}
+void _gwmDeinit(void)
+{
+ /* ToDo */
+}
+
void gwinSetWindowManager(struct GWindowManager *gwm) {
if (!gwm)
gwm = (GWindowManager *)&GNullWindowManager;
diff --git a/src/gwin/list.c b/src/gwin/list.c
index 0f09e86e..972ea1ab 100644
--- a/src/gwin/list.c
+++ b/src/gwin/list.c
@@ -431,13 +431,14 @@ int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
ListItem *newItem;
if (useAlloc) {
- if (!(newItem = (ListItem *)gfxAlloc(sizeof(ListItem)+strlen(item_name)+1)))
+ size_t len = strlen(item_name)+1;
+ if (!(newItem = gfxAlloc(sizeof(ListItem) + len)))
return -1;
- strcpy((char *)(newItem+1), item_name);
+ memcpy((char *)(newItem+1), item_name, len);
item_name = (const char *)(newItem+1);
} else {
- if (!(newItem = (ListItem *)gfxAlloc(sizeof(ListItem))))
+ if (!(newItem = gfxAlloc(sizeof(ListItem))))
return -1;
}