diff options
author | Joel Bodenmann <joel@embedded.pro> | 2016-07-25 17:03:27 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@embedded.pro> | 2016-07-25 17:03:27 +0200 |
commit | 1853f9d014c7eeec984d2e7e39b7d2fc4d63e273 (patch) | |
tree | c087c74c5cae74a147f679bc4c779091a26a1f5c /src | |
parent | dded46b567c21be30b0044bc1e332c0b0028feb7 (diff) | |
download | uGFX-1853f9d014c7eeec984d2e7e39b7d2fc4d63e273.tar.gz uGFX-1853f9d014c7eeec984d2e7e39b7d2fc4d63e273.tar.bz2 uGFX-1853f9d014c7eeec984d2e7e39b7d2fc4d63e273.zip |
Fixing bug in WM_Raise()
Diffstat (limited to 'src')
-rw-r--r-- | src/gwin/gwin_wm.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c index ee951335..9f5010b2 100644 --- a/src/gwin/gwin_wm.c +++ b/src/gwin/gwin_wm.c @@ -989,29 +989,31 @@ static void WM_Raise(GHandle gh) { gfxQueueASyncPut(&_GWINList, &gh->wmq); #if GWIN_NEED_CONTAINERS - // Any children need to be moved + // Any children need to be raised too if ((gh->flags & GWIN_FLG_CONTAINER)) { + GHandle gx = gh; GHandle child; bool_t restart; - // Raise the children too. - // Note children can also have their own children so after each move required we have to start again. - for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { - if ((gh->flags & GWIN_FLG_CONTAINER)) { + // Raise the children too + // Note: Children can also have their own children so after each move we have to start again. + for (gx = gwinGetNextWindow(0); gx; gx = gwinGetNextWindow(gx)) { + if ((gx->flags & GWIN_FLG_CONTAINER)) { restart = FALSE; - for(child = gwinGetNextWindow(0); child && child != gh; child = gwinGetNextWindow(child)) { - if (child->parent == gh) { - // Oops - this child is behind its parent + for (child = gwinGetNextWindow(0); child && child != gx; child = gwinGetNextWindow(child)) { + if (child->parent == gx) { + // Oops - this child is behind its parent. Move it to the front. gfxQueueASyncRemove(&_GWINList, &child->wmq); gfxQueueASyncPut(&_GWINList, &child->wmq); - // Continue the loop here effectively restarts at the front of the list - // for this parent container as we have moved this child to the start of the list. - // We also need to restart everything once this container is done. + + // Restart at the front of the list for this parent container as we have moved this child + // to the end of the list. We also need to restart everything once this container is done. + child = 0; restart = TRUE; } } if (restart) - gh = 0; + gx = 0; } } } |