aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/gwin_wm.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-08-13 01:13:36 +0200
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-08-13 01:13:36 +0200
commit3ba3be201cddf3c6a4606f49028fc6640da0b28e (patch)
treed1b4e580a0ca258516da026c1d6966561d751dce /src/gwin/gwin_wm.c
parent37a088efb73e119a6675241394926cdb47c11ab2 (diff)
downloaduGFX-3ba3be201cddf3c6a4606f49028fc6640da0b28e.tar.gz
uGFX-3ba3be201cddf3c6a4606f49028fc6640da0b28e.tar.bz2
uGFX-3ba3be201cddf3c6a4606f49028fc6640da0b28e.zip
Adding gwinSetFocus() and gwinGetFocus()
Diffstat (limited to 'src/gwin/gwin_wm.c')
-rw-r--r--src/gwin/gwin_wm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c
index 00365c36..52f7a1aa 100644
--- a/src/gwin/gwin_wm.c
+++ b/src/gwin/gwin_wm.c
@@ -162,7 +162,7 @@
extern const GWindowManager GNullWindowManager;
GWindowManager * _GWINwm;
bool_t _gwinFlashState;
-
+static GHandle _widgetInFocus;
static gfxSem gwinsem;
static gfxQueueASync _GWINList;
#if GWIN_NEED_FLASHING
@@ -184,6 +184,8 @@ static volatile uint8_t RedrawPending;
void _gwmInit(void)
{
+ _widgetInFocus = 0;
+
gfxSemInit(&gwinsem, 1, 1);
gfxQueueASyncInit(&_GWINList);
#if GWIN_NEED_FLASHING
@@ -571,6 +573,25 @@ GHandle gwinGetNextWindow(GHandle gh) {
return gh ? (GHandle)gfxQueueASyncNext(&gh->wmq) : (GHandle)gfxQueueASyncPeek(&_GWINList);
}
+void gwinSetFocus(GHandle gh) {
+ // Passing NULL removes the focus from any widget
+ if (gh == 0) {
+ _widgetInFocus = 0;
+ return;
+ }
+
+ // Only accept widgets
+ if (!gwinIsWidget(gh)) {
+ return;
+ }
+
+ _widgetInFocus = gh;
+}
+
+GHandle gwinGetFocus(void) {
+ return _widgetInFocus;
+}
+
#if GWIN_NEED_FLASHING
static void FlashTimerFn(void *param) {
GHandle gh;