aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-08-16 22:51:05 +1000
committerinmarket <andrewh@inmarket.com.au>2014-08-16 22:51:05 +1000
commit5dd9e1dc350ec4cfcf393e5b082789edc99841c4 (patch)
tree9b3d550e0209c06b5cae0ca8eaa67499ec6799bb
parent65c8b96a3d61676fe2d81bce65fce559047cd0c2 (diff)
downloaduGFX-5dd9e1dc350ec4cfcf393e5b082789edc99841c4.tar.gz
uGFX-5dd9e1dc350ec4cfcf393e5b082789edc99841c4.tar.bz2
uGFX-5dd9e1dc350ec4cfcf393e5b082789edc99841c4.zip
Fix visibility issues associated with a window destroy.
-rw-r--r--src/gwin/class_gwin.h16
-rw-r--r--src/gwin/gwin.c9
2 files changed, 23 insertions, 2 deletions
diff --git a/src/gwin/class_gwin.h b/src/gwin/class_gwin.h
index c4442264..488f3d68 100644
--- a/src/gwin/class_gwin.h
+++ b/src/gwin/class_gwin.h
@@ -211,7 +211,7 @@ typedef enum GRedrawMethod { REDRAW_WAIT, REDRAW_NOWAIT, REDRAW_INSESSION } GRed
/**
* @brief Flush any pending redraws in the system.
*
- * @param[in] doWait Do we wait for the lock?
+ * @param[in] how Do we wait for the lock?
*
* @note This call will attempt to flush any pending redraws
* in the system. The doWait parameter tells this call
@@ -243,6 +243,20 @@ bool_t _gwinDrawStart(GHandle gh);
void _gwinDrawEnd(GHandle gh);
/**
+ * @brief Flush any pending redraws in the system.
+ *
+ * @param[in] gh The window
+ * @param[in] how Do we wait for the lock?
+ *
+ * @note This call will delete the window. If called without the
+ * drawing lock 'how' must be REDRAW_WAIT. If called with the drawing
+ * lock 'how' must be REDRAW_INSESSION.
+ *
+ * @notapi
+ */
+void _gwinDestroy(GHandle gh, GRedrawMethod how);
+
+/**
* @brief Add a window to the window manager and set its position and size
* @return TRUE if successful
*
diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c
index ee0a7222..9b0fb03a 100644
--- a/src/gwin/gwin.c
+++ b/src/gwin/gwin.c
@@ -152,13 +152,16 @@ GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pI
return pgw;
}
-void gwinDestroy(GHandle gh) {
+void _gwinDestroy(GHandle gh, GRedrawMethod how) {
if (!gh)
return;
// Make the window invisible
gwinSetVisible(gh, FALSE);
+ // Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION
+ _gwinFlushRedraws(how);
+
#if GWIN_NEED_CONTAINERS
// Notify the parent it is about to be deleted
if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete)
@@ -182,6 +185,10 @@ void gwinDestroy(GHandle gh) {
gh->flags = 0; // To be sure, to be sure
}
+void gwinDestroy(GHandle gh) {
+ _gwinDestroy(gh, REDRAW_WAIT);
+}
+
const char *gwinGetClassName(GHandle gh) {
return gh->vmt->classname;
}