(widget_default_set_state): clarify set of widget state's exclusive bits.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-01-06 13:00:15 +03:00
parent fbfb4f565c
commit 3a3171c990
1 changed files with 13 additions and 5 deletions

View File

@ -788,14 +788,23 @@ widget_default_set_state (Widget * w, widget_state_t state, gboolean enable)
if (enable)
{
/* exclusive bits */
if ((state & WST_CONSTRUCT) != 0)
switch (state)
{
case WST_CONSTRUCT:
w->state &= ~(WST_ACTIVE | WST_SUSPENDED | WST_CLOSED);
else if ((state & WST_ACTIVE) != 0)
break;
case WST_ACTIVE:
w->state &= ~(WST_CONSTRUCT | WST_SUSPENDED | WST_CLOSED);
else if ((state & WST_SUSPENDED) != 0)
break;
case WST_SUSPENDED:
w->state &= ~(WST_CONSTRUCT | WST_ACTIVE | WST_CLOSED);
else if ((state & WST_CLOSED) != 0)
break;
case WST_CLOSED:
w->state &= ~(WST_CONSTRUCT | WST_ACTIVE | WST_SUSPENDED);
break;
default:
break;
}
}
if (owner == NULL)
@ -820,7 +829,6 @@ widget_default_set_state (Widget * w, widget_state_t state, gboolean enable)
}
break;
case WST_DISABLED:
ret = send_message (w, NULL, enable ? MSG_DISABLE : MSG_ENABLE, 0, NULL);
if (ret == MSG_HANDLED && widget_get_state (owner, WST_ACTIVE))