Re: [AD] Keeping non modified properties when grabbing |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
[another pending patch from Vincent]
> The following patch changes the behavior of grabber when grabbing
> an object on a slot which already has user properties. Any properties
> that are not created by the grabbing process are not destroyed, as
> they were before. I need this badly for my project, but other people
> might be inconvenienced by this behavior, and I thought I'd submit it
> for discussion. Feel free to apply or dismiss.
Yes, I don't think we should enable that by default.
> I'm just thinking this code could do with a command line switch to
> select this behavior over the default one too. If this is the case,
> you'll have to wait a bit, as I have very little time at the moment.
I'm ok for a command line switch.
> --- datedit.c.keep_props Sat Aug 25 13:03:04 2001
> +++ datedit.c Sat Aug 25 13:13:15 2001
> @@ -1538,6 +1538,16 @@
> x, y, w, h, colordepth);
>
> if (tmp->dat) {
> + /* Do not discard user properties (the ones not already set in the
> + new object */
> + AL_CONST DATAFILE_PROPERTY *dp = dat->prop;
> + while (dp && (dp->type != DAT_END)) {
> + AL_CONST char *prop = get_datafile_property(tmp, dp->type);
> + if (!*prop) {
> + datedit_set_property(tmp, dp->type, dp->dat);
> + }
> + dp++;
> + }
> _unload_datafile_object(dat);
> *dat = *tmp;
> return TRUE;
>
> --
> Vincent Penquerc'h
--
Eric Botcazou
ebotcazou@xxxxxxxxxx