Fix visibility issues associated with a window destroy.

This commit is contained in:
inmarket 2014-08-16 22:51:05 +10:00
parent 65c8b96a3d
commit 5dd9e1dc35
2 changed files with 23 additions and 2 deletions

View file

@ -211,7 +211,7 @@ typedef enum GRedrawMethod { REDRAW_WAIT, REDRAW_NOWAIT, REDRAW_INSESSION } GRed
/** /**
* @brief Flush any pending redraws in the system. * @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 * @note This call will attempt to flush any pending redraws
* in the system. The doWait parameter tells this call * in the system. The doWait parameter tells this call
@ -242,6 +242,20 @@ bool_t _gwinDrawStart(GHandle gh);
*/ */
void _gwinDrawEnd(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 * @brief Add a window to the window manager and set its position and size
* @return TRUE if successful * @return TRUE if successful

View file

@ -152,13 +152,16 @@ GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pI
return pgw; return pgw;
} }
void gwinDestroy(GHandle gh) { void _gwinDestroy(GHandle gh, GRedrawMethod how) {
if (!gh) if (!gh)
return; return;
// Make the window invisible // Make the window invisible
gwinSetVisible(gh, FALSE); gwinSetVisible(gh, FALSE);
// Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION
_gwinFlushRedraws(how);
#if GWIN_NEED_CONTAINERS #if GWIN_NEED_CONTAINERS
// Notify the parent it is about to be deleted // Notify the parent it is about to be deleted
if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete) 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 gh->flags = 0; // To be sure, to be sure
} }
void gwinDestroy(GHandle gh) {
_gwinDestroy(gh, REDRAW_WAIT);
}
const char *gwinGetClassName(GHandle gh) { const char *gwinGetClassName(GHandle gh) {
return gh->vmt->classname; return gh->vmt->classname;
} }