Hi

I am looking into the MenuStyle code trying to understand how some things are done. I plan to enable negation of all on/off menu styles by prefixing ! to them. However looking at the code raise some questions:

First of all what exactly does FreeColors free up? Answering this might answe some of my other questions; at least if it has some special functionality.

Second: The styles HilightBack and ActiveFore do free the colors if the style have them. Howver the corresponding off-styles does not free them. Is there any reason for this?

Last: This can't be right can it?:
-- from menustyle.c: menustyle_copy
        /* HilightBack */
        if (ST_HAS_ACTIVE_BACK(destms))
        {
                FreeColors(&ST_MENU_ACTIVE_COLORS(destms).back, 1, True);
        }
        ST_HAS_ACTIVE_BACK(destms) = ST_HAS_ACTIVE_BACK(origms);
        memcpy(&ST_MENU_ACTIVE_COLORS(destms),
               &ST_MENU_ACTIVE_COLORS(origms), sizeof(ColorPair));
        ST_DO_HILIGHT_BACK(destms) = ST_DO_HILIGHT_BACK(origms);

        /* ActiveFore */
        if (ST_HAS_ACTIVE_FORE(destms))
        {
                FreeColors(&ST_MENU_ACTIVE_COLORS(destms).fore, 1, True);
        }
--
It looks to me as it frees the active fore color after having it copied over, thus freeing the source's color instead of the overwritten.

/Viktor

Reply via email to