From 5dd9e1dc350ec4cfcf393e5b082789edc99841c4 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 16 Aug 2014 22:51:05 +1000 Subject: Fix visibility issues associated with a window destroy. --- src/gwin/class_gwin.h | 16 +++++++++++++++- src/gwin/gwin.c | 9 ++++++++- 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 @@ -242,6 +242,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; } -- cgit v1.2.3